• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

a few questions

 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
1) In a stateless session bean component interface we can have only 1 create method with no args parameter. Why cant we have a create with arguments. Though i find it in every book or tutorial that we cant have a create with arguments in slsb no one actually clarifies why we cant have one & what if we have 1. what would be the consequences
2) Why Entity Beans???. What is it that we cant do with session beans that we have to resort to entity beans apart from entity beans surviving a server crash
3) How are Message Driven beans more effecient. Apart from not having a component or home interfaces what are the advantages of having MDB. What if we have the same logic in Session or entity beans
4) Where should we actually have database access code in a session or entity bean. How to decide when to use database interaction activities from session beans or entity beans
5) How to ensure cross database & cross schema portability of our EJB code
6) In stateful session beans what are the use of arguments passed with the create methods
Rgrds
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Answer to the first question:
In stateful beans the create method is overloaded mainly to send client specific information to the bean and coz bean is created on client demand and is attached to the client till he removes it so it can preserve that information till the end.
But for stateless beans there are many reasons
1) these beans already exist in pools and are assigned to client on business method invocations hence any information to be passed to the bean is done thrugh business method arguments.
2)these Beans cannot hold client specific information and conversational state so there is no need to pass info in a create method to the bean.
In summary since the bean is not assigned to the client during the create process so we cannot send information to the bean.
[ February 08, 2004: Message edited by: Sudhir Vallam ]
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. All SLSB with the same home are identical. There is no gain in having overloaded create() methods.
2. Entity beans represent business objects.They have a direct mapping to the database tables.
The entities/rows in the database can be created/updated/deleted. Session beans are used
for business logic or modulate a workflow business process.
3. MDBs are efficient for asynchronous messaging, so there is no blocking.It is much appreciated in a project that uses JMS.
Session/Entity beans are used for synchronous communication. The bean client is blocked, until it gets a response from the ejb.
4. You need to study EJBs more in detail. You can refer the EJB Design Patterns book at http://www.theserverside.com/books/wiley/EJBDesignPatterns/index.jsp or go thru SUN's examples, including PetStore.
5. EJB-QL is used for CMP2.0 entity beans. You can try to use DAO patterns for the others.
6. SFSB always hold client specific data, so overloading of the create() methods makes sense.
It would be easy to pass most of the parameters in one call to the SFSB rather than multiple calls.

Hope that helps!
[ February 10, 2004: Message edited by: Vish Kumar ]
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Homework assignment???
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Louis Saha:
Homework assignment???


So...... do I get the job
 
What are your superhero powers? Go ahead and try them on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic