The following question:
Which method(s) from the EntityContext interface can be invoked from within the ejbCreate method?
A. getEJBHome()
B. getEJBObject()
C. getCallerPrincipal()
D. getUserTransaction()
E. setRollbackOnly()
I've answered A, C, D - The HF book gave A, B, C, D
I've spent all afternoon in memorizing the various bean things entity beans can do in various moments of their lifecycle. I'm referring to HF, page 338 (Bean things you can do during entity creation - ejbCreate() )
It's clearly stated:
1) Get a reference to the Home interface
2) Query the container about client's security info
3) Do CMT-related things
4) Access the JNDI special environment
5) Access other bean's methods
6) Access other resource managers
So, following the book (and Valentin Crettaz' PDF, and goodsense), from ejbCreate you can't get a reference to your
EJB[Local]Object...Unless...The answer was: oh yes, you can, but you would get an exception. Thank you very much. But then, you turn on HF, page 144 (the 'Bang' section, got it?) and it's written:
In EJB, there's can and there's can. ...as in "Can a session bean client call getPrimaryKey() on the EJB object stub? ...for the exam, the answer would be NO! In other words, just because something is legally exposed to the caller [...] if the specs say you can't, then you can't.
So, as a famous singer was singing, ...'What am I supposed to do?'