Hi there,
i am sitting here since hours and cant get this mapping fixed. I didnt find an solution in the forum search...
In my case i´ve got an Order which holds an ArrayList of OrdersDetails. OrdersDetails are holding an reference to an produkt. I use this mapping right now:
Code:
public class Order
{
private int id;
private int orderNr;
private ArrayList details;
...
public Order() {}
public IList Details
{
get
{
if ( details == null )
{
details = new ArrayList();
}
return details;
}
set
{
}
}
...
public override string ToString()
{
System.Text.StringBuilder sbuilder = new System.Text.StringBuilder();
...
sbuilder.Append("\nDetails: [Quantity | price | productname]\n\t");
foreach(OrdersDetails od in Details)
{
sbuilder.Append("[");
sbuilder.Append(od);
sbuilder.Append("]\n\t");
}
return sbuilder.ToString();
}
}
Access is configured as properties. So i´ve set Details property as an IList instead of ArrayList and left the empty (is there the bug? but i dont know how to implement this otherwise)
Code:
public class Order
{
private int id;
private int orderNr;
private ArrayList details;
public Order() {}
public IList Details
{
get
{
if ( details == null )
{
details = new ArrayList();
}
return details;
}
set
{
}
}
}
And finally OrdersDetails
Code:
public class BestellungsDetails
{
private int id;
private float articlePrice;
private Product product;
...
}
Saving is working fine and i got all the foreign Keys in the Table OrderDetails to Order. But they are not loaded... If i do for an example:
Code:
ICriteria criteria = session2.CreateCriteria(typeof(Order));
IList commandes = criteria.List();
foreach(Order o in commandes)
{
Console.WriteLine(o.Details.Count);
Console.WriteLine(o);
}
All Orders are loaded probably, but no OrderDetails at all.
Is there any help? I am really confused and thin i wont get it work probably...
Regards
Chris