Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » [Gemini JPA] How Gemini JPA choose the right DBAccess version ?
[Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #812523] Sat, 03 March 2012 18:57 Go to next message
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
I saw in the Gemini JPA examples that it is using a Derby DBAccess service.

DBAccess for Derby register 4 different services with 2 different versions.

I couldn't find in source code how Gemini JPA is filtering the right one.

could someone point me to that?

regards,

Cristiano
Re: [Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #812543 is a reply to message #812523] Sat, 03 March 2012 19:39 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
Hi Cristiano,

Good question Smile

Gemini JPA just filters the DataSourceFactory based on the driver class name specified in the persistence descriptor under the javax.persistence.jdbc.driver property. It does not do anything special for Derby, so the version properties are not filtered. The first service it finds that has a service property with the right driver class name will be used.

-Mike
Re: [Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #812544 is a reply to message #812543] Sat, 03 March 2012 19:40 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
BTW, if you are looking for the code that does the DSF lookup see GeminiServicesUtil.trackDataSourceFactory().

-Mike
Re: [Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #813593 is a reply to message #812544] Mon, 05 March 2012 08:31 Go to previous messageGo to next message
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
I couldn't find anything in OSGi Enterprise JPA Service Specification about the use of osgi.jdbc.driver.version to filter the DataSourceFactory.

Perhaps it was a missing detail on the spec or the spec expected that JDBC Service would expose only one version of the drive per bundle(this way we could install the right bundle) ?

Well, I wouldn't matter if I could ensure with 100% which version would be bound. But I could note that this is not true. I saw sometimes 3.0 being bounded and sometimes 4.0.

cheers

Cristiano
Re: [Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #813793 is a reply to message #813593] Mon, 05 March 2012 13:07 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
The version property was defined in OSGi so that clients of JDBC could load the driver version they wanted. Unfortunately there was no JPA property that provided a similar facility. We have considered adding a feature that would read an additional custom property from the persistence descriptor, but it would be non-standard in terms of JPA. An alternative is to just allow the additional property to be specified in the EMFBuilder.createEMF call, but that would be somewhat limiting in that the regular EMF service could not be used.

Feel free to enter a bug and make a suggestion about how you would prefer to specify the driver version.

Thanks,
-Mike
Re: [Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #813846 is a reply to message #813793] Mon, 05 March 2012 14:31 Go to previous messageGo to next message
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
JDBC service uses this property "osgi.jdbc.driver.version", right?

Maybe we can catch this property in JPA and use it to filter the JDBC service properly?

regards,

Cristiano

Re: [Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #813863 is a reply to message #813846] Mon, 05 March 2012 14:55 Go to previous messageGo to next message
Mike Keith is currently offline Mike Keith
Messages: 211
Registered: July 2009
Senior Member
Yes, putting this property in the persistence.xml file and getting Gemini JPA to look for it there is what I was describing in my earlier reply.

I have entered bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=373288
Comment there and vote for it if you like Smile

-Mike
Re: [Gemini JPA] How Gemini JPA choose the right DBAccess version ? [message #813929 is a reply to message #813863] Mon, 05 March 2012 16:25 Go to previous message
Cristiano Gaviao is currently offline Cristiano Gaviao
Messages: 253
Registered: July 2009
Senior Member
Ok, I like it Smile

I've include myself in CC list, but I can't see the vote link on the bug page.
Previous Topic:[Gemini JPA] An EntityManagerFactory created by EMFBuilder shouldn't be automatically registered?
Next Topic:Gemini Naming - Service Damping
Goto Forum:
  


Current Time: Sat Aug 30 12:24:51 EDT 2014

Powered by FUDForum. Page generated in 0.02245 seconds