+ \r
+ @Override\r
+ public T findByUuidWithoutFlush(UUID uuid) throws DataAccessException{\r
+ Session session = getSession(); \r
+ FlushMode currentFlushMode = session.getFlushMode();\r
+ try { \r
+ // set flush mode to manual so that the session does not flush\r
+ // when before performing the query\r
+ session.setFlushMode(FlushMode.MANUAL);\r
+ Criteria crit = session.createCriteria(type);\r
+ crit.add(Restrictions.eq("uuid", uuid));\r
+ crit.addOrder(Order.desc("created"));\r
+ List<T> results = crit.list();\r
+ if (results.isEmpty()){\r
+ return null;\r
+ }else{\r
+ if(results.size() > 1){\r
+ logger.error("findByUuid() delivers more than one result for UUID: " + uuid);\r
+ }\r
+ return results.get(0);\r
+ }\r
+ } finally {\r
+ // set back the session flush mode \r
+ if(currentFlushMode != null) {\r
+ session.setFlushMode(currentFlushMode);\r
+ }\r
+ }\r
+ }\r