public void save(Owner owner) throws DataAccessException {
   if (owner.isNew()) {
     hibernateTemplate.save(owner);
   } else {
     hibernateTemplate.update(owner);
   }
 }
示例#2
0
 @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);
 }
示例#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");
 }
示例#4
0
 public void courseSave(Course course) {
   hibernateTemplate.save(course);
 }
示例#5
0
 @Transactional
 public void studentSave(Student student) {
   hibernateTemplate.save(student);
 }
示例#6
0
 @Override
 @Transactional(readOnly = false)
 public void save(Person person) {
   hibernateTemplate.save(person);
 }
示例#7
0
 @Transactional
 public void saveObject(Object obj) {
   hibernateTemplate.save(obj);
 }
示例#8
0
 public void add(User user) {
   hibernateTemplate.save(user);
 }