4 Replies Latest reply on Aug 16, 2011 8:53 AM by faber81

    JBoss - Persistence JPA hibernate

    faber81

      Hi,

      i'm developed a application web with hibernate JPA, Jboss 6, Mysql, but I get the following error:

       

      Error installing to Start: name=persistence.unit:unitName=XXXXXXXXXXXXXX#XXXXXXXX state=Create: java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType

       

      My persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.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_2_0.xsd">

                <persistence-unit name="XXXXXXXXX" transaction-type="RESOURCE_LOCAL">

                          <provider>org.hibernate.ejb.HibernatePersistence</provider>

       

                          <non-jta-data-source>java:XXXXXXXXX</non-jta-data-source>

                          <class>...............................</class>

                <class>...............................</class>

                          <properties>

       

                                    <!-- DATA SOURCE -->

                                    <property name="hibernate.connection.datasource" value="java:datasouce" />

       

                     <!-- DIALECT-->

                                      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

       

                                     <!-- CATALOG -->

                                    <property name="hibernate.default_catalog" value="db"/>

                          </properties>

                </persistence-unit>

      </persistence>

      My datasource is into the folder C:\jboss-6.0.0.Final\server\default\deploy

       

      Thank.

        • 1. Re: JBoss - Persistence JPA hibernate
          wdfink

          Maybe you have wrong annotations in your entity.

          Could you localize the entity?

          Maybe it helps if you enable 'org.hibernate' logging TRACE.

          1 of 1 people found this helpful
          • 2. Re: JBoss - Persistence JPA hibernate
            faber81

            In my entity I had a field "version" that generates an annotation @version.

            I solved by changing that.

             

            Thanks

             

            Now I'm trying to solve this error

            ERROR [org.apache.catalina.core.ContainerBase. [Jboss.web]. [Localhost]. [/VmcSmartServer]. [RESTEasy]] Servlet.service () for servlet RESTEasy Threwexception: org.jboss.resteasy.spi. UnhandledException:java.lang.ClassCastException: $ $vmc.webapp.server.persistence.base.bean.Group_ _javassist_32 can not be cast tojavassist.util.proxy.ProxyObject.

             

            Any idea what could be?



            • 3. Re: JBoss - Persistence JPA hibernate
              wdfink

              No, not my part

              But you might close the issue here because you get quicker an answer in the correct forum.

              • 4. Re: JBoss - Persistence JPA hibernate
                faber81

                For information this error is generated from the file that is inside jBoss javaassit.jar.

                In a Maven project, just enter

                <exclusion>

                <artifactId> javassist </ artifactId>

                <groupId> javassist </ groupId>

                </ exclusion>

                or overwrite the jar