These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to implement Dependencies between Objects ?
PostPosted: Fri Nov 30, 2007 8:21 am 
Newbie

Joined: Fri Nov 30, 2007 7:44 am
Posts: 7
Hello,

I like to achieve an update in a 'Ziele' object if a 'RatingItem' object was given a other value.

The 'Strategie' objekt has a IList<Ziele> and a ILIst<RatingItem>. So if i do
Strategie.RatingItems[0].Value = Some_new_value;
I like to change the values of some items in Strategie.Ziele.

Is there something where NHibernate can halp me ?
What may be a good architecture to achieve that ?


NHibernate version:1.2.0.4000

Mapping documents:

<hibernate-mapping default-cascade="none" xmlns="urn:nhibernate-mapping-2.2">

<!-- Strategy -->
<class name="PPSD.BL.DomainModel.Strategie, PPSD.BL.DomainModel" table="Strategie">
<id name="ID" type="System.Int32" column="ID" unsaved-value="0">
<generator class="native" />
</id>
<property name="Name" type="System.String" column="Name" not-null="true" length="50" />
<property name="RatingScaleTypeEnum" type="System.Int32" column="RatingScaleTypeEnum" not-null="true" />
<bag name="Rating" inverse="true" lazy="false" cascade="all" >
<key>
<column name="StrategieID" not-null="true" />
</key>
<one-to-many class="PPSD.BL.DomainModel.RatingItem, PPSD.BL.DomainModel" />
</bag>
<bag name="Ziele" inverse="false" lazy="true" cascade="all-delete-orphan">
<key>
<column name="StrategieID" not-null="true" />
</key>
<one-to-many class="PPSD.BL.DomainModel.Ziele, PPSD.BL.DomainModel" />
</bag>
<bag name="PvTab" inverse="true" lazy="false" cascade="all">
<key>
<column name="StrategieID" not-null="true" />
</key>
<one-to-many class="PPSD.BL.DomainModel.PvTab, PPSD.BL.DomainModel" />
</bag>
</class>

<!-- Ziele (Goals) -->
<class name="PPSD.BL.DomainModel.Ziele, PPSD.BL.DomainModel" table="Ziele">
<id name="ID" type="System.Int32" column="ID" unsaved-value="0">
<generator class="identity" />
</id>
<property name="Name" type="System.String" column="Name" not-null="true" length="50" />
<many-to-one name="Strategie" class="PPSD.BL.DomainModel.Strategie, PPSD.BL.DomainModel" fetch="select">
<column name="StrategieID" not-null="true" />
</many-to-one>
</class>

<!-- PvTab -->
<class name="PPSD.BL.DomainModel.PvTab, PPSD.BL.DomainModel" table="PvTab">
<id name="ID" type="System.Int32" column="ID" unsaved-value="0">
<generator class="native" />
</id>
<property name="Value" type="System.Single" column="Value" not-null="true" />
<many-to-one name="Strategie" class="PPSD.BL.DomainModel.Strategie, PPSD.BL.DomainModel" fetch="select">
<column name="StrategieID" not-null="true" />
</many-to-one>
<many-to-one name="ZielRow" class="PPSD.BL.DomainModel.Ziele, PPSD.BL.DomainModel" cascade="none" fetch="select">
<column name="RowZielID" not-null="true" />
</many-to-one>
<many-to-one name="ZielCol" class="PPSD.BL.DomainModel.Ziele, PPSD.BL.DomainModel" cascade="none" fetch="select">
<column name="ColZielID" not-null="true" />
</many-to-one>
</class>

<!-- Rating -->
<class name="PPSD.BL.DomainModel.RatingItem, PPSD.BL.DomainModel" table="Rating">
<id name="ID" type="System.Int32" column="ID" unsaved-value="0">
<generator class="native" />
</id>
<property name="RatingScaleTypeEnum" type="System.Int32" column="RatingScaleTypeEnum" not-null="true" />
<property name="Value" type="System.Int32" column="Value" not-null="true" />
<property name="Name" type="System.String" column="Name" not-null="true" />
<many-to-one name="Strategie" class="PPSD.BL.DomainModel.Strategie, PPSD.BL.DomainModel" fetch="select">
<column name="StrategieID" not-null="true" />
</many-to-one>
</class>

</hibernate-mapping>

_________________
Kind regards
Uwe Lesta


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.