Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

desing question about composite entity pattern

 
Leandro Melo
Ranch Hand
Posts: 401
  • 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 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,
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic