Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » How to setup Persistence Service using DS and CM ?
How to setup Persistence Service using DS and CM ? [message #733832] Wed, 05 October 2011 18:24 Go to next message
Cristiano Gaviao is currently offline Cristiano GaviaoFriend
Messages: 261
Registered: July 2009
Senior Member

I have an OSGi server application where services are configured using Declarative Services and Configuration Manager Service.

This app has a persistence module that uses simple jdbc access that is configured at service activation based on connection properties from CM.

Now I'm investigating to move this module to JPA. I could find only examples where Gemini JPA is configured using persistence.xml.

Can I create all the need data to configure JPA dynamically inside the service activation method without have to use this persistence.xml ?

If yes, could someone show me how ?

thanks in advance

Re: How to setup Persistence Service using DS and CM ? [message #734431 is a reply to message #733832] Fri, 07 October 2011 18:28 Go to previous message
Michael Keith is currently offline Michael KeithFriend
Messages: 243
Registered: July 2009
Senior Member
Hi Cristiano,

Yes, you would use an EMFBuilder with DS, with a basic (nearly empty) persistence.xml file. Then you would call createEntityManagerFactory() on the builder, passing in the properties dynamically. See the doc for an example of how to use this service.

How you choose to get these properties is up to you. You could get them from the Config Admin service or wherever, you just need to pass in the standard javax.persistence.jdbc connection properties.

Let me know if you have any difficulties.

Previous Topic:Gemini Blueprint Trunk does not compile
Next Topic:blueprint extender does not activate appclication context
Goto Forum:

Current Time: Tue Oct 16 13:07:50 GMT 2018

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

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

Back to the top