01: package org.osbl.persistence.hibernate;
02:
03: import org.osbl.persistence.LoadCommand;
04: import org.osbl.persistence.SaveOrUpdateCommand;
05: import org.hibernate.SessionFactory;
06: import org.hibernate.Session;
07:
08: public class HibernateSaveOrUpdateCommand<T> extends
09: SaveOrUpdateCommand implements HibernateCommand {
10: SessionFactory sessionFactory;
11:
12: public void setSessionFactory(SessionFactory sessionFactory) {
13: this .sessionFactory = sessionFactory;
14: }
15:
16: public void execute() {
17: Session session = sessionFactory.getCurrentSession();
18: session.saveOrUpdate(object);
19: }
20: }
|