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
|