• 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?

my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!