i want explanation for postcreate()
when it is called?
what unSetentityContext()
-
what is the importance of postcreate() call back method? (3 messages)
- Posted by: vaga raju
- Posted on: September 01 2003 00:19 EDT
Threaded Messages (3)
- what is the importance of postcreate() call back method? by stephen smithstone on September 01 2003 03:42 EDT
- what is the importance of postcreate() call back method? by BENMIRA Nabil on September 01 2003 07:03 EDT
- what is the importance of postcreate() call back method? by Paul Strack on September 01 2003 22:28 EDT
-
what is the importance of postcreate() call back method?[ Go to top ]
- Posted by: stephen smithstone
- Posted on: September 01 2003 03:42 EDT
- in response to vaga raju
if i can remember correctly i think it allows you to pass multiple parameters to the create method then the create method makes the data in the db with the primary key then uses the postcreate method to set the remaining methods , you would propably needs someones elses advice thou -
what is the importance of postcreate() call back method?[ Go to top ]
- Posted by: BENMIRA Nabil
- Posted on: September 01 2003 07:03 EDT
- in response to vaga raju
Hi,
1. The container calls ejbPostCreate() after it has associated your bean instance with an EJB object (so after the ejbCreate()).
in this method you can complete your initialization by doing anything you need to that requires that EJB object, such as passing your beans EJB object reference to other beans.
You might also use this method to reset certain transaction-related parameters. For example, you could keep a data status flag in the bean to indicate whether a field has been changed. Because the bean instance may have been used before, these fields might have dirty data.
2. the unsetEntityContext disassociates a bean from its environment. The container calls this right before your entity bean instance is destroyed(when it wants to reduce the pool size).
Nabil -
what is the importance of postcreate() call back method?[ Go to top ]
- Posted by: Paul Strack
- Posted on: September 01 2003 22:28 EDT
- in response to BENMIRA Nabil
Another thing about ejbPostCreate():
In CMP, ejbPostCreate() is invoked *after* the database insert. It is useful for operations that cannot be performed until after the database record exists (like setting foreign-key references in other EJBs).
The vast majority of the time, ejbPostCreate() does nothing.