[seam-commits] Seam SVN: r8022 - in branches/Seam_2_0: src/main/org/jboss/seam/framework and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Apr 25 08:50:53 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-04-25 08:50:52 -0400 (Fri, 25 Apr 2008)
New Revision: 8022

Modified:
   branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Framework.xml
   branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityController.java
   branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityHome.java
   branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityQuery.java
   branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityController.java
   branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityHome.java
   branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityQuery.java
   branches/Seam_2_0/src/main/org/jboss/seam/framework/MutableEntityController.java
   branches/Seam_2_0/src/main/org/jboss/seam/framework/PersistenceController.java
   branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/EntityLoader.java
   branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/HibernateEntityLoader.java
Log:
JBSEAM-2913

Modified: branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Framework.xml
===================================================================
--- branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Framework.xml	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/doc/Seam_Reference_Guide/en-US/Framework.xml	2008-04-25 12:50:52 UTC (rev 8022)
@@ -55,15 +55,16 @@
             your taste, you can use extension instead:
         </para>
 
-        <programlisting role="JAVA"><![CDATA[@Stateful
+        <programlisting role="JAVA"><![CDATA[
 @Name("personHome")
-public class PersonHome extends EntityHome<Person> implements LocalPersonHome {
-    @RequestParameter String personId;
-    @In EntityManager personDatabase;
+public class PersonHome extends EntityHome<Person> {
     
-    public Object getId() { return personId; }
-    public EntityManager getEntityManager() { return personDatabase; }
+   @In EntityManager personDatabase;
     
+   public EntityManager getEntityManager() {
+      return personDatabase; 
+   }
+    
 }]]></programlisting>
 
         <para>
@@ -77,10 +78,35 @@
             A second advantage is that your classes may be EJB stateful
             session beans, if you like. (They do not have to be, they 
             can be plain JavaBean components if you prefer.)  If you are using
-            JBoss AS, you'll need 4.2.2.GA or later.
+            JBoss AS, you'll need 4.2.2.GA or later:
         </para>
         
+        <programlisting role="JAVA"><![CDATA[@Stateful
+ at Name("personHome")
+public class PersonHome extends EntityHome<Person> implements LocalPersonHome {
+    
+}]]></programlisting>
+        
         <para>
+            You can also make your classes stateless session beans. In this case
+            you <emphasis>must</emphasis> use injection to provide the
+            persistence context, even if it is called 
+            <literal>entityManager</literal>:
+        </para>
+        
+        <programlisting role="JAVA"><![CDATA[@Stateless
+ at Name("personHome")
+public class PersonHome extends EntityHome<Person> implements LocalPersonHome {
+    
+   @In EntityManager entityManager;
+    
+   public EntityManager getPersistenceContext() { 
+      entityManager; 
+   }
+    
+}]]></programlisting>
+        
+        <para>
             At this time, the Seam Application Framework provides four main
             built-in components: <literal>EntityHome</literal> and
             <literal>HibernateEntityHome</literal> for CRUD, along with

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityController.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityController.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityController.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -82,10 +82,4 @@
       getEntityManager().remove(entity);
    }
    
-   @Override
-   protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
-   
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityHome.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityHome.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityHome.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -216,10 +216,4 @@
       }
    }
    
-   @Override
-   protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
-   
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityQuery.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityQuery.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/EntityQuery.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -234,11 +234,5 @@
          throw new RuntimeException("could not join transaction", se);
       }
    }
-
-   @Override
-   protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
    
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityController.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityController.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityController.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -117,11 +117,5 @@
    {
       getSession().refresh(entity);
    }
-
-   @Override
-   protected boolean isPersistenceContextOpen(Session persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
    
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityHome.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityHome.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityHome.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -119,10 +119,4 @@
       }
    }
    
-   @Override
-   protected boolean isPersistenceContextOpen(Session persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
-   
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityQuery.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityQuery.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/HibernateEntityQuery.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -201,11 +201,5 @@
    {
       this.fetchSize = fetchSize;
    }
-   
-   @Override
-   protected boolean isPersistenceContextOpen(Session persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
 
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/MutableEntityController.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/MutableEntityController.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/MutableEntityController.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -82,10 +82,4 @@
       getEntityManager().remove(entity);
    }
    
-   @Override
-   protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
-   
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/framework/PersistenceController.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/framework/PersistenceController.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/src/main/org/jboss/seam/framework/PersistenceController.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -15,7 +15,7 @@
    
    public T getPersistenceContext()
    {
-      if (persistenceContext==null || !isPersistenceContextOpen(persistenceContext))
+      if (persistenceContext==null)
       {
          persistenceContext = (T) getComponentInstance( getPersistenceContextName() );
       }
@@ -28,10 +28,5 @@
    }
 
    protected abstract String getPersistenceContextName();
-   
-   protected boolean isPersistenceContextOpen(T persistenceContext)
-   {
-      return true;
-   }
 
 }

Modified: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/EntityLoader.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/EntityLoader.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/EntityLoader.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -50,10 +50,5 @@
    {
       return (EntityLoader) Component.getInstance(EntityLoader.class, STATELESS);
    }
-   
-   @Override
-   protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
+
 }

Modified: branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/HibernateEntityLoader.java
===================================================================
--- branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/HibernateEntityLoader.java	2008-04-25 12:47:09 UTC (rev 8021)
+++ branches/Seam_2_0/ui/src/main/java/org/jboss/seam/ui/converter/entityConverter/HibernateEntityLoader.java	2008-04-25 12:50:52 UTC (rev 8022)
@@ -50,10 +50,4 @@
       return (HibernateEntityLoader) Component.getInstance(HibernateEntityLoader.class, STATELESS);
    }
    
-   @Override
-   protected boolean isPersistenceContextOpen(Session persistenceContext)
-   {
-      return persistenceContext.isOpen();
-   }
-   
 }




More information about the seam-commits mailing list