[seam-commits] Seam SVN: r8021 - in trunk: src/main/org/jboss/seam/framework and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Apr 25 08:47:10 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-04-25 08:47:09 -0400 (Fri, 25 Apr 2008)
New Revision: 8021
Modified:
trunk/doc/reference/en/modules/framework.xml
trunk/src/main/org/jboss/seam/framework/EntityController.java
trunk/src/main/org/jboss/seam/framework/EntityHome.java
trunk/src/main/org/jboss/seam/framework/EntityQuery.java
trunk/src/main/org/jboss/seam/framework/HibernateEntityController.java
trunk/src/main/org/jboss/seam/framework/HibernateEntityHome.java
trunk/src/main/org/jboss/seam/framework/HibernateEntityQuery.java
trunk/src/main/org/jboss/seam/framework/MutableEntityController.java
trunk/src/main/org/jboss/seam/framework/PersistenceController.java
Log:
JBSEAM-2913
Modified: trunk/doc/reference/en/modules/framework.xml
===================================================================
--- trunk/doc/reference/en/modules/framework.xml 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/doc/reference/en/modules/framework.xml 2008-04-25 12:47:09 UTC (rev 8021)
@@ -51,15 +51,15 @@
your taste, you can use extension instead:
</para>
- <programlisting><![CDATA[@Stateful
- at Name("personHome")
-public class PersonHome extends EntityHome<Person> implements LocalPersonHome {
- @RequestParameter String personId;
- @In EntityManager personDatabase;
+ <programlisting><![CDATA[@Name("personHome")
+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>
@@ -73,10 +73,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: trunk/src/main/org/jboss/seam/framework/EntityController.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/EntityController.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/EntityController.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -82,10 +82,4 @@
getEntityManager().remove(entity);
}
- @Override
- protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
- {
- return persistenceContext.isOpen();
- }
-
}
Modified: trunk/src/main/org/jboss/seam/framework/EntityHome.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/EntityHome.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/EntityHome.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -216,10 +216,4 @@
}
}
- @Override
- protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
- {
- return persistenceContext.isOpen();
- }
-
}
Modified: trunk/src/main/org/jboss/seam/framework/EntityQuery.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/EntityQuery.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/EntityQuery.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -234,11 +234,5 @@
throw new RuntimeException("could not join transaction", se);
}
}
-
- @Override
- protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
- {
- return persistenceContext.isOpen();
- }
}
Modified: trunk/src/main/org/jboss/seam/framework/HibernateEntityController.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/HibernateEntityController.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/HibernateEntityController.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -117,11 +117,5 @@
{
getSession().refresh(entity);
}
-
- @Override
- protected boolean isPersistenceContextOpen(Session persistenceContext)
- {
- return persistenceContext.isOpen();
- }
}
Modified: trunk/src/main/org/jboss/seam/framework/HibernateEntityHome.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/HibernateEntityHome.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/HibernateEntityHome.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -119,10 +119,4 @@
}
}
- @Override
- protected boolean isPersistenceContextOpen(Session persistenceContext)
- {
- return persistenceContext.isOpen();
- }
-
}
Modified: trunk/src/main/org/jboss/seam/framework/HibernateEntityQuery.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/HibernateEntityQuery.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/HibernateEntityQuery.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -201,11 +201,5 @@
{
this.fetchSize = fetchSize;
}
-
- @Override
- protected boolean isPersistenceContextOpen(Session persistenceContext)
- {
- return persistenceContext.isOpen();
- }
}
Modified: trunk/src/main/org/jboss/seam/framework/MutableEntityController.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/MutableEntityController.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/MutableEntityController.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -82,10 +82,4 @@
getEntityManager().remove(entity);
}
- @Override
- protected boolean isPersistenceContextOpen(EntityManager persistenceContext)
- {
- return persistenceContext.isOpen();
- }
-
}
Modified: trunk/src/main/org/jboss/seam/framework/PersistenceController.java
===================================================================
--- trunk/src/main/org/jboss/seam/framework/PersistenceController.java 2008-04-25 07:34:46 UTC (rev 8020)
+++ trunk/src/main/org/jboss/seam/framework/PersistenceController.java 2008-04-25 12:47:09 UTC (rev 8021)
@@ -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;
- }
}
More information about the seam-commits
mailing list