View RSS Feed

My Java Tips

Broken Pipe - Transaction

Rate this Entry
by , 10-31-2011 at 04:51 PM (975 Views)
I assume that you are having a J2EE environment with connection pool and you are using hibernate.


When you use transactions, you have to explicitly commit or rollback every time. Some programmers believe that queries do not have to be committed. This is not right in my opinion. If you do not commit, the connection is left assigned. Which means we have dangling connections that later will be killed by the database server like: MySQL. Connection pool would later attempt to reattach to the dangling connection and you will get java.net.SocketException Broken Pipe exception.

I know many programmers who spent many days finding this reason. Do comment if you want to add something to this.

Submit "Broken Pipe - Transaction" to Facebook Submit "Broken Pipe - Transaction" to Digg Submit "Broken Pipe - Transaction" to del.icio.us Submit "Broken Pipe - Transaction" to StumbleUpon Submit "Broken Pipe - Transaction" to Google

Tags: None Add / Edit Tags
Categories
Hibernate , Java EE , Network Programming

Comments