OK trying to upgrade from Hibernate 3.6.10 to 4.1
I am using Hibernate in a desktop java swing application. All works fine in 3.6.10. But after I upgrade to 4.1 the EntityManagerFactory fails to be created. The error I get with <validation-mode>CALLBACK</validation-mode>
is:
Unable to build the default ValidatorFactory
if I change this to
<validation-mode>NONE</validation-mode>
The error I get is:
Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Any idea of the problem ???
Thanks
Heres my test method:
@Test
public void testGetEntityManager() {
EntityManager entityManager = null;
try {
EntityManagerFactory factory;
// Fails on the next line
factory = Persistence.createEntityManagerFactory("dbresource");
entityManager = factory.createEntityManager();
entityManager.getTransaction().begin();
entityManager.getTransaction().commit();
} catch (RuntimeException re) {
entityManager.getTransaction().rollback();
throw re;
} finally {
entityManager.close();
}
}
heres my persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_2_0.xsd"
version="2.0">
<persistence-unit name="dbresource" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!-- My simple class -->
<class>org.trade.persistent.dao.Contract</class>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<validation-mode>CALLBACK</validation-mode>
<properties>
<property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver" />
<property name="hibernate.connection.password" value="ledzepplin" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/tradeprod" />
<property name="hibernate.connection.username" value="trader" />
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.default_schema" value="tradeprod" />
<property name="hibernate.max_fetch_depth" value="5" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.current_session_context_class" value="thread" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.use_sql_comments" value="false" />
<property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
<property name="hibernate.c3p0.acquire_increment" value="1" />
<property name="hibernate.c3p0.idle_test_period" value="60" />
<property name="hibernate.c3p0.min_size" value="1" />
<property name="hibernate.c3p0.max_size" value="20" />
<property name="hibernate.c3p0.timeout" value="5" />
<property name="hibernate.c3p0.acquireRetryAttempts" value="1" />
<property name="hibernate.c3p0.acquireRetryDelay" value="250" />
<property name="hibernate.c3p0.max_statements" value="50" />
</properties>
</persistence-unit>
</persistence>
here whats in my class path:
antlr-2.7.7.jar
javassist-3.15.0-GA.jar
c3p0-0.9.1.jar
hibernate-c3p0-4.1.0.Final.jar
hibernate-core-4.1.0.Final.jar
hibernate-entitymanager-4.1.0.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
commons-collections-3.2.1.jar
dom4j-1.6.1.jar
ejb-api-3.0.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jboss-logging-3.1.0.CR2.jar
hibernate-validator-annotation-processor-4.2.0.Final.jar
validation-api-1.0.0.GA.jar
junit-4.8.1.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
log4j-1.2.16.jar
mysql-connector-java-5.1.18.jar
+ jdk1.7_02