Get the persistence-unit name [duplicate]

2019-07-30 07:38发布

问题:

This question is an exact duplicate of:

  • Finding the current persistence unit for the current EntityManagerFactory 2 answers

How do you get the name of a persistence-unit in Java? I have a persistence.xml with many units, so I want to control which unit is used to create my EntityManager.

There's method like getPersistenceName or smth? I have searched for a while but did not find anything useful.

回答1:

Please check this thread: Finding the current persistence unit for the current EntityManagerFactory



标签: java jpa toplink