Hi,
I am using Guice + JPA+ Hibernate for web application running within Jboss.
1. per 
http://google-guice.googlecode.com/git/javadoc/com/google/inject/persist/PersistFilter.html
I did the following to register PersistFilter in my service module, which 
extends from ServletModule 
                 install(new JpaPersistModule(PERSITENCE_UNIT_NAME)); 
                filter("/*").through(PersistFilter.class);
2. per 
http://google-guice.googlecode.com/git/javadoc/com/google/inject/servlet/GuiceFilter.html,
 I added the guiceFilter to my web.xml

 Buy I got the following error when starting Jboss
[[/]] Exception starting filter guiceFilter: java.lang.IllegalStateException: 
Persistence service was already initialized.]
If I remove "filter("/*").through(PersistFilter.class);" then it works fine. 
The reason I added this is to make sure it is work per request.

What is the right way to achieve the goal for work per request? I notice that 
there is one JpaPersistModule 
<http://google-guice.googlecode.com/git/javadoc/com/google/inject/persist/jpa/JpaPersistModule.html#JpaPersistModule%28java.lang.String%29>
 but do not use it. Should it be used together with PersistFilter?

Thx.

Hui

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to