Is it Possible to create a Component that contains a array of items ?
I Try to do this with Attributes but it always give an error. I think the problem is that components don't have own ID's, but is it posible that the ID of the class containing te component, will be used ?
This is what I did :
[Class(Table = "BaseClass")]
Class baseClass
{
...
[Id(Name = "Id")]
[NHibernate.Mapping.Attributes.Generator(1, Class = "native")]
public virtual Guid Id
{
get { return id; }
set {id = value;}
}
[NHibernate.Mapping.Attributes.ComponentProperty(ComponentType=typeof(Component))]
public virtual Component Component
{
get { return answerset; }
set { answerset = value; }
}
...
}
[NHibernate.Mapping.Attributes.Component()]
Class Component
{
...
[NHibernate.Mapping.Attributes.OneToMany(ClassType = typeof(Items))]
[NHibernate.Mapping.Attributes.Array()]
[NHibernate.Mapping.Attributes.Key(Column = "fk")]
[NHibernate.Mapping.Attributes.Index(Column = "index", TypeType = typeof(Int32))]
public virtual Items[] ItemAnswers
{
get
{
return items;
}
set
{
items = value;
}
}
...
}
Does somebody knows what I m doing wrong ?
|