01: package org.osbl.persistence.hibernate;
02:
03: import org.osbl.persistence.LoadCommand;
04: import org.hibernate.*;
05:
06: public class HibernateLoadCommand<T> extends LoadCommand<T> implements
07: HibernateCommand {
08: SessionFactory sessionFactory;
09:
10: public void setSessionFactory(SessionFactory sessionFactory) {
11: this .sessionFactory = sessionFactory;
12: }
13:
14: public T execute() {
15: Session session = sessionFactory.getCurrentSession();
16: return (T) session.load(type, id);
17: }
18: }
|