These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Stream has already been closed - problem - FIXED
PostPosted: Wed Oct 24, 2007 1:49 pm 
Newbie

Joined: Wed Oct 24, 2007 1:32 pm
Posts: 2
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..


Last edited by migu82 on Tue Oct 30, 2007 6:17 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 6:16 am 
Newbie

Joined: Wed Oct 24, 2007 1:32 pm
Posts: 2
This is resolved by setting fetch strategy to Lazy to all relationships. I wonder why this works like this, becouse I thought that when using annotations, the fetchstrategy is lazy by default, and does not need to be specified. And a much better errormessage should be used. I would write a bugfix/feature request for this...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.