1

I am trying to fix an issue for hours but nothing seems to work.I tried everything available online. I am using Intellij IDEA. I am using a Maven project. I have created hibernate.cfg.xml with following content

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
    <session-factory>
        <property name="connection.driver_class">org.h2.Driver</property>
        <property name="connection.url">jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</property>
        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
        <property name="show_sql">true</property>
        <property name="hbm2ddl.auto">create</property>
        <mapping class="User"/>
    </session-factory>
</hibernate-configuration>

Following line is throwing an error that cannot resolve class dialect

<property name="dialect">org.hibernate.dialect.H2Dialect</property>

My External Libraries structure looks like this.

enter image description here

any help would be appreciated.

4
  • Post the exact and complete exception stack trace.
    – JB Nizet
    Mar 16, 2019 at 22:59
  • I am not sure but for sometime it was showing this error. File is not configured as hibernate facet
    – Qasim Ali
    Mar 16, 2019 at 23:08
  • @QasimAli do you get the error only in pom.xml highlighting or when app is running?
    – CrazyCoder
    Mar 17, 2019 at 3:55
  • @CrazyCoder only on hibernate.cfg.xml highlighting. I did not try to run it.
    – Qasim Ali
    Mar 17, 2019 at 11:13

1 Answer 1

2

I fixed the problem. The problem was Intellij IDEA was not able to download maven files for Hibernate. I used maven repository for adding the repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.