I'd like to use the container-managed EntityManager of JPA, but want it to be created from one specific EntityManagerFactory, is it possible to do that? Thanks
Asked
Active
Viewed 71 times
1 Answers
0
I think you can use use a container-managed EntityManager of JPA. Maybe you can do this by specifying the persistence unit name when obtaining the EntityManager instance
@PersistenceUnit(unitName = "myPersistenceUnit")
private EntityManagerFactory entityManagerFactory;
public void someMethod() {
EntityManager entityManager = entityManagerFactory.createEntityManager();
// Use the entityManager instance to perform JPA operations
entityManager.close();
}

dincer.unal
- 67
- 1
- 2
- 13