Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359400 - JNDI integration in Gemini JPA.
Summary: JNDI integration in Gemini JPA.
Status: RESOLVED FIXED
Alias: None
Product: Gemini.JPA
Classification: RT
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: 1.2.0 M1   Edit
Assignee: Michael Keith CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-29 07:07 EDT by Carlos Salinas CLA
Modified: 2013-06-20 13:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Salinas CLA 2011-09-29 07:07:39 EDT
It would be interesting a new feature, where Gemini JPA allows integration with Gemini Naming project, so the persistance descriptors could get the datasource object throught JNDI, using the following tag for example:


<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/XXX)</non-jta-data-source>


There is a comment in the Gemini Forum:

http://www.eclipse.org/forums/index.php/t/242860/
Comment 1 Magnus Jungsbluth CLA 2012-03-06 04:52:31 EST
Please make sure that setting <jta-data-source></...> is at least not prevented. At the moment you have to track EMFBuilderS to appear, re-parse persistence.xml, set jta and non-jta datasources and create the EMF by hand which is tedious. I am actually not sure if the non-jta datasource is required at all if a jta datasource is set.

The solution to this problem would be a real timesaver...
Comment 2 Prasenjit Purohit CLA 2012-09-27 02:47:05 EDT
This is a really good feature to have.
Comment 3 Michael Keith CLA 2013-01-21 14:18:06 EST
I will put some support in for this, but only in the context of non-JTA at this point. Will go further to support JTA data sources once I get to enhancement 356508 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=356508)
Comment 4 Michael Keith CLA 2013-01-25 16:18:40 EST
I think the presence of a non-jta-data-source element in persistence.xml will override JDBC properties if they exist. If anybody feels like this should not be the case then speak up now.
Comment 5 Michael Keith CLA 2013-06-06 15:31:31 EDT
Added for M1.
Comment 6 Prasenjit Purohit CLA 2013-06-19 02:50:38 EDT
I have downloaded the M1 release it works, but if the data source is registered after the gemini jpa bundle started, it does not recognize the the data source and EMF is not registered.

After a restart of the gemini jpa bundle it works. 

Means if data source is registered before jemini jpa bundle start, it works.

This would be great if we get rid of this start order..
Comment 7 Michael Keith CLA 2013-06-19 10:26:43 EDT
It's not possible to track the JNDI entry in the cases when the JNDI lookup is in a traditional JNDI environment, i.e. not a dynamic service. 

My understanding of what people wanted was to use it in some kind of a container environment, and in these kinds of environments the application is deployed into the container, so the datasource would already have been registered in JNDI. 

What is the environment that you are using it in, and why would the JNDI entry not exist when Gemini JPA processes the application?
Comment 8 Prasenjit Purohit CLA 2013-06-20 02:33:40 EDT
I am using it in equinox OSGI only where the datasource object is an OSGI service. This service is registered by a datasource bundle(depends on dbaccess bundle) when the CM bundle is started as it consumes configuration.

So there is enough possibility that the jpa bundle starts before datasource bundle.

Aries jpa manages it well, but I dont use it as it require openjpa.
Comment 9 Michael Keith CLA 2013-06-20 08:40:06 EDT
If you are in an environment where DBAccess is running then why don't you just use that? Why are you using JNDI at all?
Comment 10 Michael Keith CLA 2013-06-20 13:05:03 EDT
I have entered bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411279 to describe the data source tracking issue. Please add any comments to that bug. Thanks.