Hi,
I'm developping an application which will use OSGI. The OSGI bundles will contains entities. The application is in charge of adding the bundle entities to the AnnotationConfiguration at startup. After that, the application can retreive the SessionFactory.
Right now, I had to change the classloader of the current thread to include the OSGI classloader. I was wondering if there a better way to achieve this ? Is there a way to configure the classloader used by Hibernate ?
I'm using JPA (annoted entities), Java 6, Hibernate :
<dependency> <groupId>javax.transaction</groupId> <artifactId>jta</artifactId> <version>1.0.1B</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.3.0.ga</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>3.0.0.ga</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager </artifactId> <version>3.3.2.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-commons-annotations </artifactId> <version>3.3.0.ga</version> </dependency>
Thank you !
|