File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lots of tables, what kind of mapping?

 
Leandro Melo
Ranch Hand
Posts: 401
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i'm building a j2ee e-commerce application.
I've modelled the system classes and the database, wich has around 30 tables (i took care of object-relational impedance mistach and everything else i could). Now, i'm in a deep doubt!
Actually, my question is a mixture of j2ee concepts with mapping concepts.
Anything i say from now on is a part of my doubt :-(
The classes i model (from the system use cases) should represent my business view correct (or the persistence view)?
I think it would be better to use composite entity design pattern to build the entities ejbs, but how do i make the choices? I mean, how do choose wich tables are gonna be joined in one composite entity?
Thanks,
 
Erik Bengtson
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are using CMP entity beans, you don't have much choice. You will mostly be locked in a 1 class - 1 table mapping.
if you are using BMP entity beans, why do that ? it's just a wrapper to a JDBC code that slow down the application performance. Go straight with JDBC
if you are evaluating a real O/R mapper, try Toplink, Hibernate, Torque or JDO.
Check if your O/R mapper also support direct SQL, so you can run stored procedures. To get the best performance, you can combine JDBC or O/R mapper with stored procedures.
 
Leandro Melo
Ranch Hand
Posts: 401
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i`m new at this, so could u give a litte more information?
- I didn`t understand why u sad that it wouldn`t make sense if i was using
BMPs.
- What exactly does JDO (or hibernate) do? Does it matter if i`m using
CMPs or BMPs?
Thanks is advance,
 
Christopher Keene
Wavemaker Support
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a pretty good article (I have to say that because I wrote it ) on this topic (getting good data access performance in J2EE) on JavaWorld here:
http://www.javaworld.com/javaworld/jw-04-2004/jw-0405-bottleneck-p3.html
There is also a discussion of the same article in The Server Side here:
http://www.theserverside.com/news/thread.tss?thread_id=24932#116887
The problem with CMPs is that they come with a fair amount of overhead and lock you into a specific set of mapping features offered by the J2EE vendor so limit the flexibility of the mapping. BMP has similar overhead to CMP, and gives you unlimited flexibility in mapping by requiring that you do it yourself!
The advice about using stored procedures in conjunction with an O/R mapping layer is also good - that allows you to do some of the uglier data massaging inside the database if you are working with complex legacy tables.
Along with the suggestion to look at OR mapping tools like JDO and Toplink, I would suggest EdgeXtend from Persistence Software for strong OR mapping combined with clustered caching. You can download a trial version here:
http://www.persistence.com/download/index.html
- chris
Persistence Software, the world�s technology leader for data access and caching
www.persistence.com
 
Erik Bengtson
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best advice I can tell you is read the book:
"Expert one-on-one J2EE Design and Development" Rod Johnson
It's a book that pay its price. You will get the best of J2EE can offer, and avoid making mistakes based on true experience of the author.
 
Erik Bengtson
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just for clarification:
EJB container providers (Bea, IBM, JBoss) gives you an O/R mapper, also known as EJB entity beans.
One of the advantages of using CMPs (entity beans) is that it is a standard with the most common O/R mapping features implemented by all vendors. Someday you will use proprietary extensions from your provider, and using standards like EJB CMP or jdo will not warranty your application will be portable between vendors, but it will certainly provide a good level.
The same happens to others O/R proprietary mappers like hibernate, toplink, etc. You will always get locked to your vendor. The best you can do, is evaluate the health of your vendor and its level of maturity in the tool you are using.
 
Leandro Melo
Ranch Hand
Posts: 401
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Erik's comment is not coherent.
If i'm wrong, someone please correct me, but O/R mapper is "also know as CMPs".
Object relational (OR) is the tool that you'll use have a consisten persistence model, it does not directly implies CMPs.
 
Leandro Melo
Ranch Hand
Posts: 401
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I kinda forgot some word.
I meant to say the o/r maaping are NOT also know as CMPs
 
Erik Bengtson
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't mean O/R mapper = CMP. I mean when you buy an application server J2EE 1.3 you receive an O/R mapper, called EJB CMP. If you know an application server which their CMP implementation is not an O/R mapper, please let me know.

> I didn`t understand why u sad that it wouldn`t make sense if i was using
BMPs.
BMPs are just overhead to something you can do with a DAO pattern
> What exactly does JDO (or hibernate) do? Does it matter if i`m using
CMPs or BMPs?
With CMPs, you cant use other O/R mapper, as all JDBC access code are created by the application server in the moment you deploy your application.
If you put JDO or Hibernate inside a BMP, you are just adding more overhead to your application. More classes, more xml files, an EJB container that will proxy each call to a ejbCreate, ejbLoad, blabla, etc...
My suggestion is choose one of the following:
1- CMP (I know weblogic and websphere, which are pretty good)
2- JDBC with DAO
3- O/R mapper, JDO, hibernate or other
Avoid using BMPs
See this link for many approach of using EJBs and performance results
http://www.urbancode.com/projects/ejbbenchmark/default.jsp
Hope its clearer
 
Leandro Melo
Ranch Hand
Posts: 401
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, it cleared out.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic