Hey,
this is probably a nebie question,but i didnt know where else to ask and i couldnt search for it.
So I have a model where an PartA has manytomany PartB and PartB has onetomany PartC, these are mapped accordingly, and everything works fine when I save these objects, the problem comes when I query them:
Code:
List<PartA> list = session.createCriteria(PartA.class).list();
for (PartA partA : list) {
session.delete(designObj);
}
It doesnt matter if I use HQL or Criteria
If I try to reference any kind of object the all throw:
(finnish oracle, so this means Tietovirta on jo suljettu =
Stream has already been closed)
Code:
24.10.2007 20:39:40 org.hibernate.type.NullableType nullSafeGet
INFO: could not read column value from result set: text4_3_; Tietovirta on jo suljettu
24.10.2007 20:39:40 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 17027, SQLState: null
24.10.2007 20:39:40 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Tietovirta on jo suljettu
Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at thesis.hibernate.exec.EmptyDB.clear(EmptyDB.java:29)
at thesis.hibernate.exec.EmptyDB.main(EmptyDB.java:17)
Caused by: java.sql.SQLException: Tietovirta on jo suljettu
and if i reference another object like a child collection object of the searched object it says:
Code:
" org.hibernate.exception.GenericJDBCException: could not initialize a collection:
It looks like it would close the session/resultsSet too early.
I am using Oracle 10g (latest versions of hibernate core and annotations).
All relatinships are bidirectional.
I have no fetch strategies, but these should be lazy by default, right?
(Plus I tried it with both fetch strategies)
Could this be somehow connected to hashCode() and equals() methods,
and if so why?
I am begging for help, my thesis is due in 2 weeks..