Ahojda,
mozna jsem se prehnlednul kdyz jsem se na to dival, ale mam problemek s
proxy u hibernate.
text chyby:
2006-09-22 09:13:06,317 ERROR
[org.hibernate.LazyInitializationException] - <could not initialize
proxy - the owning Session was closed>
org.hibernate.LazyInitializationException: could not initialize proxy -
the owning Session was closed
Mam nasledujici kod na kterem tu chybu testuju:
public ArrayList getArticleSalesHistory( long oid ) {
ArrayList result = new ArrayList();
Session session = this.sessionFactory.openSession();
try {
ArrayList list = (ArrayList) session
.createQuery("from PriceWTimestamp item where
item.article.oid=?")
.setParameter(0, new Long(oid))
.list()
;
if(list!=null) result = list;
} catch (Exception ex) {
logger.error(ex.getLocalizedMessage());
}
session.close();
return result;
}
Pak k tomu seznamu cen pristupuju a vznikne tento problem. Chapu asi o
co jde. On pri session.close() ty objekty zahodi. Jak to tedy nastavit
tak, aby mi vytvorene objekty nerusil? Jde o to ze se mi nechce
prochazet znovu pole a delat klony, ktere by pak fungovaly jak maji.
Pet