import java.util.List;
+import mir.core.model.IImage;
import net.sf.hibernate.Criteria;
+import net.sf.hibernate.Hibernate;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.SessionFactory;
*
* StorageService
* @author idefix
- * @version $Id: StorageService.java,v 1.2 2003/08/19 00:42:38 idfx Exp $
+ * @version $Id: StorageService.java,v 1.3 2003/09/05 20:23:59 idfx Exp $
*/
public abstract class StorageService {
private Class objectClass;
.setMaxResults(limit);
List returnList = criteria.list();
transaction.commit();
+ sessionHolder.closeSession();
return returnList;
} catch (HibernateException e) {
throw new StorageServiceFailure(e);
Session session = sessionHolder.currentSession();
Transaction transaction = session.beginTransaction();
Object returnObject = session.load(objectClass, id);
+ initializeLazyCollections(returnObject);
transaction.commit();
+ sessionHolder.closeSession();
return returnObject;
} catch (HibernateException e) {
throw new StorageServiceFailure(e);
}
}
+ /**
+ * @param returnObject
+ */
+ protected abstract void initializeLazyCollections(Object returnObject)
+ throws HibernateException;
+
public Integer add(Object newObject){
try {
Session session = sessionHolder.currentSession();