• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

complex mappings in EJB3

 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Dinner will be steamed monkey heads with a side of tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic