File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Generalizations and EJBs - Part II Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Architect Certification (SCEA/OCMJEA)
Reply Bookmark "Generalizations and EJBs - Part II" Watch "Generalizations and EJBs - Part II" New topic
Author

Generalizations and EJBs - Part II

Sridhar Raman
Ranch Hand

Joined: Nov 30, 2001
Posts: 142
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

Joined: Dec 16, 2002
Posts: 307
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.


www.classic-and-class.com - www.evalulearn.com
Interfaces are the glue of OO.
Sridhar Raman
Ranch Hand

Joined: Nov 30, 2001
Posts: 142
Thanks, Thomas, for your response. It is very helpful.
 
 
subject: Generalizations and EJBs - Part II
 
Threads others viewed
Some doubts with transactions(Please help).
Detail in Class Diagram
Use of DAO in SCJEA Assignment
EJB CookBook... for beginners?
session EJB with local entity EJBs in component diagram
IntelliJ Java IDE