-
1. Re: How to retrieve same Connection after Activation
weston.price Dec 15, 2006 12:07 PM (in response to amedina)No. You can maintain the connection handle across method invocations but not the actualy physical connection. The only way that you would be guaranteed to have the same physical connection is if a transaction spanned multiple method calls on your StatefulSessionBean and your *-ds.xml file specified that you wanted to track-by-transaction.
Generally, this is a bad idea to begin with and requires you to explicitly enable this capability in the CachedConnectionManager.
There is no concept of holding a connection open during passivation. Being that the bean instance is serialized to disk you should close the connection prior to passivation and reopen the connection on activation. -
2. Re: How to retrieve same Connection after Activation
amedina Dec 18, 2006 7:55 AM (in response to amedina)Thank you for the quick reply.
Unfortunately, this is impossible for us, cause we're opening some temporary tables on the database, which are thrown away on connection close.
So would it be possible to write an Mbean, which holds the connections for the passivated beans? -
3. Re: How to retrieve same Connection after Activation
weston.price Dec 18, 2006 7:59 AM (in response to amedina)Anything is possible ;-)
Just keep in mind that resource leaks, timeouts, transaction issues etc will be common with your approach as you are going well outside of the JCA/EJB/J2EE specifications in terms of resource management.