views:

88

answers:

2

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

A: 

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

Travis
A: 

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