Bugs item #550404, was opened at 2002-04-29 17:14
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=402704&aid=550404&group_id=31602
Category: None
Group: None
Status: Open
Resolution: None
Priority: 6
Submitted By: Paul Cantrell (melquiades)
Assigned to: Nobody/Anonymous (nobody)
Summary: Subclass's home iface extends super's
Initial Comment:
Suppose I have these entity beans:
SuperEntityEJB implements EntityBean
SubEntityEJB extends SuperEntityEJB
From these, xdoclet will generate these relationships:
SuperEntityEJBLocal extends EntityBean
SubEntityEJBLocal extends SuperEntityEJBLocal
SuperEntityEJBLocalHome extends EntityBean
SubEntityEJBLocalHome extends SuperEntityEJBLocalHome
I believe that the first of these is correct, but the second is wrong. There is no reason that there should be any natural relationship between different home interfaces. Home interfaces are essentially constructors and static methods -- and neither of these have any enforced relationship between subclasses and superclasses in the normal Java object model, so why should they in the EJB object model? The correct code for xdoclet to generate would be:
SuperEntityEJBLocalHome extends EntityBean
SubEntityEJBLocalHome extends EntityBean
----------------------------------------------------------------------
>Comment By: Paul Cantrell (melquiades)
Date: 2002-07-24 13:51
Message:
Logged In: YES
user_id=41726
I've submitted a patch for this:
https://sourceforge.net/tracker/?func=detail&aid=578858&group_id=31602&atid=402706
----------------------------------------------------------------------
Comment By: Paul Cantrell (melquiades)
Date: 2002-07-11 09:22
Message:
Logged In: YES
user_id=41726
> Since the SubEntity bean is going to inherit
> those, then why shouldn't its home interface
> also inherit its equivalents from the SuperHome?
Well, that's sort of a red herring. Having those methods in the EJB itself is a hack they use to give implementations of those methods somewhere to live. Those methods aren't actually allowed to access instance attributes of the EJB -- they're essentially static methods.
Home interfaces are essentially constructors and static methods, and should not be inherited for the same reasons that constructors and static methods are not inherited in normal objects.
Consider, for example, the case where your subclass has a different or more limited set of constructors than its superclass -- say the superclass has a no-args create(), but you want the subentity to expose only create(String name). You should be able to expose only create() in one home interface, and only create(String name) in the other.
----------------------------------------------------------------------
Comment By: Andrew Stevens (stevensa)
Date: 2002-07-11 04:15
Message:
Logged In: YES
user_id=247081
I disagree. If the SuperEntity has a finder method
ejbFindByWhatever, the SubEntity will inherit it and so its
home interface needs to have the equivalend
findByWhatever. Same for the ejbCreate methods,
ejbHomeXXX methods, etc. Since the SubEntity bean is
going to inherit those, then why shouldn't its home interface
also inherit its equivalents from the SuperHome?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=402704&aid=550404&group_id=31602
|