[jboss-cvs] JBossAS SVN: r82495 - in projects/ejb3/trunk/docs/tutorial: callbacks and 2 other directories.

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


Author: jaikiran
Date: 2008-12-23 02:42:23 -0500 (Tue, 23 Dec 2008)
New Revision: 82495

Added:
   projects/ejb3/trunk/docs/tutorial/callbacks/
   projects/ejb3/trunk/docs/tutorial/callbacks/META-INF/
   projects/ejb3/trunk/docs/tutorial/callbacks/build.xml
   projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.html
   projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.wiki
   projects/ejb3/trunk/docs/tutorial/callbacks/jndi.properties
   projects/ejb3/trunk/docs/tutorial/callbacks/log4j.xml
   projects/ejb3/trunk/docs/tutorial/callbacks/pom.xml
   projects/ejb3/trunk/docs/tutorial/callbacks/src/
Removed:
   projects/ejb3/trunk/docs/tutorial/callbacks/META-INF/
   projects/ejb3/trunk/docs/tutorial/callbacks/build.xml
   projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.html
   projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.wiki
   projects/ejb3/trunk/docs/tutorial/callbacks/jndi.properties
   projects/ejb3/trunk/docs/tutorial/callbacks/log4j.xml
   projects/ejb3/trunk/docs/tutorial/callbacks/src/
Modified:
   projects/ejb3/trunk/docs/tutorial/callbacks/META-INF/persistence.xml
   projects/ejb3/trunk/docs/tutorial/callbacks/src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java
Log:
Initial working version of the Callbacks tutorial, on JBoss-5 GA

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

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

Modified: projects/ejb3/trunk/docs/tutorial/callbacks/META-INF/persistence.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/callbacks/META-INF/persistence.xml	2008-12-23 07:30:02 UTC (rev 82494)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/META-INF/persistence.xml	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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/callbacks/build.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/callbacks/build.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/build.xml	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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 and log4j.xml  -->
-      <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.callback.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/callbacks/build.xml (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/callbacks/build.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/callbacks/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/build.xml	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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-callbacks.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.callback.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/callbacks/callbacks.html
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/callbacks/callbacks.html	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.html	2008-12-23 07:42:23 UTC (rev 82495)
@@ -1,191 +0,0 @@
-<html>
-<body>
-<p>
-<h2>Callbacks and Callback Handlers</h2>
-
-</p><p>
-The EJB 3.0 specification defines some callbacks, and allows you to handle these by implementing your own callback handlers.
-The callbacks defined for each bean are shown below:
-</p><p>
-<h3>Stateless session bean callbacks</h3>
-
-<ul>
-<li> <tt>PostConstruct</tt> - is invoked when the bean is first created, after any dependency injection is done.</li>
-<li> <tt>PreDestroy</tt> - is invoked when the bean is removed from the pool or destroyed.</li>
-</ul>
-</p><p>
-<h3>Message-driven bean callbacks</h3>
-
-<ul>
-<li> <tt>PostConstruct</tt> - is invoked when the bean is first created, after any dependency injection is done.</li>
-<li> <tt>PreDestroy</tt> - is invoked when the bean is removed from the pool or destroyed.</li>
-</ul>
-</p><p>
-<h3>Stateful session bean callbacks</h3>
-
-<ul>
-<li> <tt>PostConstruct</tt> - is invoked when the bean is first created, after any dependency injection is done.</li>
-<li> <tt>PreDestroy</tt> - is invoked when the bean is removed from the pool or destroyed. It will happen before any <tt>@Remove</tt> annotated method is invoked.</li>
-<li> <tt>PostActivate</tt> - is invoked when</li>
-<li> <tt>PrePassivate</tt> -</li>
-</ul>
-</p><p>
-<h3>Entity bean callbacks</h3>
-
-<ul>
-<li> <tt>PrePersist</tt> - Is invoked right before the entity is created in the database. Will cascade to all entities to which this operation is cascaded.</li>
-<li> <tt>PostPersist</tt> - Is invoked right after the entity is created in the database. Will cascade to all entities to which this operation is cascaded.</li>
-<li> <tt>PreRemove</tt> - Is invoked right before the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.</li>
-<li> <tt>PostRemove</tt> - Is invoked right after the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.</li>
-<li> <tt>PreUpdate</tt> - Takes place right before the database is updated.</li>
-<li> <tt>PostUpdate</tt> - Takes place immediately after the database has been updated.</li>
-<li> <tt>PostLoad</tt> - Takes place right after data has been loaded from the database and associated with the entity</li>
-</ul>
-</p><p>
-The callbacks are not compulsory, and you can define the ones you want to handle.
-</p><p>
-<h3>Using callbacks on the bean class</h3>
-
-You use the callbacks listed above by either annotating methods in the bean class. The annotations live in the <tt>javax.ejb</tt> package so for example <tt>PostConstruct</tt> would be <tt>javax.ejb.PostConstruct</tt>. You can call the methods what you like, but their method signature must return a void and take no arguments. Look at the <a href="src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java">CustomerDAOBean</a> stateless session bean and you will see that the <tt>preDestroyCallback()</tt> method has been annotated with <tt>@javax.ejb.PreDestroy</tt>. For session/message-driven beans, just like for <a href="../interceptor/interceptor.html">Interceptors</a>, if the bean class extends another class any callback annotated methods  on the super class will be invoked first.
-</p><p>
-</p><p>
-<h3>Entity listeners for entity beans</h3>
-
-You can also separate out the callbacks for entity beans into a separate EntityListener class. Take a look at the <a href="src/org/jboss/tutorial/callback/bean/Customer.java">Customer</a> entity bean, and you will see that the class has been annotated with
-<pre>@javax.persistence.EntityListener("org.jboss.tutorial.callback.bean.CustomerCallbackListener")</pre> This specifies that the <tt>org.jboss.tutorial.callback.bean.CustomerCallbackListener</tt> class should be used as the callback listener class for the bean. Now open <a href="src/org/jboss/tutorial/callback/bean/CustomerCallbackListener.java">CustomerCallbackListener</a> and you will see that the class annotates the callback methods in the same way as when defining callbacks on the bean class itself. However, one <b>important difference</b> is that callback methods defined in a listener class must take a single argument, which will be the bean we are working with. The parameter must be of type <tt>java.lang.Object</tt>, or the actual bean type.
-</p><p>
-<h3>Interceptors for session/message-driven beans</h3>
-
-Callbacks for session beans can also be put into a separate class, configured as an interceptor <a href="../interceptor/interceptor.html">Interceptors</a>. This means that your interceptors can initialise themselves when constructed. The lifecycle methods in an interceptor must have the following signature:
-</p><p>
-<pre>
-   Object &lt;any method name&gt;(InvocationContext)
-</pre>
-</p><p>
-<a href="src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java">CustomerDAOBean</a> specifies that it wants to use an external interceptor.
-<pre>
- at Stateless
- at Remote(CustomerDAO.class)
- at Interceptors({LifecycleInterceptor.class})
-public class CustomerDAOBean implements CustomerDAO
-{
-   ...
-}
-</pre>
-</p><p>
-and <a href="src/org/jboss/tutorial/callback/bean/LifecycleInterceptor.java">LifecycleInterceptor</a> has a <tt>@PostConstruct</tt> annotated method. As shown, each interceptor lifecycle method must call <tt>proceed</tt> on the InvocationContext to invoke the next interceptor. 
-</p><p>
-Interceptors may contain both the <tt>@AroundInvoke</tt> methods for intercepting business methods, and lifecycle methods. If you want to configure lifecycle methods for your interceptors with xml, you will need to do this in the <tt>interceptor</tt> section of ejb-jar.xml, and the keywords are <tt>post-construct-method</tt>, <tt>post-activate-method</tt>, <tt>pre-passivate-method</tt> and <tt>pre-destry-method</tt>. For example
-</p><p>
-<pre>
-&lt;ejb-jar&gt;
-   &lt;interceptors&gt;
-      &lt;interceptor&gt;
-         &lt;interceptor-class&gt;org.acme.SomeInterceptor&lt;/interceptor-class&gt;
-         &lt;around-invoke-method&gt;
-            &lt;method-name&gt;interceptorMethod&lt;/method-name&gt;
-         &lt;/around-invoke-method&gt;
-         &lt;post-construct-method&gt;
-            &lt;method-name&gt;sendCancelMessage&lt;/method-name&gt;
-         &lt;/post-construct-method&gt;
-         &lt;pre-destroy-method&gt;
-            &lt;method-name&gt;sendCancelMessage&lt;/method-name&gt;
-         &lt;/pre-destroy-method&gt;
-      &lt;/interceptor&gt;   
-   &lt;/interceptors&gt;
-&lt;/ejb-jar&gt;
-</pre>
-</p><p>
-Interceptor methods for handling lifecycle events follow exactly the same ordering and inheritance rules as business method interceptor methods, and an interceptor instance follows the lifecycle of the bean instance it is bound to.
-</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] Create Bill Burke and Monica Smith
-     [java] log4j:WARN No appenders could be found for logger (org.jboss.remoting.Client).
-     [java] log4j:WARN Please initialize the log4j system properly.
-     [java] Bill and Monica get married
-     [java] Get all the Burkes
-     [java] There are now 2 Burkes
-     [java] Bill and Monica are moving abroad
-</pre>
-</p><p>
-In the jboss console window you should see:
-<pre>
-20:06:05,596 INFO  [STDOUT] LifecycleInterceptor postConstruct
-20:06:05,596 INFO  [STDOUT] PostConstruct - Have EntityManager: true
-20:06:05,596 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:06:05,596 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
-20:06:05,596 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
-20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:06:05,617 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
-20:06:05,617 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
-20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.find()
-20:06:05,627 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:06:05,627 INFO  [STDOUT] -- CustomerDAOBean.merge()
-20:06:05,637 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:06:05,637 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
-20:06:05,657 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
-20:06:05,667 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
-20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
-20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
-20:06:05,687 INFO  [STDOUT] -- CustomerDAOBean.delete()
-20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
-20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
-20:06:05,687 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
-20:06:05,697 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
-</pre>
-</p><p>
-Now if you open up JBOSS_HOME/server/all/deploy/ejb3.deployer/META-INF/hibernate.properties and add the following line
-</p><p>
-<pre>
-hibernate.show_sql=true
-</pre>
-</p><p>
-and restart JBoss before running the example again, the output should be:
-<pre>
-20:22:10,013 INFO  [STDOUT] PostConstruct - Have EntityManager: true
-20:22:10,033 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:22:10,103 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
-20:22:10,123 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
-20:22:10,133 INFO  [STDOUT] Hibernate: call identity()
-20:22:10,143 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
-20:22:10,194 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:22:10,194 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
-20:22:10,194 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
-20:22:10,194 INFO  [STDOUT] Hibernate: call identity()
-20:22:10,194 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
-20:22:10,264 INFO  [STDOUT] -- CustomerDAOBean.find()
-20:22:10,274 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
-20:22:10,284 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:22:10,294 INFO  [STDOUT] -- CustomerDAOBean.merge()
-20:22:10,304 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
-20:22:10,304 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:22:10,304 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
-20:22:10,314 INFO  [STDOUT] Hibernate: update CUSTOMER set STATE=?, FIRST=?, LAST=?, STREET=?, CITY=?, ZIP=? where id=?
-20:22:10,314 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
-20:22:10,324 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
-20:22:10,604 INFO  [STDOUT] Hibernate: select customer0_.id as id, customer0_.STATE as STATE0_, customer0_.FIRST as FIRST0_, customer0_.LAST as LAST0_
-, customer0_.STREET as STREET0_, customer0_.CITY as CITY0_, customer0_.ZIP as ZIP0_ from CUSTOMER customer0_ where (customer0_.LAST=? )
-20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
-20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
-20:22:10,624 INFO  [STDOUT] -- CustomerDAOBean.delete()
-20:22:10,634 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
-20:22:10,644 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
-20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
-20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
-20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
-20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
-</pre>
-</p><p>
-Thus you can see how the callbacks on the entity bean wrap the interaction with the database.
-</p>
-</body>
-</html>

Copied: projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.html (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/callbacks/callbacks.html)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.html	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.html	2008-12-23 07:42:23 UTC (rev 82495)
@@ -0,0 +1,191 @@
+<html>
+<body>
+<p>
+<h2>Callbacks and Callback Handlers</h2>
+
+</p><p>
+The EJB 3.0 specification defines some callbacks, and allows you to handle these by implementing your own callback handlers.
+The callbacks defined for each bean are shown below:
+</p><p>
+<h3>Stateless session bean callbacks</h3>
+
+<ul>
+<li> <tt>PostConstruct</tt> - is invoked when the bean is first created, after any dependency injection is done.</li>
+<li> <tt>PreDestroy</tt> - is invoked when the bean is removed from the pool or destroyed.</li>
+</ul>
+</p><p>
+<h3>Message-driven bean callbacks</h3>
+
+<ul>
+<li> <tt>PostConstruct</tt> - is invoked when the bean is first created, after any dependency injection is done.</li>
+<li> <tt>PreDestroy</tt> - is invoked when the bean is removed from the pool or destroyed.</li>
+</ul>
+</p><p>
+<h3>Stateful session bean callbacks</h3>
+
+<ul>
+<li> <tt>PostConstruct</tt> - is invoked when the bean is first created, after any dependency injection is done.</li>
+<li> <tt>PreDestroy</tt> - is invoked when the bean is removed from the pool or destroyed. It will happen before any <tt>@Remove</tt> annotated method is invoked.</li>
+<li> <tt>PostActivate</tt> - is invoked when</li>
+<li> <tt>PrePassivate</tt> -</li>
+</ul>
+</p><p>
+<h3>Entity bean callbacks</h3>
+
+<ul>
+<li> <tt>PrePersist</tt> - Is invoked right before the entity is created in the database. Will cascade to all entities to which this operation is cascaded.</li>
+<li> <tt>PostPersist</tt> - Is invoked right after the entity is created in the database. Will cascade to all entities to which this operation is cascaded.</li>
+<li> <tt>PreRemove</tt> - Is invoked right before the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.</li>
+<li> <tt>PostRemove</tt> - Is invoked right after the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.</li>
+<li> <tt>PreUpdate</tt> - Takes place right before the database is updated.</li>
+<li> <tt>PostUpdate</tt> - Takes place immediately after the database has been updated.</li>
+<li> <tt>PostLoad</tt> - Takes place right after data has been loaded from the database and associated with the entity</li>
+</ul>
+</p><p>
+The callbacks are not compulsory, and you can define the ones you want to handle.
+</p><p>
+<h3>Using callbacks on the bean class</h3>
+
+You use the callbacks listed above by either annotating methods in the bean class. The annotations live in the <tt>javax.ejb</tt> package so for example <tt>PostConstruct</tt> would be <tt>javax.ejb.PostConstruct</tt>. You can call the methods what you like, but their method signature must return a void and take no arguments. Look at the <a href="src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java">CustomerDAOBean</a> stateless session bean and you will see that the <tt>preDestroyCallback()</tt> method has been annotated with <tt>@javax.ejb.PreDestroy</tt>. For session/message-driven beans, just like for <a href="../interceptor/interceptor.html">Interceptors</a>, if the bean class extends another class any callback annotated methods  on the super class will be invoked first.
+</p><p>
+</p><p>
+<h3>Entity listeners for entity beans</h3>
+
+You can also separate out the callbacks for entity beans into a separate EntityListener class. Take a look at the <a href="src/org/jboss/tutorial/callback/bean/Customer.java">Customer</a> entity bean, and you will see that the class has been annotated with
+<pre>@javax.persistence.EntityListener("org.jboss.tutorial.callback.bean.CustomerCallbackListener")</pre> This specifies that the <tt>org.jboss.tutorial.callback.bean.CustomerCallbackListener</tt> class should be used as the callback listener class for the bean. Now open <a href="src/org/jboss/tutorial/callback/bean/CustomerCallbackListener.java">CustomerCallbackListener</a> and you will see that the class annotates the callback methods in the same way as when defining callbacks on the bean class itself. However, one <b>important difference</b> is that callback methods defined in a listener class must take a single argument, which will be the bean we are working with. The parameter must be of type <tt>java.lang.Object</tt>, or the actual bean type.
+</p><p>
+<h3>Interceptors for session/message-driven beans</h3>
+
+Callbacks for session beans can also be put into a separate class, configured as an interceptor <a href="../interceptor/interceptor.html">Interceptors</a>. This means that your interceptors can initialise themselves when constructed. The lifecycle methods in an interceptor must have the following signature:
+</p><p>
+<pre>
+   Object &lt;any method name&gt;(InvocationContext)
+</pre>
+</p><p>
+<a href="src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java">CustomerDAOBean</a> specifies that it wants to use an external interceptor.
+<pre>
+ at Stateless
+ at Remote(CustomerDAO.class)
+ at Interceptors({LifecycleInterceptor.class})
+public class CustomerDAOBean implements CustomerDAO
+{
+   ...
+}
+</pre>
+</p><p>
+and <a href="src/org/jboss/tutorial/callback/bean/LifecycleInterceptor.java">LifecycleInterceptor</a> has a <tt>@PostConstruct</tt> annotated method. As shown, each interceptor lifecycle method must call <tt>proceed</tt> on the InvocationContext to invoke the next interceptor. 
+</p><p>
+Interceptors may contain both the <tt>@AroundInvoke</tt> methods for intercepting business methods, and lifecycle methods. If you want to configure lifecycle methods for your interceptors with xml, you will need to do this in the <tt>interceptor</tt> section of ejb-jar.xml, and the keywords are <tt>post-construct-method</tt>, <tt>post-activate-method</tt>, <tt>pre-passivate-method</tt> and <tt>pre-destry-method</tt>. For example
+</p><p>
+<pre>
+&lt;ejb-jar&gt;
+   &lt;interceptors&gt;
+      &lt;interceptor&gt;
+         &lt;interceptor-class&gt;org.acme.SomeInterceptor&lt;/interceptor-class&gt;
+         &lt;around-invoke-method&gt;
+            &lt;method-name&gt;interceptorMethod&lt;/method-name&gt;
+         &lt;/around-invoke-method&gt;
+         &lt;post-construct-method&gt;
+            &lt;method-name&gt;sendCancelMessage&lt;/method-name&gt;
+         &lt;/post-construct-method&gt;
+         &lt;pre-destroy-method&gt;
+            &lt;method-name&gt;sendCancelMessage&lt;/method-name&gt;
+         &lt;/pre-destroy-method&gt;
+      &lt;/interceptor&gt;   
+   &lt;/interceptors&gt;
+&lt;/ejb-jar&gt;
+</pre>
+</p><p>
+Interceptor methods for handling lifecycle events follow exactly the same ordering and inheritance rules as business method interceptor methods, and an interceptor instance follows the lifecycle of the bean instance it is bound to.
+</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] Create Bill Burke and Monica Smith
+     [java] log4j:WARN No appenders could be found for logger (org.jboss.remoting.Client).
+     [java] log4j:WARN Please initialize the log4j system properly.
+     [java] Bill and Monica get married
+     [java] Get all the Burkes
+     [java] There are now 2 Burkes
+     [java] Bill and Monica are moving abroad
+</pre>
+</p><p>
+In the jboss console window you should see:
+<pre>
+20:06:05,596 INFO  [STDOUT] LifecycleInterceptor postConstruct
+20:06:05,596 INFO  [STDOUT] PostConstruct - Have EntityManager: true
+20:06:05,596 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:06:05,596 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
+20:06:05,596 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
+20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:06:05,617 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
+20:06:05,617 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
+20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.find()
+20:06:05,627 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:06:05,627 INFO  [STDOUT] -- CustomerDAOBean.merge()
+20:06:05,637 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:06:05,637 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
+20:06:05,657 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
+20:06:05,667 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
+20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
+20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
+20:06:05,687 INFO  [STDOUT] -- CustomerDAOBean.delete()
+20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
+20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
+20:06:05,687 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
+20:06:05,697 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
+</pre>
+</p><p>
+Now if you open up JBOSS_HOME/server/all/deploy/ejb3.deployer/META-INF/hibernate.properties and add the following line
+</p><p>
+<pre>
+hibernate.show_sql=true
+</pre>
+</p><p>
+and restart JBoss before running the example again, the output should be:
+<pre>
+20:22:10,013 INFO  [STDOUT] PostConstruct - Have EntityManager: true
+20:22:10,033 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:22:10,103 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
+20:22:10,123 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
+20:22:10,133 INFO  [STDOUT] Hibernate: call identity()
+20:22:10,143 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
+20:22:10,194 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:22:10,194 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
+20:22:10,194 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
+20:22:10,194 INFO  [STDOUT] Hibernate: call identity()
+20:22:10,194 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
+20:22:10,264 INFO  [STDOUT] -- CustomerDAOBean.find()
+20:22:10,274 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
+20:22:10,284 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:22:10,294 INFO  [STDOUT] -- CustomerDAOBean.merge()
+20:22:10,304 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
+20:22:10,304 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:22:10,304 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
+20:22:10,314 INFO  [STDOUT] Hibernate: update CUSTOMER set STATE=?, FIRST=?, LAST=?, STREET=?, CITY=?, ZIP=? where id=?
+20:22:10,314 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
+20:22:10,324 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
+20:22:10,604 INFO  [STDOUT] Hibernate: select customer0_.id as id, customer0_.STATE as STATE0_, customer0_.FIRST as FIRST0_, customer0_.LAST as LAST0_
+, customer0_.STREET as STREET0_, customer0_.CITY as CITY0_, customer0_.ZIP as ZIP0_ from CUSTOMER customer0_ where (customer0_.LAST=? )
+20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
+20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
+20:22:10,624 INFO  [STDOUT] -- CustomerDAOBean.delete()
+20:22:10,634 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
+20:22:10,644 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
+20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
+20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
+20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
+20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
+</pre>
+</p><p>
+Thus you can see how the callbacks on the entity bean wrap the interaction with the database.
+</p>
+</body>
+</html>

Deleted: projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.wiki
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/callbacks/callbacks.wiki	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.wiki	2008-12-23 07:42:23 UTC (rev 82495)
@@ -1,168 +0,0 @@
-!!!Callbacks and Callback Handlers
-
-The EJB 3.0 specification defines some callbacks, and allows you to handle these by implementing your own callback handlers.
-The callbacks defined for each bean are shown below:
-
-!!Stateless session bean callbacks
-* {{PostConstruct}} - is invoked when the bean is first created, after any dependency injection is done.
-* {{PreDestroy}} - is invoked when the bean is removed from the pool or destroyed.
-
-!!Message-driven bean callbacks
-* {{PostConstruct}} - is invoked when the bean is first created, after any dependency injection is done.
-* {{PreDestroy}} - is invoked when the bean is removed from the pool or destroyed.
-
-!!Stateful session bean callbacks
-* {{PostConstruct}} - is invoked when the bean is first created, after any dependency injection is done.
-* {{PreDestroy}} - is invoked when the bean is removed from the pool or destroyed. It will happen before any {{@Remove}} annotated method is invoked.
-* {{PostActivate}} - is invoked when
-* {{PrePassivate}} -
-
-!!Entity bean callbacks
-* {{PrePersist}} - Is invoked right before the entity is created in the database. Will cascade to all entities to which this operation is cascaded.
-* {{PostPersist}} - Is invoked right after the entity is created in the database. Will cascade to all entities to which this operation is cascaded.
-* {{PreRemove}} - Is invoked right before the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.
-* {{PostRemove}} - Is invoked right after the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.
-* {{PreUpdate}} - Takes place right before the database is updated.
-* {{PostUpdate}} - Takes place immediately after the database has been updated.
-* {{PostLoad}} - Takes place right after data has been loaded from the database and associated with the entity
-
-The callbacks are not compulsory, and you can define the ones you want to handle.
-
-!!Using callbacks on the bean class
-You use the callbacks listed above by either annotating methods in the bean class. The annotations live in the {{javax.ejb}} package so for example {{PostConstruct}} would be {{javax.ejb.PostConstruct}}. You can call the methods what you like, but their method signature must return a void and take no arguments. Look at the [CustomerDAOBean|src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java] stateless session bean and you will see that the {{preDestroyCallback()}} method has been annotated with {{@javax.ejb.PreDestroy}}. For session/message-driven beans, just like for [Interceptors|../interceptor/interceptor.html], if the bean class extends another class any callback annotated methods  on the super class will be invoked first.
-
-
-!!Entity listeners for entity beans
-You can also separate out the callbacks for entity beans into a separate EntityListener class. Take a look at the [Customer|src/org/jboss/tutorial/callback/bean/Customer.java] entity bean, and you will see that the class has been annotated with
-{{{@javax.persistence.EntityListener("org.jboss.tutorial.callback.bean.CustomerCallbackListener")}}} This specifies that the {{org.jboss.tutorial.callback.bean.CustomerCallbackListener}} class should be used as the callback listener class for the bean. Now open [CustomerCallbackListener|src/org/jboss/tutorial/callback/bean/CustomerCallbackListener.java] and you will see that the class annotates the callback methods in the same way as when defining callbacks on the bean class itself. However, one __important difference__ is that callback methods defined in a listener class must take a single argument, which will be the bean we are working with. The parameter must be of type {{java.lang.Object}}, or the actual bean type.
-
-!!Interceptors for session/message-driven beans
-Callbacks for session beans can also be put into a separate class, configured as an interceptor [Interceptors|../interceptor/interceptor.html]. This means that your interceptors can initialise themselves when constructed. The lifecycle methods in an interceptor must have the following signature:
-
-{{{
-   Object <any method name>(InvocationContext)
-}}}
-
-[CustomerDAOBean|src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java] specifies that it wants to use an external interceptor.
-{{{
- at Stateless
- at Remote(CustomerDAO.class)
- at Interceptors({LifecycleInterceptor.class})
-public class CustomerDAOBean implements CustomerDAO
-{
-   ...
-}
-}}}
-
-and [LifecycleInterceptor|src/org/jboss/tutorial/callback/bean/LifecycleInterceptor.java] has a {{@PostConstruct}} annotated method. As shown, each interceptor lifecycle method must call {{proceed}} on the InvocationContext to invoke the next interceptor. 
-
-Interceptors may contain both the {{@AroundInvoke}} methods for intercepting business methods, and lifecycle methods. If you want to configure lifecycle methods for your interceptors with xml, you will need to do this in the {{interceptor}} section of ejb-jar.xml, and the keywords are {{post-construct-method}}, {{post-activate-method}}, {{pre-passivate-method}} and {{pre-destry-method}}. For example
-
-{{{
-<ejb-jar>
-   <interceptors>
-      <interceptor>
-         <interceptor-class>org.acme.SomeInterceptor</interceptor-class>
-         <around-invoke-method>
-            <method-name>interceptorMethod</method-name>
-         </around-invoke-method>
-         <post-construct-method>
-            <method-name>sendCancelMessage</method-name>
-         </post-construct-method>
-         <pre-destroy-method>
-            <method-name>sendCancelMessage</method-name>
-         </pre-destroy-method>
-      </interceptor>   
-   </interceptors>
-</ejb-jar>
-}}}
-
-Interceptor methods for handling lifecycle events follow exactly the same ordering and inheritance rules as business method interceptor methods, and an interceptor instance follows the lifecycle of the bean instance it is bound to.
-
-!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] Create Bill Burke and Monica Smith
-     [java] log4j:WARN No appenders could be found for logger (org.jboss.remoting.Client).
-     [java] log4j:WARN Please initialize the log4j system properly.
-     [java] Bill and Monica get married
-     [java] Get all the Burkes
-     [java] There are now 2 Burkes
-     [java] Bill and Monica are moving abroad
-}}}
-
-In the jboss console window you should see:
-{{{
-20:06:05,596 INFO  [STDOUT] LifecycleInterceptor postConstruct
-20:06:05,596 INFO  [STDOUT] PostConstruct - Have EntityManager: true
-20:06:05,596 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:06:05,596 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
-20:06:05,596 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
-20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:06:05,617 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
-20:06:05,617 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
-20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.find()
-20:06:05,627 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:06:05,627 INFO  [STDOUT] -- CustomerDAOBean.merge()
-20:06:05,637 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:06:05,637 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
-20:06:05,657 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
-20:06:05,667 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
-20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
-20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
-20:06:05,687 INFO  [STDOUT] -- CustomerDAOBean.delete()
-20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
-20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
-20:06:05,687 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
-20:06:05,697 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
-}}}
-
-Now if you open up JBOSS_HOME/server/all/deploy/ejb3.deployer/META-INF/hibernate.properties and add the following line
-
-{{{
-hibernate.show_sql=true
-}}}
-
-and restart JBoss before running the example again, the output should be:
-{{{
-20:22:10,013 INFO  [STDOUT] PostConstruct - Have EntityManager: true
-20:22:10,033 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:22:10,103 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
-20:22:10,123 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
-20:22:10,133 INFO  [STDOUT] Hibernate: call identity()
-20:22:10,143 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
-20:22:10,194 INFO  [STDOUT] -- CustomerDAOBean.create()
-20:22:10,194 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
-20:22:10,194 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
-20:22:10,194 INFO  [STDOUT] Hibernate: call identity()
-20:22:10,194 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
-20:22:10,264 INFO  [STDOUT] -- CustomerDAOBean.find()
-20:22:10,274 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
-20:22:10,284 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:22:10,294 INFO  [STDOUT] -- CustomerDAOBean.merge()
-20:22:10,304 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
-20:22:10,304 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
-20:22:10,304 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
-20:22:10,314 INFO  [STDOUT] Hibernate: update CUSTOMER set STATE=?, FIRST=?, LAST=?, STREET=?, CITY=?, ZIP=? where id=?
-20:22:10,314 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
-20:22:10,324 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
-20:22:10,604 INFO  [STDOUT] Hibernate: select customer0_.id as id, customer0_.STATE as STATE0_, customer0_.FIRST as FIRST0_, customer0_.LAST as LAST0_
-, customer0_.STREET as STREET0_, customer0_.CITY as CITY0_, customer0_.ZIP as ZIP0_ from CUSTOMER customer0_ where (customer0_.LAST=? )
-20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
-20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
-20:22:10,624 INFO  [STDOUT] -- CustomerDAOBean.delete()
-20:22:10,634 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
-20:22:10,644 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
-20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
-20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
-20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
-20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
-}}}
-
-Thus you can see how the callbacks on the entity bean wrap the interaction with the database.

Copied: projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.wiki (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/callbacks/callbacks.wiki)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.wiki	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/callbacks.wiki	2008-12-23 07:42:23 UTC (rev 82495)
@@ -0,0 +1,168 @@
+!!!Callbacks and Callback Handlers
+
+The EJB 3.0 specification defines some callbacks, and allows you to handle these by implementing your own callback handlers.
+The callbacks defined for each bean are shown below:
+
+!!Stateless session bean callbacks
+* {{PostConstruct}} - is invoked when the bean is first created, after any dependency injection is done.
+* {{PreDestroy}} - is invoked when the bean is removed from the pool or destroyed.
+
+!!Message-driven bean callbacks
+* {{PostConstruct}} - is invoked when the bean is first created, after any dependency injection is done.
+* {{PreDestroy}} - is invoked when the bean is removed from the pool or destroyed.
+
+!!Stateful session bean callbacks
+* {{PostConstruct}} - is invoked when the bean is first created, after any dependency injection is done.
+* {{PreDestroy}} - is invoked when the bean is removed from the pool or destroyed. It will happen before any {{@Remove}} annotated method is invoked.
+* {{PostActivate}} - is invoked when
+* {{PrePassivate}} -
+
+!!Entity bean callbacks
+* {{PrePersist}} - Is invoked right before the entity is created in the database. Will cascade to all entities to which this operation is cascaded.
+* {{PostPersist}} - Is invoked right after the entity is created in the database. Will cascade to all entities to which this operation is cascaded.
+* {{PreRemove}} - Is invoked right before the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.
+* {{PostRemove}} - Is invoked right after the entity is deleted in the database. Will cascade to all entities to which this operation is cascaded.
+* {{PreUpdate}} - Takes place right before the database is updated.
+* {{PostUpdate}} - Takes place immediately after the database has been updated.
+* {{PostLoad}} - Takes place right after data has been loaded from the database and associated with the entity
+
+The callbacks are not compulsory, and you can define the ones you want to handle.
+
+!!Using callbacks on the bean class
+You use the callbacks listed above by either annotating methods in the bean class. The annotations live in the {{javax.ejb}} package so for example {{PostConstruct}} would be {{javax.ejb.PostConstruct}}. You can call the methods what you like, but their method signature must return a void and take no arguments. Look at the [CustomerDAOBean|src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java] stateless session bean and you will see that the {{preDestroyCallback()}} method has been annotated with {{@javax.ejb.PreDestroy}}. For session/message-driven beans, just like for [Interceptors|../interceptor/interceptor.html], if the bean class extends another class any callback annotated methods  on the super class will be invoked first.
+
+
+!!Entity listeners for entity beans
+You can also separate out the callbacks for entity beans into a separate EntityListener class. Take a look at the [Customer|src/org/jboss/tutorial/callback/bean/Customer.java] entity bean, and you will see that the class has been annotated with
+{{{@javax.persistence.EntityListener("org.jboss.tutorial.callback.bean.CustomerCallbackListener")}}} This specifies that the {{org.jboss.tutorial.callback.bean.CustomerCallbackListener}} class should be used as the callback listener class for the bean. Now open [CustomerCallbackListener|src/org/jboss/tutorial/callback/bean/CustomerCallbackListener.java] and you will see that the class annotates the callback methods in the same way as when defining callbacks on the bean class itself. However, one __important difference__ is that callback methods defined in a listener class must take a single argument, which will be the bean we are working with. The parameter must be of type {{java.lang.Object}}, or the actual bean type.
+
+!!Interceptors for session/message-driven beans
+Callbacks for session beans can also be put into a separate class, configured as an interceptor [Interceptors|../interceptor/interceptor.html]. This means that your interceptors can initialise themselves when constructed. The lifecycle methods in an interceptor must have the following signature:
+
+{{{
+   Object <any method name>(InvocationContext)
+}}}
+
+[CustomerDAOBean|src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java] specifies that it wants to use an external interceptor.
+{{{
+ at Stateless
+ at Remote(CustomerDAO.class)
+ at Interceptors({LifecycleInterceptor.class})
+public class CustomerDAOBean implements CustomerDAO
+{
+   ...
+}
+}}}
+
+and [LifecycleInterceptor|src/org/jboss/tutorial/callback/bean/LifecycleInterceptor.java] has a {{@PostConstruct}} annotated method. As shown, each interceptor lifecycle method must call {{proceed}} on the InvocationContext to invoke the next interceptor. 
+
+Interceptors may contain both the {{@AroundInvoke}} methods for intercepting business methods, and lifecycle methods. If you want to configure lifecycle methods for your interceptors with xml, you will need to do this in the {{interceptor}} section of ejb-jar.xml, and the keywords are {{post-construct-method}}, {{post-activate-method}}, {{pre-passivate-method}} and {{pre-destry-method}}. For example
+
+{{{
+<ejb-jar>
+   <interceptors>
+      <interceptor>
+         <interceptor-class>org.acme.SomeInterceptor</interceptor-class>
+         <around-invoke-method>
+            <method-name>interceptorMethod</method-name>
+         </around-invoke-method>
+         <post-construct-method>
+            <method-name>sendCancelMessage</method-name>
+         </post-construct-method>
+         <pre-destroy-method>
+            <method-name>sendCancelMessage</method-name>
+         </pre-destroy-method>
+      </interceptor>   
+   </interceptors>
+</ejb-jar>
+}}}
+
+Interceptor methods for handling lifecycle events follow exactly the same ordering and inheritance rules as business method interceptor methods, and an interceptor instance follows the lifecycle of the bean instance it is bound to.
+
+!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] Create Bill Burke and Monica Smith
+     [java] log4j:WARN No appenders could be found for logger (org.jboss.remoting.Client).
+     [java] log4j:WARN Please initialize the log4j system properly.
+     [java] Bill and Monica get married
+     [java] Get all the Burkes
+     [java] There are now 2 Burkes
+     [java] Bill and Monica are moving abroad
+}}}
+
+In the jboss console window you should see:
+{{{
+20:06:05,596 INFO  [STDOUT] LifecycleInterceptor postConstruct
+20:06:05,596 INFO  [STDOUT] PostConstruct - Have EntityManager: true
+20:06:05,596 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:06:05,596 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
+20:06:05,596 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
+20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:06:05,617 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
+20:06:05,617 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
+20:06:05,617 INFO  [STDOUT] -- CustomerDAOBean.find()
+20:06:05,627 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:06:05,627 INFO  [STDOUT] -- CustomerDAOBean.merge()
+20:06:05,637 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:06:05,637 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
+20:06:05,657 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
+20:06:05,667 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
+20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
+20:06:05,677 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
+20:06:05,687 INFO  [STDOUT] -- CustomerDAOBean.delete()
+20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
+20:06:05,687 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
+20:06:05,687 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
+20:06:05,697 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
+}}}
+
+Now if you open up JBOSS_HOME/server/all/deploy/ejb3.deployer/META-INF/hibernate.properties and add the following line
+
+{{{
+hibernate.show_sql=true
+}}}
+
+and restart JBoss before running the example again, the output should be:
+{{{
+20:22:10,013 INFO  [STDOUT] PostConstruct - Have EntityManager: true
+20:22:10,033 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:22:10,103 INFO  [STDOUT] doPrePersist: About to create Customer: Bill Burke
+20:22:10,123 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
+20:22:10,133 INFO  [STDOUT] Hibernate: call identity()
+20:22:10,143 INFO  [STDOUT] doPostPersist: Created Customer: Bill Burke
+20:22:10,194 INFO  [STDOUT] -- CustomerDAOBean.create()
+20:22:10,194 INFO  [STDOUT] doPrePersist: About to create Customer: Monica Smith
+20:22:10,194 INFO  [STDOUT] Hibernate: insert into CUSTOMER (STATE, FIRST, LAST, STREET, CITY, ZIP, id) values (?, ?, ?, ?, ?, ?, null)
+20:22:10,194 INFO  [STDOUT] Hibernate: call identity()
+20:22:10,194 INFO  [STDOUT] doPostPersist: Created Customer: Monica Smith
+20:22:10,264 INFO  [STDOUT] -- CustomerDAOBean.find()
+20:22:10,274 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
+20:22:10,284 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:22:10,294 INFO  [STDOUT] -- CustomerDAOBean.merge()
+20:22:10,304 INFO  [STDOUT] Hibernate: select customer0_.id as id0_, customer0_.STATE as STATE0_0_, customer0_.FIRST as FIRST0_0_, customer0_.LAST as LAST0_0_, customer0_.STREET as STREET0_0_, customer0_.CITY as CITY0_0_, customer0_.ZIP as ZIP0_0_ from CUSTOMER customer0_ where customer0_.id=?
+20:22:10,304 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Smith
+20:22:10,304 INFO  [STDOUT] doPreUpdate: About to update Customer: Monica Burke
+20:22:10,314 INFO  [STDOUT] Hibernate: update CUSTOMER set STATE=?, FIRST=?, LAST=?, STREET=?, CITY=?, ZIP=? where id=?
+20:22:10,314 INFO  [STDOUT] doPostUpdate: Updated Customer: Monica Burke
+20:22:10,324 INFO  [STDOUT] -- CustomerDAOBean.findByLastName(id)
+20:22:10,604 INFO  [STDOUT] Hibernate: select customer0_.id as id, customer0_.STATE as STATE0_, customer0_.FIRST as FIRST0_, customer0_.LAST as LAST0_
+, customer0_.STREET as STREET0_, customer0_.CITY as CITY0_, customer0_.ZIP as ZIP0_ from CUSTOMER customer0_ where (customer0_.LAST=? )
+20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Bill Burke
+20:22:10,604 INFO  [STDOUT] doPostLoad: Loaded Customer: Monica Burke
+20:22:10,624 INFO  [STDOUT] -- CustomerDAOBean.delete()
+20:22:10,634 INFO  [STDOUT] doPreRemove: About to delete Customer: Bill Burke
+20:22:10,644 INFO  [STDOUT] doPreRemove: About to delete Customer: Monica Burke
+20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
+20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Bill Burke
+20:22:10,644 INFO  [STDOUT] Hibernate: delete from CUSTOMER where id=?
+20:22:10,644 INFO  [STDOUT] doPostRemove: Deleted Customer: Monica Burke
+}}}
+
+Thus you can see how the callbacks on the entity bean wrap the interaction with the database.

Deleted: projects/ejb3/trunk/docs/tutorial/callbacks/jndi.properties
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/callbacks/jndi.properties	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/jndi.properties	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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/callbacks/jndi.properties (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/callbacks/jndi.properties)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/callbacks/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/jndi.properties	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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/callbacks/log4j.xml
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/callbacks/log4j.xml	2008-12-04 08:31:45 UTC (rev 82032)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/log4j.xml	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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/callbacks/log4j.xml (from rev 82494, projects/oldstuff/ejb3/docs/tutorial/callbacks/log4j.xml)
===================================================================
--- projects/ejb3/trunk/docs/tutorial/callbacks/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/log4j.xml	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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/callbacks/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/callbacks/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/pom.xml	2008-12-23 07:42:23 UTC (rev 82495)
@@ -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.callback.client.Client</ejb3.tutorial.client>
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-callbacks</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Callbacks and Callback handlers in EJB3</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial about Callbacks and Callback Handlers in EJB3
+  </description>
+  
+ 
+</project>


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

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

Modified: projects/ejb3/trunk/docs/tutorial/callbacks/src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java
===================================================================
--- projects/oldstuff/ejb3/docs/tutorial/callbacks/src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java	2008-12-23 07:30:02 UTC (rev 82494)
+++ projects/ejb3/trunk/docs/tutorial/callbacks/src/org/jboss/tutorial/callback/bean/CustomerDAOBean.java	2008-12-23 07:42:23 UTC (rev 82495)
@@ -72,7 +72,10 @@
       for (Iterator it = l.iterator() ; it.hasNext() ; )
       {
          Customer c = (Customer)it.next();
-         manager.remove(c);
+         // First we merge the Customer that might have been detached.
+         Customer mergedCustomer = manager.merge(c);
+         // Then we remove the customer
+         manager.remove(mergedCustomer);
       }
    }
 




More information about the jboss-cvs-commits mailing list