I was doing configuration of hibernate by using hibernate.properties file ONLY. Is it necessary that along with hibernate.properties file that we also have hibernate.cfg.xml file also. The code is as under :
I am getting the following exception.
org.hibernate.HibernateException: Hibernate Dialect must be explicitly set at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57) at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39) at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292) at com.hibernateexample.onetoone.AssociationOneToOneMapping.main(AssociationOneToOneMapping.java:20)
Please help me !!! I am unable to understand the logic behind this - if we are writing all the properties in hibernate.properties then why do we need hibernate.cfg.xml file.
A remark on the syntax: in the original hibernate.properties files, properties are specified without the equals sign, like:
And make sure that the file is at the root of the classpath.
posted 10 years ago
I have my hibernate.properties in the root of the classpath. I have tried with modifed syntax also as well as with the equal(=) also. Now I am not getting an exception but now the problem is that even if I am giving wrong values in the hibernate.properties file even then its working (i.e printing Done) only when i give wrong value of hibernate.connection.driver_class does it gives an error. Please help !!!
Do we have to pass to the mapping file information to the configure () method? Because when we have the XML configuration, we can just use configure () but when the name of the XML file is different, other than hibernate.cfg.xml, we pass the name of the XML file to the configure () method. Similarly, for the above case, do we have to pass the hibernate.properties as a parameter to the configure () method??
I'm just not hijacking this thread, but I was wondering if this could be linked to the problem that was posted above?
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!