Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » XML-less JPA in JSE with EclipseLink
XML-less JPA in JSE with EclipseLink [message #929652] Mon, 01 October 2012 16:34 Go to next message
Scott Dudley is currently offline Scott Dudley
Messages: 21
Registered: October 2012
Junior Member
I've struggled for a couple of days now trying to ascertain whether or not it's possible to create a persistence.xml 'less JPA configuration in a JSE application with EclipseLink.

I've found like solutions for Spring, Hybernate, using Tapestry, etc but not interested in any of them.

Can someone tell me whether it's possible to do so with EclipseLink?

I went so far as to create an implementation of javax.persistence.spi.PersistenceUnitInfo but when I invoke PersistenceProvider().createContainerEntityManagerFactory, I get the following:

java.lang.NullPointerException
at org.eclipse.persistence.exceptions.i18n.ExceptionMessageGenerator.buildMessage(ExceptionMessageGenerator.java:41)
at org.eclipse.persistence.exceptions.EntityManagerSetupException.createContainerEntityManagerFactoryNotSupportedInOSGi(EntityManagerSetupException.java:295)
at org.eclipse.persistence.jpa.osgi.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:62)

Thanks.
Re: XML-less JPA in JSE with EclipseLink [message #929772 is a reply to message #929652] Mon, 01 October 2012 19:00 Go to previous messageGo to next message
Tom Ware is currently offline Tom Ware
Messages: 17
Registered: July 2009
Junior Member
Have you looked at the Gemini project? - the reference implementation for the OSGi specifications that provide Java EE functionality

http://www.eclipse.org/gemini/

Gemini JPA provides a standardized way to build EntityManagerFactories in OSGi and is our recommendation.



Re: XML-less JPA in JSE with EclipseLink [message #929880 is a reply to message #929772] Mon, 01 October 2012 21:15 Go to previous messageGo to next message
Scott Dudley is currently offline Scott Dudley
Messages: 21
Registered: October 2012
Junior Member
My application is not an OSGi app, nor do I aspire to convert it to one. Wink

I'm simply trying to circumnavigate the requirement for a persistence.xml file. The results of my Google searches are indicative that others share the same requirement.

Thanks Tom.
Re: XML-less JPA in JSE with EclipseLink [message #930660 is a reply to message #929880] Tue, 02 October 2012 14:18 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Try calling,

org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory()

It does not use a persistence.xml.


James : Wiki : Book : Blog : Twitter
Re: XML-less JPA in JSE with EclipseLink [message #939534 is a reply to message #930660] Wed, 10 October 2012 21:15 Go to previous message
Scott Dudley is currently offline Scott Dudley
Messages: 21
Registered: October 2012
Junior Member
I'm using JPA 2 so no such method. As indicated in my post, there is a createContainerEntityManagerFactory(PersistenceUnitInfo, Map) method but it's invocation resulted in the aforementioned exception.

Is there no way to do this is JSE without using OSGI? If not, moving on.
Previous Topic:MOXy - Two issues with XML-bindings
Next Topic:WebSphere Application Server 7.0.0.7 Local JNDI Name
Goto Forum:
  


Current Time: Mon Oct 20 11:32:55 GMT 2014

Powered by FUDForum. Page generated in 0.03784 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software