-->
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: should i use begin and commit for each hibernate call ?
PostPosted: Fri Nov 16, 2007 11:11 am 
Beginner
Beginner

Joined: Wed Oct 03, 2007 9:46 pm
Posts: 37
i have no problem executing hsql like below , but after my app run for few hours, i get exception at the bottom. is it because i didnt use "begintransaction" and commit in my query method ?

my example query::::::
Criteria crit = sess.createCriteria(TheObject.class,"table_name")
.addOrder(bSortOrder ? Order.asc(sortColumnId): Order.desc(sortColumnId))
.setFirstResult(nFirst)
.setMaxResults(nPageSize);


random exception after app run for many hours::::

ARNING: Template for component StorageFile does not reference embedded component: idForm.
Nov 16, 2007 4:36:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: 08S01
Nov 16, 2007 4:36:23 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2637)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1554)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3176)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 17, 2007 12:38 am 
Newbie

Joined: Tue Nov 13, 2007 7:25 am
Posts: 8
Location: Bhubaneswar
Yeah dude..... There is nothing wrong with yr code.... Actually I think MySql is not supporting for more than 8 hours..... It'll b better if u use C3P0 connection pooling. The default value is 280000. U also can manage the pooling manually.....

_________________
Regards
Lalit Narayan Mishra


Top
 Profile  
 
 Post subject: is it because i didnt use "begintransaction" and c
PostPosted: Sat Nov 17, 2007 12:41 am 
Newbie

Joined: Tue Nov 13, 2007 7:25 am
Posts: 8
Location: Bhubaneswar
Hey man r u crazy ????? Why should anyone use begintransaction in selection of value from database ??? And offcourse no need of commit here.... Bcoz u r not commiting anything into database....

_________________
Regards
Lalit Narayan Mishra


Top
 Profile  
 
 Post subject: c3p0
PostPosted: Sat Nov 17, 2007 10:15 am 
Beginner
Beginner

Joined: Wed Oct 03, 2007 9:46 pm
Posts: 37
how to set that in my hibernate.cfg.xml ? can elaborate more? by default hibernate not using c3p0?


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.