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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 26 04:57:18 EST 2008


Author: jaikiran
Date: 2008-12-26 04:57:17 -0500 (Fri, 26 Dec 2008)
New Revision: 82551

Added:
   projects/ejb3/trunk/docs/tutorial/joininheritance/
   projects/ejb3/trunk/docs/tutorial/joininheritance/META-INF/
   projects/ejb3/trunk/docs/tutorial/joininheritance/build.xml
   projects/ejb3/trunk/docs/tutorial/joininheritance/jndi.properties
   projects/ejb3/trunk/docs/tutorial/joininheritance/join.html
   projects/ejb3/trunk/docs/tutorial/joininheritance/join.wiki
   projects/ejb3/trunk/docs/tutorial/joininheritance/log4j.xml
   projects/ejb3/trunk/docs/tutorial/joininheritance/pom.xml
   projects/ejb3/trunk/docs/tutorial/joininheritance/src/
Removed:
   projects/ejb3/trunk/docs/tutorial/joininheritance/META-INF/
   projects/ejb3/trunk/docs/tutorial/joininheritance/build.xml
   projects/ejb3/trunk/docs/tutorial/joininheritance/jndi.properties
   projects/ejb3/trunk/docs/tutorial/joininheritance/join.html
   projects/ejb3/trunk/docs/tutorial/joininheritance/join.wiki
   projects/ejb3/trunk/docs/tutorial/joininheritance/log4j.xml
   projects/ejb3/trunk/docs/tutorial/joininheritance/src/
Modified:
   projects/ejb3/trunk/docs/tutorial/joininheritance/META-INF/persistence.xml
Log:
JoinInheritance tutorial for JBoss-5 GA

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

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

Modified: projects/ejb3/trunk/docs/tutorial/joininheritance/META-INF/persistence.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/joininheritance/META-INF/persistence.xml	2008-12-24 23:43:57 UTC (rev 82546)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/META-INF/persistence.xml	2008-12-26 09:57:17 UTC (rev 82551)
@@ -1,5 +1,9 @@
 <?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/joininheritance/build.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/joininheritance/build.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/build.xml	2008-12-26 09:57:17 UTC (rev 82551)
@@ -1,90 +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="all"/>
-   <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}/deploy/ejb3.deployer">
-         <include name="*.jar"/>
-      </fileset>
-      <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.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="run" depends="ejbjar">
-      <java classname="org.jboss.tutorial.joininheritance.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/joininheritance/build.xml (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/joininheritance/build.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/joininheritance/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/build.xml	2008-12-26 09:57:17 UTC (rev 82551)
@@ -0,0 +1,84 @@
+<?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-joininheritance.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="run" depends="ejbjar">
+      <java classname="org.jboss.tutorial.joininheritance.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/joininheritance/jndi.properties
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/joininheritance/jndi.properties	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/jndi.properties	2008-12-26 09:57:17 UTC (rev 82551)
@@ -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/joininheritance/jndi.properties (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/joininheritance/jndi.properties)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/joininheritance/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/jndi.properties	2008-12-26 09:57:17 UTC (rev 82551)
@@ -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/joininheritance/join.html
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/joininheritance/join.html	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/join.html	2008-12-26 09:57:17 UTC (rev 82551)
@@ -1,102 +0,0 @@
-<html>
-<body>
-<p>
-<h2>Inheritance: Join Strategy</h2>
-
-The EJB specification allows you to define entities that inherit from one another.  The inheritance relationships can be reflected in
-queries as well.  So, if you queried based on the base class, the query is polymorphic.
-</p><p>
-The tutorial example uses the join table strategy to map an inheritance relationship of <a href="src/org/jboss/tutorial/joininheritance/bean/Pet.java">Pet</a>, which is the base class for <a href="src/org/jboss/tutorial/joininheritance/bean/Cat.java">Cat</a> and <a href="src/org/jboss/tutorial/joininheritance/bean/Dog.java">Dog</a>.
-</p><p>
-With the join table strategy there is a table per class in the hierarchy, but the subclass tables only have the extra attribute they define in their subclass.
-A discriminator column is <i>NOT</i> required to differentiate between which class type is persisted in a particular row unlike the
-single table mapping.  The persistence manager does not need a discrimiator column to figure out the type.
-</p><p>
-This is what the annotations look like for Pet.
-</p><p>
-<pre>
- at Entity
- at Inheritance(strategy = InheritanceType.JOINED)
-public class Pet implements java.io.Serializable
-{
-</pre>
-</p><p>
-<pre>
- at Entity
- at Inheritance(strategy = InheritanceType.JOINED)
-public class Dog extends Pet
-{
-</pre>
-</p><p>
-<h4>Polymorphic Queries</h4>
-
-<a href="src/org/jboss/tutorial/joininheritance/bean/PetDAOBean.java">PetDAOBean</a> stateless EJB wraps some polymorphic queries.
-</p><p>
-<pre>
-   public List findByWeight(double weight)
-   {
-      return manager.createQuery("from Pet p where p.weight &lt; :weight").setParameter("weight", weight).getResultList();
-   }
-</pre>
-</p><p>
-Even though the <tt>findByWeight</tt> method queries on Pet, either Dog or Cat instances can be returned.
-</p><p>
-<h4>Table mapping</h4>
-
-The table mapping for this example looks like this:
-</p><p>
-<pre>
-create table PET (
-  ID integer primary key,
-  ANIMAL_TYPE varchar,
-  NAME varchar,
-  WEIGHT double
-);
-
-create table CAT (
-  ID integer primary key,
-  LIVES int
-);
-
-create table DOG (
-  ID integer primary key,
-  NUMBONES int
-);
-</pre>
-</p><p>
-To load subclasses the persistence manager must before a SQL join.  This is less efficient than the single table strategy as the SQL query is more complicated.
-</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] 2004-10-07 00:16:20,395 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
-rt: org/apache/axis/AxisFault
-     [java] Sox
-     [java] Junior
-</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>
-
-EJB 3.0 beans must be packaged in a JAR file with the suffix <tt>.jar</tt>.  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/joininheritance/join.html (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/joininheritance/join.html)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/joininheritance/join.html	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/join.html	2008-12-26 09:57:17 UTC (rev 82551)
@@ -0,0 +1,102 @@
+<html>
+<body>
+<p>
+<h2>Inheritance: Join Strategy</h2>
+
+The EJB specification allows you to define entities that inherit from one another.  The inheritance relationships can be reflected in
+queries as well.  So, if you queried based on the base class, the query is polymorphic.
+</p><p>
+The tutorial example uses the join table strategy to map an inheritance relationship of <a href="src/org/jboss/tutorial/joininheritance/bean/Pet.java">Pet</a>, which is the base class for <a href="src/org/jboss/tutorial/joininheritance/bean/Cat.java">Cat</a> and <a href="src/org/jboss/tutorial/joininheritance/bean/Dog.java">Dog</a>.
+</p><p>
+With the join table strategy there is a table per class in the hierarchy, but the subclass tables only have the extra attribute they define in their subclass.
+A discriminator column is <i>NOT</i> required to differentiate between which class type is persisted in a particular row unlike the
+single table mapping.  The persistence manager does not need a discrimiator column to figure out the type.
+</p><p>
+This is what the annotations look like for Pet.
+</p><p>
+<pre>
+ at Entity
+ at Inheritance(strategy = InheritanceType.JOINED)
+public class Pet implements java.io.Serializable
+{
+</pre>
+</p><p>
+<pre>
+ at Entity
+ at Inheritance(strategy = InheritanceType.JOINED)
+public class Dog extends Pet
+{
+</pre>
+</p><p>
+<h4>Polymorphic Queries</h4>
+
+<a href="src/org/jboss/tutorial/joininheritance/bean/PetDAOBean.java">PetDAOBean</a> stateless EJB wraps some polymorphic queries.
+</p><p>
+<pre>
+   public List findByWeight(double weight)
+   {
+      return manager.createQuery("from Pet p where p.weight &lt; :weight").setParameter("weight", weight).getResultList();
+   }
+</pre>
+</p><p>
+Even though the <tt>findByWeight</tt> method queries on Pet, either Dog or Cat instances can be returned.
+</p><p>
+<h4>Table mapping</h4>
+
+The table mapping for this example looks like this:
+</p><p>
+<pre>
+create table PET (
+  ID integer primary key,
+  ANIMAL_TYPE varchar,
+  NAME varchar,
+  WEIGHT double
+);
+
+create table CAT (
+  ID integer primary key,
+  LIVES int
+);
+
+create table DOG (
+  ID integer primary key,
+  NUMBONES int
+);
+</pre>
+</p><p>
+To load subclasses the persistence manager must before a SQL join.  This is less efficient than the single table strategy as the SQL query is more complicated.
+</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] 2004-10-07 00:16:20,395 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
+rt: org/apache/axis/AxisFault
+     [java] Sox
+     [java] Junior
+</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>
+
+EJB 3.0 beans must be packaged in a JAR file with the suffix <tt>.jar</tt>.  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/joininheritance/join.wiki
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/joininheritance/join.wiki	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/join.wiki	2008-12-26 09:57:17 UTC (rev 82551)
@@ -1,90 +0,0 @@
-!!!Inheritance: Join Strategy
-The EJB specification allows you to define entities that inherit from one another.  The inheritance relationships can be reflected in
-queries as well.  So, if you queried based on the base class, the query is polymorphic.
-
-The tutorial example uses the join table strategy to map an inheritance relationship of [Pet|src/org/jboss/tutorial/joininheritance/bean/Pet.java], which is the base class for [Cat|src/org/jboss/tutorial/joininheritance/bean/Cat.java] and [Dog|src/org/jboss/tutorial/joininheritance/bean/Dog.java].
-
-With the join table strategy there is a table per class in the hierarchy, but the subclass tables only have the extra attribute they define in their subclass.
-A discriminator column is ''NOT'' required to differentiate between which class type is persisted in a particular row unlike the
-single table mapping.  The persistence manager does not need a discrimiator column to figure out the type.
-
-This is what the annotations look like for Pet.
-
-{{{
- at Entity
- at Inheritance(strategy = InheritanceType.JOINED)
-public class Pet implements java.io.Serializable
-{
-}}}
-
-{{{
- at Entity
- at Inheritance(strategy = InheritanceType.JOINED)
-public class Dog extends Pet
-{
-}}}
-
-!Polymorphic Queries
-[PetDAOBean|src/org/jboss/tutorial/joininheritance/bean/PetDAOBean.java] stateless EJB wraps some polymorphic queries.
-
-{{{
-   public List findByWeight(double weight)
-   {
-      return manager.createQuery("from Pet p where p.weight < :weight").setParameter("weight", weight).getResultList();
-   }
-}}}
-
-Even though the {{findByWeight}} method queries on Pet, either Dog or Cat instances can be returned.
-
-!Table mapping
-The table mapping for this example looks like this:
-
-{{{
-create table PET (
-  ID integer primary key,
-  ANIMAL_TYPE varchar,
-  NAME varchar,
-  WEIGHT double
-);
-
-create table CAT (
-  ID integer primary key,
-  LIVES int
-);
-
-create table DOG (
-  ID integer primary key,
-  NUMBONES int
-);
-}}}
-
-To load subclasses the persistence manager must before a SQL join.  This is less efficient than the single table strategy as the SQL query is more complicated.
-
-!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] 2004-10-07 00:16:20,395 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
-rt: org/apache/axis/AxisFault
-     [java] Sox
-     [java] Junior
-}}}
-
-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
-EJB 3.0 beans must be packaged in a JAR file with the suffix {{.jar}}.  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/joininheritance/join.wiki (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/joininheritance/join.wiki)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/joininheritance/join.wiki	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/join.wiki	2008-12-26 09:57:17 UTC (rev 82551)
@@ -0,0 +1,90 @@
+!!!Inheritance: Join Strategy
+The EJB specification allows you to define entities that inherit from one another.  The inheritance relationships can be reflected in
+queries as well.  So, if you queried based on the base class, the query is polymorphic.
+
+The tutorial example uses the join table strategy to map an inheritance relationship of [Pet|src/org/jboss/tutorial/joininheritance/bean/Pet.java], which is the base class for [Cat|src/org/jboss/tutorial/joininheritance/bean/Cat.java] and [Dog|src/org/jboss/tutorial/joininheritance/bean/Dog.java].
+
+With the join table strategy there is a table per class in the hierarchy, but the subclass tables only have the extra attribute they define in their subclass.
+A discriminator column is ''NOT'' required to differentiate between which class type is persisted in a particular row unlike the
+single table mapping.  The persistence manager does not need a discrimiator column to figure out the type.
+
+This is what the annotations look like for Pet.
+
+{{{
+ at Entity
+ at Inheritance(strategy = InheritanceType.JOINED)
+public class Pet implements java.io.Serializable
+{
+}}}
+
+{{{
+ at Entity
+ at Inheritance(strategy = InheritanceType.JOINED)
+public class Dog extends Pet
+{
+}}}
+
+!Polymorphic Queries
+[PetDAOBean|src/org/jboss/tutorial/joininheritance/bean/PetDAOBean.java] stateless EJB wraps some polymorphic queries.
+
+{{{
+   public List findByWeight(double weight)
+   {
+      return manager.createQuery("from Pet p where p.weight < :weight").setParameter("weight", weight).getResultList();
+   }
+}}}
+
+Even though the {{findByWeight}} method queries on Pet, either Dog or Cat instances can be returned.
+
+!Table mapping
+The table mapping for this example looks like this:
+
+{{{
+create table PET (
+  ID integer primary key,
+  ANIMAL_TYPE varchar,
+  NAME varchar,
+  WEIGHT double
+);
+
+create table CAT (
+  ID integer primary key,
+  LIVES int
+);
+
+create table DOG (
+  ID integer primary key,
+  NUMBONES int
+);
+}}}
+
+To load subclasses the persistence manager must before a SQL join.  This is less efficient than the single table strategy as the SQL query is more complicated.
+
+!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] 2004-10-07 00:16:20,395 INFO org.jboss.remoting.InvokerRegistry[main] - Failed to load soap remoting transpo
+rt: org/apache/axis/AxisFault
+     [java] Sox
+     [java] Junior
+}}}
+
+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
+EJB 3.0 beans must be packaged in a JAR file with the suffix {{.jar}}.  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/joininheritance/log4j.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/joininheritance/log4j.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/log4j.xml	2008-12-26 09:57:17 UTC (rev 82551)
@@ -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/joininheritance/log4j.xml (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/joininheritance/log4j.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/joininheritance/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/log4j.xml	2008-12-26 09:57:17 UTC (rev 82551)
@@ -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/joininheritance/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/joininheritance/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/joininheritance/pom.xml	2008-12-26 09:57:17 UTC (rev 82551)
@@ -0,0 +1,36 @@
+<?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.joininheritance.client.Client</ejb3.tutorial.client>
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-joininheritance</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>EJB3.0 Inheritance of Entities</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial about how entities can be inherited in EJB3
+  </description>
+  
+
+
+</project>


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

Copied: projects/ejb3/trunk/docs/tutorial/joininheritance/src (from rev 82546, projects/oldstuff/ejb3/docs/tutorial/joininheritance/src)




More information about the jboss-cvs-commits mailing list