Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

One-to-One Mapping in Hibernate  RSS feed

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
Boost this thread!