Cross posting from SO: http://stackoverflow.com/questions/15167029/dynamic-finders-and-units-of-work
I've got a project that uses Guice's (3.0) dynamic finders. Recently I've noticed behavior like that described in this bug<http://code.google.com/p/google-guice/issues/detail?id=730> and alluded to in this post<http://stackoverflow.com/questions/14585505/jpa-guice-persist-permanently-opened-connection-issue>. I initially assumed that @Finder would exhibit similar behavior to @Transactional in terms of their UnitOfWork, but this turns out not to be the case. From the look of it the finder implicitly starts the unit of work (by requesting an EntityManager) but never closes it. I erroneously thought adding @Transactional to the finder interface would solve the issue but since the Finders are all proxied this annotation gets lost. I realize that in a servlet context I can install a PersistFilter to deal with the issue. But I'm not sure how best to resolve it in a standalone Java application. Are dynamic finders not really used? Should I just switch to a concrete DAO class with @Transactional methods? Something else I'm missing? Thanks for any suggestions, -Chris -- 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.
