• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Correct manage of trasactions.

 
David Crecente
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is what i used...

integration tier -> DAO ....belo code lies in integration tier..
 
David Crecente
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic