-->
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: Hibernate Session closed
PostPosted: Wed Dec 21, 2005 7:47 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
Hi,

We deployed a sample application in JBOSS to insert data & get data from the database.

There are to methods insert and get

In each method we are opening a session using

HibernateUtil.currentSession() and closing as
session.close() and HibernateUtil.closeSession()

First time executing fine, but when I execute the application in another browser ( that means two clients),

I am getting the following error.

Can you suggest what is the wrong?

Thanks,
Srinivas
-----------------------------------------------------------------------------------

12:37:16,466 INFO [STDOUT] Caused by: org.hibernate.SessionException: Session is closed
12:37:16,466 INFO [STDOUT] at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:131)
12:37:16,466 INFO [STDOUT] at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49)
12:37:16,467 INFO [STDOUT] at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:24)
12:37:16,467 INFO [STDOUT] at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:271)
12:37:16,467 INFO [STDOUT] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1079)
-------------------------------------------------------------------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 8:14 am 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
Is HibernateUtil storing Session on a per-session basis or a per-application basis? I can imagine this happenign if its per-application basis as you have already closed the session after the first client has completed its operation. You should use the session-per-request ideally for web based applications. Refer to the wiki and hib_docs for configuring a session per session/request/application


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 9:13 am 
Beginner
Beginner

Joined: Tue Aug 30, 2005 9:40 am
Posts: 29
Hi Thank you

Can you provide teh link where we can get this information

to open session per session/request/application for web based applications

Thanks,
Srinivas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 9:34 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://hibernate.org/42.html
http://hibernate.org/43.html


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.