• 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

Question on EJB

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,
Whole solving one question come is
Is it compulsory for Enitity and Session bean to have atleast one create method???
I think this is not complusory becase entity bean can choose not to write any create method ??

Please share your views
Thanks
Apratim
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Apratim Khandalkar:
Hi All ,
Whole solving one question come is
Is it compulsory for Enitity and Session bean to have atleast one create method???
I think this is not complusory becase entity bean can choose not to write any create method ??

Please share your views
Thanks
Apratim



Hi Apratim,

In Fact, session and entity beans must have at least on create method in yours home interface. But in the case of entity beans, they can to choose to not have an create method, because they can be achieved by finder methods. Remember that, entity beans represents an row of an relational database. So, those records can be accessed using finders methods.

If an bean provider choose to not create an create method for an entity bean, it is because this bean will be for read-only pourpouses only. Something like the fast lane reader pattern does. Makes available tabular data to the application.

But, the session beans must have at least one create method, because it is the only way to access the bean (that represents a service for the application). Remember that the home interface acts as a factory for the enterprise beans. So, to access the bean, you should use the factory home interface, calling the create method related.

That is, the reason because session beans must have on create method declared in your home interface, and entity beans can choose to not define an create method.

I hope have helped you!~
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would recommend the EJB specificaion on this. It clearly states when you need create method on Entity and Session beans.
 
Apratim Khandalkar
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot Ricardo,
This was very good explanation.It helpe me lot.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic