aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes complex mappings in EJB3 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 "complex mappings in EJB3" Watch "complex mappings in EJB3" New topic
Author

complex mappings in EJB3

Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
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?


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Mike Keith
author
Ranch Hand

Joined: Jul 14, 2005
Posts: 304
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


-Mike
Pro JPA 2: Mastering the Java Persistence API
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: complex mappings in EJB3