Where and when should I use the context.getPrimaryKey() method rather than just accessing the Primary Key field(s) directly?

Sathyanarayana Katakam

context.getPrimaryKey() is used when an instance is associated with an EJB object, and is used during the callback methods (ejbActivate, ejbPassivate, etc ..) and business methods.

This method should be called once the bean is associated with an EJBObject. As, if the bean is not associated with one, then you will get an IllegalStateException. The earliest you can call this method without getting an exception is in the ejbPostCreate() mtehod.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact