public void save(Owner owner) throws DataAccessException {
   if (owner.isNew()) {
     hibernateTemplate.save(owner);
   } else {
     hibernateTemplate.update(owner);
   }
 }
 @Override
 @Transactional
 public void saveStock(Stock stock) {
   System.out.println("sessionFactory: " + sessionFactory);
   //        getSessionFactory().openSession();
   //        getSessionFactory().getCurrentSession().setFlushMode(FlushMode.AUTO);
   // System.out.println("Get Current Session:"+getSessionFactory().openSession());
   hibernateTemplate.save(stock);
 }
Beispiel #3
0
 public static void main(String[] args) {
   HibernateTemplate template = (HibernateTemplate) Util.getObject("template");
   final Person p1 = new Person();
   p1.setId(109);
   p1.setFirstName("vins");
   p1.setLastName("jains");
   p1.setAge(26);
   Object obj = template.save(p1);
   System.out.println("done with " + obj);
   System.out.println("done");
 }
 public void courseSave(Course course) {
   hibernateTemplate.save(course);
 }
 @Transactional
 public void studentSave(Student student) {
   hibernateTemplate.save(student);
 }
 @Override
 @Transactional(readOnly = false)
 public void save(Person person) {
   hibernateTemplate.save(person);
 }
 @Transactional
 public void saveObject(Object obj) {
   hibernateTemplate.save(obj);
 }
Beispiel #8
0
 public void add(User user) {
   hibernateTemplate.save(user);
 }