Forums Register Login
Why you can not overload findByPrimaryKey method?
Please comment. Thanks.
A entity bean can have only one primary key and hence only one meaningful findByPrimaryKey() is possible and allowed.
If I create a method findByPrimaryKey(String str1, String str2) will it not compile?
I know it is not making sense, but in this case I think container will not use it and it will be considered a normal business method.
Code would compile. but whether it would deploy or not depends on the container provider.

EJB specs, 9.5.2, page 113 states the following:
There is a unique findByPrimaryKey(primaryKey) method for an entity bean on its remote home interface; this method must not be overloaded

The above implies you as a Bean provider must ensure that the component interface complies to the above guideline. Unless you comply to EJB specs, you cannot guarantee code portability (WODA).

For the exam, HFEJB has explained what a "can" means. I suggest you to follow that rule strictly.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

All times above are in ranch (not your local) time.
The current ranch time is
Dec 13, 2017 21:18:19.