[weld-commits] Weld SVN: r5063 - doc/trunk/reference/en-US.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sun Nov 15 19:18:48 EST 2009


Author: gavin.king at jboss.com
Date: 2009-11-15 19:18:47 -0500 (Sun, 15 Nov 2009)
New Revision: 5063

Modified:
   doc/trunk/reference/en-US/example.xml
Log:
missing from example

Modified: doc/trunk/reference/en-US/example.xml
===================================================================
--- doc/trunk/reference/en-US/example.xml	2009-11-15 23:52:05 UTC (rev 5062)
+++ doc/trunk/reference/en-US/example.xml	2009-11-16 00:18:47 UTC (rev 5063)
@@ -34,6 +34,26 @@
 </h:form>]]></programlisting>
 
       <para>
+         Users are represented by a JPA entity:
+      </para>
+      
+      <programlisting role="JAVA"><![CDATA[@Entity
+public class User {
+   private @Id String username;
+   private String password;
+   
+   public String getUsername() { return username; }
+   public void setUsername(String username) { this.username = username; }
+   public String setPassword(String password) { this.password = password; }
+   
+}]]></programlisting>
+
+      <para>
+         (Note that we're also going to need a <literal>persistence.xml</literal> file to configure the JPA persistence 
+         unit containing <literal>User</literal>.)
+      </para>
+
+      <para>
          The actual work is done by a session-scoped bean that maintains information about the currently logged-in user
          and exposes the <literal>User</literal> entity to other beans:
       </para>
@@ -91,8 +111,9 @@
       We need an adaptor bean to expose our typesafe <literal>EntityManager</literal>:
    </para>
 
-   <programlisting role="JAVA"><![CDATA[public class UserDatabaseProducer {
-   @Produces @UserDatabase @PersistenceContext EntityManager userDatabase;
+   <programlisting role="JAVA"><![CDATA[class UserDatabaseProducer {
+   @Produces @UserDatabase @PersistenceContext 
+   static EntityManager userDatabase;
 }]]></programlisting> 
    
    <para>Now <literal>DocumentEditor</literal>, or any other bean, can easily inject the current user:</para>



More information about the weld-commits mailing list