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.properties

Use eclipselink.composite-unit.properties to configure the properties for persistence unit members.


Values

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

Table 5-23 Valid Values for composite-unit.properties

Value Description

Map of properties

Properties to be passed to the persistence unit. Use the persistence unit's name as the key.



Usage

Pass this property to createEntityManager method of a composite persistence unit to pass properties to its member persistence units.


Examples

Example 5-13 shows how to use this extension in a property map

Example 5-13 Using composite-unit.properties in a Property Map

Map props1 = new HashMap();
 
   props1.put("javax.persistence.jdbc.user", "user1");
   props1.put("javax.persistence.jdbc.password", "password1");
   props1.put("javax.persistence.jdbc.driver", "oracle.jdbc.OracleDriver");
   props1.put("javax.persistence.jdbc.url", "jdbc:oracle:thin:@oracle_db_url:1521:db");
 
Map props2 = new HashMap();
 
   props2.put("javax.persistence.jdbc.user", "user2");
   props2.put("javax.persistence.jdbc.password", "password2");
   props2.put("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
   props2.put("javax.persistence.jdbc.url", " jdbc:mysql://my_sql_db_url:3306/user2");
 
Map memberProps = new HashMap();
   memberProps.put("memberPu1", props1);
   memberProps.put("memberPu2", props2);
 
Map props = new HashMap();
   props.put("eclipselink.logging.level", "FINEST");
   props.put("eclipselink.composite-unit.properties", memberProps);
 
EntityManagerFactory emf = Persistence.createEntityManagerFactory("compositePu", props);


See Also

For more information, see:

Comments powered by Disqus