views:

239

answers:

0

Hello good fellas!i'm a bit confused about something right now about hibernate property.I have a parent class that doesn't need to browse it's child for now , eg the type of table that just hold information (id| currency | description) so in the mapping file of the parent i ignore the set tag. in the child class i have reference to the parent (the parent object property) and had a many-to-one tag

<class name="parent">
  <id name="id">
   <generator class="native"/>
  </id>
  <property name="currency"/>
  <property name="description" length="400">
</class>

here is the child mapping file

<class name="child">
  <id name="id">
   <generator class="native"/>
  </id>
  <property name="someprop1"/>
  <property name="someprop2">
  <many-to-one class="Parent" column="parent_field" name="parent" />
</class>

ok that's it but it seems to me that the child is trying to save to the parent what i don't want to allow so i'm wondering if i should use inverse true here or cascade.using the cascade on the many-to-one association looks like it's means for the child to insert or delete from the parent.Unless i'm really confused.so my only concern for now is to prevent the child to insert in the parent.thanks for reading