-->
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.  [ 1 post ] 
Author Message
 Post subject: Using Hibernate and SQL DAOs in the same transaction.
PostPosted: Tue Jan 29, 2008 12:50 pm 
Newbie

Joined: Tue Jan 29, 2008 12:18 pm
Posts: 1
Hi,

I'm developing an application that uses hibernate to make the CRUD operations and SQL DAOs to make some lookups and complex selects to the database. The hibernate uses one datasource and the DAOs uses another one.

There some situations where I need to call one or more DAOs inside an Hibernate transaction, for exemple to validate a data against a database parameter or other business validation.

In order to understand if I have any problem with database connections lock I only have one connection available for each datasource.

Every thing works fine even when I have to open and close (by connection pool) many DAOs connections inside the Hibernate transaction until I found that if my DAO statement have an error the connection is not released and the code stops because i get out of connections in the datasource.

I close every connection in the finnaly and already debug and saw that the connection pool close method is call every time and the connection change to a close state.

My question is if it's possible that in a error statement the DAO connection could be get by the hibernate transaction and is not released.

In the past when I used Session EJB instead of Hibernate I have the same problem too, but occurs everytime even when the statement has ok. To solve the problem I implemented a way of suspend the EJB session when I need to call the DAO, do you think that I have to make the same thing with hibernate? If yes, how can i suspend the Hibernate transaction.

I already find the Hibernate have DAOs too but since i'm using the same DAOs in customtags that need to make lookuops, think it's dificult to change the DAOs to the Hibernate session.

Thanks in advanced,

Best regards,

rjc

Hibernate version: 3

Name and version of the database you are using: MS SQL Server 2005


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

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.