Eduard Barbu wrote:
Hello everybody,
I am new to hibernate... I read the documentation but I cannot solve my problem. I wanted to test a little application. Here are the steps I followed:
1. I use Eclipse 3.1.1 together with hibernate Eclipse 3.1.0 beta 2 plugin
Hibernate version is 3.1
2. Database MYSQL with mysql 3.1.12 connection
3. The structure of the project is as follows:
02/08/2006 05:54 PM 810 hibernate.cfg.xml
02/08/2006 06:17 PM 1,631 InsertProduct.class
02/08/2006 06:17 PM 705 InsertProduct.java
02/08/2006 05:01 PM 1,095 Product.class
02/08/2006 05:37 PM 823 Product.hbm.xml
02/08/2006 04:49 PM 752 Product.java
The content of hibernate.cfg.xml is correct and it is the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/hibernate</property>
<property name="hibernate.connection.username">eduard</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
</session-factory>
</hibernate-configuration>
However runnig the application I get the following error (you can see the log)
18:34:44,123 INFO Environment:474 - Hibernate 3.1 rc3
18:34:44,133 INFO Environment:504 - hibernate.properties not found
18:34:44,133 INFO Environment:520 - using CGLIB reflection optimizer
18:34:44,133 INFO Environment:550 - using JDK 1.4 java.sql.Timestamp handling
18:34:44,233 INFO Configuration:495 - Reading mappings from resource: product/Product.hbm.xml
18:34:44,734 INFO HbmBinder:265 - Mapping class: product.Product -> products
18:34:44,764 INFO Configuration:1021 - processing extends queue
18:34:44,764 INFO Configuration:1025 - processing collection mappings
18:34:44,764 INFO Configuration:1034 - processing association property references
18:34:44,764 INFO Configuration:1056 - processing foreign key constraints
18:34:44,854 WARN UserSuppliedConnectionProvider:23 - No connection properties specified - the user must supply JDBC connections
Exception in thread "main" 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:378)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1830)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1150)
at product.InsertProduct.main(InsertProduct.java:17)
It seems to me that hibernate.cfg.xml is not procesed. I would be glad if someone can help me!
Regards!
Eduard
http://www.hibernate.org/ForumMailingli ... AskForHelp
The usual issue is the file isn't found in the classpath. Are all the files listed above in the same directory ?
What does your code look like ?