This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[Hibernate] How do you map value objects?

 
Joshua White
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a customer object and a customer table. The customer table contains address information. I have chosen to seperate this information in the customer object into a value object named address. How would I map the address value object? I have included a example mapping of the customer object below.

Regards,

Joshua



[ June 22, 2004: Message edited by: Joshua White ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can split table mappings up into separate POJOs. In fact this is what Hibernate recommend you do (unless address is not a nullable property - in which case its clearer if you keep them together). Write a mapping for each part of the table - customer & address - give them the same PK column, but different POJO names. Then just treat the as you would normal objects.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic