Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate: Can someone verify my mapping configuration?  RSS feed

Choon-Chern Lim
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still experimenting with Hibernate, and I would really appreciate if someone could provide me some feedbacks on my mapping configuration.

My test app has 3 database tables: PERSON, CAR and CARTYPE. The relationship between PERSON and CAR is one-to-many, and CARTYPE to CAR is one-to-many.

These are my JAVA bean classes:-

These are my database tables:-

Basically, a person can have many cars. The CARTYPE table is more like a dictionary where it has a list of available car names, like Mustang, Ford, Honda, etc. So, CARTYPE is totally independent from other tables.

This is my mapping configuration:-

May I know if my mapping configuration above is set up correctly? I saw a Hibernate example (Order, LineItem, Product) which is very similar to what I have here, but it pretty much consolidates the CAR mapping into PERSON using COMPOSITE-ELEMENT tag and I wasn't quite sure what's going on there.

Thanks much in advance!
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!