See the topics, Assembling JPA applications for a Java EE environment and Assembling JPA applications for a Java SE environment.