Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generalizations and EJBs - Part II

 
Sridhar Raman
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This question is related to Part II of the exam but the question as such pertains to general EJB concepts.

Suppose I have a relationship such as Customer "is a" User where Customer is an Entity Bean and User is not a business entity but a regular abstract base class.
Can I have the Customer EJB extending the User abstract class? If so, How is it implemented?
Does inheritance work the same way in EJBs as in regular Java classes?
Thanks in advance
Sridhar
 
Thomas Taeger
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sridhar Raman001:
... Can I have the ... EJB extending the ... abstract class? If so, How is it implemented? ...

Hi Sridhar,
the following worked in a project:
public class MyEntityBean
extends EntityBeanAbstr // what you want to add
implements EntityBean // what the EJB container needs
public abstract class EntityBeanAbstr
extends DbConnectionFactoryBeanAbstr // as an example ...
public abstract class DbConnectionFactoryBeanAbstr // not via deployment descriptor here
// no extends or implements ...

But this is true for the BEAN CLASS only and not for the home or remote interfaces.
The home or remote interface must extend EJBHome and EJBObject directly.
Otherwise (not the compiler but) the verifier of the deploymenttool and the one of the ATG J2EE server insisted that the remote interface MySession must _directly_ extend EJBObject. There is not any interface level possible between the interfaces MySession and EJBObject.
Good luck
Thomas.
 
Sridhar Raman
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Thomas, for your response. It is very helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic