comparison src/main/java/org/mpi/openmind/repository/services/AbstractPersistenceService.java @ 58:153a0232270b

cleanup and better comments.
author casties
date Fri, 09 Dec 2016 21:19:21 +0100
parents e08f3dd127a5
children c11fd8ca5c0a
comparison
equal deleted inserted replaced
57:e08f3dd127a5 58:153a0232270b
37 37
38 private static Logger txLog = Logger.getLogger(TRANSACTION_LOGGER); 38 private static Logger txLog = Logger.getLogger(TRANSACTION_LOGGER);
39 39
40 private boolean importMode = false; 40 private boolean importMode = false;
41 41
42 /*
43 * static { logger.setLevel(Level.DEBUG); PatternLayout layout = new
44 * PatternLayout( "%d{ABSOLUTE} %5p %c{1}:%L - %m%n"); Appender stdout = new
45 * ConsoleAppender(layout, "System.out"); logger.addAppender(stdout); }
46 */
47
48 public AbstractPersistenceService() { 42 public AbstractPersistenceService() {
49 } 43 }
50 44
51 public String generateOwnValue(Entity entity) { 45 public String generateOwnValue(Entity entity) {
52 Session session = HibernateUtil.getSessionFactory().getCurrentSession(); 46 Session session = HibernateUtil.getSessionFactory().getCurrentSession();
62 session.getTransaction().commit(); 56 session.getTransaction().commit();
63 } 57 }
64 58
65 return ownValue; 59 return ownValue;
66 } 60 }
67
68 /*
69 * Performs the actual disabling of the Hibernate second-level cache.
70 */
71 /*
72 protected void disableSecondLevelCache() {
73 Map<Object, Cache> cacheRegionsMap = ((SessionFactoryImpl) HibernateUtil
74 .getSessionFactory()).getAllSecondLevelCacheRegions();
75 Collection<Cache> cacheRegions = cacheRegionsMap.values();
76 for (Cache cache : cacheRegions) {
77 cache.clear();
78 }
79 }*/
80 61
81 public int dropAssertions() { 62 public int dropAssertions() {
82 int row = 0; 63 int row = 0;
83 try { 64 try {
84 Session session = HibernateUtil.getSessionFactory() 65 Session session = HibernateUtil.getSessionFactory()