Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implement Transactions best way, in my application

 
Sajith Hasanka
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34384
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
done
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic