Hi,

I have followed the advise 
on http://code.google.com/p/google-guice/wiki/JPA and it seems to work when 
I set @Transactional directly on my DAO. However, I have trouble 
implementing this in a transaction-per-request fashion. My first attempt is 
to use a filter:

@Transactional
>
> class TransactionFilter implements Filter {
>
>
>  final Provider<EntityManager> entityManager;
>
>  @Inject
>
> public TransactionFilter(Provider<EntityManager> entityManager) {
>
>  this.entityManager = entityManager;
>
> }
>
>  @Transactional
>
> @Override
>
> public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain 
> arg2) throws IOException, ServletException {
>
>  arg2.doFilter(arg0, arg1);
>
> }
>
Bound AFTER:

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

in my module. It just does not seem to have an effect.

How do people ensure one transaction per request in a servlet environment ?

Kind regards
Johannes 

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/EJByN5WHgnIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to