posted 9 years ago
Hello I have a JSE Application using JPA 2.1
I have run into a curious problem.
I am using an EntityListener for auditing purposes
This listener is dependent on UserService.
I have tried to make that a Singleton:
This in turn uses PersistenceService (which should be a singleton too ...) and which should provide one and only one instance of the EntityManagerFactory
to the application:
When I run tests I see that a lot of instances of these "Singletons" are created until the application crashes because all connections to the database are used up.
When I remove the EntityListener this behavior stops, but I really need the AuditListener
What is going on? And how can I correct this problem?
Many thanks for any hints