• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CMP Entity Beans Vs BMP Entity Beans

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When is it appropriate(rather, the only choice) to use a BMP Entity Bean as against a CMP Entity Bean? We have a table which also has a child table. For each row in the parent table, there will be one or more rows in the child table. If I want to develop an entity Bean for the parent table, can I use a CMP Bean? Is it possible to depict this relation correctly, using the Deployment Descriptors, according to EJB1.1? Please help. Thanks!
 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have more than one table involved you need to use BMP
or if your database supports updateable views you could use
CMP and create a view to reference.
 
Asuthosh Borikar
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jim. That's what I thought, but wanted to confirm my thoughts.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a common misconception to think that CMP is limited to only one-table database schemas. Yes, with CMP you can map your bean to only one database table/view, but doesn't necessarily mean that you are limited to one-table schemas.
 
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
svoropay,
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks,
Matt
 
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear svoropay,
Would you please provide and example or online resource that explains how to use CMP with more that one table?
Thank you,
Michael
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is hard to come up with any good online resource on this topic, but a very good printed resource would be "Enterprise Java Beans 2d Ed." by Richard Monson-Haefel. A whole section called "Entity beans relationships" in chapter 9 is devoted to this topic, where the author suggests a few possible ways of dealing with relationships between EJBs.
Regards,
Sergei
 
Asuthosh Borikar
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sergie,
I've read that topic from Richard's book. He does specify the CMP way of dealing with relationships between EJBs, but he also states that UNLESS your App.Server supports Object-to-Relational data mapping, the only way of dealing with many-to-one relationships is to use BMP. I just wanted to make sure that this issue is cleared out, and that I've understood that book correctly. Your comments are welcome. Thanks!
 
Sergei Voropay
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like people have mixed opinions on this topic. Some say it is ok to mimic one-to-many relationships with CMP ejbs through bean references, some say that it's too costly and inefficient in terms of performance and alternative solutions (o/r mapping) should be used. I'm a supporter of the former approach considering the benefits CMP provides even if I have to sacrifice some performance. For small to medium complexity database schemas involving one-to-many relationships, mimicking the relationships between beans through references is very easy -- just extend the concept provided in the book to collections of objects. Here is a little example on one-to-many relationships between CMP ejbs from the Borland web site: http://www.borland.com/techpubs/books/appserver/appserver40/examples/ejb/pigs/README.html.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sergei,
That web site is not exist anymore, do you know the
correct one?
Thanks a lot,
Sarah
 
Matt Midcap
Sheriff
Posts: 440
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi "sarah00",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.borland.com/techpubs/books/appserver/appserver40/examples/ejb/pigs/README. html
But this sample is not object of the discussion, right?
[This message has been edited by George Toronto (edited March 04, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic