[seam-commits] Seam SVN: r9637 - in trunk/examples: groovybooking and 13 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Nov 24 23:52:38 EST 2008
Author: dan.j.allen
Date: 2008-11-24 23:52:37 -0500 (Mon, 24 Nov 2008)
New Revision: 9637
Added:
trunk/examples/groovybooking/build.properties
trunk/examples/jpa/build-jboss5.xml
Modified:
trunk/examples/build.xml
trunk/examples/groovybooking/build.xml
trunk/examples/groovybooking/readme.txt
trunk/examples/groovybooking/resources/META-INF/persistence-dev-war.xml
trunk/examples/groovybooking/resources/META-INF/persistence-prod-war.xml
trunk/examples/groovybooking/resources/WEB-INF/components.xml
trunk/examples/hibernate/build-glassfish.xml
trunk/examples/hibernate/build.xml
trunk/examples/hibernate/readme.txt
trunk/examples/jee5/booking/build.xml
trunk/examples/jee5/booking/resources/META-INF/persistence.xml
trunk/examples/jee5/readme.txt
trunk/examples/jee5/remoting/build.xml
trunk/examples/jpa/build-glassfish.xml
trunk/examples/jpa/build.xml
trunk/examples/jpa/readme.txt
trunk/examples/jpa/resources-glassfish/META-INF/persistence.xml
trunk/examples/jpa/resources-glassfish/WEB-INF/components.xml
trunk/examples/jpa/resources-glassfish/WEB-INF/web.xml
trunk/examples/jpa/resources-jboss/META-INF/persistence.xml
trunk/examples/jpa/resources-jboss/WEB-INF/components.xml
trunk/examples/jpa/resources-websphere61/META-INF/persistence.xml
Log:
JBSEAM-3579
JBSEAM-3612
Modified: trunk/examples/build.xml
===================================================================
--- trunk/examples/build.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/build.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -21,6 +21,9 @@
<!-- ###################### PROPERTY DEFINITIONS ###################### -->
+ <!-- Settings -->
+ <property name="loadPersistenceUnits" value="true"/>
+
<!-- Source directories -->
<property name="src.java.dir" value="src" />
<property name="src.test.dir" value="src" />
@@ -645,6 +648,7 @@
<filter token="debug" value="${debug}" />
<filter token="jndiPattern" value="${example.name}/#{ejbName}/local" />
<filter token="embeddedEjb" value="false" />
+ <filter token="loadPersistenceUnits" value="${loadPersistenceUnits}" />
</filterset>
</copy>
</target>
@@ -903,6 +907,7 @@
<filter token="debug" value="${debug}" />
<filter token="jndiPattern" value="#{ejbName}/local" />
<filter token="embeddedEjb" value="false" />
+ <filter token="loadPersistenceUnits" value="${loadPersistenceUnits}" />
</filterset>
</copy>
</target>
Added: trunk/examples/groovybooking/build.properties
===================================================================
--- trunk/examples/groovybooking/build.properties (rev 0)
+++ trunk/examples/groovybooking/build.properties 2008-11-25 04:52:37 UTC (rev 9637)
@@ -0,0 +1,2 @@
+# Uncomment when deploying to JBoss AS 5
+#loadPersistenceUnits=false
Modified: trunk/examples/groovybooking/build.xml
===================================================================
--- trunk/examples/groovybooking/build.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/groovybooking/build.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -4,8 +4,11 @@
<!-- Example name -->
<property name="Name" value="Seam Groovy Example" />
- <property name="example.name" value="jboss-seam-groovy" />
+ <property name="example.name" value="jboss-seam-groovybooking" />
+ <!-- Give user a chance to override without editing this file or typing -D -->
+ <property file="${basedir}/build.properties" />
+
<!-- Libraries -->
<property name="seam.ui.lib" value="yes" />
<property name="seam.debug.lib" value="yes" />
Modified: trunk/examples/groovybooking/readme.txt
===================================================================
--- trunk/examples/groovybooking/readme.txt 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/groovybooking/readme.txt 2008-11-25 04:52:37 UTC (rev 9637)
@@ -6,6 +6,9 @@
Thus, you prefix all the typical targets (explode, restart, unexplode) with
"jbosswar." (e.g., jbosswar.explode, jbosswar.restart, jbosswar.unexplode).
+Please note that you need to uncomment the loadPersistenceUnits=true property
+in build.properties when deploying to JBoss AS 5.
+
When editing Groovy files from the src/action directory, you can run ant
"jbosswar.explode" to see your changes take effect. When editing Groovy files
from src/model, you need to run "ant jbosswar.explode jbosswar.restart"
Modified: trunk/examples/groovybooking/resources/META-INF/persistence-dev-war.xml
===================================================================
--- trunk/examples/groovybooking/resources/META-INF/persistence-dev-war.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/groovybooking/resources/META-INF/persistence-dev-war.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -12,6 +12,9 @@
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
+ <!-- Binds the EntityManagerFactory to JNDI where Seam can look it up.
+ This is only relevant when the container automatically loads the persistence unit, as is the case in JBoss AS 5. -->
+ <property name="jboss.entity.manager.factory.jndi.name" value="java:/groovyEntityManagerFactory"/>
</properties>
</persistence-unit>
Modified: trunk/examples/groovybooking/resources/META-INF/persistence-prod-war.xml
===================================================================
--- trunk/examples/groovybooking/resources/META-INF/persistence-prod-war.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/groovybooking/resources/META-INF/persistence-prod-war.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -12,6 +12,9 @@
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.jdbc.batch_size" value="20"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
+ <!-- Binds the EntityManagerFactory to JNDI where Seam can look it up.
+ This is only relevant when the container automatically loads the persistence unit, as is the case in JBoss AS 5. -->
+ <property name="jboss.entity.manager.factory.jndi.name" value="java:/groovyEntityManagerFactory"/>
</properties>
</persistence-unit>
Modified: trunk/examples/groovybooking/resources/WEB-INF/components.xml
===================================================================
--- trunk/examples/groovybooking/resources/WEB-INF/components.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/groovybooking/resources/WEB-INF/components.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -20,12 +20,14 @@
conversation-timeout="120000"
conversation-id-parameter="cid"/>
- <persistence:managed-persistence-context name="em"
- auto-create="true"
- entity-manager-factory="#{groovyEntityManagerFactory}"/>
+ <persistence:entity-manager-factory name="groovyEntityManagerFactory"
+ persistence-unit-name="groovy" installed="@loadPersistenceUnits@"/>
- <persistence:entity-manager-factory name="groovyEntityManagerFactory"
- persistence-unit-name="groovy"/>
+ <!-- If Seam loads the persistence unit (JBoss 4.x), the EntityManagerFactory will be resolved from #{groovyEntityManagerFactory}.
+ On JBoss AS 5, the EntityManagerFactory is retrieved from JNDI (the binding occurs during application deployment). -->
+ <persistence:managed-persistence-context name="em" auto-create="true"
+ entity-manager-factory="#{groovyEntityManagerFactory}"
+ persistence-unit-jndi-name="java:/groovyEntityManagerFactory"/>
<security:identity authenticate-method="#{authenticator.authenticate}"
remember-me="true"/>
Modified: trunk/examples/hibernate/build-glassfish.xml
===================================================================
--- trunk/examples/hibernate/build-glassfish.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/hibernate/build-glassfish.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -3,7 +3,7 @@
<project name="Hibernate Booking" default="noejb.archive" basedir=".">
<!-- Naming -->
- <property name="Name" value="The Hibernate Example for Glassfish"/>
+ <property name="Name" value="The Hibernate Example for GlassFish"/>
<property name="example.name" value="jboss-seam-hibernate"/>
<!-- resources -->
Modified: trunk/examples/hibernate/build.xml
===================================================================
--- trunk/examples/hibernate/build.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/hibernate/build.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -22,7 +22,7 @@
<ant antfile="build-jboss405.xml"/>
</target>
- <target name="glassfish" description="Build the Hibernate Booking example artifacts, suitable for deployment to Glassfish V2">
+ <target name="glassfish" description="Build the Hibernate Booking example artifacts, suitable for deployment to GlassFish V2">
<ant antfile="build-glassfish.xml"/>
</target>
Modified: trunk/examples/hibernate/readme.txt
===================================================================
--- trunk/examples/hibernate/readme.txt 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/hibernate/readme.txt 2008-11-25 04:52:37 UTC (rev 9637)
@@ -2,7 +2,7 @@
=======================
This is the Hotel Booking example implemented in Seam and Hibernate POJOs.
-It can be deployed in JBoss AS 4.x, WebLogic, Glassfish and Tomcat without
+It can be deployed in JBoss AS 4.x, WebLogic, GlassFish and Tomcat without
the EJB3 container.
JBoss AS 4.2.x:
@@ -53,20 +53,29 @@
* Start Tomcat
* Access the app at http://localhost:8080/jboss-seam-hibernate/
-Glassfish
- * Install Glassfish V1 or V2
+GlassFish
+ * Install GlassFish V1 or V2
* ant glassfish
- * Start GlassFish
+ * Start GlassFish and the Embedded Derby Database
* Load the admin console http://localhost:4848/
* Deploy dist-glassfish/jboss-seam-hibernate.war as Web App
* Access the app at http://localhost:8080/jboss-seam-hibernate/
+GlassFish:
+ * Install GlassFish V1 or V2
+ * ant glassfish
+ * Start GlassFish and the Embedded Derby Database
+ * Load the admin console http://localhost:4848/
+ * Deploy dist-glassfish/jboss-seam-hibernate.war in the Admin Console (Applications > Web Applications)
+ or using the command $GLASSFISH_HOME/bin/asadmin deploy dist-glassfish/jboss-seam-hibernate.war
+ * Access the app at http://localhost:8080/jboss-seam-hibernate/
+
NOTES FOR GLASSFISH USERS:
- In order for the app to work out of the box with Glassfish, we have
- used the Derby (i.e. Java DB) database in Glassfish. However,
- we strongly recommend you to use a non-Derby data source (e.g., HSQL
- is a much better embedded DB) if possible. The
- WEB/classes/GlassfishDerbyDialect.class is a special hack to get around
- a Derby bug in Glassfish TM. You must use it as your Hibernate dialect
- if you are using Derby with Glassfish.
-
+ In order for the app to work out of the box with GlassFish, we have
+ used the Derby (i.e., Java DB) database in GlassFish. The included
+ WEB-INF/classes/GlassfishDerbyDialect.class is a special hack to get
+ around a Derby bug in GlassFish V2. You must use it as your Hibernate
+ dialect if you use Derby with GlassFish.
+
+ However, we strongly recommend you to use a non-Derby data source if
+ possible (for example, HSQL is a much better embedded DB).
Modified: trunk/examples/jee5/booking/build.xml
===================================================================
--- trunk/examples/jee5/booking/build.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jee5/booking/build.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -3,7 +3,7 @@
<project name="Java EE 5 Booking" default="archive" basedir=".">
<!-- Naming -->
- <property name="Name" value="The Java EE 5 Example for Glassfish"/>
+ <property name="Name" value="The Java EE 5 Example for GlassFish"/>
<property name="example.name" value="jboss-seam-jee5"/>
<!-- resources -->
Modified: trunk/examples/jee5/booking/resources/META-INF/persistence.xml
===================================================================
--- trunk/examples/jee5/booking/resources/META-INF/persistence.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jee5/booking/resources/META-INF/persistence.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -7,7 +7,7 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/__default</jta-data-source>
<properties>
- <!-- The following two properties are for Glassfish -->
+ <!-- The following two properties are for GlassFish -->
<property name="hibernate.dialect"
value="org.hibernate.dialect.DerbyDialect"/>
<property name="hibernate.transaction.manager_lookup_class"
Modified: trunk/examples/jee5/readme.txt
===================================================================
--- trunk/examples/jee5/readme.txt 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jee5/readme.txt 2008-11-25 04:52:37 UTC (rev 9637)
@@ -4,36 +4,36 @@
The examples in this directory showcases how to build Java EE 5 compliant Seam
applications. The application should run on all Java EE 5 compliant
application servers with minimal changes in code and configuration files. The
-default build script builds a deployable EAR for Glassfish. See Seam reference
+default build script builds a deployable EAR for GlassFish. See Seam reference
guide for instructions for other containers.
-Glassfish v2
+GlassFish V2
------------
1. Build the demo app by running ANT. The build target is
"dist/jboss-seam-jee5.ear"
-2. Download Glassfish V2 Final Build
+2. Download GlassFish V2 Final Build
3. Install it: java -Xmx256m -jar glassfish-installer-xxx.jar
4. Setup glassfish: cd glassfish; ant -f setup.xml;
-5. Start the Glassfish server: bin/asadmin start-domain domain1
+5. Start the GlassFish server: $GLASSFISH_HOME/bin/asadmin start-domain domain1
-6. Start the embedded JavaDB: bin/asadmin start-database
+6. Start the embedded JavaDB: $GLASSFISH_HOME/bin/asadmin start-database
7. Load the admin console: http://localhost:4848/
8. Login using username/password: admin / adminadmin
-9. Deploy the "enterprise application" in the admin console:
- The app is located at SEAM_HOME/examples/jee5/booking/dist/jboss-seam-jee5.ear
+9. Deploy the "Enterprise Application" in the admin console
+ or using the command $GLASSFISH_HOME/bin/asadmin deploy dist/jboss-seam-jee5.ear
10. Checkout the app at: http://localhost:8080/seam-jee5/
11. Stop the server and database:
- bin/asadmin stop-domain domain1; bin/asadmin stop-database
+ $GLASSFISH_HOME/bin/asadmin stop-domain domain1; $GLASSFISH_HOME/bin/asadmin stop-database
OC4J 11g Technology Preview
@@ -42,7 +42,7 @@
1. Modify the following files in the project.
* build.xml: Un-comment the OC4J-related libraries
- * resources/META-INF/persistence.xml: Comment out the Glassfish properties
+ * resources/META-INF/persistence.xml: Comment out the GlassFish properties
and un-comment the OC4J properties
2. Build the demo app by running ANT. The build target is
@@ -138,4 +138,4 @@
The instructions for integration with Websphere are fairly verbose. Please
refer to the Seam reference guide for additional information.
-- http://seamframework.org/Documentation
\ No newline at end of file
+- http://seamframework.org/Documentation
Modified: trunk/examples/jee5/remoting/build.xml
===================================================================
--- trunk/examples/jee5/remoting/build.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jee5/remoting/build.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -3,7 +3,7 @@
<project name="Java EE 5 Remoting Test" default="archive" basedir=".">
<!-- Naming -->
- <property name="Name" value="The Java EE 5 Example for Glassfish"/>
+ <property name="Name" value="The Java EE 5 Example for GlassFish"/>
<property name="example.name" value="jboss-seam-remoting"/>
<!-- resources -->
Modified: trunk/examples/jpa/build-glassfish.xml
===================================================================
--- trunk/examples/jpa/build-glassfish.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/build-glassfish.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -3,7 +3,7 @@
<project name="JPA Booking" default="noejb.archive" basedir=".">
<!-- Naming -->
- <property name="Name" value="The JPA Example for Glassfish"/>
+ <property name="Name" value="The JPA Example for GlassFish"/>
<property name="example.name" value="jboss-seam-jpa"/>
<!-- resources -->
Added: trunk/examples/jpa/build-jboss5.xml
===================================================================
--- trunk/examples/jpa/build-jboss5.xml (rev 0)
+++ trunk/examples/jpa/build-jboss5.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<project name="JPA Booking" default="jbosswar.deploy" basedir=".">
+
+ <!-- Naming -->
+ <property name="Name" value="The JPA Example for JBoss 5.0.0.GA"/>
+ <property name="example.name" value="jboss-seam-jpa"/>
+
+ <!-- settings -->
+ <property name="loadPersistenceUnits" value="false"/>
+
+ <!-- resources -->
+ <property name="resources.dir" value="resources-jboss" />
+ <property name="dist.dir" value="dist-jboss" />
+ <property name="exploded-archives.dir" value="exploded-archives-jboss" />
+
+ <!-- Libraries to include -->
+ <property name="seam.ui.lib" value="true"/>
+ <property name="seam.debug.lib" value="true"/>
+ <property name="facelets.lib" value="true"/>
+ <property name="richfaces.lib" value="true"/>
+
+ <import file="../build.xml"/>
+
+</project>
+
Modified: trunk/examples/jpa/build.xml
===================================================================
--- trunk/examples/jpa/build.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/build.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -18,11 +18,15 @@
<ant antfile="build-jboss.xml" target="jbosswar.undeploy"/>
</target>
+ <target name="jboss5" description="Build the JPA artifacts, suitable for deployment to JBoss 5.0.0.GA">
+ <ant antfile="build-jboss5.xml"/>
+ </target>
+
<target name="jboss405" description="Build the JPA artifacts, suitable for deployment to JBoss 4.0.5.GA">
<ant antfile="build-jboss405.xml"/>
</target>
- <target name="glassfish" description="Build the JPA artifacts, suitable for deployment to Glassfish V2">
+ <target name="glassfish" description="Build the JPA artifacts, suitable for deployment to GlassFish V2">
<ant antfile="build-glassfish.xml"/>
</target>
Modified: trunk/examples/jpa/readme.txt
===================================================================
--- trunk/examples/jpa/readme.txt 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/readme.txt 2008-11-25 04:52:37 UTC (rev 9637)
@@ -2,7 +2,7 @@
================
This is the Hotel Booking example implemented in Seam POJO and Hibernate JPA.
-It can be deployed in JBoss AS 4.x, WebLogic, Glassfish, Tomcat (both with and
+It can be deployed in JBoss AS 4.x, WebLogic, GlassFish, Tomcat (both with and
without the EJB3 container).
JBoss AS 4.2.0:
@@ -65,20 +65,21 @@
* Start Tomcat
* Access the app at http://localhost:8080/jboss-seam-jpa/
-Glassfish:
- * Install Glassfish V2
+GlassFish:
+ * Install GlassFish V2
* ant glassfish
- * Start GlassFish
+ * Start GlassFish and the Embedded Derby Database
* Load the admin console http://localhost:4848/
- * Deploy dist-glassfish/jboss-seam-jpa.war as Web App
+ * Deploy dist-glassfish/jboss-seam-jpa.war in the admin console (Applications > Web Applications)
+ or using the command $GLASSFISH_HOME/bin/asadmin deploy dist-glassfish/jboss-seam-jpa.war
* Access the app at http://localhost:8080/jboss-seam-jpa/
NOTES FOR GLASSFISH USERS:
- In order for the app to work out of the box with Glassfish, we have
- used the Derby (i.e., Java DB) database in Glassfish. However,
- we strongly recommend you to use a non-Derby data source (e.g., HSQL
- is a much better embeded DB) if possible. The
- WEB/classes/GlassfishDerbyDialect.class is a special hack to get around
- a Derby bug in Glassfish TM. You must use it as your Hibernate dialect
- if you use Derby with Glassfish.
-
+ In order for the app to work out of the box with GlassFish, we have
+ used the Derby (i.e., Java DB) database in GlassFish. The included
+ WEB-INF/classes/GlassfishDerbyDialect.class is a special hack to get
+ around a Derby bug in GlassFish V2. You must use it as your Hibernate
+ dialect if you use Derby with GlassFish.
+
+ However, we strongly recommend you to use a non-Derby data source if
+ possible (for example, HSQL is a much better embedded DB).
Modified: trunk/examples/jpa/resources-glassfish/META-INF/persistence.xml
===================================================================
--- trunk/examples/jpa/resources-glassfish/META-INF/persistence.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/resources-glassfish/META-INF/persistence.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -7,12 +7,14 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/__default</jta-data-source>
<properties>
- <property name="hibernate.dialect"
- value="GlassfishDerbyDialect"/>
+ <property name="hibernate.dialect" value="GlassfishDerbyDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+ <!-- Transaction manager lookup is only needed when Seam bootstraps the persistence unit (as opposed to the Java EE container) -->
+ <!--
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
+ -->
</properties>
</persistence-unit>
</persistence>
Modified: trunk/examples/jpa/resources-glassfish/WEB-INF/components.xml
===================================================================
--- trunk/examples/jpa/resources-glassfish/WEB-INF/components.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/resources-glassfish/WEB-INF/components.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -16,13 +16,12 @@
concurrent-request-timeout="500"
conversation-id-parameter="cid"/>
-
- <persistence:entity-manager-factory name="bookingDatabase"/>
-
- <persistence:managed-persistence-context name="em"
- auto-create="true"
- entity-manager-factory="#{bookingDatabase}"/>
+ <!-- You can choose to have Seam load the persistence unit using <persistence:entity-manager-factory>,
+ but we are leveraging the functionality baked into Java EE -->
+ <!-- The JNDI name where the EntityManagerFactory is stored is defined by the <persistence-unit-ref-name> element in web.xml -->
+ <persistence:managed-persistence-context name="em" auto-create="true" persistence-unit-jndi-name="java:comp/env/bookingEntityManagerFactory"/>
+
<security:identity authenticate-method="#{authenticator.authenticate}"/>
</components>
Modified: trunk/examples/jpa/resources-glassfish/WEB-INF/web.xml
===================================================================
--- trunk/examples/jpa/resources-glassfish/WEB-INF/web.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/resources-glassfish/WEB-INF/web.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -55,5 +55,10 @@
<param-value>true</param-value>
</context-param>
+ <!-- Forces the container to load the persistence unit when the application is deployed -->
+ <persistence-unit-ref>
+ <persistence-unit-ref-name>bookingEntityManagerFactory</persistence-unit-ref-name>
+ <persistence-unit-name>bookingDatabase</persistence-unit-name>
+ </persistence-unit-ref>
</web-app>
Modified: trunk/examples/jpa/resources-jboss/META-INF/persistence.xml
===================================================================
--- trunk/examples/jpa/resources-jboss/META-INF/persistence.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/resources-jboss/META-INF/persistence.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -11,10 +11,9 @@
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
- <!-- alternative
- <property name="jboss.entity.manager.factory.jndi.name"
- value="java:/jpaBookingEntityManagerFactory"/>
- -->
+ <!-- Binds the EntityManagerFactory to JNDI where Seam can look it up.
+ This is only relevant when the container automatically loads the persistence unit, as is the case in JBoss AS 5. -->
+ <property name="jboss.entity.manager.factory.jndi.name" value="java:/bookingEntityManagerFactory"/>
</properties>
</persistence-unit>
-</persistence>
\ No newline at end of file
+</persistence>
Modified: trunk/examples/jpa/resources-jboss/WEB-INF/components.xml
===================================================================
--- trunk/examples/jpa/resources-jboss/WEB-INF/components.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/resources-jboss/WEB-INF/components.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -18,11 +18,12 @@
<transaction:entity-transaction entity-manager="#{em}"/>
- <persistence:entity-manager-factory name="bookingDatabase"/>
-
- <persistence:managed-persistence-context name="em"
- auto-create="true"
- entity-manager-factory="#{bookingDatabase}"/>
+ <persistence:entity-manager-factory name="bookingDatabase" installed="@loadPersistenceUnits@"/>
+
+ <!-- If Seam loads the persistence unit (JBoss 4.x), the EntityManagerFactory will be resolved from #{bookingDatabase}.
+ On JBoss AS 5, the EntityManagerFactory is retrieved from JNDI (the binding occurs during application deployment). -->
+ <persistence:managed-persistence-context name="em" auto-create="true"
+ entity-manager-factory="#{bookingDatabase}" persistence-unit-jndi-name="java:/bookingEntityManagerFactory"/>
<security:identity authenticate-method="#{authenticator.authenticate}"/>
Modified: trunk/examples/jpa/resources-websphere61/META-INF/persistence.xml
===================================================================
--- trunk/examples/jpa/resources-websphere61/META-INF/persistence.xml 2008-11-25 04:51:13 UTC (rev 9636)
+++ trunk/examples/jpa/resources-websphere61/META-INF/persistence.xml 2008-11-25 04:52:37 UTC (rev 9637)
@@ -7,7 +7,7 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>DefaultDatasource</jta-data-source>
<properties>
- <!-- From WAS 6.1.0.9, the embedded DB is switched to the same Derby DB in Glassfish -->
+ <!-- From WAS 6.1.0.9, the embedded DB is switched to the same Derby DB in GlassFish -->
<property name="hibernate.dialect" value="GlassfishDerbyDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
More information about the seam-commits
mailing list