-->
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: many-to-one associated class property changing problem
PostPosted: Thu Mar 31, 2011 9:04 pm 
Newbie

Joined: Thu Mar 31, 2011 8:49 pm
Posts: 2
Hi everyone!
I'm new here and somewhat beginner to Hibernate...

I'm having some problems changing the value of one property in a associated class while inside its setter.
See the following code:

Code:
public class Comment {
private User oUser;
public virtual User User {
   get { return oUser; }
   set {
      oUser = value;
      // If this is a anonymous comment or the user isn't logged in, don't show its name/ID
      if (Anonymous || (Application.UserID == 0)) {
         oUser.Image = "anonymous.jpg";
         Link   = "<i>Anonymous</i>";
      } else {
         Link   = "<a href=\"Profile.aspx?userID=" + oUser.ID + "\">" + oUser.Name + "</a>";
      }
   }
}
}


Some useful mapping:
Code:
   <property name="Anonymous" column="anonymous" length="1" type="yes_no" />
   <many-to-one name="User" column="userid" />


Here is the problem: everytime, no matter what happens, oUser.Image WILL be the string "anonymous.jpg".
Note that when I enter the setter while debugging, value already has the Image property as anonymous.jpg.

What could be happening? I don't get what I've did wrong!

Thanks in advance, and sorry for my bad english!


Top
 Profile  
 
 Post subject: Re: many-to-one associated class property changing problem
PostPosted: Mon Apr 04, 2011 8:36 am 
Newbie

Joined: Thu Mar 31, 2011 8:49 pm
Posts: 2
...no help for me, guys?
I really need help with this :x


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.