I am new to hibernate. Recently, I am trying to learn hibernate.
I am trying to run hibernate-3.2.1.ga examples eg/org/hibernate/auction, however I have the following problems.
13:41:17,643 INFO HbmBinder:300 - Mapping class: org.hibernate.auction.User -> AuctionUser
13:41:17,643 DEBUG HbmBinder:1270 - Mapped property: id -> id
13:41:17,643 DEBUG HbmBinder:1270 - Mapped property: userName -> userName
13:41:17,737 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:409)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:119)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)
at org.hibernate.auction.Main.main(Main.java:368)
The environment I used to run the example is following:
1. Lomboz 3.2 with the following jar files with the following classpath:
antlr.jar,cglib.jar,asm.jar,asm-attrs.jars,commons-collections.jar,commons-logging.jar, hibernate3.jar,jta.jar,dom4j.jar,log4j.jar,mysql-connector.jar
2. I didnot create table for User, Bid and AuctionItem. I use MySQL Server 5.0 as my databases, and I am not sure where I can config the database' name. In my application, I need to use the name as "Test".
3. I tried to run the org\hibernate\auction\Main.java as a standalone application in Lomboz (Eclipse).
4. I copied log4j.properties and hibernate.cfg.xml in the root of class path, and no hibernate.properties.
5. hibernate.cfg.xml as following:
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:hsql://localhost</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="events/Event.hbm.xml"/>
<mapping resource="events/Person.hbm.xml"/>
</session-factory>
</hibernate-configuration>
|