Hi,
I am working on a tutorial of Hibernate and have a few questions. First of all, what is Hibernate's classpath relative to my application? I have:
Code:
drwxr-xr-x 2 root root 4096 Aug 8 11:00 bin
drwxr-xr-x 2 alex alex 4096 Aug 8 10:59 lib
drwxr-xr-x 2 alex alex 4096 Aug 8 10:59 src
-rw-r--r-- 1 alex alex 1093 Aug 3 03:17 build.xml
and src is:
Code:
-rw-r--r-- 1 root root 394 Aug 8 10:59 hibernate.properties
-rw-r--r-- 1 alex alex 1316 Aug 8 10:43 HibernateUtil.java
-rw-r--r-- 1 root root 1191 Aug 6 11:22 HibernateUtil.java.original
-rw-r--r-- 1 alex alex 654 Aug 5 05:50 SKUManager.java
-rw-r--r-- 1 alex alex 417 Aug 5 05:10 SKU.hbm.xml
-rw-rw-r-- 1 alex alex 959 Aug 5 05:01 hibernate.cfg.xml.original
-rw-r--r-- 1 alex alex 475 Aug 3 02:11 SKU.java
Now, as I understand I can define datasource properties in either hibernate.properties or hibernate.cfg.xml, right? I am using hibernate.properties:
Code:
bernate.connection.driver_class = com.mysql.jdbc.Driver
hibernate.connection.url = jdbc:mysql://localhost:3306/mydb
hibernate.connection.username = root
hibernate.connection.password =
hibernate.dialect = net.sf.hibernate.dialect.MySQLDialect
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=300
hibernate.c3p0.max_statements=50
hibernate.c3p0.idle_test_period=3000
But where the file should go? What is the classpath? I think this is related to the error I am getting when building:
Code:
run:
[java] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[java] log4j:WARN Please initialize the log4j system properly.
[java] Initial SessionFactory creation failed.org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at HibernateUtil.<clinit>(Unknown Source)
[java] at SKUManager.createAndStoreEvent(Unknown Source)
[java] at SKUManager.main(Unknown Source)
[java] Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
[java] at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
[java] at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
[java] at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:374)
[java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
[java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1502)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1031)
[java] ... 3 more
[java] Java Result: 1
thanks for your help because this drives me nuts!