[jboss-cvs] JBossAS SVN: r82496 - in projects/ejb3/trunk/docs/tutorial: entity and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 23 02:48:30 EST 2008


Author: jaikiran
Date: 2008-12-23 02:48:30 -0500 (Tue, 23 Dec 2008)
New Revision: 82496

Added:
   projects/ejb3/trunk/docs/tutorial/entity/
   projects/ejb3/trunk/docs/tutorial/entity/META-INF/
   projects/ejb3/trunk/docs/tutorial/entity/build.xml
   projects/ejb3/trunk/docs/tutorial/entity/entity.html
   projects/ejb3/trunk/docs/tutorial/entity/entity.wiki
   projects/ejb3/trunk/docs/tutorial/entity/jndi.properties
   projects/ejb3/trunk/docs/tutorial/entity/log4j.xml
   projects/ejb3/trunk/docs/tutorial/entity/pom.xml
   projects/ejb3/trunk/docs/tutorial/entity/src/
Removed:
   projects/ejb3/trunk/docs/tutorial/entity/META-INF/
   projects/ejb3/trunk/docs/tutorial/entity/build.xml
   projects/ejb3/trunk/docs/tutorial/entity/entity.html
   projects/ejb3/trunk/docs/tutorial/entity/entity.wiki
   projects/ejb3/trunk/docs/tutorial/entity/jndi.properties
   projects/ejb3/trunk/docs/tutorial/entity/log4j.xml
   projects/ejb3/trunk/docs/tutorial/entity/src/
Modified:
   projects/ejb3/trunk/docs/tutorial/entity/META-INF/persistence.xml
Log:
Initial working version of the Entity tutorial, on JBoss-5 GA

Copied: projects/ejb3/trunk/docs/tutorial/entity (from rev 82032, projects/oldstuff/ejb3/docs/tutorial/entity)

Copied: projects/ejb3/trunk/docs/tutorial/entity/META-INF (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/entity/META-INF)

Modified: projects/ejb3/trunk/docs/tutorial/entity/META-INF/persistence.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/entity/META-INF/persistence.xml	2008-12-23 07:30:02 UTC (rev 82494)
+++ projects/ejb3/trunk/docs/tutorial/entity/META-INF/persistence.xml	2008-12-23 07:48:30 UTC (rev 82496)
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<persistence>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+   version="1.0">
    <persistence-unit name="tempdb">
       <jta-data-source>java:/DefaultDS</jta-data-source>
       <properties>

Deleted: projects/ejb3/trunk/docs/tutorial/entity/build.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/entity/build.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/entity/build.xml	2008-12-23 07:48:30 UTC (rev 82496)
@@ -1,95 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- ======================================================================= -->
-<!-- JBoss build file                                                       -->
-<!-- ======================================================================= -->
-
-<project name="JBoss" default="ejbjar" basedir=".">
-
-   <property environment="env"/>
-   <property name="src.dir" value="${basedir}/src"/>
-   <property name="jboss.home" value="${env.JBOSS_HOME}"/>
-   <property name="jboss.server.config" value="default"/>
-   <property name="build.dir" value="${basedir}/build"/>
-   <property name="build.classes.dir" value="${build.dir}/classes"/>
-
-   <!-- Build classpath -->
-   <path id="classpath">
-      <!-- So that we can get jndi.properties for InitialContext -->
-      <pathelement location="${basedir}"/>
-      <fileset dir="${jboss.home}/lib">
-         <include name="**/*.jar"/>
-      </fileset>
-      <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
-         <include name="**/*.jar"/>
-      </fileset>
-      <fileset dir="${jboss.home}/server/${jboss.server.config}/deployers/ejb3.deployer">
-         <include name="*.jar"/>
-      </fileset>
-      <pathelement location="${build.classes.dir}"/>
-   </path>
-
-   <property name="build.classpath" refid="classpath"/>
-
-   <!-- =================================================================== -->
-   <!-- Prepares the build directory                                        -->
-   <!-- =================================================================== -->
-   <target name="prepare">
-      <mkdir dir="${build.dir}"/>
-      <mkdir dir="${build.classes.dir}"/>
-   </target>
-
-   <!-- =================================================================== -->
-   <!-- Compiles the source code                                            -->
-   <!-- =================================================================== -->
-   <target name="compile" depends="prepare">
-      <javac srcdir="${src.dir}"
-         destdir="${build.classes.dir}"
-         debug="on"
-         deprecation="on"
-         optimize="off"
-         includes="**">
-         <classpath refid="classpath"/>
-      </javac>
-   </target>
-
-   <target name="ejbjar" depends="compile">
-      <jar jarfile="build/tutorial.jar">
-         <fileset dir="${build.classes.dir}">
-            <include name="**/*.class"/>
-         </fileset>
-         <fileset dir=".">
-            <include name="META-INF/persistence.xml"/>
-         </fileset>
-      </jar>
-      <copy file="build/tutorial.jar" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
-   </target>
-
-   <target name="entity2xml" depends="prepare">
-      <java fork="yes" failOnError="true" className="org.jboss.ejb3.entity.EntityToHibernateXml">
-         <classpath refid="classpath"/>
-         <arg value="org.jboss.tutorial.entity.bean.Order"/>
-         <arg value="org.jboss.tutorial.entity.bean.LineItem"/>
-      </java>
-   </target>
-   <target name="run" depends="ejbjar">
-      <java classname="org.jboss.tutorial.entity.client.Client" fork="yes" dir=".">
-         <classpath refid="classpath"/>
-      </java>
-   </target>
-
-   <!-- =================================================================== -->
-   <!-- Cleans up generated stuff                                           -->
-   <!-- =================================================================== -->
-   <target name="clean.db">
-      <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
-   </target>
-
-   <target name="clean">
-      <delete dir="${build.dir}"/>
-      <delete file="${jboss.home}/server/${jboss.server.config}/deploy/tutorial.jar"/>
-   </target>
-
-
-</project>
-

Copied: projects/ejb3/trunk/docs/tutorial/entity/build.xml (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/entity/build.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/entity/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/entity/build.xml	2008-12-23 07:48:30 UTC (rev 82496)
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file                                                       -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="ejbjar" basedir=".">
+
+   <property environment="env"/>
+   <property name="src.dir" value="${basedir}/src"/>
+	<property name="jboss.home" value="${env.JBOSS_HOME}"/>
+		<property name="jboss.server.config" value="default"/>
+		<property name="build.dir" value="${basedir}/build"/>
+	   	<property name="build.classes.dir" value="${build.dir}/classes"/>
+		<property name="build.artifact" value="jboss-ejb3-tutorial-entity.jar"/>
+
+   <!-- Build classpath -->
+   <path id="classpath">
+      <!-- So that we can get jndi.properties for InitialContext -->
+      <pathelement location="${basedir}"/>
+   		<!-- Only the jbossall-client.jar should ideally be sufficient -->
+      <fileset dir="${jboss.home}/client">
+         <include name="**/jbossall-client.jar"/>
+      </fileset>
+      <pathelement location="${build.classes.dir}"/>
+   </path>
+
+   <property name="build.classpath" refid="classpath"/>
+
+   <!-- =================================================================== -->
+   <!-- Prepares the build directory                                        -->
+   <!-- =================================================================== -->
+   <target name="prepare">
+      <mkdir dir="${build.dir}"/>
+      <mkdir dir="${build.classes.dir}"/>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Compiles the source code                                            -->
+   <!-- =================================================================== -->
+   <target name="compile" depends="prepare">
+      <javac srcdir="${src.dir}"
+         destdir="${build.classes.dir}"
+         debug="on"
+         deprecation="on"
+         optimize="off"
+         includes="**">
+         <classpath refid="classpath"/>
+      </javac>
+   </target>
+
+   <target name="ejbjar" depends="compile">
+      <jar jarfile="build/${build.artifact}">
+         <fileset dir="${build.classes.dir}">
+            <include name="**/*.class"/>
+         </fileset>
+         <fileset dir=".">
+            <include name="META-INF/persistence.xml"/>
+         </fileset>
+      </jar>
+      <copy file="build/${build.artifact}" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+   </target>
+
+   <target name="entity2xml" depends="prepare">
+      <java fork="yes" failOnError="true" className="org.jboss.ejb3.entity.EntityToHibernateXml">
+         <classpath refid="classpath"/>
+         <arg value="org.jboss.tutorial.entity.bean.Order"/>
+         <arg value="org.jboss.tutorial.entity.bean.LineItem"/>
+      </java>
+   </target>
+   <target name="run" depends="ejbjar">
+      <java classname="org.jboss.tutorial.entity.client.Client" fork="yes" dir=".">
+         <classpath refid="classpath"/>
+      </java>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Cleans up generated stuff                                           -->
+   <!-- =================================================================== -->
+   <target name="clean.db">
+      <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
+   </target>
+
+   <target name="clean">
+      <delete dir="${build.dir}"/>
+      <delete file="${jboss.home}/server/${jboss.server.config}/deploy/${build.artifact}"/>
+   </target>
+
+
+</project>
+

Deleted: projects/ejb3/trunk/docs/tutorial/entity/entity.html
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/entity/entity.html	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/entity/entity.html	2008-12-23 07:48:30 UTC (rev 82496)
@@ -1,124 +0,0 @@
-<html>
-<body>
-<p>
-<h2>Entity Beans</h2>
-
-Entity Beans have been given a complete overhaul in EJB 3.0.  Entity beans are plain Java objects that can be allocated with <tt>new</tt> and attached/detached/reattached to persistence storage.  Entity beans are not remotable and must be access through the new <tt>javax.persistence.EntityManager</tt> service.  JBoss's EJB 3.0 implementation is built on top of Hibernate.
-</p><p>
-<h4>O/R Mapping</h4>
-
-First let's look at the example implementation of two related Entity beans.  <a href="src/org/jboss/tutorial/entity/bean/Order.java">Order</a> and <a href="src/org/jboss/tutorial/entity/bean/LineItem.java">LineItem</a>.  These two beans form a one to many relationship and automatic table generation is used to generate the database tables.
-</p><p>
-The EJB container determines the persistent properties by looking for all getter/setter method pairs.  By default, all getter/setter methods will be treated as persistence properties.  
-</p><p>
-Defining an Entity is easy.  First, tag the class as an <tt>@Entity</tt>.  In the minimum, you must at least define a primary key field using the <tt>@Id</tt> annotation.
-</p><p>
-<pre>
-   @Id @GeneratedValue
-   public int getId()
-   {
-      return id;
-   }
-</pre>
-</p><p>
-Annotations must be defined on the getter method.  The above <tt>@Id</tt> annotation tells the container that <tt>id</tt> is the primary key property.  The <tt>@GeneratedValue</tt>: that it should be automatically generated by the container.
-</p><p>
-Also, the create table name is specified using the <tt>@Table</tt> annotation
-</p><p>
-<pre>
- at Table(name = "PURCHASE_ORDER")
-</pre>
-</p><p>
-If the table name isn't specified it defaults to the bean name of the class.  For instance, the LineItem EJB would be mapped to the LINEITEM table.
-</p><p>
-<h4>One to Many Relationship</h4>
-
-The Order bean also defines a one to many relationship.
-</p><p>
-<pre>
-   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="order")
-   public Collection&lt;LineItem&gt; getLineItems()
-   {
-      return lineItems;
-   }
-</pre>
-</p><p>
-Generics must be used so that the container can determine the bean order is related to.  
-</p><p>
-<tt>CascadeType.ALL</tt> specifies that when an Order is created, any LineItems held in the <tt>lineItems</tt> collection will be created as well (<tt>CascadeType.PERSIST</tt>).  If the Order is delete from persistence storage, all related LineItems will be deleted (<tt>CascadeType.REMOVE</tt>).  If an Order instance is reattached to persistence storage, any changes to the LineItems collection will be merged with persistence storage (<tt>CascadeType.MERGE</tt>).
-</p><p>
-<tt>FetchType.EAGER</tt> specifies that when the Order is loaded whether or not to prefetch the relationship as well.  If you want the LineItems to be loaded on demand, then specify <tt>FetchType.LAZY</tt>.
-</p><p>
-The <tt>mappedBy</tt> attribute specifies that this is a bi-directional relationship that is managed by the order property
-on the LineItem entity bean.
-</p><p>
-<h4>Many to One Relationship</h4>
-
-LineItem completes the  bi-directional between Order and LineItem.
-</p><p>
-<pre>
-   @ManyToOne
-   @JoinColumn(name = "order_id")
-   public Order getOrder()
-   {
-      return order;
-   }
-</pre>
-</p><p>
-The <tt>@JoinColumn</tt> specifies the foreign key column within the LineItem table.
-</p><p>
-<h4>EntityManager</h4>
-
-The <a href="src/org/jboss/tutorial/entity/bean/ShoppingCartBean.java">ShoppingCartBean</a> allocates and stores all instances of Orders and LineItems.  If you look at the example you can see that ShoppingCart interacts with Order as a plain Java object.  It allocates it with <tt>new</tt>.  It can pass the Order back to the client.  The <tt>checkout()</tt> method actually stores it with persistence storage by using the required EntityManager service.
-</p><p>
-The EntityManager service is injected using field injection and the <tt>@PersistenceContext</tt> annotation.
-</p><p>
-<pre>
-   @PersistenceContext
-   private EntityManager manager;
-</pre>
-</p><p>
-The EntityManager is central to EJB 3.0 as there are no homes.  The EntityManager is used to do querying, creating, find by primary key, and removal of entity beans.
-</p><p>
-</p><p>
-</p><p>
-<h4>Building and Running</h4>
-
-To build and run the example, make sure you have <tt>ejb3.deployer</tt> installed in JBoss 4.0.x and have JBoss running.  See the reference manual on how to install EJB 3.0.  
-<pre>
-Unix:    $ export JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
-Windows: $ set JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
-$ ant
-$ ant run
-
-run:
-     [java] Buying 2 memory sticks
-     [java] 2004-10-06 22:12:44,131 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
-rt: org/apache/axis/AxisFault
-     [java] Buying a laptop
-     [java] Print cart:
-     [java] Total: $3000.0
-     [java] 2     Memory stick     1000.0
-     [java] 1     Laptop     2000.0
-     [java] Checkout
-</pre>
-</p><p>
-The INFO message you can ignore.  It will be fixed in later releases of JBoss 4.0.
-</p><p>
-<h4>View the tables and rows</h4>
-
-You can view the tables created by JBoss by going to the <a href="http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss%3Aservice%3DHypersonic%2Cdatabase%3DlocalDB">Hypersonic SQL service</a>, scrolling down to the <tt>startDatabaseManager</tt> button and clicking it.  A Hypersonic SQL window will be minimized, but you can open it up to look at the tables and do queries.
-</p><p>
-<h4>Jar structure</h4>
-
-Persistence archives must have a META-INF/persistence.xml file.  They can be packaged along with EJB-JARs or by themselves in an EAR.  They can also be packaged in a WAR as well, but JBoss doesn't support his yet.
-See the packaging tutorial for more detail.  Running the ant script above creates a JAR file within the deploy/ directory of JBoss.  All that needs to be in that jar is your server-side class files and additionally, you will probably need to define a hibernate.properties file in the META-INF directory of the JAR.  hibernate.properties is needed if you need to hook in a datasource other than JBoss's DefaultDS, or change the caching of Hibernate.  See the EJB 3.0 reference manual and Hibernate reference manual for more details.f
-</p><p>
-</p><p>
-</p><p>
-</p><p>
-</p><p>
-</p><p>
-</p>
-</body>
-</html>

Copied: projects/ejb3/trunk/docs/tutorial/entity/entity.html (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/entity/entity.html)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/entity/entity.html	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/entity/entity.html	2008-12-23 07:48:30 UTC (rev 82496)
@@ -0,0 +1,124 @@
+<html>
+<body>
+<p>
+<h2>Entity Beans</h2>
+
+Entity Beans have been given a complete overhaul in EJB 3.0.  Entity beans are plain Java objects that can be allocated with <tt>new</tt> and attached/detached/reattached to persistence storage.  Entity beans are not remotable and must be access through the new <tt>javax.persistence.EntityManager</tt> service.  JBoss's EJB 3.0 implementation is built on top of Hibernate.
+</p><p>
+<h4>O/R Mapping</h4>
+
+First let's look at the example implementation of two related Entity beans.  <a href="src/org/jboss/tutorial/entity/bean/Order.java">Order</a> and <a href="src/org/jboss/tutorial/entity/bean/LineItem.java">LineItem</a>.  These two beans form a one to many relationship and automatic table generation is used to generate the database tables.
+</p><p>
+The EJB container determines the persistent properties by looking for all getter/setter method pairs.  By default, all getter/setter methods will be treated as persistence properties.  
+</p><p>
+Defining an Entity is easy.  First, tag the class as an <tt>@Entity</tt>.  In the minimum, you must at least define a primary key field using the <tt>@Id</tt> annotation.
+</p><p>
+<pre>
+   @Id @GeneratedValue
+   public int getId()
+   {
+      return id;
+   }
+</pre>
+</p><p>
+Annotations must be defined on the getter method.  The above <tt>@Id</tt> annotation tells the container that <tt>id</tt> is the primary key property.  The <tt>@GeneratedValue</tt>: that it should be automatically generated by the container.
+</p><p>
+Also, the create table name is specified using the <tt>@Table</tt> annotation
+</p><p>
+<pre>
+ at Table(name = "PURCHASE_ORDER")
+</pre>
+</p><p>
+If the table name isn't specified it defaults to the bean name of the class.  For instance, the LineItem EJB would be mapped to the LINEITEM table.
+</p><p>
+<h4>One to Many Relationship</h4>
+
+The Order bean also defines a one to many relationship.
+</p><p>
+<pre>
+   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="order")
+   public Collection&lt;LineItem&gt; getLineItems()
+   {
+      return lineItems;
+   }
+</pre>
+</p><p>
+Generics must be used so that the container can determine the bean order is related to.  
+</p><p>
+<tt>CascadeType.ALL</tt> specifies that when an Order is created, any LineItems held in the <tt>lineItems</tt> collection will be created as well (<tt>CascadeType.PERSIST</tt>).  If the Order is delete from persistence storage, all related LineItems will be deleted (<tt>CascadeType.REMOVE</tt>).  If an Order instance is reattached to persistence storage, any changes to the LineItems collection will be merged with persistence storage (<tt>CascadeType.MERGE</tt>).
+</p><p>
+<tt>FetchType.EAGER</tt> specifies that when the Order is loaded whether or not to prefetch the relationship as well.  If you want the LineItems to be loaded on demand, then specify <tt>FetchType.LAZY</tt>.
+</p><p>
+The <tt>mappedBy</tt> attribute specifies that this is a bi-directional relationship that is managed by the order property
+on the LineItem entity bean.
+</p><p>
+<h4>Many to One Relationship</h4>
+
+LineItem completes the  bi-directional between Order and LineItem.
+</p><p>
+<pre>
+   @ManyToOne
+   @JoinColumn(name = "order_id")
+   public Order getOrder()
+   {
+      return order;
+   }
+</pre>
+</p><p>
+The <tt>@JoinColumn</tt> specifies the foreign key column within the LineItem table.
+</p><p>
+<h4>EntityManager</h4>
+
+The <a href="src/org/jboss/tutorial/entity/bean/ShoppingCartBean.java">ShoppingCartBean</a> allocates and stores all instances of Orders and LineItems.  If you look at the example you can see that ShoppingCart interacts with Order as a plain Java object.  It allocates it with <tt>new</tt>.  It can pass the Order back to the client.  The <tt>checkout()</tt> method actually stores it with persistence storage by using the required EntityManager service.
+</p><p>
+The EntityManager service is injected using field injection and the <tt>@PersistenceContext</tt> annotation.
+</p><p>
+<pre>
+   @PersistenceContext
+   private EntityManager manager;
+</pre>
+</p><p>
+The EntityManager is central to EJB 3.0 as there are no homes.  The EntityManager is used to do querying, creating, find by primary key, and removal of entity beans.
+</p><p>
+</p><p>
+</p><p>
+<h4>Building and Running</h4>
+
+To build and run the example, make sure you have <tt>ejb3.deployer</tt> installed in JBoss 4.0.x and have JBoss running.  See the reference manual on how to install EJB 3.0.  
+<pre>
+Unix:    $ export JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
+Windows: $ set JBOSS_HOME=&lt;where your jboss 4.0 distribution is&gt;
+$ ant
+$ ant run
+
+run:
+     [java] Buying 2 memory sticks
+     [java] 2004-10-06 22:12:44,131 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
+rt: org/apache/axis/AxisFault
+     [java] Buying a laptop
+     [java] Print cart:
+     [java] Total: $3000.0
+     [java] 2     Memory stick     1000.0
+     [java] 1     Laptop     2000.0
+     [java] Checkout
+</pre>
+</p><p>
+The INFO message you can ignore.  It will be fixed in later releases of JBoss 4.0.
+</p><p>
+<h4>View the tables and rows</h4>
+
+You can view the tables created by JBoss by going to the <a href="http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss%3Aservice%3DHypersonic%2Cdatabase%3DlocalDB">Hypersonic SQL service</a>, scrolling down to the <tt>startDatabaseManager</tt> button and clicking it.  A Hypersonic SQL window will be minimized, but you can open it up to look at the tables and do queries.
+</p><p>
+<h4>Jar structure</h4>
+
+Persistence archives must have a META-INF/persistence.xml file.  They can be packaged along with EJB-JARs or by themselves in an EAR.  They can also be packaged in a WAR as well, but JBoss doesn't support his yet.
+See the packaging tutorial for more detail.  Running the ant script above creates a JAR file within the deploy/ directory of JBoss.  All that needs to be in that jar is your server-side class files and additionally, you will probably need to define a hibernate.properties file in the META-INF directory of the JAR.  hibernate.properties is needed if you need to hook in a datasource other than JBoss's DefaultDS, or change the caching of Hibernate.  See the EJB 3.0 reference manual and Hibernate reference manual for more details.f
+</p><p>
+</p><p>
+</p><p>
+</p><p>
+</p><p>
+</p><p>
+</p>
+</body>
+</html>

Deleted: projects/ejb3/trunk/docs/tutorial/entity/entity.wiki
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/entity/entity.wiki	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/entity/entity.wiki	2008-12-23 07:48:30 UTC (rev 82496)
@@ -1,110 +0,0 @@
-!!!Entity Beans
-Entity Beans have been given a complete overhaul in EJB 3.0.  Entity beans are plain Java objects that can be allocated with {{new}} and attached/detached/reattached to persistence storage.  Entity beans are not remotable and must be access through the new {{javax.persistence.EntityManager}} service.  JBoss's EJB 3.0 implementation is built on top of Hibernate.
-
-!O/R Mapping
-First let's look at the example implementation of two related Entity beans.  [Order|src/org/jboss/tutorial/entity/bean/Order.java] and [LineItem|src/org/jboss/tutorial/entity/bean/LineItem.java].  These two beans form a one to many relationship and automatic table generation is used to generate the database tables.
-
-The EJB container determines the persistent properties by looking for all getter/setter method pairs.  By default, all getter/setter methods will be treated as persistence properties.  
-
-Defining an Entity is easy.  First, tag the class as an {{@Entity}}.  In the minimum, you must at least define a primary key field using the {{@Id}} annotation.
-
-{{{
-   @Id @GeneratedValue
-   public int getId()
-   {
-      return id;
-   }
-}}}
-
-Annotations must be defined on the getter method.  The above {{@Id}} annotation tells the container that {{id}} is the primary key property.  The {{@GeneratedValue}}: that it should be automatically generated by the container.
-
-Also, the create table name is specified using the {{@Table}} annotation
-
-{{{
- at Table(name = "PURCHASE_ORDER")
-}}}
-
-If the table name isn't specified it defaults to the bean name of the class.  For instance, the LineItem EJB would be mapped to the LINEITEM table.
-
-!One to Many Relationship
-The Order bean also defines a one to many relationship.
-
-{{{
-   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="order")
-   public Collection<LineItem> getLineItems()
-   {
-      return lineItems;
-   }
-}}}
-
-Generics must be used so that the container can determine the bean order is related to.  
-
-{{CascadeType.ALL}} specifies that when an Order is created, any LineItems held in the {{lineItems}} collection will be created as well ({{CascadeType.PERSIST}}).  If the Order is delete from persistence storage, all related LineItems will be deleted ({{CascadeType.REMOVE}}).  If an Order instance is reattached to persistence storage, any changes to the LineItems collection will be merged with persistence storage ({{CascadeType.MERGE}}).
-
-{{FetchType.EAGER}} specifies that when the Order is loaded whether or not to prefetch the relationship as well.  If you want the LineItems to be loaded on demand, then specify {{FetchType.LAZY}}.
-
-The {{mappedBy}} attribute specifies that this is a bi-directional relationship that is managed by the order property
-on the LineItem entity bean.
-
-!Many to One Relationship
-LineItem completes the  bi-directional between Order and LineItem.
-
-{{{
-   @ManyToOne
-   @JoinColumn(name = "order_id")
-   public Order getOrder()
-   {
-      return order;
-   }
-}}}
-
-The {{@JoinColumn}} specifies the foreign key column within the LineItem table.
-
-!EntityManager
-The [ShoppingCartBean|src/org/jboss/tutorial/entity/bean/ShoppingCartBean.java] allocates and stores all instances of Orders and LineItems.  If you look at the example you can see that ShoppingCart interacts with Order as a plain Java object.  It allocates it with {{new}}.  It can pass the Order back to the client.  The {{checkout()}} method actually stores it with persistence storage by using the required EntityManager service.
-
-The EntityManager service is injected using field injection and the {{@PersistenceContext}} annotation.
-
-{{{
-   @PersistenceContext
-   private EntityManager manager;
-}}}
-
-The EntityManager is central to EJB 3.0 as there are no homes.  The EntityManager is used to do querying, creating, find by primary key, and removal of entity beans.
-
-
-
-!Building and Running
-To build and run the example, make sure you have {{ejb3.deployer}} installed in JBoss 4.0.x and have JBoss running.  See the reference manual on how to install EJB 3.0.  
-{{{
-Unix:    $ export JBOSS_HOME=<where your jboss 4.0 distribution is>
-Windows: $ set JBOSS_HOME=<where your jboss 4.0 distribution is>
-$ ant
-$ ant run
-
-run:
-     [java] Buying 2 memory sticks
-     [java] 2004-10-06 22:12:44,131 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
-rt: org/apache/axis/AxisFault
-     [java] Buying a laptop
-     [java] Print cart:
-     [java] Total: $3000.0
-     [java] 2     Memory stick     1000.0
-     [java] 1     Laptop     2000.0
-     [java] Checkout
-}}}
-
-The INFO message you can ignore.  It will be fixed in later releases of JBoss 4.0.
-
-!View the tables and rows
-You can view the tables created by JBoss by going to the [Hypersonic SQL service|http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss%3Aservice%3DHypersonic%2Cdatabase%3DlocalDB], scrolling down to the {{startDatabaseManager}} button and clicking it.  A Hypersonic SQL window will be minimized, but you can open it up to look at the tables and do queries.
-
-!Jar structure
-Persistence archives must have a META-INF/persistence.xml file.  They can be packaged along with EJB-JARs or by themselves in an EAR.  They can also be packaged in a WAR as well, but JBoss doesn't support his yet.
-See the packaging tutorial for more detail.  Running the ant script above creates a JAR file within the deploy/ directory of JBoss.  All that needs to be in that jar is your server-side class files and additionally, you will probably need to define a hibernate.properties file in the META-INF directory of the JAR.  hibernate.properties is needed if you need to hook in a datasource other than JBoss's DefaultDS, or change the caching of Hibernate.  See the EJB 3.0 reference manual and Hibernate reference manual for more details.f
-
-
-
-
-
-

Copied: projects/ejb3/trunk/docs/tutorial/entity/entity.wiki (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/entity/entity.wiki)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/entity/entity.wiki	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/entity/entity.wiki	2008-12-23 07:48:30 UTC (rev 82496)
@@ -0,0 +1,110 @@
+!!!Entity Beans
+Entity Beans have been given a complete overhaul in EJB 3.0.  Entity beans are plain Java objects that can be allocated with {{new}} and attached/detached/reattached to persistence storage.  Entity beans are not remotable and must be access through the new {{javax.persistence.EntityManager}} service.  JBoss's EJB 3.0 implementation is built on top of Hibernate.
+
+!O/R Mapping
+First let's look at the example implementation of two related Entity beans.  [Order|src/org/jboss/tutorial/entity/bean/Order.java] and [LineItem|src/org/jboss/tutorial/entity/bean/LineItem.java].  These two beans form a one to many relationship and automatic table generation is used to generate the database tables.
+
+The EJB container determines the persistent properties by looking for all getter/setter method pairs.  By default, all getter/setter methods will be treated as persistence properties.  
+
+Defining an Entity is easy.  First, tag the class as an {{@Entity}}.  In the minimum, you must at least define a primary key field using the {{@Id}} annotation.
+
+{{{
+   @Id @GeneratedValue
+   public int getId()
+   {
+      return id;
+   }
+}}}
+
+Annotations must be defined on the getter method.  The above {{@Id}} annotation tells the container that {{id}} is the primary key property.  The {{@GeneratedValue}}: that it should be automatically generated by the container.
+
+Also, the create table name is specified using the {{@Table}} annotation
+
+{{{
+ at Table(name = "PURCHASE_ORDER")
+}}}
+
+If the table name isn't specified it defaults to the bean name of the class.  For instance, the LineItem EJB would be mapped to the LINEITEM table.
+
+!One to Many Relationship
+The Order bean also defines a one to many relationship.
+
+{{{
+   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="order")
+   public Collection<LineItem> getLineItems()
+   {
+      return lineItems;
+   }
+}}}
+
+Generics must be used so that the container can determine the bean order is related to.  
+
+{{CascadeType.ALL}} specifies that when an Order is created, any LineItems held in the {{lineItems}} collection will be created as well ({{CascadeType.PERSIST}}).  If the Order is delete from persistence storage, all related LineItems will be deleted ({{CascadeType.REMOVE}}).  If an Order instance is reattached to persistence storage, any changes to the LineItems collection will be merged with persistence storage ({{CascadeType.MERGE}}).
+
+{{FetchType.EAGER}} specifies that when the Order is loaded whether or not to prefetch the relationship as well.  If you want the LineItems to be loaded on demand, then specify {{FetchType.LAZY}}.
+
+The {{mappedBy}} attribute specifies that this is a bi-directional relationship that is managed by the order property
+on the LineItem entity bean.
+
+!Many to One Relationship
+LineItem completes the  bi-directional between Order and LineItem.
+
+{{{
+   @ManyToOne
+   @JoinColumn(name = "order_id")
+   public Order getOrder()
+   {
+      return order;
+   }
+}}}
+
+The {{@JoinColumn}} specifies the foreign key column within the LineItem table.
+
+!EntityManager
+The [ShoppingCartBean|src/org/jboss/tutorial/entity/bean/ShoppingCartBean.java] allocates and stores all instances of Orders and LineItems.  If you look at the example you can see that ShoppingCart interacts with Order as a plain Java object.  It allocates it with {{new}}.  It can pass the Order back to the client.  The {{checkout()}} method actually stores it with persistence storage by using the required EntityManager service.
+
+The EntityManager service is injected using field injection and the {{@PersistenceContext}} annotation.
+
+{{{
+   @PersistenceContext
+   private EntityManager manager;
+}}}
+
+The EntityManager is central to EJB 3.0 as there are no homes.  The EntityManager is used to do querying, creating, find by primary key, and removal of entity beans.
+
+
+
+!Building and Running
+To build and run the example, make sure you have {{ejb3.deployer}} installed in JBoss 4.0.x and have JBoss running.  See the reference manual on how to install EJB 3.0.  
+{{{
+Unix:    $ export JBOSS_HOME=<where your jboss 4.0 distribution is>
+Windows: $ set JBOSS_HOME=<where your jboss 4.0 distribution is>
+$ ant
+$ ant run
+
+run:
+     [java] Buying 2 memory sticks
+     [java] 2004-10-06 22:12:44,131 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
+rt: org/apache/axis/AxisFault
+     [java] Buying a laptop
+     [java] Print cart:
+     [java] Total: $3000.0
+     [java] 2     Memory stick     1000.0
+     [java] 1     Laptop     2000.0
+     [java] Checkout
+}}}
+
+The INFO message you can ignore.  It will be fixed in later releases of JBoss 4.0.
+
+!View the tables and rows
+You can view the tables created by JBoss by going to the [Hypersonic SQL service|http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss%3Aservice%3DHypersonic%2Cdatabase%3DlocalDB], scrolling down to the {{startDatabaseManager}} button and clicking it.  A Hypersonic SQL window will be minimized, but you can open it up to look at the tables and do queries.
+
+!Jar structure
+Persistence archives must have a META-INF/persistence.xml file.  They can be packaged along with EJB-JARs or by themselves in an EAR.  They can also be packaged in a WAR as well, but JBoss doesn't support his yet.
+See the packaging tutorial for more detail.  Running the ant script above creates a JAR file within the deploy/ directory of JBoss.  All that needs to be in that jar is your server-side class files and additionally, you will probably need to define a hibernate.properties file in the META-INF directory of the JAR.  hibernate.properties is needed if you need to hook in a datasource other than JBoss's DefaultDS, or change the caching of Hibernate.  See the EJB 3.0 reference manual and Hibernate reference manual for more details.f
+
+
+
+
+
+

Deleted: projects/ejb3/trunk/docs/tutorial/entity/jndi.properties
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/entity/jndi.properties	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/entity/jndi.properties	2008-12-23 07:48:30 UTC (rev 82496)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=localhost

Copied: projects/ejb3/trunk/docs/tutorial/entity/jndi.properties (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/entity/jndi.properties)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/entity/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/entity/jndi.properties	2008-12-23 07:48:30 UTC (rev 82496)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=localhost

Deleted: projects/ejb3/trunk/docs/tutorial/entity/log4j.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/entity/log4j.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/entity/log4j.xml	2008-12-23 07:48:30 UTC (rev 82496)
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!--                                                                       -->
-<!--  Log4j Configuration                                                  -->
-<!--                                                                       -->
-<!-- ===================================================================== -->
-
-<!-- $Id$ -->
-
-<!--
-   | For more configuration infromation and examples see the Jakarta Log4j
-   | owebsite: http://jakarta.apache.org/log4j
- -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-   
-<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
-      <param name="Target" value="System.out"/>
-      <param name="Threshold" value="INFO"/>
-
-      <layout class="org.apache.log4j.PatternLayout">
-         <!-- The default pattern: Date Priority [Category] Messagen -->
-         <!--
-         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
-         -->
-         <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L)  -%m%n"/>
-      </layout>
-</appender>
-
-   <root>
-      <appender-ref ref="CONSOLE"/>
-   </root>
-
-</log4j:configuration>

Copied: projects/ejb3/trunk/docs/tutorial/entity/log4j.xml (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/entity/log4j.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/entity/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/entity/log4j.xml	2008-12-23 07:48:30 UTC (rev 82496)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id$ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+   
+<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Messagen -->
+         <!--
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+         -->
+         <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L)  -%m%n"/>
+      </layout>
+</appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: projects/ejb3/trunk/docs/tutorial/entity/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/entity/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/entity/pom.xml	2008-12-23 07:48:30 UTC (rev 82496)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  
+
+  
+   
+  <!-- Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.jboss.ejb3</groupId>
+    <artifactId>jboss-ejb3-tutorial-common</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../common/</relativePath>
+  </parent>
+
+  <properties>
+    <ejb3.tutorial.client>org.jboss.tutorial.entity.client.Client</ejb3.tutorial.client>
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-entity</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>EJB3.0 Entities Tutorial</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial about Entities in EJB 3.0
+  </description>
+  
+  
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/entity/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Copied: projects/ejb3/trunk/docs/tutorial/entity/src (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/entity/src)




More information about the jboss-cvs-commits mailing list