karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: Unable to create EntityManagerFactory
Date Sun, 28 May 2017 11:29:40 GMT
There are several ways to use an EntityManagerFactory.

One is indeed Persistence.createEntityManagerFactory but you need to set
the ContextClassLoader to a classloader that can see the persistence
provider as well as the database drivers. This is more a workaround than a
good solution.

Another option is to use Aries JPA. It creates the EMF from you
persistence.xml and offers it as an OSGi service which you can then refer
to.
See
https://github.com/apache/aries-jpa/tree/master/examples

Christian

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message