To start define your jpa persistence unit, lets say "addressbook". Then you could create a new JPAContainer using the JPAContainerFactory
.
Example:
JPAContainerFactory.make(Person.class, JpaAddressbookApplication.PERSISTENCE_UNIT); // where PERSISTENCE_UNIT = "addressbook"
Going this way you don't have to deal with the EntityManager
.
I highly recommend you to follow up this tutorial and have a look at the following answer on stackoverflow: https://stackoverflow.com/a/17876743