-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to use NHibernate.Mapping.Attributes.Bag
PostPosted: Wed Feb 01, 2006 10:21 am 
Newbie

Joined: Wed Feb 01, 2006 10:16 am
Posts: 13
Hello i'm a newbie of nhibernate
And i would like to use the NHibernate.Mapping.Attributes
there is 2 table
User and Card primary key id
user one to many Cards
but i don't undertand to code this
i test that
[NHibernate.Mapping.Attributes.Bag(Name = "Card", Table = "Card")]
[NHibernate.Mapping.Attributes.Key(Column="Id")]
[NHibernate.Mapping.Attributes.OneToMany(Class = "DemoHibernate.DataCard.Card, DemoHibernate.DataUser.User")]
but there is an error


2006-02-01 15:24:14,769 [2900] ERROR NHibernate.Cfg.Configuration [(null)] <(null)> - Could not configure datastore from input stream
System.Xml.Schema.XmlSchemaValidationException: Le contenu de l'élément 'bag' dans l'espace de noms 'urn:nhibernate-mapping-2.0' est incomplet. Liste d'éléments possibles attendue : 'urn:nhibernate-mapping-2.0:element urn:nhibernate-mapping-2.0:one-to-many urn:nhibernate-mapping-2.0:many-to-many urn:nhibernate-mapping-2.0:composite-element urn:nhibernate-mapping-2.0:many-to-any'.
à NHibernate.Cfg.Configuration.ValidationHandler(Object o, ValidationEventArgs args)
à System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(ValidationEventHandler eventHandler, Object sender, XmlSchemaValidationException e, XmlSeverityType severity)
à System.Xml.Schema.XmlSchemaValidator.CompleteValidationError(ValidationState context, ValidationEventHandler eventHandler, Object sender, String sourceUri, Int32 lineNo, Int32 linePos, Boolean getParticles)
à System.Xml.Schema.XsdValidator.ValidateEndElement()
à System.Xml.Schema.XsdValidator.Validate()
à System.Xml.XmlValidatingReaderImpl.ProcessCoreReaderEvent()
à System.Xml.XmlValidatingReaderImpl.Read()
à System.Xml.XmlValidatingReader.Read()
à System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
à System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
à System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
à System.Xml.XmlDocument.Load(XmlReader reader)
à NHibernate.Cfg.Configuration.LoadMappingDocument(XmlTextReader hbmReader)
à NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader)
à NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)


Thanks
A french man


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 10:20 pm 
Beginner
Beginner

Joined: Wed Oct 05, 2005 5:35 am
Posts: 47
Location: France
If you had a mapping file it would have been:
Code:
<bag name="Cards" >
    <key column="UserID" />
<one-to-many class="xxx.Card, xxx" />
</bag>

In your example:
[NHibernate.Mapping.Attributes.OneToMany(Class = "DemoHibernate.DataCard.Card, DemoHibernate.DataUser.User")]
is probably wrong. Class element should be "MyAssembly.MyClass, MyAssembly", and that's for 1 class - Card in your case, I guess


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.