aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes CMP-CMR relationships ejbActivate and EJB Performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMP-CMR relationships ejbActivate and EJB Performance" Watch "CMP-CMR relationships ejbActivate and EJB Performance" New topic
Author

CMP-CMR relationships ejbActivate and EJB Performance

Mallik Hiremath
Ranch Hand

Joined: Oct 20, 2002
Posts: 46
Let me explain the CMP-CMR relationships and the problem!!
Say we have Employee (CMP-EJB) maps to EMPLOYEE_TBL
and Dept (CMP-EBJ) maps to DEPT_TBL
in EMPLOYEE_TBL there is a Dept_FK that maps to Dept_ID in DEPT_TBL
Say there are 2 Million employees ( Imaginary company ! )
out of these 2 Million say 1 Million belongs to Dept 1.
As per EJB specification set the Dept_FK relationship of the Employee Bean in its ejbPostCreate() method.
Now try to add one more employee to Dept 1,
while the Dept_FK CMR relationship is being set to this Employee Bean in the ejbPostCreate() method of EmployeeBean the container will call ejbActivate() method 1 million + 1 times and then sets the relationship of new Employee with Dept 1 EJB, then calls the ejbStore method of this new Employee.
Then again try to add one more Employee to same dept 1, this time its going to call ejbActivate() for 1 Million + 2 times !!!
What is going on here? Is this how the CMP beans supposed to work? or am I missing some settings in orion-ejb-jar.xml or any other config file?
I am using OC4J 904 on win2000 with oracle DB, would like to know how other EJB Servers doing on this issue?
Thank you
Mallik
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: CMP-CMR relationships ejbActivate and EJB Performance