Forums Register Login

[Hibernate] How do you map value objects?

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
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.
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1908 times.
Similar Threads
Hibernate Issue
Simple mapping issue for Hibernate newbie
ORA-00001: unique constraint exception
One-to-One mapping problem
Hibernate inserting man-to-one fails
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:35:24.