disclaimer: I am new to both java and Hibernate ;)
I have a simplistic sample below that fails with a java.lang.NoClassDefFoundError: javax/transaction/Synchronization on openSession(). Based on searching sun.com, I know that the Synchronization class is part of the EE version but am fairly certain that SE is all that is required to run Hibernate.
Any suggestions or pointers to help would be greatly appreciated.
Timothy Vogel
Code:
public static void main(String[] args) {
TaClassb curClass = null;
SessionFactory sessions;
Session curSess = null;
try {
curClass = new TaClassb("first class", "comment", 0);
sessions = new Configuration().configure("/hibernate.cfg.xml").buildSessionFactory();
curSess = sessions.openSession();
curSess.save(curClass);
curClass = null;
curSess.close();
} catch (HibernateException e) {
System.out.println("Error thrown during save [" + e.getMessage() + "]");
}
}
hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<!-- a SessionFactory instance -->
<session-factory>
<!-- properties -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:data/TeachersAid</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="dialect">net.sf.hibernate.dialect.HSQLDialect</property>
<property name="show_sql">true</property>
<property name="hibernate.cache.provider_class">net.sf.hibernate.cache.HashtableCacheProvider</property>
<property name="use_outer_join">true</property>
<!-- same results w/ & w/o this property
<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
-->
<!-- mapping files -->
<mapping resource="src/java/com/ccsi/TeachersAid/common/TaClassb.hbm.xml" />
</session-factory>
</hibernate-configuration>