Hibernate version: 3.0RC1
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="hello.Message" table="MESSAGES">
<id name="id" column="MESSAGE_ID" access="field">
<generator class="native"/>
</id>
<property name="text" column="MSG_TXT"/>
<many-to-one name="nextMessage" column="NEXT_MSG_ID"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
13:00:28,178 INFO Environment:456 - Hibernate 3.0rc1
13:00:28,191 INFO Environment:469 - hibernate.properties not found
13:00:28,197 INFO Environment:502 - using CGLIB reflection optimizer
13:00:28,206 INFO Environment:532 - using JDK 1.4 java.sql.Timestamp handling
13:00:28,208 DEBUG Configuration:1035 - Preparing to build session factory with filters : {}
13:00:28,214 INFO Configuration:844 - processing extends queue
13:00:28,228 INFO Configuration:848 - processing collection mappings
13:00:28,230 INFO Configuration:857 - processing association property references
13:00:28,232 INFO Configuration:884 - processing foreign key constraints
Exception in thread "main" java.lang.ExceptionInInitializerError
at hello.HelloWorld.<clinit>(HelloWorld.java:38)
Caused by: org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:474)
at org.hibernate.dialect.Dialect.getDialect(Dialect.java:496)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:51)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1497)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1041)
at hello.HelloWorld.<clinit>(HelloWorld.java:34)
Name and version of the database you are using:
HSQLDB (latest)
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
DEBUG
I have run into this problem in previous applications -- so I just created a hibernate.properties file and it would work. But my understanding is that this properties file is going away. For some reason my hibernate.cfg.xml is never picked up when I put it in the src directory -- it is first in my classpath when I run the HelloWorld example.
Could this have anything to do with me being on a mac running OS X?
Here is my hibernate.cfg.xml file:
<!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.username">sa</property>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.connection.url">jdbc:hsqldb:hello</property>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="hello/Message.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Any help is greatly appreciated -- I have training tomorrow and I was walking through the CBT and I hit this config issue again.
Thanks.
|