<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Negocio"
namespace="Negocio" >
<class name="Pai" table="pai">
<id name="CodigoPai" column="codigo_Pai" type="Int32" >
<generator class="identity"></generator>
</id>
<property column="nome" name="Nome" type="String"></property>
<bag name="Filhos" table="filho" lazy="true" cascade="none"
inverse="true">
<key column="codigo_pai" />
<one-to-many class="Filho" />
</bag>
</class>
</hibernate-mapping>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Negocio"
namespace="Negocio" >
<class name="Filho" table="filho">
<id name="CodigoFilho" column="codigo_filho" type="Int32"
unsaved-value="0">
<generator class="identity"></generator>
</id>
<property column="nome" name="Nome" type="String"></property>
<many-to-one class="Pai" name="Pai" column="codigo_pai"
cascade="none"></many-to-one>
</class>
</hibernate-mapping>
I was trying cascade and inverse. I see that code:
Pai pai = Pai.Find(1);
Filho f = new Filho();
pai.Nome = "mario";
f.Pai = pai;
f.Nome = "LUIZ";
f.Save();
1) saves a new Filho if in mapping inverse be true or false
2) every time that f.Save() is called Pai is updated;
How can i do for pai dont be updated? i undertood thats done withi cascade,
but it not works.
what about inverse? is it necessary yes or no?
thanks to tha help.
--
Att,
Diego da Silva Barbosa
--
Att,
Diego da Silva Barbosa
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---