• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

EJB1.1 Dependent Object - CMP Entity Beans

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic