hi all, I have a customer EJB object. It has a dependent object Address. Customer EJB is a CMP Entity bean. How can i establish the relationship between Customer and Address Beans. Can the address also be a CMP Entity bean? Does it have to be a Java Bean. If it were to be a java bean, how can i ensure the persistence of its fields. I am using EJB1.1 not 2.0 I d appreciate your comments. thanks Ajit
Both of them can be CMP. The relationship is maintained by FK. This is a one to many relationship. The parent is customer and the child is address. The address bean will keep the customer's primary key as foreigh key. EJB 2.0 relationships are represented by abstract accessors and special collection classes which are managed by the EJB container. The child CMP should be implemented with local interfaces. Modeling this relationship with CMP has several advantages than using DAO.
Be careful -- the support for this varies based on the EJB container vendor you are using. For instance, WebSphere provides different support for this than WebLogic... Which container are you using, by the way? Kyle