[jboss-user] [Persistence] - Re: moving JPA application using Hibernate to JBOSS 5.01

waltc do-not-reply at jboss.com
Sat Nov 21 23:14:26 EST 2009


After much trial and error and false starts I discovered my problem.

It is important that the web-inf/lib contain NO hibernate jar files or javassist.jar. The original error, which was, the MySQLDialect could not be cast to Dialect was due to the mismatched hibernate jars. So be careful here.



The final persistence.xml is:

  | I believe I could live better without the class elements as this version of hibernate will discover them.
  | The c3p0 properties, even though commented out, I left in as the non-jta-data-source should have connection and statement pooling in it not here.
  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence version="1.0" 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/persistence_1_0.xsd">
  |   <persistence-unit name="CU3JPAPU" transaction-type="RESOURCE_LOCAL">
  |     <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |     <non-jta-data-source>java:/LuceneResumeDatasource</non-jta-data-source>
  |     <properties>
  |       <!--property name="jboss.entity.manager.factory.jndi.name" value="java:/UpdaterEntityManagerFactory"/-->
  |       <!--property name="hibernate.connection.username" value="root"/>
  |       <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
  |       <property name="hibernate.connection.password" value=""/>
  |       <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/upd"/-->
  |       <!--property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/-->
  |       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
  |      
  |       <!--property name="hibernate.c3p0.min_size" value="5"/>
  |       <property name="hibernate.c3p0.max_size" value="50"/>
  |       <property name="hibernate.c3p0.max_statements" value="100"/>
  |       <property name="hibernate.c3p0.idle_test_period" value="3000"/>
  |       <property name="hibernate.c3p0.max_timeout" value="300"/>
  |       <property name="hibernate.show_sql" value="false"/>
  |       <property name="hibernate.format_sql" value="false"/-->
  | 
  |     </properties>
  |   </persistence-unit>
  | </persistence>

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266906#4266906

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266906



More information about the jboss-user mailing list