Use a UserTransaction in the servlet to control the tx. Make sure the tx attributes on all the beans are Requires or Supported. Make sure you set up datasources with tx support, either local or xa. If you get connections to more than one database (not table, database) in one transaction, read a book that explains two phase commit thoroughly and be sure you understand it.
david jencks On 2003.03.13 01:48 Craig Berry wrote: > This is in part a general J2EE question, but I suspect some of the > behavior may be implementation specific, so if it has a JBoss > peculiarity, please let me know. > > I would like to establish a JTA transaction in a servlet, under which the > servlet will look up and interact with session beans, which will in turn > do the same with entity beans. The entity beans, and possibly the > session beans under special circumstances, will be obtaining JDBC > connections from the pool and using them to move data to and from the DB. > The servlet will make many session bean calls, each of which may make > several entity bean calls, but of course I want the whole thing, > including all the DB changes, to operate as a transaction -- that is, > nothing really changes at the DB level until the servlet calls > usertxn.commit(). > > The problem is that all the doc I can find dances around the interaction > of jdbc and jta transactions without actually answering the question of > whether this is how things are supposed to work, and if so, what config > and coding pattern(s) to follow to achieve this goal. It seems like a > fairly standard thing to want to do, so I can't imagine the answer isn't > out there somewhere -- but so far, I've had no luck finding it. > > If it matters, all the beans use container managed transactions set to > join any txn in process, and the entity beans use bean-managed > persistence. > > So, can anyone either provide this info directly, or point me to some > good clear documentation on the details of how to do this under JBoss? > Thanks in advance! > > ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
