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

Populate an empty object if none is found

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a many-to-one relation in my mapping file.
In some cases, this many-to-one value does not exist in the joing table.

Is it possible for me to populate this many-to-one object with only the identifier value and the rest empty?

The database does not have foreign keys so there is possible there could exist such a key that does not refer to a value in the many-to-one table.

I could add not-found="ignore", but that would entail that the mapped object gets a null object for the many-to-one relation.

In other words get Hibernate to populate/create object2 inside object1 with only the identifier value in object1.
[ February 07, 2008: Message edited by: Sverre Moe ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic