• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Implement Transactions best way, in my application

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I 'm currently developing an application, 3 - tire one, where its business services are exposed as web services, and those web services directly invokes DAO operations for data base operations.

I have a question, what is the best way to implement transsactions in my application.

Do i need to implement transactions in both Service layer as well as DAO layer ? if not is it enough to implemnt in only one layer?
What are the disadvantages im facing if i implement TX in both layers?

What are the techniques i have to follow, i mean, are there specific techniques to implement service level transactions compared to DAO transactions?
can i use spring frameowrk? with AOP support?

I'm really confused abt the way i should handle transactions, so your reply will be a huge help for me... thanks in advance

Thanks a lot
saj
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Saj,
You mean tier and not tire. This might have been a typo, but I wanted to call your attention to it in case it is not.

Do i need to implement transactions in both Service layer as well as DAO layer ?


No. I usually only use transactions in the service layer.

if not is it enough to implemnt in only one layer?


Yes. The advantage of the service layer is it makes the whole service one logical transaction. Which tends to be what you need.

What are the disadvantages im facing if i implement TX in both layers?


It depends on the settings and your requirement. Do you have a requirement that the DAO roll back independently? If not, the setting would be to use the service layer's transaction. And the disadvantage would be added complexity.

What are the techniques i have to follow, i mean, are there specific techniques to implement service level transactions compared to DAO transactions? can i use spring frameowrk?


Yes, Spring is a good way to create a service level transaction.
 
Sajith Hasanka
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne ,

Thanks a lot for your reply, and it solves my doubts and you have replied the way i was expecting, and ya, i meant tier , not tire .. typo
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"s hk", please check your private messages for an important administrative matter.
 
Sajith Hasanka
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
done
 
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic