Пример #1
0
 /**
  * @param sessionFactory
  * @return
  */
 @Bean
 @Autowired
 public HibernateTemplate hibernateTemplate(SessionFactory sessionFactory) {
   final HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
   hibernateTemplate.setCacheQueries(Boolean.TRUE);
   return hibernateTemplate;
 }
Пример #2
0
 @SuppressWarnings("unchecked")
 @Transactional(readOnly = true)
 public <T extends Words> List<T> findAll(Class<T> wordsClass) {
   return (List<T>) template.find("FROM " + wordsClass.getSimpleName());
 }
Пример #3
0
 public <T extends Words> T persist(T words) {
   return template.merge(words);
 }
Пример #4
0
 public Words update(Words words) {
   return template.merge(words);
 }
Пример #5
0
 @Transactional(readOnly = true)
 public Words find(int id) {
   return template.get(Words.class, id);
 }