Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One-to-One Mapping in Hibernate

Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want to declare a One-To-One association to the same class.
Person -> substiude -> Person

my mapping is:

<class name="Person">

<id name="id">
<generator class="native"/>
<property name="substituteId" unique="true"/>
<property name="name"/>

<one-to-one name="substitude" class="Person"
cascade="all" foreign-key="substituteId"/>

But no foreign key is genrated to the substitudeId.
What is my mistake?
Can someone help?

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic