Hello,
this is for 1.2
I have a failing testcase and wonder, if someone could point me the right direction...
theme = getTheme();
p = new Product(31, Guid.NewGuid().ToString(), "bla");
r = new ThemeProductRelation(p, theme);
themeDao.SaveOrUpdate(theme);
productDao.SaveOrUpdate(p);
theme.AddProductRelation(r);
themeDao.SaveOrUpdate(theme);
Assert.IsTrue(theme.ProductRelations[0].Id > 0); // fails
Theme.AddProductRelation(ThemeProductRelation) is like this:
public virtual void AddProductRelation(ThemeProductRelation
relation)
{
relation.Theme = this;
if (productRelations == null)
productRelations = new List<ThemeProductRelation>();
productRelations.Add(relation);
}
All of this follows closely the recommendation of the reference pdf ~pg. 140
Same goes for the xml...
<class name="Theme"
table="Kit"
lazy="true">
<id name="Id"
column="KitID"
unsaved-value="0">
<generator class="identity" />
</id>
<bag name="ProductRelations"
table="ProductKit"
inverse="true"
cascade="all-delete-orphan">
<key column="KitID" />
<one-to-many class="ThemeProductRelation" />
</bag>
</class>
What can I do for this test to pass?
Thanks for any help,
Jan
|