Is it recommended to call an ejbcreate method from an another ejbCreate method (EJB 2.0 CMP)?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tamilinian_Chinnachamy
Posted On:   Monday, January 20, 2003 04:59 PM

Is it recommended to call an ejbcreate method from an another ejbCreate method (EJB 2.0 CMP)? I have an aggregate entity, lets say employee and addresses. One employee has many addresses. We use CMP EJB 2.0 beans. Lets say that I have to create an employee who has two addresses. I have the following two options. Both of them work. 1. I can perform a JNDI lookup for these two entity beans from a session bean, call their ejbCreate and set the relationships accordingly. 2. I can make the employee entity bean lookup for the address entity bean (from the ejb create of employee entity bean) and create its addresses, and Call the employee entity bean from a session bean with an aggregate val   More>>

Is it recommended to call an ejbcreate method from an another ejbCreate method (EJB 2.0 CMP)?


I have an aggregate entity, lets say employee and addresses. One employee has many addresses. We use CMP EJB 2.0 beans. Lets say that I have to create an employee who has two addresses.




I have the following two options. Both of them work.


1. I can perform a JNDI lookup for these two entity beans from a session bean, call their ejbCreate and set the relationships accordingly.


2. I can make the employee entity bean lookup for the address entity bean (from the ejb create of employee entity bean) and create its addresses, and Call the employee entity bean from a session bean with an aggregate value object as an argument. In this case, I will have several entity beans calling other entity beans while creating an entity bean - nested ejb creates in entity beans.




I have noticed that most of the articles/demos use the first Option described above.





Now, Which one of the above two options is recommended, and Why? Is there and major performance varions among them?

   <<Less
About | Sitemap | Contact