• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB1.1 Dependent Object - CMP Entity Beans  RSS feed

 
Ajit Kumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Hope this help
Ruilin
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer to Chaper 5 & 6 of "Professional EJB" from Wrox. The topic was covered very well in that book.
Good luck
Ruilin
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle,
I am using JRun. The beta version is supporting EJB 2.0.
ruilin
 
Ajit Kumar
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Guys,
It looks like the idea of having both the customer and the address as CMP entity beans does not seem to be a good idea, as it varies with app servers. I am using EJB1.1.

Is it a good idea to go with Bean Managed Persistence, with a DAO doing the data access part.
[ February 07, 2002: Message edited by: Ajit Kumar ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!