Jump to: navigation, search

Difference between revisions of "Gemini/JPA/Documentation/Integrations"

(Integrations)
(Integrations)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Integrations ==
 
== Integrations ==
  
There are a number of integrations with other components that make Gemini JPA play well with others.
+
Gemini JPA is integrated with a number of other technologies. The following sections describe how other technologies fit with Gemini JPA.
  
 
==== JDBC ====
 
==== JDBC ====
Line 9: Line 9:
 
==== JNDI ====
 
==== JNDI ====
  
Gemini JPA can do a JNDI lookup to find an existing data source if an entry is supplied in the '''non-jta-data-source''' element in the persistence.xml descriptor. If the data source is available in the OSGi service registry and an OSGi JNDI provider is active then the OSGi JNDI syntax can be used to specify it. For example, the following entry could be present in the persistence descriptor:
+
Gemini JPA can do a JNDI lookup to find an existing data source if an entry is supplied in the '''non-jta-data-source''' element in the persistence.xml descriptor. For example:
  
 
<source lang="xml">
 
<source lang="xml">
 
<persistence-unit name="MyPU" transaction-type="RESOURCE_LOCAL">
 
<persistence-unit name="MyPU" transaction-type="RESOURCE_LOCAL">
         <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+
        ...
 +
         <non-jta-data-source>jdbc/myDS</non-jta-data-source>
 +
        ...
 +
</persistence-unit>
 +
</source>
 +
 
 +
If the data source is available in the OSGi service registry and an OSGi JNDI provider is active then the OSGi JNDI syntax of ''osgi:service'' can be used to specify it. (The ''osgi:servicelist'' syntax is not supported.) The following entry could be present in the persistence descriptor to refer to a data source that was registered as a service, with a service property name defined by '''org.osgi.service.jndi.JNDIConstants.JNDI_SERVICENAME''' and a value of '''''myDS''''':
 +
 
 +
<source lang="xml">
 +
<persistence-unit name="MyPU" transaction-type="RESOURCE_LOCAL">
 +
        ...
 
         <non-jta-data-source>osgi:service/myDS</non-jta-data-source>
 
         <non-jta-data-source>osgi:service/myDS</non-jta-data-source>
 
         ...
 
         ...
Line 19: Line 29:
 
</source>
 
</source>
  
Note that this data source is not a JTA data source.
+
Note that the service must be of type '''javax.sql.DataSource'''. It is not currently supported for them to be JTA data sources.
  
 
==== Configuration Admin ====
 
==== Configuration Admin ====
  
 
See the [[Gemini/JPA/Documentation/OtherTopics#Configuration_Admin | Configuration Admin]] section for details on how to use Config Admin with Gemini JPA.
 
See the [[Gemini/JPA/Documentation/OtherTopics#Configuration_Admin | Configuration Admin]] section for details on how to use Config Admin with Gemini JPA.

Latest revision as of 15:31, 21 June 2013

Integrations

Gemini JPA is integrated with a number of other technologies. The following sections describe how other technologies fit with Gemini JPA.

JDBC

Gemini JPA is integrated with the OSGi JDBC spec. In fact, the use of Gemini DBAccess to access a JDBC datasource is highly recommended. See the Using Gemini DBAccess section.

JNDI

Gemini JPA can do a JNDI lookup to find an existing data source if an entry is supplied in the non-jta-data-source element in the persistence.xml descriptor. For example:

<persistence-unit name="MyPU" transaction-type="RESOURCE_LOCAL">
        ...
        <non-jta-data-source>jdbc/myDS</non-jta-data-source>
        ...
</persistence-unit>

If the data source is available in the OSGi service registry and an OSGi JNDI provider is active then the OSGi JNDI syntax of osgi:service can be used to specify it. (The osgi:servicelist syntax is not supported.) The following entry could be present in the persistence descriptor to refer to a data source that was registered as a service, with a service property name defined by org.osgi.service.jndi.JNDIConstants.JNDI_SERVICENAME and a value of myDS:

<persistence-unit name="MyPU" transaction-type="RESOURCE_LOCAL">
        ...
        <non-jta-data-source>osgi:service/myDS</non-jta-data-source>
        ...
</persistence-unit>

Note that the service must be of type javax.sql.DataSource. It is not currently supported for them to be JTA data sources.

Configuration Admin

See the Configuration Admin section for details on how to use Config Admin with Gemini JPA.