Git Repositories

Initial
[xerox-elastic-poc.git] / src / main / java / com / viseo / xerox / elastic / EntityManagerProvider.java
1 package com.viseo.xerox.elastic;
2
3 import lombok.Getter;
4
5 import javax.persistence.EntityManager;
6 import javax.persistence.EntityManagerFactory;
7 import javax.persistence.Persistence;
8
9 public class EntityManagerProvider {
10     @Getter
11     private static final EntityManagerProvider instance = new EntityManagerProvider();
12     public static final String PERSISTENCE_UNIT_NAME = "xerox-app";
13
14     @Getter
15     private EntityManagerFactory emf;
16     @Getter
17     private EntityManager em;
18
19     private EntityManagerProvider() {
20         emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
21         em = emf.createEntityManager();
22     }
23 }