Use eclipselink.sessions-xml
to use a specified native sessions.xml
configuration file (which references a project.xml
file) to load configuration and mapping information instead of JPA annotations or EclipseLink XML (as shown in Figure 5-1).
Values
Table 5-88 describes this persistence property's values.
Table 5-88 Valid Values for sessions-xml
Value | Description |
---|---|
configuration file |
The resource name of the sessions XML file. If you do not specify the value for this property, it will not be used. |
Usage
You can use the eclipselink.sessions-xml
property as an alternative to using annotations and deployment XML. With this property, EclipseLink builds an in-memory EclipseLink session and project based on this metadata (as shown in Figure 5-1). You can acquire a persistence manager and use it, having defined all entities and so on using only EclipseLink sessions.xml
.
Figure 5-1 Using the eclipselink.sessions-xml Persistence Property
Examples
Example 5-91 shows how to use this property in a persistence.xml
file.
Example 5-91 Using sessions-xml in the persistence.xml file
<property name="eclipselink.sessions-xml" value="mysession.xml"/>
Example 5-91 shows how to use this property in a property map.
Example 5-92 Using sessions-xml in Property Map
import org.eclipse.persistence.config.PersistenceUnitProperties; propertiesMap.put(PersistenceUnitProperties.SESSIONS_XML, "mysession.xml");
See Also
For more information, see: