Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

openejb-jar.xml just specifies the module's information and makes a dependency on the .

Code Block
xml
xml
borderStylesolid
titleopenejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar
		xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" 
		xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" 
		xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" 
		xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" 
		xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
	<sys:environment>
		<sys:moduleId>
			<sys:groupId>org.apache.geronimo.samples</sys:groupId>
			<sys:artifactId>MyPhonebookBean</sys:artifactId>
			<sys:version>1.0</sys:version>
			<sys:type>car</sys:type>
		</sys:moduleId>
	</sys:environment>
</openejb-jar>

persistence.xml will specify the name of the PersistenceUnit. This name is used when referencing for the EntityManagerFactory. I have denoted it as PhonePU. For some reason I could not get it to reference with jta-data-source. So the alternative method is to explicitly specify the ConnectionURL, ConnectionDriverName, and ConnectionUserName. I added an extra property called SynchronizeMappings so that the data in the database will not be overwritten.

Code Block
xml
xml
borderStylesolid
titlepersistence.xml
<?xml version="1.0" encoding="UTF-8"?>
		<sys:dependencies>
			<sys:dependency>
				<sys:groupId>console.dbpool</sys:groupId>
				<sys:artifactId>PhoneBookPool</sys:artifactId>
				<sys:version>1.0</sys:version>
				<sys:type>rar</sys:type>
			</sys:dependency>

			<sys:dependency>
				<sys:groupId>org.apache.geronimo.configs</sys:groupId>
				<sys:artifactId>openjpa</sys:artifactId>
				<sys:type>car</sys:type>
			</sys:dependency>
		</sys:dependencies>
	</sys:environment>
</openejb-jar><persistence	xmlns="http://java.sun.com/xml/ns/persistence"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
		xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
	<persistence-unit name="PhonePU">
		<description>Phone Book</description>
		<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
		<class>org.apache.geronimo.samples.myphonebookpak.PhoneBook</class>
		<properties>
			<property name="openjpa.ConnectionURL" value="jdbc:derby:PhoneBookDB" />
			<property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver" />
			<property name="ConnectionUserName" value="app" />
			<property name="openjpa.jdbc.SynchronizeMappings" value="false" />
		</properties>
	</persistence-unit>
	<!--
	<jta-data-source>PhoneBookPool</jta-data-source>
	<non-jta-data-source>PhoneBookPool</non-jta-data-source>
	-->
</persistence>