Home

 

Persistence units

A persistence unit defines a set of entity classes that are managed by one entity manager (described hereafter) instance in an application. This set of entity classes represents the data contained within a single data store.

Persistence units are defined by the persistence.xml configuration file. The JAR file or directory whose META-INF directory contains persistence.xml is called the root of the persistence unit. The scope of the persistence unit is determined by the persistence unit's root.

Example | 2-3 shows an extract of the persistence.xml file.

Example 12-3 Extract of a persistence.xml file

<persistence version="1.0" ...........>
	<persistence-unit name="ITSOBank" transaction-type="JTA">
		<jta-data-source>jdbc/itsobank</jta-data-source>
		<class>itso.bank.entities.Account</class>
		<class>itso.bank.entities.Customer</class>
		<class>itso.bank.entities.Transaction</class>		
	</persistence-unit>
</persistence>

ibm.com/redbooks