Comment by alex.che...@gmail.com:
I'm using the following solution for the problem mentioned above (my msg
dated Feb 4, 2012).
I've bound an Interceptor for method returning an EntityManager in my main
module:
<code language='java'>
bindInterceptor(Matchers.subclassesOf(PersistService.class),
Matchers.returns(Matchers.identicalTo(EntityManager.class)),
new EntityManagerTuner()
);
</code>
In an interceptor i'm enabling the desired behavior before returning the
EntityManager
<code language='java'>
public class EntityManagerTuner implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
Object result = invocation.proceed();
if (result instanceof EntityManagerImpl) {
EntityManagerImpl castedEm = (EntityManagerImpl) result;
((SessionImpl) castedEm.getSession()).setAutoClear(true);
}
return result;
}
}
</code>
Quite rough but works )
Hope this will help.
For more information:
http://code.google.com/p/google-guice/wiki/JPA
--
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-dev@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.