Hi all, In my current project I am using hibernate in the persistence layer. I used to do these tasks with EJB 2.1. Container Managed Transaction. And I used to define the scope of transacitions in deployment descriptors. But now, I have to do these things.
I would like to know the best way to manage the transaction with hibernate.
I suggest the next one:
Thank you in advance.
Amit Y Desai
Ranch Hand
Joined: Dec 06, 2007
Posts: 35
posted
0
while you are performaing CRUD operations using hibernate..thens surrong that code using beginTransaction and endTransaction....querying generally does not require this...Try to use DAO pattern.
David Crecente
Greenhorn
Joined: Nov 24, 2006
Posts: 7
posted
0
Hi, thank you for your awnser.
I am using DAO pattern but, I have to open the transaction in some place. This place is the class which calls the DAO classes, inside the try - catch block. (The DAO layer has several facades).
JSF -> Bussiness layer -> DTO layer -> DAO layer. The calls are made between DTO and DAO layer. Between facades.
If there is other way to do it (the try - catch block), could you put a piece of code?.
Thank you again.
Amit Y Desai
Ranch Hand
Joined: Dec 06, 2007
Posts: 35
posted
0
below is what i used...
integration tier -> DAO ....belo code lies in integration tier..
David Crecente
Greenhorn
Joined: Nov 24, 2006
Posts: 7
posted
0
If you get an exception when you call the method getNextScheduleDates on pagerSchedDao, what is happening?
In the case of: 1) SQLException? 2) Any of your application exception? 3) A RuntineException?