This week's book giveaway is in the Cloud/Virtualization forum. We're giving away four copies of Mastering Corda: Blockchain for Java Developers and have Jamiel Sheikh on-line! See this thread for details.
hello friends Here is a mock question from one of IBM's sample tests. An "account" CMP bean has a container-managed relationship to a "customer" CMP bean. The account table reflects the relationship with a foreign key relating to the customer table. The foreign key is declared with a "NOT NULL" constraint. When creating a new account for a customer the developer MUST: A. set the customer in the ejbCreate method of the account bean B. set the customer in the ejbPostCreate method of the account bean C. set the account in the ejbPostCreate method of the customer bean D. provide a local interface for the customer CMP entity bean Are B and D the correct answers ? If a bean has a relationship to another, is it mandatory that the database table of the first bean must have the foreign key set to the database table of the second ? Thanks Vipin
From ejb Spec 2.0 1. (Please see CMP-Entity Lifecycle) The entity Bean Provider may use the ejbPostCreate<METHOD>(...) to set the values of cmr-fields to complete the initialization of the entity bean instance. 2. CMP Entity use with Local Interface Only
Hopefully : It will help u.
Java Developer, Thailand
hey friends What about my above question ? Please send in your inputs. Here is one more question which I found confusing. A typical use of ejbHome and ejbSelect method would be? (Select 2 answers) A. use ejbSelect methods within ejbHome methods to return entities B. use ejbSelect methods to access fields of a bean instance C. use ejbHome methods to perform operation not specific to a entity instance D. Use ejbHome methods to initialize entity bean instance variables I know that C is surely correct. What about A and B, only one of them is right. ejbSelect methods can return CMP fields as well as entities. right ? So which one would it be ? Thanks Vipin
My answers to your ejbHome and ejbSelect methods question: Option A is correct, as ejbSelect methods can be called in ejbFinder methods. Option B is incorrect, as ejbSelect methods are not exposed to the client. In fact all methods of the bean instance can be used to access the fields of a loaded bean instance. Option C is correct, as finder methods and home business methods are used in the home interface. Option D may not be correct, as ejbActivate method may be used to initialize the bean instance after passivation.