The Artima Developer Community
Sponsored Link

Java Community News
JOTM Transactions in Spring and Hibernate

1 reply on 1 page. Most recent reply: Aug 31, 2006 4:09 PM by Anjan Bacchu

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

JOTM Transactions in Spring and Hibernate Posted: Aug 31, 2006 10:52 AM
Reply to this message Reply
Summary
In a recent java.net article, Binildas Christudas and Sowmya Hubert argue that using Spring, along with a half-dozen other tools, leads to a simpler solution for distributed transactions than using a full-blown app server would. When do you prefer to roll your own solution, and when would you rather use a full-featured app server?
Advertisement

A recent java.net article, JOTM Transactions In Spring And Hibernate, Binildas Christudas and Sowmya Hubert explore distributed transactions with the help of the Java Open Transaction Manager (JOTM) and the Spring framework.

They claim that while most J2EE application servers provide full support for the sort of complex distributed service interaction depicted in the article, developers should eschew a full-blown app server in favor of a light-weight approach that uses Spring along with other light-weight tools. According to the article, a key benefit of that approach is that the solution will not be tied to any specific application server:

Component relationships are externalized in configuration files, and the Spring runtime instantiates the required objects and sets relationships. Similarly, the transaction attributes are configured on a per-instance level or on a per-method basis. If you combine these two capabilities, you gain a lot of advantages in the component world. The important part is that the components configured in this way are not tied to any specific application server or runtime mechanisms.

While that may be so, the article illustrates that, in lieu of a full-blown app server, a developer has to piece together various tools to achieve correct transaction semantics for the application. For example, to use transactional semantics outside an app server, a component will need to enlist an implementation of the Java Transaction API (JTA), and to coordinate distributed transactions that adhere to the two-phase commit protocol, you also need a distributed transaction manager that, ideally, understands the industry-standard X/Open interface.

JTA provides the application-level interface to coordinate a transaction across multiple resources. If this has to happen, the various Resource Managers have to interoperate, and this is achieved by all Resource Managers adhering to the X/Open XA Resource Manager interface. ...Here you need multiple connectors to coordinate in the same transaction, and you need a JTA-compliant Transaction Manager. It is here you are going to use JOTM. Such Transaction Managers are also called Transaction Processing (TP) Monitors... Java Open Transaction Manager (JOTM) is a JTA-compliant Transaction Manager.

And, for persistence, you need to weave Hibernate, or another O/R mapping or persistence tool, into the Spring-based solution.

As the article itself demonstrates, configuring and coordinating the work of all the components that go into this solution is a fairly complex task. Although the Spring-based solution may provide a "light-weight" approach, an off-the-shelf application server can possibly provide a turn-key, ready-to-use environment that hides much of the configuration complexity from a developer via tools.

While there has been a backlash against top-heavy application servers in recent years, with the proliferation of so many frameworks and tools—many of which try to solve similar problems—do you believe that the pendulum will swing the other way? Instead of having to self-assemble a solution from a half dozen framework components, in what situations would you favor using just one turn-key, out-of-the-box tool to solve a complex problem?


Anjan Bacchu

Posts: 18
Nickname: anjanb
Registered: Mar, 2002

Re: JOTM Transactions in Spring and Hibernate Posted: Aug 31, 2006 4:09 PM
Reply to this message Reply
hi there,

pls. add printing to the forums just like InfoQ has. It is really useful to read on train trips or when you don't feel like sitting in front of the PC.

BR,
~A

Flat View: This topic has 1 reply on 1 page
Topic: JOTM Transactions in Spring and Hibernate Previous Topic   Next Topic Topic: Apache Ant Project Releases 1.7 Beta of Ant

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use