Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Talk:EclipseLink/DesignDocs/328404"

(Proposed Config)
(Proposed Config)
Line 40: Line 40:
 
<entity class="eclipselink.example.jpa.employee.model.Employee" />
 
<entity class="eclipselink.example.jpa.employee.model.Employee" />
 
<entity class="eclipselink.example.jpa.employee.model.Address" data-source="addr-ds" />
 
<entity class="eclipselink.example.jpa.employee.model.Address" data-source="addr-ds" />
</entity>
 
 
</source>
 
</source>
  

Revision as of 14:54, 25 October 2010

Session Type

The property to set the Session type, such as using a DatabaseSession should not be, "eclipselink.jdbc.single-connection", but "eclipselink.session.type". For SessionBroker, this should be of type "SessionBroker", "DatabaseSession" could also be supported, the default would be "ServerSession", but other types could be supported, including a user defined class "<package>.<class>".

James.sutherland.oracle.com 13:54, 25 October 2010 (UTC)

Configuration

We should not have two (or 5??) different ways to configure this. Only a single logical way. The user should define a persistence unit for each ServerSession and another for the SessionBroker that lists the dependent persistence units.

James.sutherland.oracle.com 13:54, 25 October 2010 (UTC)

The property names should make sense, not be "eclipselink.define.my-set-property.value1". Should be "eclipselink.session.dependents"="pu1, pu2".

James.sutherland.oracle.com 13:54, 25 October 2010 (UTC)

This feature should be developed in 2 stages. Stage 1: Update JPA to use DatabaseSessionImpl, define SessionBroker from two independent persistence units. Stage 2: Support cross persistence unit relationships.

James.sutherland.oracle.com 13:54, 25 October 2010 (UTC)

JPA Configuration Example

--Doug 18:11, 25 October 2010 (UTC) Although originally I had been assuming we would have a persistence unit per data source with a composite data source it does make container managed JPA support challenging. Even more so when we add support for simple configuration of relationships that go between tables in different data sources.

Proposed Config

Within the persistence.xml a secondary data source is defined. This DS couldne JTA, non--JTA, or a native JDBC connection pool.

<persistence-unit name="employee" transaction-type="JTA">
	<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
	<jta-data-source>localJTA</jta-data-source>
 
	<properties>
                <!-- Implicitly define a secondary data source named 'addr-ds' -->
		<property name="eclipselink.jta-data-source.addr-ds" value="addrDS"/>
	</properties>
</persistence-unit>

Within the specified or defaulted EclipseLink ORM xml the data source for entity types not stored in the default DS can be specified.

<entity class="eclipselink.example.jpa.employee.model.Employee" />
<entity class="eclipselink.example.jpa.employee.model.Address" data-source="addr-ds" />

In this example we'll use a secondary native connection pool as the data source.

<persistence-unit name="employee" transaction-type="JTA">
	<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
	<jta-data-source>localJTA</jta-data-source>
 
	<properties>
                <!-- Implicitly define a secondary data source named 'addr-ds' -->
		<property name="eclipselink.jdbc.driver.addr-ds" value="oracle."/>
		<property name="eclipselink.jdbc.url.addr-ds" value="jdbc:"/>
		<property name="eclipselink.jdbc.user.addr-ds" value="scott"/>
		<property name="eclipselink.jdbc.password.addr-ds" value="tiger"/>
	</properties>
</persistence-unit>

Back to the top