-
Notifications
You must be signed in to change notification settings - Fork 160
/
JbatchEntityManagerFactory.java
51 lines (44 loc) · 1.75 KB
/
JbatchEntityManagerFactory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
* Copyright (c) 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.job.engine.jbatch.persistence;
import org.eclipse.kapua.commons.jpa.AbstractEntityManagerFactory;
import org.eclipse.kapua.commons.jpa.EntityManager;
import org.eclipse.kapua.commons.jpa.EntityManagerFactory;
import java.util.HashMap;
import java.util.Map;
/**
* {@link EntityManagerFactory} for the jBatch module.
*
* @since 1.2.0
*/
public class JbatchEntityManagerFactory extends AbstractEntityManagerFactory implements EntityManagerFactory {
private static final String PERSISTENCE_UNIT_NAME = "jbatch";
private static final String DATASOURCE_NAME = "kapua-dbpool";
private static final Map<String, String> UNIQUE_CONTRAINTS = new HashMap<>();
private static JbatchEntityManagerFactory instance = new JbatchEntityManagerFactory();
/**
* Constructs a new entity manager factory and configure it to use the job persistence unit.
*/
private JbatchEntityManagerFactory() {
super(PERSISTENCE_UNIT_NAME,
DATASOURCE_NAME,
UNIQUE_CONTRAINTS);
}
/**
* Return the {@link EntityManager} singleton instance
*
* @return
*/
public static JbatchEntityManagerFactory getInstance() {
return instance;
}
}