tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick PC Yu" <p...@popular.com.hk>
Subject Qs 'bout javax.transaction.* implementation in Tomcat
Date Wed, 10 Oct 2001 00:24:14 GMT
Hi,

I'm new to tomcat.  Has Tomcat implemented the javax.transaction package?

Currenly I'm working on this case:

Suppose an object "Company"  has-a "Office" object.  And they both have a
method ".insert()".  The pattern is like this:

public void insert() throws SQLException {

   getConnection....
   executeQuery...
   connection.close()

}

So, when i insert a new company with an office in JSP....

company.insert();
office.insert();


In the jsp, i need to check:  if failed to insert "office", i have to
rollback also "company".  So, I suppose I need sth like this:

transaction.begin();
company.insert();

try {
        office.insert();
        transaction.commit();
} catch (Exception e) {
        transaction.rollback();
}

My Questions:
1)  Is my logic right?
2)  If yes, do I need that transaction stuff (IF I DON'T want to keep the
connection in the jsp's)?
3)  How to use the javax.transaction.*[.*.* ...] in tomcat?  (e.g. how to
get an implemented transaction?)

Thx very much for ur kind advice!


Regards,
Patrick
Thx a lot!

Regards,
Patrick PC Yu


Mime
View raw message