J2EE tutorial says that we can keep a long-term connection even for a entity bean. That means that it keeps the connection for its entire life. I am frustrated with this description because I think this doesn't work with distributed transaction.
Please read this: http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Resources3.html#65118 EJB 2.0 section 17.3.1 says "An Entity Bean must always be designed with container-managed transaction demarcation". So we cannot control the transaction demarcation explicitly even for the long-term connection case. According to JTA(Java Transaction API) spec, calling Connection.close() send a notification to an application server, and this causes the following sequence: 1. application closes the connection. 2. application server get a closing notification 3. application server calls Transaction.delistResource(). 4. transaction calls XAResource.end(). With distributed transaction, therefore, the long-term connection is never closed until the end of the life. Thus the application server doesn't have a chance to inform the end of transaction to the resource manager before returning ejb methods. IMHO, the entity bean with long-term transaction works only with one of the following conditions: - local transaction - NotSupported for distributed transaction. I just want to clear up a "guideline for writing BMP entity beans". Before sending a comment to J2EE tutorial team, I'd like to hear the expert's ideas. Thank you, Miki ---------------------------------------------------------------- Fusayuki Minamoto Solution Technology Development Unit Solution Development Center Fuji Xerox Co., Ltd. =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
