List of usage examples for org.hibernate.cfg AvailableSettings JPA_SHARED_CACHE_STORE_MODE
String JPA_SHARED_CACHE_STORE_MODE
To view the source code for org.hibernate.cfg AvailableSettings JPA_SHARED_CACHE_STORE_MODE.
Click Source Link
From source file:org.unitedinternet.cosmo.dao.hibernate.ItemDaoImpl.java
License:Apache License
@SuppressWarnings("unchecked") public <STAMP_TYPE extends Stamp> STAMP_TYPE findStampByInternalItemUid(String internalItemUid, Class<STAMP_TYPE> clazz) { try (StatelessSession session = this.openStatelessSession()) { List<Stamp> stamps = (List<Stamp>) session.createNamedQuery("item.stamps.by.uid") .setParameter("uid", internalItemUid) .setHint(AvailableSettings.JPA_SHARED_CACHE_STORE_MODE, null) .setHint(AvailableSettings.JPA_SHARED_CACHE_RETRIEVE_MODE, null).getResultList(); for (Stamp stamp : stamps) { if (clazz.isInstance(stamp)) { return clazz.cast(stamp); }/*from w w w. ja va2s.co m*/ } } catch (HibernateException e) { throw SessionFactoryUtils.convertHibernateAccessException(e); } return null; }