You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Sorin Silaghi <so...@gmail.com> on 2011/04/21 11:08:37 UTC

ClassCastException when using Spring ORM in bundle

Hi all,


          I'm getting a class cast exception when I try to instantiate a
LocalEntityManagerFactoryBean. Here is the spring xml declaration:

    <bean id="entityManagerFactoryBean"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="model"/>
    </bean>

         And here's my persistence.xml:

    <persistence-unit name="model" transaction-type="RESOURCE_LOCAL">
        <class>de.edigrid.util.servicemix.model.EmailLog</class>
        <class>de.edigrid.util.servicemix.model.TransactionLog</class>
        <properties>
            <property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect" />
            <property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver" />
            <property name="hibernate.connection.url"
value="jdbc:hsqldb:file:data/db/logging" />
            <property name="hibernate.connection.username" value="sa" />
            <property name="hibernate.connection.password" value="" />
            <property name="hibernate.hbm2ddl.auto" value="create" />
            <property name="hibernate.show_sql" value="false" />
            <property name="hibernate.format_sql" value="false" />
        </properties>
    </persistence-unit>

         I'm running SMX 4.3.0 and I have jpa-hibernate installed.

Any ideas ? Also I noticed on various web pages mentioned an example called
"examples-jpa-osgi", anybody know where I can find the source code for it ?

Sorin.

Re: ClassCastException when using Spring ORM in bundle

Posted by Freeman Fang <fr...@gmail.com>.
On 2011-4-21, at 下午5:08, Sorin Silaghi wrote:

> Hi all,
>
>
>          I'm getting a class cast exception when I try to  
> instantiate a
> LocalEntityManagerFactoryBean. Here is the spring xml declaration:
>
>    <bean id="entityManagerFactoryBean"
> class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
>        <property name="persistenceUnitName" value="model"/>
>    </bean>
>
>         And here's my persistence.xml:
>
>    <persistence-unit name="model" transaction-type="RESOURCE_LOCAL">
>        <class>de.edigrid.util.servicemix.model.EmailLog</class>
>        <class>de.edigrid.util.servicemix.model.TransactionLog</class>
>        <properties>
>            <property name="hibernate.dialect"
> value="org.hibernate.dialect.HSQLDialect" />
>            <property name="hibernate.connection.driver_class"
> value="org.hsqldb.jdbcDriver" />
>            <property name="hibernate.connection.url"
> value="jdbc:hsqldb:file:data/db/logging" />
>            <property name="hibernate.connection.username"  
> value="sa" />
>            <property name="hibernate.connection.password" value="" />
>            <property name="hibernate.hbm2ddl.auto" value="create" />
>            <property name="hibernate.show_sql" value="false" />
>            <property name="hibernate.format_sql" value="false" />
>        </properties>
>    </persistence-unit>
>
>         I'm running SMX 4.3.0 and I have jpa-hibernate installed.
>
> Any ideas ? Also I noticed on various web pages mentioned an example  
> called
> "examples-jpa-osgi", anybody know where I can find the source code  
> for it ?
>
Hi,
The examples-jpa-osgi shipped with FUSE ESB kit only, you can download  
it from[1]
[1]http://repo.fusesource.com/nexus/content/repositories/releases/org/apache/servicemix/apache-servicemix/4.3.1-fuse-01-09/

Freeman
> Sorin.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference