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: WCF and Iesi.Collections.ISet
PostPosted: Thu Feb 01, 2007 7:15 am 
Newbie

Joined: Thu Feb 01, 2007 6:47 am
Posts: 1
Hibernate version:1.0.3

Hi,

I had a working Nhibernate mapping, all was nice until i tried to use WCF.
Everythings work well ( update, delete, getlist, ...)
as long as i don't try to get an objet with an Iesi.Collections.ISet defined inside.

I've first tried to declare a DataContract and used another type than Iesi.Collections.ISet. This was working without WCF, or with WCF if my return object have an empty Iesi.Collections.ISet.

my object is :
Code:
    [Serializable()]
    [NHibernate.Mapping.Attributes.Class(Table = "TableTest")]
    public class TableTest    {
        private string _idTableTest = "";
        [NHibernate.Mapping.Attributes.Id(0, Name = "IdTableTest")]
        [NHibernate.Mapping.Attributes.Generator(1, Class = "uuid.hex")]
        [NHibernate.Mapping.Attributes.Set(2, Table = "lnkTableTestTableTest2", Name = "TableTest2Set")]
        [NHibernate.Mapping.Attributes.Key(3, Column = "IdTableTest")]
        [NHibernate.Mapping.Attributes.ManyToMany(4, Class = "xxx.Entities.TableTest2, xxx", Column = "IdTableTest2")]
        public string IdTableTest
        {
            get
            {
                return _idTableTest;
            }
            set
            {
                _idTableTest = value;
            }
        }


        private Iesi.Collections.ISet _tableTest2Set;
        public virtual Iesi.Collections.ISet TableTest2Set
        {
            get
            {
                return this._tableTest2Set;
            }
            set
            {
                this._tableTest2Set = value;
            }
        }


If anyone have somes clues about solve this problem,
Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 5:44 pm 
Beginner
Beginner

Joined: Thu Dec 21, 2006 11:38 am
Posts: 30
Since you're crossing a service boundary, you may have to ensure that the collection is initialized before sending it over the wire.

Two ways to do this:
1) before sending the object, call NHibernateUtil.Initialize() on the property.

2) turn off lazy loading for any of those properties. (default is on, I believe)

I'd recommend option 1 first because its a lot more explicit. (we don't want to hydate the entire database!)


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.