This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

one-to-one mapping  RSS feed

 
jack hamme
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to map Account object to Transaction object.

I have a ReferenceId (type:long) field in Transaction which should hold the AccountId

The accountid is the primary key for Account and is of type long.

The mapping for Account is

<one-to-one name="Transaction" class="a.b.Transaction" cascade="save-update" fetch="select" property-ref="ReferenceId" />


When the account object is saved the ReferenceId is always set as 0.


can any one help me figure out why?

Any help or comments would he highly appreciated.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!