I have a Entity bean called "CategoryBean" that is recursive. Categories
can have children categories, and those categories can have children, etc.
Example:
Furniture
Chair
Couch
Bedding
Sheets
Blankets
My ejb "CategoryBean" needs to get its children. For example, user clicks
on category, need to show sub-categories. I created a method called
getChildCategories() in my CategoryBean object. The method
getChildCategories() does the lookup on the home object and calls the
findByParent(String categoryId) finder on the home object.
My question is, is this indirection necessary? Why would I need my instance
of an EJB to look up another (possible its own) reference to lookup its
children?
Does anyone have example of parent/child relationship as entity bean?
Thanks!
public Enumeration getChildCategories() throws RemoteException {
CategoryHome home = null;
try {
Context initCtx = new InitialContext(ctx.getEnvironment());
home = (CategoryHome) initCtx.findByParent(categoryId);
} catch (Exception e) {
throw new ServerException("Lookup failed",e);
}
}
Phillip Rhodes
[EMAIL PROTECTED]
Alcoa eCommerce
https://www.ALCOADIRECT.COM
826B Two Allegheny Center Pittsburgh, PA 15212
(412) 553-4900 (phone) (412) 553-2484 (fax)
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".