1 Reply Latest reply: Feb 28, 2012 10:39 AM by lostiniceland RSS

Hibernate and datasource

Sunil Pandit Newbie

Hello Folks,

 

We have a web application which exposes some REST services. This app uses Hibernate and is working as expected in Jboss AS7 . However when we packaged this app as a OSGI bundle , we are having some issues getting the data source.

 

It throws an exception

 

java.lang.classcastexception: org.jboss.jca.adapters.jdbc.wrapperdatasource cannot be cast to javax.sql.datasource

 

In web application we had resource references and hibernate configuration included name of the resource reference . However in OSGI bundle there is not such thing so we are directly using the JNDI name of the data source in hibernate configuration file .

 

My understanding is the resource reference definition in web applkication specifies the resource type  javax.sql.datasource and that could be taking care of conversion . But there is not such resource refernce for OSGI apps.

 

Any thoughts what could be causing this isse and solution to resolve it ?

 

Thanks

Sunil

  • 1. Re: Hibernate and datasource
    lostiniceland Newbie

    I am also interested in this.

    As far as I know, Hibernate is not yet OSGiyfied so there will be problems when it comes to ClassLoading. Thats why I used EclipseLink within a Eclipse RCP for JPA. However, since AS 7 provides a OSGi-subsystem for web-bundles I expected some kind of integration. Is there a way to use Hibernate or would I have to leave the osgi-subsystem (calling an EJB for instance) which wrapps my data-access-logic?

     

    Thanks