Hi,
I'm using NHProfiler to profile my NH activity and I'm getting the
warning:
superfluous <many-to-one> update - use inverse = 'true'
I have two classes, Post and Comment, here is the mapping :
Post.hbm.xml :
hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Metrica.Post, Metrica" table="Post" lazy="true"
discriminator-value="POST" abstract="true">
<id name="Id" column="PostID">
<generator class="native"/>
</id>
<discriminator column="Type" type="string" />
<property name="DateCreated" type="date" column="DateCreated"
insert="false" generated="always" />
<property name="Headline" type="string" length="500"
column="Headline" />
<many-to-one class="Metrica.Publication,Metrica"
name="thePublication" cascade="none" column="PublicationID" />
<property name="URL" type="string" length="1000" column="URL" />
<property name="AnalystComment" type="string"
column="AnalystComment" />
<bag name="Comments" inverse="true" cascade="all" lazy="true">
<key column="PostID" />
<one-to-many class="Metrica.CommentPost, Metrica" />
</bag>
</class>
Comment.hbm.xml:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Metrica.CommentPost, Metrica" table="Comment"
lazy="true" discriminator-value="COMMENT"
proxy="Metrica.CommentPost,Metrica" >
<id name="Id" column="CommentID">
<generator class="native"/>
</id>
<discriminator column="Type" type="string" />
<property name="DateCreated" type="date" column="DateCreated"
insert="false" generated="always" />
<many-to-one name="thePost" class="Metrica.Post, Metrica"
cascade="none" column="PostID" not-null="true" />
</class>
</hibernate-mapping>
I don't see where I should add inverse=true in order to avoid all the
UPDATE statements that occur when I save a Post :
UPDATE Comment SET PostID = @p0 WHERE CommentID = @p1
(called as many times as there are comment entities associated to the
post entity ! )
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---