Rickard wrote:
> Have you done println statements in ejbPassivate and checked that they
> are called after each transaction? I think you will find that this is
> not the case.
> A particular instance associated with a particular primary key will be
> passivated if "left alone" long enough, and will then be passivated
> after which this particular instance may be reused for serving other
> primary keys(/objects).
> If you can make a testcase in which you start a transaction, use a bean,
> commit the transaction, and the bean is *immediately* passivated I would
> be surprised. Can you do this?
Here is a trace I had already prepared earlier,
by inserting println statements inside the ejb methods of
an EJB called TString. Many of the ejb methods of TString are implemented by
its base class TObject so you will see TObject in the trace too.
The EJB server in this case is IBM Websphere Advanced 3.0.
Successive EJB creates are performed from a remote, stand-alone Java application.
A transaction is raised for each create by the IBM EJB Server and
at the end of each transaction the EJB server passivates the EJB,
and the EJBObject is returned to the pool, and the EJB is deallocated.
This can be seen from the trace and the fact that the this pointer
is the same for every transaction.
The question is whether this defensive behaviour to preserve
data integrity is correct. J2EE does not do this but this means
that you have to manage your own data integrity. Shouldn't there be
a dirty flag and a version/timestamp marker in the EJB specification
so that data integrity can be controlled in a consistent,
vendor-independent manner?
Please see my earlier posting.
Here is the trace from WSA 3.0 :
**** TObjectBean > setEntityContext
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = null
**** TObjectBean < getPrimaryKey
**** TObjectBean > setEntityContext null
**** TObjectBean < setEntityContext
**** TStringBean > ejbCreate
**** TStringBean > ejbCreate localhost:TString=0, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TObjectBean > ejbCreate
**** TObjectBean > ejbCreate localhost:TString=0
**** TObjectBean < ejbCreate localhost:TString=0
**** TStringBean < ejbCreate localhost:TString=0, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TStringBean > ejbPostCreate
**** TStringBean > ejbPostCreate localhost:TString=0
**** TObjectBean > ejbPostCreate
**** TObjectBean > ejbPostCreate localhost:TString=0
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=0
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbPostCreate localhost:TString=0
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=0
**** TObjectBean < getPrimaryKey
**** TStringBean < ejbPostCreate localhost:TString=0
**** TObjectBean > ejbStore
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=0
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbStore localhost:TString=0
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=0
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbStore localhost:TString=0
**** TObjectBean > ejbPassivate
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=0
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbPassivate localhost:TString=0
**** TObjectBean < ejbPassivate
**** TStringBean > ejbCreate
**** TStringBean > ejbCreate localhost:TString=1, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TObjectBean > ejbCreate
**** TObjectBean > ejbCreate localhost:TString=1
**** TObjectBean < ejbCreate localhost:TString=1
**** TStringBean < ejbCreate localhost:TString=1, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TStringBean > ejbPostCreate
**** TStringBean > ejbPostCreate localhost:TString=1
**** TObjectBean > ejbPostCreate
**** TObjectBean > ejbPostCreate localhost:TString=1
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=1
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbPostCreate localhost:TString=1
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=1
**** TObjectBean < getPrimaryKey
**** TStringBean < ejbPostCreate localhost:TString=1
**** TObjectBean > ejbStore
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=1
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbStore localhost:TString=1
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=1
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbStore localhost:TString=1
**** TObjectBean > ejbPassivate
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=1
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbPassivate localhost:TString=1
**** TObjectBean < ejbPassivate
**** TStringBean > ejbCreate
**** TStringBean > ejbCreate localhost:TString=2, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TObjectBean > ejbCreate
**** TObjectBean > ejbCreate localhost:TString=2
**** TObjectBean < ejbCreate localhost:TString=2
**** TStringBean < ejbCreate localhost:TString=2, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TStringBean > ejbPostCreate
**** TStringBean > ejbPostCreate localhost:TString=2
**** TObjectBean > ejbPostCreate
**** TObjectBean > ejbPostCreate localhost:TString=2
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=2
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbPostCreate localhost:TString=2
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=2
**** TObjectBean < getPrimaryKey
**** TStringBean < ejbPostCreate localhost:TString=2
**** TObjectBean > ejbStore
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=2
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbStore localhost:TString=2
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=2
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbStore localhost:TString=2
**** TObjectBean > ejbPassivate
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=2
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbPassivate localhost:TString=2
**** TObjectBean < ejbPassivate
**** TStringBean > ejbCreate
**** TStringBean > ejbCreate localhost:TString=3, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TObjectBean > ejbCreate
**** TObjectBean > ejbCreate localhost:TString=3
**** TObjectBean < ejbCreate localhost:TString=3
**** TStringBean < ejbCreate localhost:TString=3, this =
com.ubs.cube.test.ejb.TStringBean@3a0a58
**** TStringBean > ejbPostCreate
**** TStringBean > ejbPostCreate localhost:TString=3
**** TObjectBean > ejbPostCreate
**** TObjectBean > ejbPostCreate localhost:TString=3
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=3
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbPostCreate localhost:TString=3
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=3
**** TObjectBean < getPrimaryKey
**** TStringBean < ejbPostCreate localhost:TString=3
**** TObjectBean > ejbStore
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=3
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbStore localhost:TString=3
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=3
**** TObjectBean < getPrimaryKey
**** TObjectBean < ejbStore localhost:TString=3
**** TObjectBean > ejbPassivate
**** TObjectBean > getPrimaryKey
**** TObjectBean > getPrimaryKey = localhost:TString=3
**** TObjectBean < getPrimaryKey
**** TObjectBean > ejbPassivate localhost:TString=3
**** TObjectBean < ejbPassivate
**** TStringBean > ejbCreate
Geoff
===========================================================================
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".