You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by bu...@apache.org on 2011/07/10 07:37:10 UTC

svn commit: r792466 [11/19] - /websites/staging/openejb/trunk/content/

Added: websites/staging/openejb/trunk/content/javaagent.html
==============================================================================
--- websites/staging/openejb/trunk/content/javaagent.html (added)
+++ websites/staging/openejb/trunk/content/javaagent.html Sun Jul 10 05:37:04 2011
@@ -0,0 +1,159 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>JavaAgent</title>
+    <link rel="stylesheet" type="text/css" media="screen" href="http://incubator.apache.org/lucy/css/lucy.css">
+  </head>
+
+  <body>
+
+    <div id="lucy-rigid_wrapper">
+
+      <div id="lucy-top" class="container_16 lucy-white_box_3d">
+
+        <div id="lucy-logo_box" class="grid_8">
+          <a href="/OpenEJB/"><img src="http://openejb.apache.org/images/logo_openejb.gif" alt="Apache OpenEJB™"></a>
+        </div> <!-- lucy-logo_box -->
+
+        <div #id="lucy-top_nav_box" class="grid_8">
+          <div id="lucy-top_nav_bar" class="container_8">
+            <ul>
+              <li><a href="http://www.apache.org/" title="Apache Software Foundation">Apache Software Foundation</a></li>
+              <li><a href="http://www.apache.org/licenses/" title="License">License</a></li>
+              <li><a href="http://www.apache.org/foundation/sponsorship.html" title="Sponsorship">Sponsorship</a></li>
+              <li><a href="http://www.apache.org/foundation/thanks.html" title="Thanks">Thanks</a></li>
+              <li><a href="http://www.apache.org/security/ " title="Security">Security</a></li>
+            </ul>
+          </div> <!-- lucy-top_nav_bar -->
+          <p><a href="http://www.apache.org/">Apache</a>&nbsp;&raquo&nbsp;<a href="/">Incubator</a></p>
+          <form name="lucy-top_search_box" id="lucy-top_search_box" action="http://www.google.com/search" method="get">
+            <input value="*.apache.org" name="sitesearch" type="hidden"/>
+            <input type="text" name="q" id="query" style="width:85%">
+            <input type="submit" id="submit" value="Search">
+          </form>
+        </div> <!-- lucy-top_nav_box -->
+
+        <div class="clear"></div>
+
+      </div> <!-- lucy-top -->
+
+      <div id="lucy-main_content" class="container_16 lucy-white_box_3d">
+
+        <div class="grid_4" id="lucy-left_nav_box">
+          <h6>About</h6>
+            <ul>
+              <li><a href="/lucy/">Welcome</a></li>
+              <li><a href="/lucy/faq.html">FAQ</a></li>
+              <li><a href="/lucy/people.html">People</a></li>
+            </ul>
+          <h6>Resources</h6>
+            <ul>
+              <li><a href="/lucy/download.html">Download</a></li>
+              <li><a href="/lucy/mailing_lists.html">Mailing Lists</a></li>
+              <li><a href="/lucy/docs/perl/">Documentation</a></li>
+              <li><a href="http://wiki.apache.org/lucy/">Wiki</a></li>
+              <li><a href="https://issues.apache.org/jira/browse/LUCY">Issue Tracker</a></li>
+              <li><a href="/lucy/version_control.html">Version Control</a></li>
+            </ul>
+          <h6>Related Projects</h6>
+            <ul>
+              <li><a href="http://lucene.apache.org/java/">Lucene</a></li>
+              <li><a href="http://lucene.apache.org/solr/">Solr</a></li>
+              <li><a href="http://incubator.apache.org/lucene.net/">Lucene.NET</a></li>
+              <li><a href="http://lucene.apache.org/pylucene/">PyLucene</a></li>
+              <li><a href="http://lucene.apache.org/openrelevance/">Open Relevance</a></li>
+            </ul>
+        </div> <!-- lucy-left_nav_box -->
+
+        <div id="lucy-main_content_box" class="grid_9">
+          <p><a name="JavaAgent-AddingaJavaAgent"></a></p>
+
+<h1>Adding a JavaAgent</h1>
+
+<p>Adding a java agent is done via a vm parameter as follows:</p>
+
+<p>{panel}
+java -javaagent:openejb-javaagent-3.0-beta-2.jar _[other params...](other-params....html)
+_
+{panel}</p>
+
+<p>{note:title=Need the JavaAgent?}
+The java agent is only required if using OpenJPA as your persistence
+provider or if using CMP.
+{note}
+<a name="JavaAgent-Maven2"></a></p>
+
+<h2>Maven2</h2>
+
+<p>In maven2 you can enable the javaagent for your tests by adding this to
+your pom.xml file:</p>
+
+<pre><code>&lt;build&gt;
+  &lt;plugins&gt;
+    &lt;!-- this configures the surefire plugin to run your tests with the
+</code></pre>
+
+<p>javaagent enabled -->
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+        <forkMode>pertest</forkMode></p>
+
+<p><argLine>-javaagent:${basedir}/target/openejb-javaagent-3.0-beta-2.jar</argLine>
+        <workingDirectory>${basedir}/target</workingDirectory>
+          </configuration>
+        </plugin></p>
+
+<pre><code>    &lt;!-- this tells maven to copy the openejb-javaagent jar into your
+</code></pre>
+
+<p>target/ directory -->
+        <!-- where surefire can see it -->
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <executions>
+        <execution>
+          <id>copy</id>
+          <phase>process-resources</phase>
+          <goals>
+            <goal>copy</goal>
+          </goals>
+          <configuration>
+            <artifactItems>
+              <artifactItem>
+            <groupId>org.apache.openejb</groupId>
+            <artifactId>openejb-javaagent</artifactId>
+            <version>3.0-beta-2</version></p>
+
+<p><outputDirectory>${project.build.directory}</outputDirectory>
+              </artifactItem>
+            </artifactItems>
+          </configuration>
+        </execution>
+          </executions>
+        </plugin></p>
+
+<pre><code>  &lt;/plugins&gt;
+&lt;/build&gt;
+</code></pre>
+
+        </div> <!-- lucy-main_content_box --> 
+        <div class="clear"></div>
+
+      </div> <!-- lucy-main_content -->
+
+      <div id="lucy-copyright" class="container_16">
+        <p>Copyright &#169; 2010-2011 The Apache Software Foundation, Licensed under the 
+           <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+           <br/>
+          
+        </p>
+      </div> <!-- lucy-copyright -->
+
+    </div> <!-- lucy-rigid_wrapper -->
+
+  </body>
+</html>

Added: websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.cwiki
==============================================================================
--- websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.cwiki (added)
+++ websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.cwiki Sun Jul 10 05:37:04 2011
@@ -0,0 +1,62 @@
+h1. External ActiveMQ Broker
+
+{code:xml|title=openejb.xml}
+<openejb>
+    <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
+        # Do not start the embedded ActiveMQ broker
+        BrokerXmlConfig 
+        ServerUrl tcp://someHostName:61616
+    </Resource>
+
+    <Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">
+        ResourceAdapter MyJmsResourceAdapter
+    </Resource>
+
+    <Container id="MyJmsMdbContainer" ctype="MESSAGE">
+        ResourceAdapter MyJmsResourceAdapter
+    </Container>
+
+    <Resource id="FooQueue" type="javax.jms.Queue"/>
+    <Resource id="BarTopic" type="javax.jms.Topic"/>
+</openejb>
+{code}
+
+The {{ServerUrl}} would be changed to point to the host and port of the ActiveMQ process.  The various URL formats that ActiveMQ supports also work, such as 'failover:'.
+
+The same can be done via properties in an embedded configuration, via the {{conf/system.properties}} file or on the command line via {{-D}} flags.
+
+{code}
+Properties p = new Properties();
+p.put(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
+
+p.put("MyJmsResourceAdapter", "new://Resource?type=ActiveMQResourceAdapter");
+p.put("MyJmsResourceAdapter.ServerUrl", "tcp://someHostName:61616");
+// Do not start the ActiveMQ broker
+p.put("MyJmsResourceAdapter.BrokerXmlConfig", "");
+
+p.put("MyJmsConnectionFactory", "new://Resource?type=javax.jms.ConnectionFactory");
+p.put("MyJmsConnectionFactory.ResourceAdapter", "MyJmsResourceAdapter");
+
+p.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
+p.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");
+
+p.put("FooQueue", "new://Resource?type=javax.jms.Queue");
+p.put("BarTopic", "new://Resource?type=javax.jms.Topic");
+
+InitialContext context = new InitialContext(p);
+{code}
+
+
+From anywhere in the same VM as the EJB Container you could lookup the above resources like so:
+
+{code}
+javax.jms.ConnectionFactory cf = (ConnectionFactory) 
+        context.lookup("openejb:Resource/MyJmsConnectionFactory");
+            
+javax.jms.Queue queue = (Queue) context.lookup("openejb:Resource/FooQueue");
+javax.jms.Topic topic = (Topic) context.lookup("openejb:Resource/BarTopic");
+{code}
+
+h1. Internal ActiveMQ Broker
+
+_TODO_

Added: websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.html
==============================================================================
--- websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.html (added)
+++ websites/staging/openejb/trunk/content/jms-resources-and-mdb-container.html Sun Jul 10 05:37:04 2011
@@ -0,0 +1,166 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>JMS Resources and MDB Container</title>
+    <link rel="stylesheet" type="text/css" media="screen" href="http://incubator.apache.org/lucy/css/lucy.css">
+  </head>
+
+  <body>
+
+    <div id="lucy-rigid_wrapper">
+
+      <div id="lucy-top" class="container_16 lucy-white_box_3d">
+
+        <div id="lucy-logo_box" class="grid_8">
+          <a href="/OpenEJB/"><img src="http://openejb.apache.org/images/logo_openejb.gif" alt="Apache OpenEJB™"></a>
+        </div> <!-- lucy-logo_box -->
+
+        <div #id="lucy-top_nav_box" class="grid_8">
+          <div id="lucy-top_nav_bar" class="container_8">
+            <ul>
+              <li><a href="http://www.apache.org/" title="Apache Software Foundation">Apache Software Foundation</a></li>
+              <li><a href="http://www.apache.org/licenses/" title="License">License</a></li>
+              <li><a href="http://www.apache.org/foundation/sponsorship.html" title="Sponsorship">Sponsorship</a></li>
+              <li><a href="http://www.apache.org/foundation/thanks.html" title="Thanks">Thanks</a></li>
+              <li><a href="http://www.apache.org/security/ " title="Security">Security</a></li>
+            </ul>
+          </div> <!-- lucy-top_nav_bar -->
+          <p><a href="http://www.apache.org/">Apache</a>&nbsp;&raquo&nbsp;<a href="/">Incubator</a></p>
+          <form name="lucy-top_search_box" id="lucy-top_search_box" action="http://www.google.com/search" method="get">
+            <input value="*.apache.org" name="sitesearch" type="hidden"/>
+            <input type="text" name="q" id="query" style="width:85%">
+            <input type="submit" id="submit" value="Search">
+          </form>
+        </div> <!-- lucy-top_nav_box -->
+
+        <div class="clear"></div>
+
+      </div> <!-- lucy-top -->
+
+      <div id="lucy-main_content" class="container_16 lucy-white_box_3d">
+
+        <div class="grid_4" id="lucy-left_nav_box">
+          <h6>About</h6>
+            <ul>
+              <li><a href="/lucy/">Welcome</a></li>
+              <li><a href="/lucy/faq.html">FAQ</a></li>
+              <li><a href="/lucy/people.html">People</a></li>
+            </ul>
+          <h6>Resources</h6>
+            <ul>
+              <li><a href="/lucy/download.html">Download</a></li>
+              <li><a href="/lucy/mailing_lists.html">Mailing Lists</a></li>
+              <li><a href="/lucy/docs/perl/">Documentation</a></li>
+              <li><a href="http://wiki.apache.org/lucy/">Wiki</a></li>
+              <li><a href="https://issues.apache.org/jira/browse/LUCY">Issue Tracker</a></li>
+              <li><a href="/lucy/version_control.html">Version Control</a></li>
+            </ul>
+          <h6>Related Projects</h6>
+            <ul>
+              <li><a href="http://lucene.apache.org/java/">Lucene</a></li>
+              <li><a href="http://lucene.apache.org/solr/">Solr</a></li>
+              <li><a href="http://incubator.apache.org/lucene.net/">Lucene.NET</a></li>
+              <li><a href="http://lucene.apache.org/pylucene/">PyLucene</a></li>
+              <li><a href="http://lucene.apache.org/openrelevance/">Open Relevance</a></li>
+            </ul>
+        </div> <!-- lucy-left_nav_box -->
+
+        <div id="lucy-main_content_box" class="grid_9">
+          <p><a name="JMSResourcesandMDBContainer-ExternalActiveMQBroker"></a></p>
+
+<h1>External ActiveMQ Broker</h1>
+
+<p>{code:xml|title=openejb.xml}
+<openejb>
+    <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
+1. Do not start the embedded ActiveMQ broker
+    BrokerXmlConfig 
+    ServerUrl tcp://someHostName:61616
+    </Resource></p>
+
+<pre><code>&lt;Resource id="MyJmsConnectionFactory"
+</code></pre>
+
+<p>type="javax.jms.ConnectionFactory">
+    ResourceAdapter MyJmsResourceAdapter
+    </Resource></p>
+
+<pre><code>&lt;Container id="MyJmsMdbContainer" ctype="MESSAGE"&gt;
+ResourceAdapter MyJmsResourceAdapter
+&lt;/Container&gt;
+
+&lt;Resource id="FooQueue" type="javax.jms.Queue"/&gt;
+&lt;Resource id="BarTopic" type="javax.jms.Topic"/&gt;
+</code></pre>
+
+<p></openejb></p>
+
+<pre><code>The {{ServerUrl}} would be changed to point to the host and port of the
+</code></pre>
+
+<p>ActiveMQ process.  The various URL formats that ActiveMQ supports also
+work, such as 'failover:'.</p>
+
+<pre><code>The same can be done via properties in an embedded configuration, via the
+</code></pre>
+
+<p>{{conf/system.properties}} file or on the command line via {{-D}} flags.</p>
+
+<p>Properties p = new Properties();
+p.put(Context.INITIAL_CONTEXT_FACTORY,
+LocalInitialContextFactory.class.getName());</p>
+
+<p>p.put("MyJmsResourceAdapter",
+"new://Resource?type=ActiveMQResourceAdapter");
+p.put("MyJmsResourceAdapter.ServerUrl", "tcp://someHostName:61616");
+// Do not start the ActiveMQ broker
+p.put("MyJmsResourceAdapter.BrokerXmlConfig", "");</p>
+
+<p>p.put("MyJmsConnectionFactory",
+"new://Resource?type=javax.jms.ConnectionFactory");
+p.put("MyJmsConnectionFactory.ResourceAdapter", "MyJmsResourceAdapter");</p>
+
+<p>p.put("MyJmsMdbContainer", "new://Container?type=MESSAGE");
+p.put("MyJmsMdbContainer.ResourceAdapter", "MyJmsResourceAdapter");</p>
+
+<p>p.put("FooQueue", "new://Resource?type=javax.jms.Queue");
+p.put("BarTopic", "new://Resource?type=javax.jms.Topic");</p>
+
+<p>InitialContext context = new InitialContext(p);</p>
+
+<pre><code>From anywhere in the same VM as the EJB Container you could lookup the
+</code></pre>
+
+<p>above resources like so:</p>
+
+<p>javax.jms.ConnectionFactory cf = (ConnectionFactory) 
+    context.lookup("openejb:Resource/MyJmsConnectionFactory");</p>
+
+<p>javax.jms.Queue queue = (Queue)
+context.lookup("openejb:Resource/FooQueue");
+javax.jms.Topic topic = (Topic)
+context.lookup("openejb:Resource/BarTopic");</p>
+
+<pre><code>h1. Internal ActiveMQ Broker
+
+_TODO_
+</code></pre>
+
+        </div> <!-- lucy-main_content_box --> 
+        <div class="clear"></div>
+
+      </div> <!-- lucy-main_content -->
+
+      <div id="lucy-copyright" class="container_16">
+        <p>Copyright &#169; 2010-2011 The Apache Software Foundation, Licensed under the 
+           <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+           <br/>
+          
+        </p>
+      </div> <!-- lucy-copyright -->
+
+    </div> <!-- lucy-rigid_wrapper -->
+
+  </body>
+</html>

Added: websites/staging/openejb/trunk/content/jndi-names.cwiki
==============================================================================
--- websites/staging/openejb/trunk/content/jndi-names.cwiki (added)
+++ websites/staging/openejb/trunk/content/jndi-names.cwiki Sun Jul 10 05:37:04 2011
@@ -0,0 +1,278 @@
+h1. What's My Bean's JNDI Name?
+There are two things to keep in mind before you start reading:
+# OpenEJB provides a default JNDI name to your EJB. 
+# You can customize the JNDI name.
+
+h2.Default JNDI name 
+The default JNDI name is in the following format:
+{code}
+{deploymentId}{interfaceType.annotationName}
+{code}
+Lets try and understand the above format. Both *deploymentId* and *interfaceType.annotationName* are pre-defined variables. There are other pre-defined variables available which you could use to customize the JNDI name format.
+
+h1.  JNDI Name Formatting
+{excerpt}
+The *openejb.jndiname.format* property allows you to supply a template for the global JNDI names of all your EJBs.  With it, you have complete control over the structure of the JNDI layout can institute a design pattern just right for your client apps.  See the [Service Locator] doc for clever ways to use the JNDI name formatting functionality in client code.
+
+ || variable || description ||
+ | moduleId |  Typically the name of the ejb-jar file or the <ejb-jar id=""> id value if specified | 
+ | ejbType |  STATEFUL, STATELESS, BMP_ENTITY, CMP_ENTITY, or MESSAGE_DRIVEN | 
+ | ejbClass |  for a class named _org.acme.superfun.WidgetBean_ results in *org.acme.superfun.WidgetBean* | 
+ | ejbClass.simpleName |  for a class named _org.acme.superfun.WidgetBean_ results in *WidgetBean* | 
+ | ejbClass.packageName |  for a class named _org.acme.superfun.WidgetBean_ results in *org.acme.superfun* | 
+ | ejbName |  The ejb-name as specified in xml or via the 'name' attribute in an @Stateful, @Stateless, or @MessageDriven annotation | 
+ | deploymentId |  The unique system id for the ejb.  Typically the ejbName unless specified in the openejb-jar.xml or via changing the openejb.deploymentId.format | 
+ | interfaceType |  see interfaceType.annotationName | 
+ | interfaceType.annotationName | Following the EJB 3 annotations @RemoteHome, @LocalHome, @Remote and @Local
+- *RemoteHome*  _(EJB 2 EJBHome)_
+- *LocalHome* _(EJB 2 EJBLocalHome)_
+- *Remote* _(EJB 3 Business Remote)_
+- *Local* _(EJB 3 Business Local)_
+- *Endpoint* _(EJB webservice endpoint)_
+|
+ | interfaceType.annotationNameLC | This is the same as interfaceType.annotationName, but all in lower case.
+| 
+ 
+ | interfaceType.xmlName |  Following the ejb-jar.xml descriptor elements <home>, <local-home>, <business-remote>, <business-local>, and <service-endpoint>:
+- *home*  _(EJB 2 EJBHome)_
+- *local-home* _(EJB 2 EJBLocalHome)_
+- *business-remote* _(EJB 3 Business Remote)_
+- *business-local* _(EJB 3 Business Local)_
+- *service-endpoint* _(EJB webservice endpoint)_
+ | 
+ | interfaceType.xmlNameCc |  Camel-case version of interfaceType.xmlName:
+- *Home*  _(EJB 2 EJBHome)_
+- *LocalHome* _(EJB 2 EJBLocalHome)_
+- *BusinessRemote* _(EJB 3 Business Remote)_
+- *BusinessLocal* _(EJB 3 Business Local)_
+- *ServiceEndpoint* _(EJB webservice endpoint)_ | 
+ | interfaceType.openejbLegacyName |  Following the OpenEJB 1.0 hard-coded format:
+- _(empty string)_  _(EJB 2 EJBHome)_
+- *Local* _(EJB 2 EJBLocalHome)_
+- *BusinessRemote* _(EJB 3 Business Remote)_
+- *BusinessLocal* _(EJB 3 Business Local)_
+- *ServiceEndpoint* _(EJB webservice endpoint)_ | 
+ | interfaceClass |  - _(business)_ for a class named _org.acme.superfun.WidgetRemote_ results in *org.acme.superfun.WidgetRemote* 
+ - _(home)_ for a class named _org.acme.superfun.WidgetHome_ results in *org.acme.superfun.WidgetHome*
+| 
+ | interfaceClass.simpleName |  - _(business)_ for a class named _org.acme.superfun.WidgetRemote_ results in *WidgetRemote* 
+- _(home)_ for a class named _org.acme.superfun.WidgetHome_ results in *WidgetHome* | 
+ | interfaceClass.packageName |  for a class named _org.acme.superfun.WidgetRemote_ results in *org.acme.superfun* | 
+{excerpt}
+
+h1.  Setting the JNDI name
+
+It's possible to set the desired jndi name format for the whole server level, an ejb-jar, an ejb, an ejb's "local" interface (local/remote/local-home/home), and for an individual interface the ejb implements.  More specific jndi name formats act as an override to any more general formats.  The most specific format dictates the jndi name that will be used for any given interface of an ejb.  It's possible to specify a general format for your server, override it at an ejb level and override that further for a specific interface of that ejb.
+
+h2. Via System property
+
+The jndi name format can be set on a server level via a _system property_, for example:
+
+{panel:border=dotted}
+$ ./bin/openejb start "-Dopenejb.jndiname.format=\{ejbName}/\{interfaceClass}"
+{panel}
+
+As usual, other ways of specifying system properties are via the conf/system.properties file in a standalone server, or via the InitialContext properties when embedded.
+
+h2. Via properties in the openejb-jar.xml
+
+It's possible to set the openejb.jndiname.format for an ejb-jar jar in a META-INF/openejb-jar.xml file as follows:
+
+{code:xml}
+<openejb-jar>
+  <properties>
+     openejb.deploymentId.format = {ejbName}
+     openejb.jndiname.format = {deploymentId}{interfaceType.annotationName}
+  </properties>
+</openejb-jar>
+{code}
+
+h2. Via the <jndi> tag for a specific ejb
+
+The following sets the name specifically for the interface org.superbiz.Foo.
+
+{code:xml}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <jndi name="foo" interface="org.superbiz.Foo"/>  
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+Or more generally...
+
+{code:xml}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <jndi name="foo" interface="Remote"/> 
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+Or more generally still...
+
+{code:xml}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <jndi name="foo"/> 
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+The 'name' attribute can still use templates if it likes, such as: 
+
+{code:xml}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <jndi name="ejb/{interfaceClass.simpleName}" interface="org.superbiz.Foo"/> 
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+h3.  Multiple <jndi> tags
+
+Multiple <jndi> tags are allowed making it possible for you to be as specific as you need about the jndi name of each interface or each logical group of iterfaces (Local, Remote, LocalHome, RemoteHome).  
+
+Given an ejb, FooBean, with the following interfaces:
+ - business-local: org.superbiz.LocalOne
+ - business-local: org.superbiz.LocalTwo
+ - business-remote: org.superbiz.RemoteOne
+ - business-remote: org.superbiz.RemoteTwo
+ - home: org.superbiz.FooHome
+ - local-home: org.superbiz.FooLocalHome
+
+The following four examples would yield the same jndi names.  The intention with these examples is to show the various ways you can isolate specific interfaces or types of interfaces to gain more specific control on how they are named.
+
+{code:xml|title=#1}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <jndi name="LocalOne" interface="org.superbiz.LocalOne"/> 
+    <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/> 
+    <jndi name="RemoteOne" interface="org.superbiz.RemoteOne"/> 
+    <jndi name="RemoteTwo" interface="org.superbiz.RemoteTwo"/> 
+    <jndi name="FooHome" interface="org.superbiz.FooHome"/> 
+    <jndi name="FooLocalHome" interface="org.superbiz.FooLocalHome"/> 
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+{code:xml|title=#2}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <!-- applies to LocalOne and LocalTwo -->
+    <jndi name="{interfaceClass.simpleName}" interface="Local"/> 
+
+    <!-- applies to RemoteOne and RemoteTwo -->
+    <jndi name="{interfaceClass.simpleName}" interface="Remote"/> 
+
+    <!-- applies to FooHome -->
+    <jndi name="{interfaceClass.simpleName}" interface="RemoteHome"/> 
+
+    <!-- applies to FooLocalHome -->
+    <jndi name="{interfaceClass.simpleName}" interface="LocalHome"/> 
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+{code:xml|title=#3}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <!-- applies to RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
+    <jndi name="{interfaceClass.simpleName}"/> 
+
+    <!-- these two would count as an override on the above format -->
+    <jndi name="LocalOne" interface="org.superbiz.LocalOne"/> 
+    <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/> 
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+{code:xml|title=#4}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <!-- applies to LocalOne, LocalTwo, RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
+    <jndi name="{interfaceClass.simpleName}"/> 
+  </ejb-deployment>
+</openejb-jar>
+{code}
+
+
+
+h1. Changing the Default Setting
+
+*You are responsible for ensuring the names don't conflict.*  
+ 
+h3. Conservative settings
+
+A very conservative setting such as "_\{deploymentId}/\{interfaceClass}_" would guarantee that each and every single interface is bound to JNDI.  If your bean had a legacy EJBObject interface, three business remote interfaces, and two business local interfaces, this pattern would result in *six* proxies bound into JNDI.
+
+Similarly conservative settings would be:
+ - _\{deploymentId}/\{interfaceClass.simpleName}_
+ - _\{moduleId}/\{ejbName}/\{interfaceClass}_
+ - _\{ejbName}/\{interfaceClass}_
+ - _\{moduleId}/\{ejbClass}/\{interfaceClass}_
+ - _\{ejbClass}/\{interfaceClass}_
+ - _\{ejbClass}/\{interfaceClass.simpleName}_
+ - _\{ejbClass.simpleName}/\{interfaceClass.simpleName}_
+ - _\{interfaceClass}/\{ejbName}_
+
+Bordeline optimistic:
+ - _\{moduleId}/\{interfaceClass}_
+ - _\{interfaceClass}_
+
+The above two settings would work if you the interface wasn't shared by other beans.
+
+h3. Pragmatic settings
+
+A more middle ground setting such as "_\{deploymentId}\{interfaceType.annotationName}_" would guarantee that at least one proxy of each interface type is bound to JNDI.  If your bean had a legacy EJBObject interface, three business remote interfaces, and two business local interfaces, this pattern would result in *three* proxies bound into JNDI: one proxy dedicated to your EJBObject interface; one proxy implementing all three business remote interfaces; one proxy implementing the two business local interfaces.
+
+Similarly pragmatic settings would be:
+ - _\{moduleId}/\{ejbClass}/\{interfaceType.annotationName}_
+ - _\{ejbClass}/\{interfaceType.xmlName}_
+ - _\{ejbClass.simpleName}/\{interfaceType.xmlNameCc}_
+ - _\{interfaceType}/\{ejbName}_
+ - _\{interfaceType}/\{ejbClass}_
+
+h3. Optimistic settings
+
+A very optimistic setting such as "_\{deploymentId}_" would guarantee only one proxy for the bean will be bound to JNDI.  This would be fine if you knew you only had one type of interface in your beans.  For example, only business remote interfaces, or only business local interfaces, or only an EJBObject interface, or only an EJBLocalObject interface.
+
+If a bean in the app did have more than one interface type, one business local and one business remote for example, by default OpenEJB will reject the app when it detects that it cannot bind the second interface.  This strict behavior can be disabled by setting the *openejb.jndiname.failoncollision* system property to _false_.  When this property is set to false, we will simply log an error that the second proxy cannot be bound to JNDI, tell you which ejb is using that name, and continue loading your app.
+
+Similarly optimistic settings would be:
+ - _\{ejbName}_
+ - _\{ejbClass}_
+ - _\{ejbClass.simpleName}_
+ - _\{moduleId}/\{ejbClass.simpleName}_
+ - _\{moduleId}/\{ejbName}_
+
+h1. Advanced Details on EJB 3.0 Business Proxies (the simple part)
+
+If you implement your business interfaces, your life is simple as your proxies will also implement your business interfaces of the same type.  Meaning any proxy OpenEJB creates for a business local interface will also implement your other business local interfaces.  Similarly, any proxy OpenEJB creates for a business remote interface will also implement your other business remote interfaces.
+
+h1. Advanced Details on EJB 3.0 Business Proxies (the complicated part)
+
+{info:Who should read?}
+Read this section of either of these two apply to you:
+ - You do not implement your business interfaces in your bean class
+ - One or more of your business remote interfaces extend from javax.rmi.Remote
+
+If neither of these two items describe your apps, then there is no need to read further.  Go have fun.
+{info}
+h3. Not implementing business interfaces
+
+If you do not implement your business interfaces it may not be possible for us to implement all your business interfaces in a single interface.  Conflicts in the throws clauses and the return values can occur as detailed [here|OPENEJB:Multiple Business Interface Hazzards].  When creating a proxy for an interface we will detect and remove any other business interfaces that would conflict with the main interface.
+
+h3. Business interfaces extending javax.rmi.Remote
+
+Per spec rules many runtime exceptions (container or connection related) are thrown from javax.rmi.Remote proxies as java.rmi.RemoteException which is not a runtime exception and must be throwable via the proxy as a checked exception. The issue is that conflicting throws clauses are actually removed for two interfaces sharing the same method signature.  For example two methods such as these:
+ - InterfaceA: void doIt() throws Foo;
+ - InterfaceB: void doIt() throws RemoteException;
+
+can be implemented by trimming out the conflicting throws clauses as follows:
+  - Implementation: void doIt(){}
+
+This is fine for a bean class as it does not need to throw the RMI required javax.rmi.RemoteException. However if we create a proxy from these two interfaces it will also wind up with a 'doIt(){}' method that cannot throw javax.rmi.RemoteException.  This is very bad as the container does need to throw RemoteException to any business interfaces extending java.rmi.Remote for any container related issues or connection issues.  If the container attempts to throw a RemoteException from the proxies 'doIt(){}' method, it will result in an UndeclaredThrowableException thrown by the VM.
+
+The only way to guarantee the proxy has the 'doIt() throws RemoteException {}' method of InterfaceB is to cut out InterfaceA when we create the proxy dedicated to InterfaceB.
+{excerpt}

Added: websites/staging/openejb/trunk/content/jndi-names.html
==============================================================================
--- websites/staging/openejb/trunk/content/jndi-names.html (added)
+++ websites/staging/openejb/trunk/content/jndi-names.html Sun Jul 10 05:37:04 2011
@@ -0,0 +1,498 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>JNDI Names</title>
+    <link rel="stylesheet" type="text/css" media="screen" href="http://incubator.apache.org/lucy/css/lucy.css">
+  </head>
+
+  <body>
+
+    <div id="lucy-rigid_wrapper">
+
+      <div id="lucy-top" class="container_16 lucy-white_box_3d">
+
+        <div id="lucy-logo_box" class="grid_8">
+          <a href="/OpenEJB/"><img src="http://openejb.apache.org/images/logo_openejb.gif" alt="Apache OpenEJB™"></a>
+        </div> <!-- lucy-logo_box -->
+
+        <div #id="lucy-top_nav_box" class="grid_8">
+          <div id="lucy-top_nav_bar" class="container_8">
+            <ul>
+              <li><a href="http://www.apache.org/" title="Apache Software Foundation">Apache Software Foundation</a></li>
+              <li><a href="http://www.apache.org/licenses/" title="License">License</a></li>
+              <li><a href="http://www.apache.org/foundation/sponsorship.html" title="Sponsorship">Sponsorship</a></li>
+              <li><a href="http://www.apache.org/foundation/thanks.html" title="Thanks">Thanks</a></li>
+              <li><a href="http://www.apache.org/security/ " title="Security">Security</a></li>
+            </ul>
+          </div> <!-- lucy-top_nav_bar -->
+          <p><a href="http://www.apache.org/">Apache</a>&nbsp;&raquo&nbsp;<a href="/">Incubator</a></p>
+          <form name="lucy-top_search_box" id="lucy-top_search_box" action="http://www.google.com/search" method="get">
+            <input value="*.apache.org" name="sitesearch" type="hidden"/>
+            <input type="text" name="q" id="query" style="width:85%">
+            <input type="submit" id="submit" value="Search">
+          </form>
+        </div> <!-- lucy-top_nav_box -->
+
+        <div class="clear"></div>
+
+      </div> <!-- lucy-top -->
+
+      <div id="lucy-main_content" class="container_16 lucy-white_box_3d">
+
+        <div class="grid_4" id="lucy-left_nav_box">
+          <h6>About</h6>
+            <ul>
+              <li><a href="/lucy/">Welcome</a></li>
+              <li><a href="/lucy/faq.html">FAQ</a></li>
+              <li><a href="/lucy/people.html">People</a></li>
+            </ul>
+          <h6>Resources</h6>
+            <ul>
+              <li><a href="/lucy/download.html">Download</a></li>
+              <li><a href="/lucy/mailing_lists.html">Mailing Lists</a></li>
+              <li><a href="/lucy/docs/perl/">Documentation</a></li>
+              <li><a href="http://wiki.apache.org/lucy/">Wiki</a></li>
+              <li><a href="https://issues.apache.org/jira/browse/LUCY">Issue Tracker</a></li>
+              <li><a href="/lucy/version_control.html">Version Control</a></li>
+            </ul>
+          <h6>Related Projects</h6>
+            <ul>
+              <li><a href="http://lucene.apache.org/java/">Lucene</a></li>
+              <li><a href="http://lucene.apache.org/solr/">Solr</a></li>
+              <li><a href="http://incubator.apache.org/lucene.net/">Lucene.NET</a></li>
+              <li><a href="http://lucene.apache.org/pylucene/">PyLucene</a></li>
+              <li><a href="http://lucene.apache.org/openrelevance/">Open Relevance</a></li>
+            </ul>
+        </div> <!-- lucy-left_nav_box -->
+
+        <div id="lucy-main_content_box" class="grid_9">
+          <p><a name="JNDINames-What'sMyBean'sJNDIName?"></a></p>
+
+<h1>What's My Bean's JNDI Name?</h1>
+
+<p>There are two things to keep in mind before you start reading:
+1. OpenEJB provides a default JNDI name to your EJB. 
+1. You can customize the JNDI name.</p>
+
+<p><a name="JNDINames-DefaultJNDIname"></a></p>
+
+<h2>Default JNDI name</h2>
+
+<p>The default JNDI name is in the following format:</p>
+
+<pre><code>{deploymentId}{interfaceType.annotationName}
+</code></pre>
+
+<p>Lets try and understand the above format. Both <em>deploymentId</em> and
+<em>interfaceType.annotationName</em> are pre-defined variables. There are other
+pre-defined variables available which you could use to customize the JNDI
+name format.</p>
+
+<p><a name="JNDINames-JNDINameFormatting"></a></p>
+
+<h1>JNDI Name Formatting</h1>
+
+<p>{excerpt}
+The <em>openejb.jndiname.format</em> property allows you to supply a template for
+the global JNDI names of all your EJBs.  With it, you have complete control
+over the structure of the JNDI layout can institute a design pattern just
+right for your client apps.  See the <a href="service-locator.html">Service Locator</a>
+ doc for clever ways to use the JNDI name formatting functionality in
+client code.</p>
+
+<p>|| variable || description ||
+ | moduleId |  Typically the name of the ejb-jar file or the <ejb-jar
+id=""> id value if specified | 
+ | ejbType |  STATEFUL, STATELESS, BMP_ENTITY, CMP_ENTITY, or
+MESSAGE_DRIVEN | 
+ | ejbClass |  for a class named <em>org.acme.superfun.WidgetBean</em> results in
+<em>org.acme.superfun.WidgetBean</em> | 
+ | ejbClass.simpleName |  for a class named <em>org.acme.superfun.WidgetBean</em>
+results in <em>WidgetBean</em> | 
+ | ejbClass.packageName |  for a class named <em>org.acme.superfun.WidgetBean</em>
+results in <em>org.acme.superfun</em> | 
+ | ejbName |  The ejb-name as specified in xml or via the 'name' attribute
+in an @Stateful, @Stateless, or @MessageDriven annotation | 
+ | deploymentId |  The unique system id for the ejb.  Typically the ejbName
+unless specified in the openejb-jar.xml or via changing the
+openejb.deploymentId.format | 
+ | interfaceType |  see interfaceType.annotationName | 
+ | interfaceType.annotationName | Following the EJB 3 annotations
+@RemoteHome, @LocalHome, @Remote and @Local
+- <em>RemoteHome</em>  <em>(EJB 2 EJBHome)</em>
+- <em>LocalHome</em> <em>(EJB 2 EJBLocalHome)</em>
+- <em>Remote</em> <em>(EJB 3 Business Remote)</em>
+- <em>Local</em> <em>(EJB 3 Business Local)</em>
+- <em>Endpoint</em> <em>(EJB webservice endpoint)</em></p>
+
+<table>
+<tr></tr>
+ | interfaceType.annotationNameLC | This is the same as
+interfaceType.annotationName, but all in lower case.
+<tr></tr>
+</table>
+
+<p>| interfaceType.xmlName |  Following the ejb-jar.xml descriptor elements
+<home>, <local-home>, <business-remote>, <business-local>, and
+<service-endpoint>:
+- <em>home</em>  <em>(EJB 2 EJBHome)</em>
+- <em>local-home</em> <em>(EJB 2 EJBLocalHome)</em>
+- <em>business-remote</em> <em>(EJB 3 Business Remote)</em>
+- <em>business-local</em> <em>(EJB 3 Business Local)</em>
+- <em>service-endpoint</em> <em>(EJB webservice endpoint)</em>
+ | 
+ | interfaceType.xmlNameCc |  Camel-case version of interfaceType.xmlName:
+- <em>Home</em>  <em>(EJB 2 EJBHome)</em>
+- <em>LocalHome</em> <em>(EJB 2 EJBLocalHome)</em>
+- <em>BusinessRemote</em> <em>(EJB 3 Business Remote)</em>
+- <em>BusinessLocal</em> <em>(EJB 3 Business Local)</em>
+- <em>ServiceEndpoint</em> <em>(EJB webservice endpoint)</em> | 
+ | interfaceType.openejbLegacyName |  Following the OpenEJB 1.0 hard-coded
+format:
+- <em>(empty string)</em>  <em>(EJB 2 EJBHome)</em>
+- <em>Local</em> <em>(EJB 2 EJBLocalHome)</em>
+- <em>BusinessRemote</em> <em>(EJB 3 Business Remote)</em>
+- <em>BusinessLocal</em> <em>(EJB 3 Business Local)</em>
+- <em>ServiceEndpoint</em> <em>(EJB webservice endpoint)</em> | 
+ | interfaceClass |  - <em>(business)</em> for a class named
+<em>org.acme.superfun.WidgetRemote</em> results in
+<em>org.acme.superfun.WidgetRemote</em> 
+ - <em>(home)</em> for a class named <em>org.acme.superfun.WidgetHome</em> results in
+<em>org.acme.superfun.WidgetHome</em></p>
+
+<table>
+<tr></tr>
+ | interfaceClass.simpleName |  - _(business)_ for a class named
+_org.acme.superfun.WidgetRemote_ results in *WidgetRemote* 
+- _(home)_ for a class named _org.acme.superfun.WidgetHome_ results in
+*WidgetHome* | 
+ | interfaceClass.packageName |  for a class named
+_org.acme.superfun.WidgetRemote_ results in *org.acme.superfun* | 
+{excerpt}
+</table>
+
+<p><a name="JNDINames-SettingtheJNDIname"></a></p>
+
+<h1>Setting the JNDI name</h1>
+
+<p>It's possible to set the desired jndi name format for the whole server
+level, an ejb-jar, an ejb, an ejb's "local" interface
+(local/remote/local-home/home), and for an individual interface the ejb
+implements.  More specific jndi name formats act as an override to any more
+general formats.  The most specific format dictates the jndi name that will
+be used for any given interface of an ejb.  It's possible to specify a
+general format for your server, override it at an ejb level and override
+that further for a specific interface of that ejb.</p>
+
+<p><a name="JNDINames-ViaSystemproperty"></a></p>
+
+<h2>Via System property</h2>
+
+<p>The jndi name format can be set on a server level via a <em>system property</em>,
+for example:</p>
+
+<p>{panel:border=dotted}
+$ ./bin/openejb start
+"-Dopenejb.jndiname.format={ejbName}/{interfaceClass}"
+{panel}</p>
+
+<p>As usual, other ways of specifying system properties are via the
+conf/system.properties file in a standalone server, or via the
+InitialContext properties when embedded.</p>
+
+<p><a name="JNDINames-Viapropertiesintheopenejb-jar.xml"></a></p>
+
+<h2>Via properties in the openejb-jar.xml</h2>
+
+<p>It's possible to set the openejb.jndiname.format for an ejb-jar jar in a
+META-INF/openejb-jar.xml file as follows:</p>
+
+<pre><code>&lt;openejb-jar&gt;
+  &lt;properties&gt;
+     openejb.deploymentId.format = {ejbName}
+     openejb.jndiname.format = {deploymentId}{interfaceType.annotationName}
+  &lt;/properties&gt;
+&lt;/openejb-jar&gt;
+</code></pre>
+
+<p><a name="JNDINames-Viathe<jndi>tagforaspecificejb"></a></p>
+
+<h2>Via the <jndi> tag for a specific ejb</h2>
+
+<p>The following sets the name specifically for the interface
+org.superbiz.Foo.</p>
+
+<pre><code>&lt;openejb-jar&gt;
+  &lt;ejb-deployment ejb-name="FooBean"&gt;
+    &lt;jndi name="foo" interface="org.superbiz.Foo"/&gt;  
+  &lt;/ejb-deployment&gt;
+&lt;/openejb-jar&gt;
+</code></pre>
+
+<p>Or more generally...</p>
+
+<pre><code>&lt;openejb-jar&gt;
+  &lt;ejb-deployment ejb-name="FooBean"&gt;
+    &lt;jndi name="foo" interface="Remote"/&gt; 
+  &lt;/ejb-deployment&gt;
+&lt;/openejb-jar&gt;
+</code></pre>
+
+<p>Or more generally still...</p>
+
+<pre><code>&lt;openejb-jar&gt;
+  &lt;ejb-deployment ejb-name="FooBean"&gt;
+    &lt;jndi name="foo"/&gt; 
+  &lt;/ejb-deployment&gt;
+&lt;/openejb-jar&gt;
+</code></pre>
+
+<p>The 'name' attribute can still use templates if it likes, such as: </p>
+
+<pre><code>&lt;openejb-jar&gt;
+  &lt;ejb-deployment ejb-name="FooBean"&gt;
+    &lt;jndi name="ejb/{interfaceClass.simpleName}"
+</code></pre>
+
+<p>interface="org.superbiz.Foo"/> 
+      </ejb-deployment>
+    </openejb-jar></p>
+
+<p><a name="JNDINames-Multiple<jndi>tags"></a></p>
+
+<h3>Multiple <jndi> tags</h3>
+
+<p>Multiple <jndi> tags are allowed making it possible for you to be as
+specific as you need about the jndi name of each interface or each logical
+group of iterfaces (Local, Remote, LocalHome, RemoteHome).  </p>
+
+<p>Given an ejb, FooBean, with the following interfaces:
+ - business-local: org.superbiz.LocalOne
+ - business-local: org.superbiz.LocalTwo
+ - business-remote: org.superbiz.RemoteOne
+ - business-remote: org.superbiz.RemoteTwo
+ - home: org.superbiz.FooHome
+ - local-home: org.superbiz.FooLocalHome</p>
+
+<p>The following four examples would yield the same jndi names.  The intention
+with these examples is to show the various ways you can isolate specific
+interfaces or types of interfaces to gain more specific control on how they
+are named.</p>
+
+<p>{code:xml|title=#1}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <jndi name="LocalOne" interface="org.superbiz.LocalOne"/> 
+    <jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/> 
+    <jndi name="RemoteOne" interface="org.superbiz.RemoteOne"/> 
+    <jndi name="RemoteTwo" interface="org.superbiz.RemoteTwo"/> 
+    <jndi name="FooHome" interface="org.superbiz.FooHome"/> 
+    <jndi name="FooLocalHome" interface="org.superbiz.FooLocalHome"/> 
+  </ejb-deployment>
+</openejb-jar></p>
+
+<pre><code>{code:xml|title=#2}
+&lt;openejb-jar&gt;
+  &lt;ejb-deployment ejb-name="FooBean"&gt;
+    &lt;!-- applies to LocalOne and LocalTwo --&gt;
+    &lt;jndi name="{interfaceClass.simpleName}" interface="Local"/&gt; 
+
+    &lt;!-- applies to RemoteOne and RemoteTwo --&gt;
+    &lt;jndi name="{interfaceClass.simpleName}" interface="Remote"/&gt; 
+
+    &lt;!-- applies to FooHome --&gt;
+    &lt;jndi name="{interfaceClass.simpleName}" interface="RemoteHome"/&gt; 
+
+    &lt;!-- applies to FooLocalHome --&gt;
+    &lt;jndi name="{interfaceClass.simpleName}" interface="LocalHome"/&gt; 
+  &lt;/ejb-deployment&gt;
+&lt;/openejb-jar&gt;
+</code></pre>
+
+<p>{code:xml|title=#3}
+<openejb-jar>
+  <ejb-deployment ejb-name="FooBean">
+    <!-- applies to RemoteOne, RemoteTwo, FooHome, and FooLocalHome -->
+    <jndi name="{interfaceClass.simpleName}"/> </p>
+
+<pre><code>&lt;!-- these two would count as an override on the above format --&gt;
+&lt;jndi name="LocalOne" interface="org.superbiz.LocalOne"/&gt; 
+&lt;jndi name="LocalTwo" interface="org.superbiz.LocalTwo"/&gt; 
+</code></pre>
+
+<p></ejb-deployment>
+</openejb-jar></p>
+
+<pre><code>{code:xml|title=#4}
+&lt;openejb-jar&gt;
+  &lt;ejb-deployment ejb-name="FooBean"&gt;
+    &lt;!-- applies to LocalOne, LocalTwo, RemoteOne, RemoteTwo, FooHome, and
+</code></pre>
+
+<p>FooLocalHome -->
+        <jndi name="{interfaceClass.simpleName}"/> 
+      </ejb-deployment>
+    </openejb-jar></p>
+
+<p><a name="JNDINames-ChangingtheDefaultSetting"></a></p>
+
+<h1>Changing the Default Setting</h1>
+
+<p><em>You are responsible for ensuring the names don't conflict.</em>  </p>
+
+<p><a name="JNDINames-Conservativesettings"></a></p>
+
+<h3>Conservative settings</h3>
+
+<p>A very conservative setting such as "<em>{deploymentId}/{interfaceClass}</em>"
+would guarantee that each and every single interface is bound to JNDI.  If
+your bean had a legacy EJBObject interface, three business remote
+interfaces, and two business local interfaces, this pattern would result in
+<em>six</em> proxies bound into JNDI.</p>
+
+<p>Similarly conservative settings would be:
+ - <em>{deploymentId}/{interfaceClass.simpleName}</em>
+ - <em>{moduleId}/{ejbName}/{interfaceClass}</em>
+ - <em>{ejbName}/{interfaceClass}</em>
+ - <em>{moduleId}/{ejbClass}/{interfaceClass}</em>
+ - <em>{ejbClass}/{interfaceClass}</em>
+ - <em>{ejbClass}/{interfaceClass.simpleName}</em>
+ - <em>{ejbClass.simpleName}/{interfaceClass.simpleName}</em>
+ - <em>{interfaceClass}/{ejbName}</em></p>
+
+<p>Bordeline optimistic:
+ - <em>{moduleId}/{interfaceClass}</em>
+ - <em>{interfaceClass}</em></p>
+
+<p>The above two settings would work if you the interface wasn't shared by
+other beans.</p>
+
+<p><a name="JNDINames-Pragmaticsettings"></a></p>
+
+<h3>Pragmatic settings</h3>
+
+<p>A more middle ground setting such as
+"<em>{deploymentId}{interfaceType.annotationName}</em>" would guarantee that at
+least one proxy of each interface type is bound to JNDI.  If your bean had
+a legacy EJBObject interface, three business remote interfaces, and two
+business local interfaces, this pattern would result in <em>three</em> proxies
+bound into JNDI: one proxy dedicated to your EJBObject interface; one proxy
+implementing all three business remote interfaces; one proxy implementing
+the two business local interfaces.</p>
+
+<p>Similarly pragmatic settings would be:
+ - <em>{moduleId}/{ejbClass}/{interfaceType.annotationName}</em>
+ - <em>{ejbClass}/{interfaceType.xmlName}</em>
+ - <em>{ejbClass.simpleName}/{interfaceType.xmlNameCc}</em>
+ - <em>{interfaceType}/{ejbName}</em>
+ - <em>{interfaceType}/{ejbClass}</em></p>
+
+<p><a name="JNDINames-Optimisticsettings"></a></p>
+
+<h3>Optimistic settings</h3>
+
+<p>A very optimistic setting such as "<em>{deploymentId}</em>" would guarantee only
+one proxy for the bean will be bound to JNDI.  This would be fine if you
+knew you only had one type of interface in your beans.  For example, only
+business remote interfaces, or only business local interfaces, or only an
+EJBObject interface, or only an EJBLocalObject interface.</p>
+
+<p>If a bean in the app did have more than one interface type, one business
+local and one business remote for example, by default OpenEJB will reject
+the app when it detects that it cannot bind the second interface.  This
+strict behavior can be disabled by setting the
+<em>openejb.jndiname.failoncollision</em> system property to <em>false</em>.  When this
+property is set to false, we will simply log an error that the second proxy
+cannot be bound to JNDI, tell you which ejb is using that name, and
+continue loading your app.</p>
+
+<p>Similarly optimistic settings would be:
+ - <em>{ejbName}</em>
+ - <em>{ejbClass}</em>
+ - <em>{ejbClass.simpleName}</em>
+ - <em>{moduleId}/{ejbClass.simpleName}</em>
+ - <em>{moduleId}/{ejbName}</em></p>
+
+<p><a name="JNDINames-AdvancedDetailsonEJB3.0BusinessProxies(thesimplepart)"></a></p>
+
+<h1>Advanced Details on EJB 3.0 Business Proxies (the simple part)</h1>
+
+<p>If you implement your business interfaces, your life is simple as your
+proxies will also implement your business interfaces of the same type. 
+Meaning any proxy OpenEJB creates for a business local interface will also
+implement your other business local interfaces.  Similarly, any proxy
+OpenEJB creates for a business remote interface will also implement your
+other business remote interfaces.</p>
+
+<p><a name="JNDINames-AdvancedDetailsonEJB3.0BusinessProxies(thecomplicatedpart)"></a></p>
+
+<h1>Advanced Details on EJB 3.0 Business Proxies (the complicated part)</h1>
+
+<p>{info:Who should read?}
+Read this section of either of these two apply to you:
+ - You do not implement your business interfaces in your bean class
+ - One or more of your business remote interfaces extend from
+javax.rmi.Remote</p>
+
+<p>If neither of these two items describe your apps, then there is no need to
+read further.  Go have fun.
+{info}
+<a name="JNDINames-Notimplementingbusinessinterfaces"></a></p>
+
+<h3>Not implementing business interfaces</h3>
+
+<p>If you do not implement your business interfaces it may not be possible for
+us to implement all your business interfaces in a single interface. 
+Conflicts in the throws clauses and the return values can occur as detailed <a href="openejb:multiple-business-interface-hazzards.html">here</a>
+.  When creating a proxy for an interface we will detect and remove any
+other business interfaces that would conflict with the main interface.</p>
+
+<p><a name="JNDINames-Businessinterfacesextendingjavax.rmi.Remote"></a></p>
+
+<h3>Business interfaces extending javax.rmi.Remote</h3>
+
+<p>Per spec rules many runtime exceptions (container or connection related)
+are thrown from javax.rmi.Remote proxies as java.rmi.RemoteException which
+is not a runtime exception and must be throwable via the proxy as a checked
+exception. The issue is that conflicting throws clauses are actually
+removed for two interfaces sharing the same method signature.  For example
+two methods such as these:
+ - InterfaceA: void doIt() throws Foo;
+ - InterfaceB: void doIt() throws RemoteException;</p>
+
+<p>can be implemented by trimming out the conflicting throws clauses as
+follows:
+  - Implementation: void doIt(){}</p>
+
+<p>This is fine for a bean class as it does not need to throw the RMI required
+javax.rmi.RemoteException. However if we create a proxy from these two
+interfaces it will also wind up with a 'doIt(){}' method that cannot throw
+javax.rmi.RemoteException.  This is very bad as the container does need to
+throw RemoteException to any business interfaces extending java.rmi.Remote
+for any container related issues or connection issues.  If the container
+attempts to throw a RemoteException from the proxies 'doIt(){}' method, it
+will result in an UndeclaredThrowableException thrown by the VM.</p>
+
+<p>The only way to guarantee the proxy has the 'doIt() throws RemoteException
+{}' method of InterfaceB is to cut out InterfaceA when we create the proxy
+dedicated to InterfaceB.
+{excerpt}</p>
+
+        </div> <!-- lucy-main_content_box --> 
+        <div class="clear"></div>
+
+      </div> <!-- lucy-main_content -->
+
+      <div id="lucy-copyright" class="container_16">
+        <p>Copyright &#169; 2010-2011 The Apache Software Foundation, Licensed under the 
+           <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+           <br/>
+          
+        </p>
+      </div> <!-- lucy-copyright -->
+
+    </div> <!-- lucy-rigid_wrapper -->
+
+  </body>
+</html>

Added: websites/staging/openejb/trunk/content/jpa-concepts.cwiki
==============================================================================
--- websites/staging/openejb/trunk/content/jpa-concepts.cwiki (added)
+++ websites/staging/openejb/trunk/content/jpa-concepts.cwiki Sun Jul 10 05:37:04 2011
@@ -0,0 +1,142 @@
+h1. JPA 101
+
+If there's one thing you have to understand to successfully use JPA (Java Persistence API) it's the concept of a *Cache*.  Almost everything boils down to the Cache at one point or another.  Unfortunately the Cache is an internal thing and not exposed via the JPA API classes, so it not easy to touch or feel from a coding perspective.
+
+Here's a quick cheat sheet of the JPA world:
+
+ - A *Cache* is a *copy of data*, copy meaning pulled from but living outside the database.
+ - *Flushing* a Cache is the act of putting modified data back into the database.
+ - A *PersistenceContext* is essentially a Cache. It also tends to have it's own non-shared database connection.
+ - An *EntityManager* represents a PersistenceContext (and therefore a Cache)
+ - An *EntityManagerFactory* creates an EntityManager (and therefore a PersistenceContext/Cache)
+
+
+ - With <persistence-unit transaction-type="*RESOURCE_LOCAL*"> *you* are responsible for EntityManager (PersistenceContext/Cache) creating and tracking...
+    -- You *must* use the *EntityManagerFactory* to get an EntityManager
+    -- The resulting *EntityManager* instance *is* a PersistenceContext/Cache
+    -- An *EntityManagerFactory* can be injected via the *@PersistenceUnit* annotation only (not @PersistenceContext)
+    -- You are *not* allowed to use @PersistenceContext to refer to a unit of type RESOURCE_LOCAL
+    -- You *must* use the *EntityTransaction* API to begin/commit around *every* call to your EntityManger
+    -- Calling entityManagerFactory.createEntityManager() twice results in *two* separate EntityManager instances and therefor *two* separate PersistenceContexts/Caches.
+    -- It is *almost never* a good idea to have more than one *instance* of an EntityManager in use (don't create a second one unless you've destroyed the first)
+
+
+ - With <persistence-unit transaction-type="*TRANSACTION*"> the *container* will do EntityManager (PersistenceContext/Cache) creating and tracking...
+    -- You *cannot* use the *EntityManagerFactory* to get an EntityManager
+    -- You can only get an *EntityManager* supplied by the *container*
+    -- An *EntityManager* can be injected via the *@PersistenceContext* annotation only (not @PersistenceUnit)
+    -- You are *not* allowed to use @PersistenceUnit to refer to a unit of type TRANSACTION
+    -- The *EntityManager* given by the container is a *reference* to the PersistenceContext/Cache associated with a JTA Transaction.
+    -- If no JTA transaction is in progress, the EntityManager *cannot be used* because there is no PersistenceContext/Cache.
+    -- Everyone with an EntityManager reference to the *same unit* in the *same transaction* will automatically have a reference to the *same PersistenceContext/Cache*
+    -- The PersistenceContext/Cache is *flushed* and cleared at JTA *commit* time
+
+h1.  Cache == PersistenceContext
+
+The concept of a database cache is an extremely important concept to be aware of.  Without a copy of the data in memory (i.e. a cache) when you call account.getBalance() the persistence provider would have to go read the value from the database.  Calling account.getBalance() several times would cause several trips to the database.  This would obviously be a big waste of resources.  The other side of having a cache is that when you call account.setBalance(5000) it also doesn't hit the database (usually).  When the cache is "flushed" the data in it is sent to the database via as many SQL updates, inserts and deletes as are required.  That is the basics of java persistence of any kind all wrapped in a nutshell.  If you can understand that, you're good to go in nearly any persistence technology java has to offer.
+
+Complications can arise when there is more than one PersistenceContext/Cache relating the same data in the same transaction.  In any given transaction you want exactly one PersistenceContext/Cache for a given set of data.  Using a TRANSACTION unit with an EntityManager created by the container will always guarantee that this is the case.  With a RESOURCE_LOCAL unit and an EntityManagerFactory you should create and use exactly one EntityManager instance in your transaction to ensure there is only one active PersistenceContext/Cache for the given set of data active against the current transaction.
+
+h1. Caches and Detaching
+
+Detaching is the concept of a persistent object *leaving* the PersistenceContext/Cache.  Leaving means that any updates made to the object are *not* reflected in the PersistenceContext/Cache.  An object will become Detached if it somehow *lives longer* or is *used outside* the scope of the PersistenceContext/Cache.  
+
+For a TRANSACTION unit, the PersistenceContext/Cache will live as long as the transaction does.  When a transaction completes (commits or rollsback) all objects that were in the PersistenceContext/Cache are Detached.  You can still use them, but they are no longer associated with a PersistenceContext/Cache and modifications on them will *not* be reflected in a PersistenceContext/Cache and therefore not the database either.
+
+Serializing objects that are currently in a PersistenceContext/Cache will also cause them to Detach.
+
+In some cases objects or collections of objects that become Detached may not have all the data you need.  This can be because of lazy loading.  With lazy loading, data isn't pulled from the database and into the PersistenceContext/Cache until it is requested in code.  In many cases the Collections of persistent objects returned from an javax.persistence.Query.getResultList() call are completely empty until you iterate over them.  A side effect of this is that if the Collection becomes Detached before it's been fully read it will be permanently empty and of no use and calling methods on the Detached Collection can cause strange errors and exceptions to be thrown.  If you wish to Detach a Collection of persistent objects it is always a good idea to iterate over the Collection at least once.
+
+You *cannot* call EntityManager.persist() or EntityManager.remove() on a Detached object.
+
+Calling EntityManager.merge() will re-attach a Detached object.
+
+h1.  Valid RESOURCE_LOCAL Unit usage
+
+Servlets and EJBs can use RESOURCE_LOCAL persistence units through the EntityManagerFactory as follows:
+
+{code:xml=persistence.xml}
+<?xml version="1.0" encoding="UTF-8" ?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+  <!-- Tutorial "unit" -->
+  <persistence-unit name="Tutorial" transaction-type="RESOURCE_LOCAL">
+    <non-jta-data-source>myNonJtaDataSource</non-jta-data-source>
+    <class>org.superbiz.jpa.Account</class>
+  </persistence-unit>
+	
+</persistence>
+{code}
+
+{code}
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+import javax.persistence.PersistenceUnit;
+
+public class MyEjbOrServlet ... {
+
+    @PersistenceUnit(unitName="Tutorial")
+    private EntityManagerFactory factory;
+
+    // Proper exception handling left out for simplicity
+    public void ejbMethodOrServletServiceMethod() throws Exception {
+        EntityManager entityManager = factory.createEntityManager();
+
+        EntityTransaction entityTransaction = entityManager.getTransaction();
+        
+        entityTransaction.begin();
+
+        Account account = entityManager.find(Account.class, 12345);
+        
+        account.setBalance(5000);
+
+        entityTransaction.commit();
+    }
+    
+    ...
+}
+{code}
+
+h1.  Valid TRANSACTION Unit usage
+
+EJBs can use TRANSACTION persistence units through the EntityManager as follows:
+
+{code:xml=persistence.xml}
+<?xml version="1.0" encoding="UTF-8" ?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+  <!-- Tutorial "unit" -->
+  <persistence-unit name="Tutorial" transaction-type="TRANSACTION">
+    <jta-data-source>myJtaDataSource</jta-data-source>
+    <non-jta-data-source>myNonJtaDataSource</non-jta-data-source>
+    <class>org.superbiz.jpa.Account</class>
+  </persistence-unit>
+	
+</persistence>
+{code}
+
+{code}
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@Stateless
+public class MyEjb implements MyEjbInterface {
+
+    @PersistenceContext(unitName = "Tutorial")
+    private EntityManager entityManager;
+
+    // Proper exception handling left out for simplicity
+    @TransactionAttribute(TransactionAttributeType.REQUIRED)
+    public void ejbMethod() throws Exception {
+
+        Account account = entityManager.find(Account.class, 12345);
+
+        account.setBalance(5000);
+
+    }
+}
+{code}
\ No newline at end of file

Added: websites/staging/openejb/trunk/content/jpa-concepts.html
==============================================================================
--- websites/staging/openejb/trunk/content/jpa-concepts.html (added)
+++ websites/staging/openejb/trunk/content/jpa-concepts.html Sun Jul 10 05:37:04 2011
@@ -0,0 +1,309 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>JPA Concepts</title>
+    <link rel="stylesheet" type="text/css" media="screen" href="http://incubator.apache.org/lucy/css/lucy.css">
+  </head>
+
+  <body>
+
+    <div id="lucy-rigid_wrapper">
+
+      <div id="lucy-top" class="container_16 lucy-white_box_3d">
+
+        <div id="lucy-logo_box" class="grid_8">
+          <a href="/OpenEJB/"><img src="http://openejb.apache.org/images/logo_openejb.gif" alt="Apache OpenEJB™"></a>
+        </div> <!-- lucy-logo_box -->
+
+        <div #id="lucy-top_nav_box" class="grid_8">
+          <div id="lucy-top_nav_bar" class="container_8">
+            <ul>
+              <li><a href="http://www.apache.org/" title="Apache Software Foundation">Apache Software Foundation</a></li>
+              <li><a href="http://www.apache.org/licenses/" title="License">License</a></li>
+              <li><a href="http://www.apache.org/foundation/sponsorship.html" title="Sponsorship">Sponsorship</a></li>
+              <li><a href="http://www.apache.org/foundation/thanks.html" title="Thanks">Thanks</a></li>
+              <li><a href="http://www.apache.org/security/ " title="Security">Security</a></li>
+            </ul>
+          </div> <!-- lucy-top_nav_bar -->
+          <p><a href="http://www.apache.org/">Apache</a>&nbsp;&raquo&nbsp;<a href="/">Incubator</a></p>
+          <form name="lucy-top_search_box" id="lucy-top_search_box" action="http://www.google.com/search" method="get">
+            <input value="*.apache.org" name="sitesearch" type="hidden"/>
+            <input type="text" name="q" id="query" style="width:85%">
+            <input type="submit" id="submit" value="Search">
+          </form>
+        </div> <!-- lucy-top_nav_box -->
+
+        <div class="clear"></div>
+
+      </div> <!-- lucy-top -->
+
+      <div id="lucy-main_content" class="container_16 lucy-white_box_3d">
+
+        <div class="grid_4" id="lucy-left_nav_box">
+          <h6>About</h6>
+            <ul>
+              <li><a href="/lucy/">Welcome</a></li>
+              <li><a href="/lucy/faq.html">FAQ</a></li>
+              <li><a href="/lucy/people.html">People</a></li>
+            </ul>
+          <h6>Resources</h6>
+            <ul>
+              <li><a href="/lucy/download.html">Download</a></li>
+              <li><a href="/lucy/mailing_lists.html">Mailing Lists</a></li>
+              <li><a href="/lucy/docs/perl/">Documentation</a></li>
+              <li><a href="http://wiki.apache.org/lucy/">Wiki</a></li>
+              <li><a href="https://issues.apache.org/jira/browse/LUCY">Issue Tracker</a></li>
+              <li><a href="/lucy/version_control.html">Version Control</a></li>
+            </ul>
+          <h6>Related Projects</h6>
+            <ul>
+              <li><a href="http://lucene.apache.org/java/">Lucene</a></li>
+              <li><a href="http://lucene.apache.org/solr/">Solr</a></li>
+              <li><a href="http://incubator.apache.org/lucene.net/">Lucene.NET</a></li>
+              <li><a href="http://lucene.apache.org/pylucene/">PyLucene</a></li>
+              <li><a href="http://lucene.apache.org/openrelevance/">Open Relevance</a></li>
+            </ul>
+        </div> <!-- lucy-left_nav_box -->
+
+        <div id="lucy-main_content_box" class="grid_9">
+          <p><a name="JPAConcepts-JPA101"></a></p>
+
+<h1>JPA 101</h1>
+
+<p>If there's one thing you have to understand to successfully use JPA (Java
+Persistence API) it's the concept of a <em>Cache</em>.  Almost everything boils
+down to the Cache at one point or another.  Unfortunately the Cache is an
+internal thing and not exposed via the JPA API classes, so it not easy to
+touch or feel from a coding perspective.</p>
+
+<p>Here's a quick cheat sheet of the JPA world:</p>
+
+<ul>
+<li>A <em>Cache</em> is a <em>copy of data</em>, copy meaning pulled from but living
+outside the database.</li>
+<li><em>Flushing</em> a Cache is the act of putting modified data back into the
+database.</li>
+<li>A <em>PersistenceContext</em> is essentially a Cache. It also tends to have
+it's own non-shared database connection.</li>
+<li>An <em>EntityManager</em> represents a PersistenceContext (and therefore a
+Cache)</li>
+<li><p>An <em>EntityManagerFactory</em> creates an EntityManager (and therefore a
+PersistenceContext/Cache)</p></li>
+<li><p>With <persistence-unit transaction-type="*RESOURCE_LOCAL*"> <em>you</em> are
+responsible for EntityManager (PersistenceContext/Cache) creating and
+tracking...
+-- You <em>must</em> use the <em>EntityManagerFactory</em> to get an EntityManager
+-- The resulting <em>EntityManager</em> instance <em>is</em> a
+PersistenceContext/Cache
+-- An <em>EntityManagerFactory</em> can be injected via the <em>@PersistenceUnit</em>
+annotation only (not @PersistenceContext)
+-- You are <em>not</em> allowed to use @PersistenceContext to refer to a unit
+of type RESOURCE_LOCAL
+-- You <em>must</em> use the <em>EntityTransaction</em> API to begin/commit around
+<em>every</em> call to your EntityManger
+-- Calling entityManagerFactory.createEntityManager() twice results in
+<em>two</em> separate EntityManager instances and therefor <em>two</em> separate
+PersistenceContexts/Caches.
+-- It is <em>almost never</em> a good idea to have more than one <em>instance</em> of
+an EntityManager in use (don't create a second one unless you've destroyed
+the first)</p></li>
+<li><p>With <persistence-unit transaction-type="*TRANSACTION*"> the <em>container</em>
+will do EntityManager (PersistenceContext/Cache) creating and tracking...
+-- You <em>cannot</em> use the <em>EntityManagerFactory</em> to get an EntityManager
+-- You can only get an <em>EntityManager</em> supplied by the <em>container</em>
+-- An <em>EntityManager</em> can be injected via the <em>@PersistenceContext</em>
+annotation only (not @PersistenceUnit)
+-- You are <em>not</em> allowed to use @PersistenceUnit to refer to a unit of
+type TRANSACTION
+-- The <em>EntityManager</em> given by the container is a <em>reference</em> to the
+PersistenceContext/Cache associated with a JTA Transaction.
+-- If no JTA transaction is in progress, the EntityManager <em>cannot be
+used</em> because there is no PersistenceContext/Cache.
+-- Everyone with an EntityManager reference to the <em>same unit</em> in the
+<em>same transaction</em> will automatically have a reference to the <em>same
+PersistenceContext/Cache</em>
+-- The PersistenceContext/Cache is <em>flushed</em> and cleared at JTA
+<em>commit</em> time</p></li>
+</ul>
+
+<p><a name="JPAConcepts-Cache==PersistenceContext"></a></p>
+
+<h1>Cache == PersistenceContext</h1>
+
+<p>The concept of a database cache is an extremely important concept to be
+aware of.  Without a copy of the data in memory (i.e. a cache) when you
+call account.getBalance() the persistence provider would have to go read
+the value from the database.  Calling account.getBalance() several times
+would cause several trips to the database.  This would obviously be a big
+waste of resources.  The other side of having a cache is that when you call
+account.setBalance(5000) it also doesn't hit the database (usually).  When
+the cache is "flushed" the data in it is sent to the database via as many
+SQL updates, inserts and deletes as are required.  That is the basics of
+java persistence of any kind all wrapped in a nutshell.  If you can
+understand that, you're good to go in nearly any persistence technology
+java has to offer.</p>
+
+<p>Complications can arise when there is more than one
+PersistenceContext/Cache relating the same data in the same transaction. 
+In any given transaction you want exactly one PersistenceContext/Cache for
+a given set of data.  Using a TRANSACTION unit with an EntityManager
+created by the container will always guarantee that this is the case.  With
+a RESOURCE_LOCAL unit and an EntityManagerFactory you should create and use
+exactly one EntityManager instance in your transaction to ensure there is
+only one active PersistenceContext/Cache for the given set of data active
+against the current transaction.</p>
+
+<p><a name="JPAConcepts-CachesandDetaching"></a></p>
+
+<h1>Caches and Detaching</h1>
+
+<p>Detaching is the concept of a persistent object <em>leaving</em> the
+PersistenceContext/Cache.  Leaving means that any updates made to the
+object are <em>not</em> reflected in the PersistenceContext/Cache.  An object will
+become Detached if it somehow <em>lives longer</em> or is <em>used outside</em> the scope
+of the PersistenceContext/Cache.  </p>
+
+<p>For a TRANSACTION unit, the PersistenceContext/Cache will live as long as
+the transaction does.  When a transaction completes (commits or rollsback)
+all objects that were in the PersistenceContext/Cache are Detached.  You
+can still use them, but they are no longer associated with a
+PersistenceContext/Cache and modifications on them will <em>not</em> be reflected
+in a PersistenceContext/Cache and therefore not the database either.</p>
+
+<p>Serializing objects that are currently in a PersistenceContext/Cache will
+also cause them to Detach.</p>
+
+<p>In some cases objects or collections of objects that become Detached may
+not have all the data you need.  This can be because of lazy loading.  With
+lazy loading, data isn't pulled from the database and into the
+PersistenceContext/Cache until it is requested in code.  In many cases the
+Collections of persistent objects returned from an
+javax.persistence.Query.getResultList() call are completely empty until you
+iterate over them.  A side effect of this is that if the Collection becomes
+Detached before it's been fully read it will be permanently empty and of no
+use and calling methods on the Detached Collection can cause strange errors
+and exceptions to be thrown.  If you wish to Detach a Collection of
+persistent objects it is always a good idea to iterate over the Collection
+at least once.</p>
+
+<p>You <em>cannot</em> call EntityManager.persist() or EntityManager.remove() on a
+Detached object.</p>
+
+<p>Calling EntityManager.merge() will re-attach a Detached object.</p>
+
+<p><a name="JPAConcepts-ValidRESOURCE_LOCALUnitusage"></a></p>
+
+<h1>Valid RESOURCE_LOCAL Unit usage</h1>
+
+<p>Servlets and EJBs can use RESOURCE_LOCAL persistence units through the
+EntityManagerFactory as follows:</p>
+
+<p>{code:xml=persistence.xml}
+<?xml version="1.0" encoding="UTF-8" ?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"></p>
+
+<p><!-- Tutorial "unit" -->
+  <persistence-unit name="Tutorial" transaction-type="RESOURCE_LOCAL">
+    <non-jta-data-source>myNonJtaDataSource</non-jta-data-source>
+    <class>org.superbiz.jpa.Account</class>
+  </persistence-unit></p>
+
+<p></persistence></p>
+
+<p>import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+import javax.persistence.PersistenceUnit;</p>
+
+<p>public class MyEjbOrServlet ... {</p>
+
+<pre><code>@PersistenceUnit(unitName="Tutorial")
+private EntityManagerFactory factory;
+
+// Proper exception handling left out for simplicity
+public void ejbMethodOrServletServiceMethod() throws Exception {
+EntityManager entityManager = factory.createEntityManager();
+
+EntityTransaction entityTransaction =
+</code></pre>
+
+<p>entityManager.getTransaction();</p>
+
+<pre><code>entityTransaction.begin();
+
+Account account = entityManager.find(Account.class, 12345);
+
+account.setBalance(5000);
+
+entityTransaction.commit();
+}
+
+...
+</code></pre>
+
+<p>}</p>
+
+<pre><code>h1.  Valid TRANSACTION Unit usage
+
+EJBs can use TRANSACTION persistence units through the EntityManager as
+</code></pre>
+
+<p>follows:</p>
+
+<pre><code>{code:xml=persistence.xml}
+&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"&gt;
+
+  &lt;!-- Tutorial "unit" --&gt;
+  &lt;persistence-unit name="Tutorial" transaction-type="TRANSACTION"&gt;
+    &lt;jta-data-source&gt;myJtaDataSource&lt;/jta-data-source&gt;
+    &lt;non-jta-data-source&gt;myNonJtaDataSource&lt;/non-jta-data-source&gt;
+    &lt;class&gt;org.superbiz.jpa.Account&lt;/class&gt;
+  &lt;/persistence-unit&gt;
+
+&lt;/persistence&gt;
+
+
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@Stateless
+public class MyEjb implements MyEjbInterface {
+
+    @PersistenceContext(unitName = "Tutorial")
+    private EntityManager entityManager;
+
+    // Proper exception handling left out for simplicity
+    @TransactionAttribute(TransactionAttributeType.REQUIRED)
+    public void ejbMethod() throws Exception {
+
+    Account account = entityManager.find(Account.class, 12345);
+
+    account.setBalance(5000);
+
+    }
+}
+</code></pre>
+
+        </div> <!-- lucy-main_content_box --> 
+        <div class="clear"></div>
+
+      </div> <!-- lucy-main_content -->
+
+      <div id="lucy-copyright" class="container_16">
+        <p>Copyright &#169; 2010-2011 The Apache Software Foundation, Licensed under the 
+           <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+           <br/>
+          
+        </p>
+      </div> <!-- lucy-copyright -->
+
+    </div> <!-- lucy-rigid_wrapper -->
+
+  </body>
+</html>

Added: websites/staging/openejb/trunk/content/jpa-usage.cwiki
==============================================================================
--- websites/staging/openejb/trunk/content/jpa-usage.cwiki (added)
+++ websites/staging/openejb/trunk/content/jpa-usage.cwiki Sun Jul 10 05:37:04 2011
@@ -0,0 +1,23 @@
+h1. Things to watch out for
+
+h2. Critical: Always set jta-data-source and non-jta-data-source
+
+Always set the value of jta-data-source and non-jta-data-source in your persistence.xml file.  Regardless if targeting your EntityManager usage for transaction-type="RESOURCE_LOCAL" or transaction-type="TRANSACTION", it's very difficult to guarantee one or the other will be the only one needed.  Often times the JPA Provider itself will require both internally to do various optimizations or other special features.  
+
+* The *jta-data-source* should always have it's OpenEJB-specific '*JtaManaged*' property set to '*true*'  (this is the default)
+* The *non-jta-data-source* should always have it's OpenEJB-specific '*JtaManaged*' property set to '*false*'.
+
+See [Containers and Resources] for how to configure 'JtaManaged' and a full list of <Resource> properties for DataSources.
+
+h2. Be detach aware
+
+A warning for any new JPA user is by default all objects will detach at the end of a transaction.  People typically discover this when the go to remove or update an object they fetched previously and get an exception like "You cannot perform operation delete on detached object".
+
+All ejb methods start a transaction unless a) you [configure them otherwise|Transaction Annotations], or b) the caller already has a transaction in progress when it calls the bean.  If you're in a test case or a servlet, it's most likely B that is biting you.  You're asking an ejb for some persistent objects, it uses the EntityManager in the scope of the transaction started around it's method and returns some persistent objects, by the time you get them the transaction has completed and now the objects are detached.
+
+h3. Solutions
+ # Call EntityManager.merge(..) inside the bean code to reattach your object.
+ # Use PersistenceContextType.EXTENDED as in '@PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.EXTENDED)' for EntityManager refs instead of the default of PersistenceContextType.TRANSACTION.
+ # If testing, use a technique to execute transactions in your test code.  That's described here in [Unit testing transactions]
+
+

Added: websites/staging/openejb/trunk/content/jpa-usage.html
==============================================================================
--- websites/staging/openejb/trunk/content/jpa-usage.html (added)
+++ websites/staging/openejb/trunk/content/jpa-usage.html Sun Jul 10 05:37:04 2011
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>JPA Usage</title>
+    <link rel="stylesheet" type="text/css" media="screen" href="http://incubator.apache.org/lucy/css/lucy.css">
+  </head>
+
+  <body>
+
+    <div id="lucy-rigid_wrapper">
+
+      <div id="lucy-top" class="container_16 lucy-white_box_3d">
+
+        <div id="lucy-logo_box" class="grid_8">
+          <a href="/OpenEJB/"><img src="http://openejb.apache.org/images/logo_openejb.gif" alt="Apache OpenEJB™"></a>
+        </div> <!-- lucy-logo_box -->
+
+        <div #id="lucy-top_nav_box" class="grid_8">
+          <div id="lucy-top_nav_bar" class="container_8">
+            <ul>
+              <li><a href="http://www.apache.org/" title="Apache Software Foundation">Apache Software Foundation</a></li>
+              <li><a href="http://www.apache.org/licenses/" title="License">License</a></li>
+              <li><a href="http://www.apache.org/foundation/sponsorship.html" title="Sponsorship">Sponsorship</a></li>
+              <li><a href="http://www.apache.org/foundation/thanks.html" title="Thanks">Thanks</a></li>
+              <li><a href="http://www.apache.org/security/ " title="Security">Security</a></li>
+            </ul>
+          </div> <!-- lucy-top_nav_bar -->
+          <p><a href="http://www.apache.org/">Apache</a>&nbsp;&raquo&nbsp;<a href="/">Incubator</a></p>
+          <form name="lucy-top_search_box" id="lucy-top_search_box" action="http://www.google.com/search" method="get">
+            <input value="*.apache.org" name="sitesearch" type="hidden"/>
+            <input type="text" name="q" id="query" style="width:85%">
+            <input type="submit" id="submit" value="Search">
+          </form>
+        </div> <!-- lucy-top_nav_box -->
+
+        <div class="clear"></div>
+
+      </div> <!-- lucy-top -->
+
+      <div id="lucy-main_content" class="container_16 lucy-white_box_3d">
+
+        <div class="grid_4" id="lucy-left_nav_box">
+          <h6>About</h6>
+            <ul>
+              <li><a href="/lucy/">Welcome</a></li>
+              <li><a href="/lucy/faq.html">FAQ</a></li>
+              <li><a href="/lucy/people.html">People</a></li>
+            </ul>
+          <h6>Resources</h6>
+            <ul>
+              <li><a href="/lucy/download.html">Download</a></li>
+              <li><a href="/lucy/mailing_lists.html">Mailing Lists</a></li>
+              <li><a href="/lucy/docs/perl/">Documentation</a></li>
+              <li><a href="http://wiki.apache.org/lucy/">Wiki</a></li>
+              <li><a href="https://issues.apache.org/jira/browse/LUCY">Issue Tracker</a></li>
+              <li><a href="/lucy/version_control.html">Version Control</a></li>
+            </ul>
+          <h6>Related Projects</h6>
+            <ul>
+              <li><a href="http://lucene.apache.org/java/">Lucene</a></li>
+              <li><a href="http://lucene.apache.org/solr/">Solr</a></li>
+              <li><a href="http://incubator.apache.org/lucene.net/">Lucene.NET</a></li>
+              <li><a href="http://lucene.apache.org/pylucene/">PyLucene</a></li>
+              <li><a href="http://lucene.apache.org/openrelevance/">Open Relevance</a></li>
+            </ul>
+        </div> <!-- lucy-left_nav_box -->
+
+        <div id="lucy-main_content_box" class="grid_9">
+          <p><a name="JPAUsage-Thingstowatchoutfor"></a></p>
+
+<h1>Things to watch out for</h1>
+
+<p><a name="JPAUsage-Critical:Alwayssetjta-data-sourceandnon-jta-data-source"></a></p>
+
+<h2>Critical: Always set jta-data-source and non-jta-data-source</h2>
+
+<p>Always set the value of jta-data-source and non-jta-data-source in your
+persistence.xml file.  Regardless if targeting your EntityManager usage for
+transaction-type="RESOURCE_LOCAL" or transaction-type="TRANSACTION", it's
+very difficult to guarantee one or the other will be the only one needed. 
+Often times the JPA Provider itself will require both internally to do
+various optimizations or other special features.  </p>
+
+<ul>
+<li>The <em>jta-data-source</em> should always have it's OpenEJB-specific
+'<em>JtaManaged</em>' property set to '<em>true</em>'  (this is the default)</li>
+<li>The <em>non-jta-data-source</em> should always have it's OpenEJB-specific
+'<em>JtaManaged</em>' property set to '<em>false</em>'.</li>
+</ul>
+
+<p>See <a href="containers-and-resources.html">Containers and Resources</a>
+ for how to configure 'JtaManaged' and a full list of <Resource> properties
+for DataSources.</p>
+
+<p><a name="JPAUsage-Bedetachaware"></a></p>
+
+<h2>Be detach aware</h2>
+
+<p>A warning for any new JPA user is by default all objects will detach at the
+end of a transaction.  People typically discover this when the go to remove
+or update an object they fetched previously and get an exception like "You
+cannot perform operation delete on detached object".</p>
+
+<p>All ejb methods start a transaction unless a) you <a href="transaction-annotations.html">configure them otherwise</a>
+, or b) the caller already has a transaction in progress when it calls the
+bean.  If you're in a test case or a servlet, it's most likely B that is
+biting you.  You're asking an ejb for some persistent objects, it uses the
+EntityManager in the scope of the transaction started around it's method
+and returns some persistent objects, by the time you get them the
+transaction has completed and now the objects are detached.</p>
+
+<p><a name="JPAUsage-Solutions"></a></p>
+
+<h3>Solutions</h3>
+
+<ol>
+<li>Call EntityManager.merge(..) inside the bean code to reattach your
+object.</li>
+<li>Use PersistenceContextType.EXTENDED as in '@PersistenceContext(unitName
+= "movie-unit", type = PersistenceContextType.EXTENDED)' for EntityManager
+refs instead of the default of PersistenceContextType.TRANSACTION.</li>
+<li>If testing, use a technique to execute transactions in your test code. 
+That's described here in <a href="unit-testing-transactions.html">Unit testing transactions</a></li>
+</ol>
+
+        </div> <!-- lucy-main_content_box --> 
+        <div class="clear"></div>
+
+      </div> <!-- lucy-main_content -->
+
+      <div id="lucy-copyright" class="container_16">
+        <p>Copyright &#169; 2010-2011 The Apache Software Foundation, Licensed under the 
+           <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+           <br/>
+          
+        </p>
+      </div> <!-- lucy-copyright -->
+
+    </div> <!-- lucy-rigid_wrapper -->
+
+  </body>
+</html>

Added: websites/staging/openejb/trunk/content/local-client-injection.cwiki
==============================================================================
--- websites/staging/openejb/trunk/content/local-client-injection.cwiki (added)
+++ websites/staging/openejb/trunk/content/local-client-injection.cwiki Sun Jul 10 05:37:04 2011
@@ -0,0 +1,56 @@
+{note:title=OpenEJB 3.1.1 or later required}
+
+The *@LocalClient* annotation (org.apache.openejb.api.LocalClient) is an innovation that crosses concepts of an Java EE Application Client with a plain Java SE client.  This particular annotation is focused on clients of an Embeddable EJB container, i.e. local clients.  There is another annotation in development called @RemoteClient that will be focused on remote clients; clients running outside the vm the container runs.
+
+Any clients annotated with @LocalClient will be scanned at deployment time for usage of injection-related annotations.  The references in the @LocalClient will be processed with the application just as if the class was a Java EE Application Client module, but with a few slight differences:
+
+  # Declaring field/method injection points as 'static' is not required
+  # References to EntityManagers via @PersistenceContext are allowed
+  # References to local business interfaces via @EJB is allowed
+  # References to UserTransaction via @Resource is allowed
+
+As well since this is not a heavyweight Java EE Application Client, you are not required to use any special packaging or command-line parameters to run the client.  Your client can be a Unit Test or any plain java code that needs to pull objects from the Embedded EJB container.  Classes with @LocalClient can be placed in a Client module or an EJB module.  A given module may have as many classes annotated with @LocalClient as it wishes.
+
+h1.  Injection
+
+The injection occurs via acquiring a LocalInitialContext via the LocalInitialContextFactory and calling _bind("inject", instance)_ passing in the instantiated local client object:
+
+{code}
+@LocalClient
+public class MoviesTest extends TestCase {
+
+    @EJB
+    private Movies movies;
+
+    @Resource
+    private UserTransaction userTransaction;
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    public void setUp() throws Exception {
+        Properties p = new Properties();
+        p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+        InitialContext initialContext = new InitialContext(p);
+        initialContext.bind("inject", this);
+    }
+
+    //... other test methods
+}
+{code}
+
+h1.  Discovery
+
+All EJB modules are scanned for @LocalClient classes, even if those EJB Modules are inside .war files as with the [OPENEJB:Collapsed EAR].  As well any modules that contain a META-INF/application-client.xml file will be scanned for @LocalClient classes.
+
+If you see the following error message and are absolutely sure the module containing your @LocalClient class is being properly identified as an EJB module or a Client module, than it is possible you are seeing some classloading issues.
+
+{panel}
+javax.naming.NamingException: Unable to find injection meta-data for org.superbiz.MyClient.  Ensure that class was annotated with @org.apache.openejb.api.LocalClient and was successfully discovered and deployed.
+{panel}
+
+If you encounter this try setting this openejb-specific boot flag so that annotations will be treated specially and always loaded by the parent classloader
+
+{quote}openejb.tempclassloader.skip=annotations{quote}
+
+