-->
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.  [ 4 posts ] 
Author Message
 Post subject: session disconnecting randomly
PostPosted: Fri Jun 18, 2004 10:59 am 
Beginner
Beginner

Joined: Tue Jan 06, 2004 4:51 pm
Posts: 48
Hi,

I'm getting an error like:

Code:
net.sf.hibernate.HibernateException: disconnected session
        at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:335)
        at net.sf.hibernate.impl.SessionImpl.prepareCollectionForUpdate(SessionImpl.java:2954)
        at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2881)
        at net.sf.hibernate.impl.FlushVisitor.processCollection(FlushVisitor.java:32)


which is bizarre, because I don't disconnect the session anywhere or destroy it in any way before the call that reports this. How can I track down when/why the session was disconnected? This is a webapp and I have a bunch of objects that carry references to sessions, but if one of these objects instantiates another one, it will just pass it the reference it is already using rather than trying to grab a new one from the context. Is this an erroneous way to design things?

For example,
Code:
class A {

static Session session;

getWhatever() {
    S somethingManager = new S(session);
     somethingManager.executeSomething();
}
}

class S {
static Session session;
S(Session s) {
   session = s;
}

public void executeSomething() {
    Query q = ....
     ...
     q.list(); // at this point the session would already be disconnected!
}
}


The hibernate logs are not helpful at all:
Code:
2004-06-18 10:52:22,868 -- DEBUG net.sf.hibernate.SQL -- select tasktypes0_.task_type_id as task_typ2___, tasktypes0_.task_id
as task_id__, tasktype1_.id as id0_, tasktype1_.name as name0_ from task_task_type tasktypes0_ inner join task_type tasktype
1_ on tasktypes0_.task_type_id=tasktype1_.id where tasktypes0_.task_id=? order by tasktypes0_.task_type_id asc
2004-06-18 10:52:22,967 -- ERROR net.sf.hibernate.LazyInitializationException -- Failed to lazily initialize a collection - no session or session was closed


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 11:33 am 
Beginner
Beginner

Joined: Tue Jan 06, 2004 4:51 pm
Posts: 48
no on has any idea?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 25, 2004 11:35 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
are you sure about your hibernate session management?

are you sure you are using the same hibernate session during the request?

are you sure the way you are thinking is thread safe? cause hibernate session isn't!

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 4:22 pm 
Newbie

Joined: Fri Jun 11, 2004 1:35 am
Posts: 18
Hello!!!

I have the same problem.

When I get the object, appears this:

15:19:41,540 INFO [STDOUT] Hibernate: select persona0_.cedula as cedula0_, persona0_.nombre as nombre0_, persona0_.telefono as telefono0_ from persona persona0_ where persona0_.cedula=?
15:20:23,910 WARN [SessionImpl] unclosed connection

I don't know, I don't understand what is happening?

Somebody, Can I help me, please?

Marcela Moreno


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.