HI every one!
Is anybody can help me with such kind of problem:
these are my mapping files:
1.For class Rating:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="IpoCredit.DBClasses.Rating, IpoCredit" table="rating">
<id name="Id" column="id" type="integer">
<generator class="identity" />
</id>
<property name="StrRatingName" column="ratingname" type="String" />
<property name="Position" column="position" type="integer" />
<set name="RatingOnDate" inverse="true" lazy="true" cascade="save-update">
<key column="ratingid" />
<one-to-many class="IpoCredit.DBClasses.RatingDate, IpoCredit" />
</set>
</class>
</hibernate-mapping>
2. For class RatingDate:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="IpoCredit.DBClasses.RatingDate, IpoCredit" table="ratingdate">
<id name="Id" column="Id" type="integer">
<generator class="identity" />
</id>
<property name="RatingId" column="ratingid" type="integer"/>
<property name="RateDate" column="date" type="DateTime"/>
<set name="RateValue" inverse="true" cascade="save-update">
<key column="RatingDateId"/>
<one-to-many class="IpoCredit.DBClasses.RatingValue, IpoCredit"/>
</set>
</class>
</hibernate-mapping>
3. For class RatingValue:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="IpoCredit.DBClasses.RatingValue, IpoCredit" table="ratingvalue">
<id name="Id" column="Id" type="integer">
<generator class="identity" />
</id>
<property name="RatingDateId" column="ratingdateid" type="integer"/>
<property name="BankId" column="bankid" type="integer"/>
<property name="Amount" column="value" type="integer"/>
</class>
</hibernate-mapping>
Every mapping file contains the decription of one-to-many associations.
My C# code:
Code:
public static IList getAllRatings(ISession session)
{
IList ratings = session.Find("from Rating");
return ratings;
}
Where i'm trying to execute the code above, i'm getting a mictake:
Here:
Code:
IList ratings = session.Find("from Rating");
Mistake: Specified cast is not valid.
Please Help me! It's very important.