Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static EntityManagerFactory getEntityManagerFactory() {
- if (entityManagerFactory == null) {
- InputStream propertiesStream = null;
- try {
- propertiesStream = new FileInputStream(ContextParams.getDbPropertiesFile());
- final Properties properties = new Properties();
- properties.load(propertiesStream);
- entityManagerFactory = Persistence.createEntityManagerFactory("JURE_PU", properties);
- } catch (Exception exception) {
- LOGGER.error("Could not load DB properties. " + exception);
- throw new ExceptionInInitializerError(exception);
- } finally {
- try {
- if (propertiesStream != null) {
- propertiesStream.close();
- }
- } catch (IOException exception) {
- LOGGER.error("Could not close DB properties stream. " + exception);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement