This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

complex mappings in EJB3

 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just looking thro the table of contents of the EJB3 Persistence book, I couldn't tell whether it covers many-to-many join tables, or other more complicated entity relationships.

I have worked with legacy databases on the last 2 projects I did, and with Hibernate I had a few problems mapping the tables to a reasonable domain model. For example, I effectively had a one-to-one relationship to model, but in the DB it was a parent-child entity relationship, and I had to map a left-join from the child to the parent. Hibernate couldn't do it.

How much would you say EJB3 provides for doing this sort of thing?
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Adam,

The book does discuss the more advanced mappings in the spec, although many-to-many join tables are not considered advanced but are in chapter 4, which is the basic O/R mapping chapter.

The first version of the spec covers some of the more common mappings, and also some exotic ones, but admittedly there will be some that are not fully specified. Some aspects of parent-child relationships are available through cascading. Explicit queries support left joins, but the spec does not specify exactly how a vendor must query for related objects if joining is not requested or for internal object loading. This would currently be a feature in vendor-add land.

-Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic