In EJB 2.0, What is a cmr-field. How can I differentiate between a cmr-field and a cmp-field?

prajakt samant

CMR stands for Container Managed Relation Field.

In EJB 2.0 Persistence of CMP bean is managed by a Persistence manager
The developer has to write his bean implementation class as abstract and Persistence Manager generates a concrete class for the bean.

I will try to give an Example:-
Bean Developers Class:-
public abstract EmployeeBean implements
javax.ejb.EntityBean {

public abstract void setFirstName(String firstName);
public abstract String getFirstName();
public abstract void setAddress(Address addr);
public abstract Address getAddres();

}//end of class

where Address is another abstract class(dependant object) having streetno,zip and other details

In Deployment Descriptor:-



Thus when Persistence manager generates the concrete class for above abstract class.It creates a variable "firstName" of type String as CMP and "myaddress" which of type Address, which is a CMR or also called as dependant object.