[jboss-cvs] jboss-seam/doc/reference/en/modules ...
Gavin King
gavin.king at jboss.com
Sat Jan 27 22:20:23 EST 2007
User: gavin
Date: 07/01/27 22:20:23
Modified: doc/reference/en/modules xml.xml
Log:
doc auto-create
Revision Changes Path
1.3 +39 -1 jboss-seam/doc/reference/en/modules/xml.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: xml.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/xml.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- xml.xml 8 Dec 2006 03:01:02 -0000 1.2
+++ xml.xml 28 Jan 2007 03:20:23 -0000 1.3
@@ -146,7 +146,8 @@
<programlisting><![CDATA[<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
- <core:managed-persistence-context name="productDatabase" scope="session"
+ <core:managed-persistence-context name="productDatabase"
+ scope="session"
persistence-unit-jndi-name="java:/productEntityManagerFactory"/>
</components>]]></programlisting>
@@ -162,6 +163,32 @@
</components>]]></programlisting>
<para>
+ It is common to use the <literal>auto-create</literal> option for infrastructural
+ objects like persistence contexts, which saves you from having to explicitly
+ specify <literal>create=true</literal> when you use the <literal>@In</literal>
+ annotation.
+ </para>
+
+ <programlisting><![CDATA[<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:core="http://jboss.com/products/seam/core"
+
+ <core:managed-persistence-context name="productDatabase"
+ auto-create="true"
+ persistence-unit-jndi-name="java:/productEntityManagerFactory"/>
+
+</components>]]></programlisting>
+
+ <programlisting><![CDATA[<components>
+
+ <component name="productDatabase"
+ auto-create="true"
+ class="org.jboss.seam.core.ManagedPersistenceContext">
+ <property name="persistenceUnitJndiName">java:/productEntityManagerFactory</property>
+ </component>
+
+</components>]]></programlisting>
+
+ <para>
The <literal><factory></literal> declaration lets you specify a value or method binding
expression that will be evaluated to initialize the value of a context variable when it is first
referenced.
@@ -194,6 +221,17 @@
</components>]]></programlisting>
<para>
+ It is especially common to see the use of <literal>auto-create="true"</literal> with the
+ <literal><factory></literal> declaration:
+ </para>
+
+ <programlisting><![CDATA[<components>
+
+ <factory name="session" value="#{entityManager.delegate}" scope="STATELESS" auto-create="true"/>
+
+</components>]]></programlisting>
+
+ <para>
Sometimes we want to reuse the same <literal>components.xml</literal> file with minor changes during
both deployment and testing. Seam lets you place wildcards of the form <literal>@wildcard@</literal> in
the <literal>components.xml</literal> file which can be replaced either by your Ant build script (at
More information about the jboss-cvs-commits
mailing list