I am assuming your entity beans are BMP, since you are explicitly modifying bean state
(which subsequently need to be persisted) in your ejbCreate/ejbPostCreate methods.
Well, my point is if you compare the lifecycle of accessing a bean method:
EJBObject.methodA()
Bean.ejbLoad()
Bean.methodA()
Bean.ejbStore()
versus creating a new bean/row:
EJBObject.create()
Bean.ejbCreate()
Bean.ejbPostCreate()
You'll notice that there is no ejbLoad/Store wrapping a create. Hence the onus is on
ejbCreate/postCreate to perform all the persistence calls (for bmp). If you modify the
state of the bean in ejbPostCreate, then you also have to make the persistent calls for
them to stick. Otherwise who else is going to do the job?
Gene
--- fname lname <[EMAIL PROTECTED]> wrote:
> I'm afraid I don't know what you mean. This is what
> the code looks like in postCreate:
> this.field1 = "Hello";
> B b = bHome.findByPrimaryKey("1");
> b.passA( myRemote );
>
> --- Gene Chuang <[EMAIL PROTECTED]> wrote:
> > Is your ejbPostCreate() just "modifying the bean
> > state", or is it making persistence
> > calls to mirror this modifications as well?
> >
> > Gene
> > --- fname lname <[EMAIL PROTECTED]> wrote:
> > > The EJB 1.1 server I'm using is doing something I
> > > don't like and I'd like to find out how other
> > vendors
> > > are handling this situation. Your comments will
> > be
> > > greatly appreciated.
> > >
> > > Both Entity A and Entity B have transaction
> > attribute
> > > set to required.
> > > [-----EJB Container-----]
> > > client Entity A Entity B
> > > | | |
> > > |***********>| |
> > > | [create] |
> > > | [postCreate]*****>|
> > > | | |
> > > | |<**callBack*|
> > > | | |
> > >
> > > 1) The client calls create on Entity A
> > > 2) Entity A ejbCreate executes
> > > 3) Entity A postCreate modifies its state and
> > passes
> > > a reference to itself to Entity B like so:
> > > this.field1 = "Hello";
> > > B b = bHome.findByPrimaryKey("1");
> > > b.passA( myRemote );
> > > 4) Entity B calls a method on A using the
> > reference it
> > > was passed.
> > > THIS IS THE PART I DON'T LIKE--> just before B
> > calls
> > > back on A, ejbLoad is getting called on A, having
> > the
> > > affect of losing the modifications within A up
> > until
> > > that point.
> > >
> > > A trace of the lifecycle methods is shown below:
> > > AImpl.setEntityContext
> > > AImpl.ejbCreate
> > > AImpl.ejbPostCreate
> > > BImpl.setEntityContext
> > > BImpl.ejbCreate
> > > BImpl.ejbPostCreate
> > > BImpl.passA
> > > AImpl.ejbLoad CALLED ON MODIFIED ENTITY!!
> > > AImpl.callBack
> > > AImpl.ejbStore
> > > AImpl.setEntityContext
> > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Tax Center - online filing with TurboTax
> > > http://taxes.yahoo.com/
> > >
> > >
> >
> ===========================================================================
> > > 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".
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://taxes.yahoo.com/
> >
> >
> ===========================================================================
> > 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".
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
===========================================================================
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".