-->
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: Illegal attempt to associate a collection with two open sess
PostPosted: Mon Sep 21, 2009 10:01 pm 
Newbie

Joined: Fri Sep 18, 2009 6:01 am
Posts: 2
anyone? do you have a problem like this? for example,
Illegal attempt to associate a collection with two open sessions
i update one user appear top error.
the code is:
Code:
     
  GridViewRow row=(GridViewRow)(((DropDownList)sender).Parent.Parent);
       int id = Convert.ToInt32(mygrid.DataKeys[row.RowIndex].Values["Userid"]);
       DropDownList ddl = (DropDownList)mygrid.Rows[row.RowIndex].FindControl("ddlist_state");
       int state = Convert.ToInt32(ddl.SelectedValue);
       UserinfoDao dao = DB.GetUserinfoObject();
       Userinfo user = dao.FindUser(id);
       user.State = state;
       dao.UpdateUser(user);

        public Userinfo FindUser(int userid)
        {
            return (Userinfo)Session.Load(typeof(Userinfo),userid);
        }
        public void UpdateUser(Userinfo user)
        {
           Session.Update(user);
        }

additional my mappping xml is one to many,
Thanks in advance.


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.