• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Declarative Transactions in Hibernate

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

I am new to Hibernate and thinking of using Hibernate for persistance .

1->I want to know if hibernate supports declaritive transaction management .

2->If yes does this declaritive transaction management depends on JTA and a supporting Application server .

Can I use Tomcat for declarative transaction management with Hibernate .


Thanks in advance !
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Varun,


1->I want to know if hibernate supports declaritive transaction management .


The answer is no: Hibernate by itself doesn�t support declarative transaction management. However there is a very nice and elegant solution to this problem: use Spring and Hibernate and you�ll be able to take advantage of Spring AOP to achieve this goal. There probably will be a little more abrupt learning curve, but once you passed that point you�ll discover that not only Spring integrate very nicely with Hibernate, but it will actually simplify the development and configuration management of Hibernate application quite a bit.


2->If yes does this declaritive transaction management depends on JTA and a supporting Application server .


Not really. Assuming you�re using Spring with Hibernate you could plug any type of transaction manager, including JDBC, JTA or even a Hibernate specialized one (there are also couple more for CORBA OTS, etc).


Can I use Tomcat for declarative transaction management with Hibernate .


Again assuming you�re using Spring and Hibernate, then yes you can. That�s another benefit of this architecture over the ejb3 for example: you�re not depending upon the heavyweight containers anymore.

Regards.
 
Varun Kukreti
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Valentin ,

Thanks for the reply ,however requirements are such that i have to use only struts and hibernate .I was looking for the declarative transaction management to make the code cleaner so that i dont have to do this for each method .



Can there are other alternatives for seperating transaction management code if I am not using Spring?

Regards
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same idea: try aspectj or other aop framework and use aspects (this also could be specified via configurations) in order to benefit of declarative transaction management. AOP by the way is mainly used to address this type of cross cutting concerns and you could use it very successfully for logging, debugging, etc as well.

Regards.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic