Loading
Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
Contents
 Search
Other Searches
 PDF
PDF
Comments
Comments


composite-unit.member

Use eclipselink.composite-unit.member to specify if the persistence unit is a member composite persistence unit.


Values

Table 5-22 describes this persistence property's values.

Table 5-22 Valid Values for composite-unit.member

Value Description

true

The persistence unit must be a member of a composite persistence unit and cannot be used as an independent persistence unit.

false

The persistence unit does not have to be a member of a composite persistence unit.



Usage

Setting this property to true indicates that the persistence unit has dependencies on other persistence units.


NoteNote:

If this property is passed to the createEntityManagerFactory method or if it is set in system properties, it is ignored.)

If this property is true, you may still create EntityManagerFactory, but it cannot be connected. Any attempt to create an entity manger will cause an exception.


Query Hint

When executing a native query on a composite persistence unit, use composite-unit.member to specify the name of the composite member persistence unit on which to execute the query.


Examples

Example 5-12 shows how to use this persistence property extension in the persistence.xml file.

Example 5-12 Using composite-unit.member in persistence.xml

Composite member persistence unit memberPu2 is defined in the member2.jar file. It has dependency on a class defined in member1.jar and cannot be used independently.

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
    <persistence-unit name="memberPu2">
        <provider>
            org.eclipse.persistence.jpa.PersistenceProvider
        </provider>
        <mapping-file>META-INF/advanced-entity-mappings2.xml</mapping-file>
        <jta-data-source>jdbc/MySqlJtaDS</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.composite-unit.member" value="true"/>
            <property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.MySQLPlatform"/>
        </properties>
    </persistence-unit>
</persistence>


See Also

For more information, see:

Comments powered by Disqus