0

How would one map this object to only retrieve the collection below and ignore it totally when creating or updating the object to the db?

 <bag name="children"  table="tb_parent_child" lazy="false">
  <key column="parentID"/>
  <one-to-many class="Child"/>
</bag>

thanks

user17510
  • 1,549
  • 5
  • 20
  • 37

2 Answers2

0

Why not set lazy to true? Wouldn't that basically do it? And also maybe set cascade to 'none'?

tsimon
  • 8,362
  • 2
  • 30
  • 41
0

Setting the cascade attribute to none:

 <bag name="children"  table="tb_parent_child" lazy="false" cascade="none">
     <key column="parentID"/>
     <one-to-many class="Child"/>
 </bag>

should accomplish this. See this blog entry for a description of cascade options.

Jamie Ide
  • 48,427
  • 16
  • 81
  • 117
  • Thanks, this still nulls out the parentID in the tb_parent_child table if send an object (with no children in the collection) to be updated – user17510 Apr 28 '09 at 02:54
  • You can try setting inverse=true. But why map the collection as a child of the parent at all? You can just retrieve the collection for yourself in code. – Jamie Ide Apr 28 '09 at 15:09