Created
October 27, 2018 20:31
-
-
Save dmitry-osin/f00cc227efb7a1a7f7f4336ee94d14f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pw.osin.example.data; | |
import javax.persistence.EntityManager; | |
import javax.persistence.Persistence; | |
public enum PersistenceHolder { | |
INSTANCE; | |
private EntityManager entityManager; | |
public EntityManager getEntityManager() { | |
if (entityManager == null) { | |
entityManager = Persistence.createEntityManagerFactory("tweetPU").createEntityManager(); | |
} | |
return entityManager; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment