-
1. Re: CMP - Local EJBs are making distinct calls to the databa
scswarga Apr 20, 2005 6:42 PM (in response to scswarga)More info:
I am using CMRs. and value objects using the @ejb.relation and @ejb.value-object xdoclet tags.
Example:
/*
* @ejb.relation
* name="customer-user"
* role-name="CustomerUserRelationshipRole"
* cascade-delete="no"
* target-ejb="User"
* target-role-name="UserCustomerRelationshipRole"
* target-cascade-delete="no"
* @ejb.value-object
* compose="CustomerVO"
* compose-name="Customer"
* members="CustomerLocal"
* members-name="CustomerLocal"
* relation="external"
*/
public abstract CustomerLocal getCustomer();
The generated CustomerCMP has the method implemented as
public CustomerVO getCustomerVO()
{
customerVO = new CustomerVO ();
try
{
customerVO .setName( getName() );
customerVO .setAddress( getAddress() );
}
catch (Exception e)
{
throw new javax.ejb.EJBException(e);
}
return customerVO;
}
And as I was profiling the application, it made separate calls to the database to get the name and address fields.
So if there are about 10 fields in the table, it would make 10 calls instead of one sql statement to retrieve all the field values.
Can anyone solve this problem?