Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

One-to-one mapping in hibernate  RSS feed

 
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In the above code we perform one-to-one mapping using <many-to-one> by setting unique="true". There is also a <one-to-one> tag. Could anyone explain me why <many-to-one> tag is used for one-to-one mapping even if <one-to-one> tag exists ?
I tried using <one-to-one> tag but there is no 'column' attribute in <one-to-one> tag
 
Akshayyha Krishnamurthy
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey people.. I've tried using <one-to-one> tag. it worked when used like this:

But didn't work when used as :

Because, <one-to-one> tag doesn't have column attribute
I tried other mappings too and I found these :
<one-to-one> doesn't have column attribute
<one-to-many> doesn't have both name and column attributes
<many-to-one> has both name and column attributes
<many-to-many> doesn't have name attribute

Could someone explain to me why its so?
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!