Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Domain Values in Hibernate

 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there,

I am facing a problem when mapping domain classes to a database table in hibernate.

I am following a domain driven approach, so a class would look like this:



Now, is there a common way to map domain values to their corresponding database columns?

what i have done so far is using the <component> element like this



and this works. however, i also use domain values for id properties that are usually mapped like this:



this expects a primitive id type, such as Long. However, if I used the type MessageID as a domain value, i don't know how to do the mapping, as the component element does not support an id element in it's body.

Hope somebody can help.

Best regards

Sebastian
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!