  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | BMP or CMP ? | BMP or CMP ? 2003-08-12 - By Rajeev Chitamoor
Back Are there any guiding principles/rules of thumb to determine which persistence strategy
to use for Entity Beans. So far, we (my team) have relied extensively upon
BMP to persist our Entity Beans, but are very interested to adopt the CMP persistence strategy
considering some of the nice benefits it offers. The cool thing I find about CMP/R is that it provides a
facility to 'declaratively' specify Entity relationship mapping.
Our only concern is, are there any potential pitfalls when it comes
to persisting certain kinds of object models using CMP, or in other words,
'Can CMP be used to persist any kind of object model ?'. I know in theory it is
possible to do so, but I was curious to hear from folks who have successfully
used CMP as their persistence mechanism.
We have a whole bunch of relatively complex Object models (objects graphs that are
multiple levels deep), which are currently being persisted using BMP. I must say
that it has so far worked well.
I did come across these broad guidelines in the Core J2EE patterns book.
- Avoid inter entity bean relationships as much as possible.
- Use coarse grained objects if possible
- Composite pattern.
I sort of felt that most of the suggestions/examples (related to Object persistence) mentioned in
the book seemed more applicable to BMP than CMP.
The single biggest concern I have about CMP is, 'Can I efficiently map
complex composite objects to a underlying relational data store ?' .
I did do some initial reading on web and also glanced through some books
(I thought Ed Roman's book had some nice examples on CMP), but most of these examples
were not terribly complex, and I haven't come across any examples that can alleviate my
concerns about CMP.
We are currently looking at ways to simply the current object models we have in the
hope that it would simply the persistence mechanism.
We derive a whole bunch of intermediate data structures (for efficiency reasons) from our
relational data to be stored in our object models which we are looking to eliminate
as much as possible.
Any thoughts/ideas/suggestions in this area would be appreciated. Also, if you are
currently using CMP as your persistence strategy, it would benefit my team
hugely to know of potential pitfalls and also of any design/implementation/testing
tips.
Thanks much
- Rajeev
==================================================================== Community Web Site (Core J2EE Patterns Catalog - Online Version): http://java.sun.com/blueprints/corej2eepatterns Getting Started (Beta Version): http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ Get the book: http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20 (See http://tte-20.ora-code.com) List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
<html>
<head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {font-family:Arial; color:windowtext;} @(protected) Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Are there any guiding principles/rules of thumb to determine which persistence strategy</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>to use for Entity Beans. So far, we (my team) have relied extensively upon</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>BMP to persist our Entity Beans, but are very interested to adopt the CMP persistence strategy</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>considering some of the nice benefits it offers. The cool thing I find about CMP/R is that it provides a </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>facility to ‘declaratively’ specify Entity relationship mapping.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Our only concern is, are there any potential pitfalls when it comes</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>to persisting certain kinds of object models using CMP, or in other words,</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>‘Can CMP be used to persist any kind of object model ? ’. I know in theory it is</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>possible to do so, but I was curious to hear from folks who have successfully</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>used CMP as their persistence mechanism.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>We have a whole bunch of relatively complex Object models (objects graphs that are</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>multiple levels deep), which are currently being persisted using BMP. I must say</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>that it has so far worked well.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>I did come across these broad guidelines in the Core J2EE patterns book.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>- Avoid inter entity bean relationships as much as possible. </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>- Use coarse grained objects if possible</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>- Composite pattern.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>I sort of felt that most of the suggestions/examples (related to Object persistence) mentioned in </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>the book seemed more applicable to BMP than CMP.</span>< /font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>The single biggest concern I have about CMP is, ‘Can I efficiently map</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>complex composite objects to a underlying relational data store ?’ .</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>I did do some initial reading on web and also glanced through some books </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>(I thought Ed Roman's book had some nice examples on CMP), but most of these examples </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>were not terribly complex, and I haven't come across any examples that can alleviate my</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>concerns about CMP.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>We are currently looking at ways to simply the current object models we have in the</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>hope that it would simply the persistence mechanism.</span>< /font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>We derive a whole bunch of intermediate data structures (for efficiency reasons) from our</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>relational data to be stored in our object models which we are looking to eliminate </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>as much as possible.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Any thoughts/ideas/suggestions in this area would be appreciated. Also, if you are </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>currently using CMP as your persistence strategy, it would benefit my team </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>hugely to know of potential pitfalls and also of any design/implementation/testing </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>tips.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Thanks much</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>- Rajeev</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'> </span></font></p>
</div>
</body>
</html> ==================================================================== Community Web Site (Core J2EE Patterns Catalog - Online Version): http://java.sun.com/blueprints/corej2eepatterns Getting Started (Beta Version): http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ Get the book: http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20 (See http://tte-20.ora-code.com) List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|
 |