Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can ejbHome Methods be declared as final?

 
AmitKumar Jain
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB Specification clearly states for ejbCreate() and ejbPostCreate() that they cannot be marked final or static.
But for ejbHome methods, it only states that "The method must not be declared as static". So can we declare Home Business methods as final??
 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit,
I guess that should work. Since no other class is going to implement your home interface, so declaring your home business methods should be fine.

Let us know if you write code and test it..

Thanks,
Ugender
 
paresh vernekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Amit,
Although the spec doesn't mention that the ejbHome methods shouldn't be final, however this doesn't work.I tried the same but the appserver didn't deploy the application.I used Weblogic v8.1.It used to give error at deploy time

Regards,
Paresh Vernekar
 
AmitKumar Jain
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks paresh for verifying the same. I was unable to verify due to tight work schedule.
The only thing that makes this exam tough is these ifs and buts, which really don't matter while at work and then this makes me think whether its worth devoting time on these.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi AmitKumar Jain,

Methods in an interface can never be marked as 'final',
If you try to do so: the compiler will give you an error.

Good luck!

Herman Scheltinga
 
AmitKumar Jain
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am talking of EJB bean class here and not home interface.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi AmitKumar Jain,

Sorry for misunderstanding you.

Then I think Ugender Rekulampally is right:
according to the ejb2.0 specs it should be OK.

Herman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic