Hi! I've been integrating Guice 3.0 into a desktop application. To access my database I use JPA together with EclipseLink. Everything is configured straight forward, using the JpaPersistModule guice provides. The application runs multiple threads and each thread is using the same data access object to read and write data in which the EntityManager is injected using constructor injection. However it appears that using the DAO within a thread, transactions are not commited and entities do not appear in the database.
After inspecting that issue, I've seen that the EntityManager get's injected as a singleton, which is not suitable as it is not thread-safe. I then tried to inject the EntityManagerFactory instead, which bypasses the transaction interception somehow. Is there a general approach to get this working? Unfortunately I haven't found much about this topic especially in conjunction with guice on the web. Any help is greatly appreciated! -- 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/-/KlKbRlNE_TQJ. 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.
