• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Correct manage of trasactions.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic