File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes desing question about composite entity pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "desing question about composite entity pattern" Watch "desing question about composite entity pattern" New topic
Author

desing question about composite entity pattern

Leandro Melo
Ranch Hand

Joined: Mar 27, 2004
Posts: 401
Hi, i'm building a j2ee e-commerce application.
I've modelled the system classes and the database, wich has around 20 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 :-(
After i modelled the system classes, i have to steps:
- Modelling entities beans (with composite entity?)
- Modelling session beans, wich i could choose from the system use cases
About the entities,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,


Leandro Melo
SCJP 1.4, SCWCD 1.4
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Quite honestly, with EJB 2.0, I find the composite entity pattern to no longer be useful. That's not only my opinion -- check Floyd Marinescu's "EJB Design Patterns" book on chapter 9, "EJB Design Strategies" where the first strategy is "Don't use the Composite Entity pattern".
Just model each table as an EJB 2.0 entity with relationships between the tables modeled as EJB relationships.

Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by Kyle Brown:
Quite honestly, with EJB 2.0, I find the composite entity pattern to no longer be useful.

I wholeheartedly concur. Further, one of the main benefits of entity beans is CMP. But with the Composite Entity pattern you're SOL. You can't use CMP to map to a parent-child entity like a Person with Addresses. So you're stuck with BMP at which point I wonder why you're not using Hibernate.
Of course, even if you *are* using CMP, I still wonder why you're not using Hibernate. [Sorry, couldn't resist]
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by David Harkness:
Of course, even if you *are* using CMP, I still wonder why you're not using Hibernate. [Sorry, couldn't resist]

I like this guy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: desing question about composite entity pattern