Revision: 1295
Author: dhanji
Date: Sun Oct 17 19:20:45 2010
Log: Edited wiki page JPA through web user interface.
http://code.google.com/p/google-guice/source/detail?r=1295

Modified:
 /wiki/JPA.wiki

=======================================
--- /wiki/JPA.wiki      Thu Sep 16 14:43:28 2010
+++ /wiki/JPA.wiki      Sun Oct 17 19:20:45 2010
@@ -9,7 +9,7 @@
 To enable persistence support, simply install the JPA module:

 {{{
-Injector injector = Guice.createInjector(..., new JpaModule("myFirstJpaUnit")); +Injector injector = Guice.createInjector(..., new JpaPersistModule("myFirstJpaUnit"));
 }}}

In JPA, you specify your configuration in a *persistence.xml* file in the `META-INF` folder of that is available on the classpath (if inside a jar, then at the root for example). In this file you declare several _Persistence Units_ that are roughly different profiles (for example, backed by different databases). Here is an example of a simple JPA configuration:
@@ -39,7 +39,7 @@
To tell Guice Persist which persistence unit you wish you use, you specify its name when creating your module:

 {{{
-Injector injector = Guice.createInjector(..., new JpaModule("myFirstJpaUnit")); +Injector injector = Guice.createInjector(..., new JpaPersistModule("myFirstJpaUnit"));
 }}}

Finally, you must decide when the persistence service is to be started by invoking `start()` on `PersistService`. I typically use a simple initializer class that I can trigger at a time of my choosing:
@@ -94,7 +94,7 @@
 {{{
 public class MyModule extends ServletModule {
   protected void configureServlets() {
-    install(new JpaModule("myJpaUnit"));  // like we saw earlier.
+    install(new JpaPersistModule("myJpaUnit"));  // like we saw earlier.

     filter("/*").through(PersistFilter.class);
   }

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to google-guice-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to