-->
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 create a component with an array
PostPosted: Mon Jul 16, 2007 11:50 am 
Newbie

Joined: Mon Jul 16, 2007 11:46 am
Posts: 1
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 ?


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.