• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A simple query

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please tell me if one can create a bean class which extends another bean? After all in java one can create any class which is extending one single class and EJB is a java class file only. If not what could be the reason.

Thanks
Shalu
 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes you can. you can extend another class - a class who is a child, directly or indirectly to a parent ejb class
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Extending just a class is always permitted in EJB but what really makes any sense to just a class extension in terms of inheritance in EJB? I guess it will be worth if an EJB extends another EJB to add-on some functionality and inherit all characteristics of the parent EJB (here all characteristics means many thing like EJB type, transactions, security etc) but an EJB is really not a single class so in true sense the inheritance in EJB is not supported by specification. Some day the true inheritance may be possible but not now.
 
shalu sharma
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Naren India:
I guess it will be worth if an EJB extends another EJB to add-on some functionality and inherit all characteristics of the parent EJB (here all characteristics means many thing like EJB type, transactions, security etc) but an EJB is really not a single class so in true sense the inheritance in EJB is not supported by specification.



yes i was talking about 1 ejb extending another ejb only.. if it is not supported by the specification then it means that this feature would not be supported by many app servers.

Here I would like to know which all vendors/app servers support this type of functionality and can u give me some example/scenario where there is a suitablity for type of inheritance.
 
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

It is clearly given in the book (HF EJB) that you can extend a bean class from another class or bean class. It is plain old java inheritance. It will just do the normal inheritance and you cannot inherit beanness. Refer to the book. I couldnt remember the chapter name. I will tell you tomorrow.
 
Naren India
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Back to your question is there any app server that supports bean inheritance? Answer is NO because bean inheritance is not supported in EJB specification. Sure the specification does not prevent to use class inheritance. An EJB can extend a class but that's not some thing inheriting EJB or EJB's characteristics.
 
shalu sharma
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I came accross an interesting article about ejb inheritance. Pls check it out. would like to know the ranchers comment.

http://www.onjava.com/lpt/a/2589
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Interesting debate,
Well, the thing is that, there are two things 1) What you can do according to Java specs 2) What you can do as per ejb specs

Although you can Inherit any class according to Java Specs but Ejb Specs doesnt say any thing about Inheritence of a bean.

This is an exam based on Ejb specification rather than Java Specification. (clearly mentioned in HF EJB).
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shalu,

EJB being part of J2EE spec, does support inheritance... by saying that when u inherit the one bean CLASS in another, you can inherit the functionality, but not the 'UNDERLYING BEANESS' provided by it...

- Ganesh.
SCJP,SBCD,SCEA,BEA Certified Weblogic Administrator.
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic