I have the following hibernate.cfg.xml
:
<hibernate-configuration>
<session-factory>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/EJB</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
<!-- Snip -->
Which I consume using this line:
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
Then, elsewhere I try this:
SimpleSelect pkSelect = new SimpleSelect(Dialect.getDialect());
Which results in the following exception:
org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
Note, the following extract from the logs:
02:26:48,714 INFO Configuration:1426 - configuring from resource: /hibernate.cfg.xml
02:26:48,717 INFO Configuration:1403 - Configuration resource: /hibernate.cfg.xml
02:26:48,909 DEBUG Configuration:1387 - hibernate.dialect=org.hibernate.dialect.MySQLDialect
Any ideas what I'm doing wrong?