Versions Compared

Key

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

...

  1. @Entity annotation to mark this class as an Entity Bean
  2. @Table annotation to map the table name that is being represented by the Entity Bean.
  3. @Id annotation to specify the primary key of the table.

And, as usual their there is an empty constructor for the Entity Bean

...

Deployment Plans for EJB

openejb-jar.xml just specifies the module's information such as the group and artifact IDs and the verion and module type.

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>

...

Code Block
xml
xml
borderStylesolid
titlepersistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>

Deployment Plans for the Web-App

web.xml references the EJB by specifying the package to which the MyPhonebookLocal belongs to.

...

Code Block
xml
xml
borderStylesolid
titlegeronimo-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"
         xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
         xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>${pom.groupId}</sys:groupId>
      <sys:artifactId>${pom.artifactId}</sys:artifactId>
      <sys:version>${version}</sys:version>
      <sys:type>war</sys:type>
    </sys:moduleId>
  </sys:environment>
  <context-root>/myphonebook</context-root>
</web-app>

Deployment Plan for the

...

Application

geronimo-application.xml tells the application that there is a database pool that needs to be deployed as well. The db pool is defined in PhoneBookPool.xml and the driver that is needs in order to be deployed is the tranql-connector-ra-1.3.rar file--these two files will reside on the top level layer of the resultant EAR file.

...