-->
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.  [ 3 posts ] 
Author Message
 Post subject: I don't update the PO,but the hibernate AUTO update my Obj
PostPosted: Thu Jan 27, 2005 2:38 am 
Newbie

Joined: Tue Dec 28, 2004 4:43 am
Posts: 2
Location: Beijing China
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:[/b]
Hibernate-2.1.6
[b]Mapping documents:[/b]
Map hbm
<class name="com.cwitg.xxt.base.Usr" table="usr" dynamic-update="true">
<id column="usr_id" name="id" type="long">
<generator class="UserDefined"/>
</id>........
-------------------------------------------------
parent Form Bean
public class Usr_ implements Serializable {

/** identifier field */
protected Long id;

/** nullable persistent field */
protected String status;

/** nullable persistent field */
protected String loginid;
/** nullable persistent field */
protected String password;
....
public void setPassword(String password) {
this.password = password;
}
... ...
child Form Bean
public class Usr extends Usr_ {
// my operation logic...

//overwriting the setPassword() method in chlid project
public void setPassword(final String inPassword) {
super.setPassword(MD5.encode(inPassword));
}



[b]Code between sessionFactory.openSession() and session.close():[/b]
login check:
public static Usr login(String loginid, String password) {
Usr usr = null;
String db_pwd = null;

XQuery xq = new XQuery();
List usrs = xq.getDBList("select usr from com.cwitg.xxt.base.Usr usr where usr.loginid='" + loginid + "' and usr.status='ACT'");
if (usrs.size() == 0) {
return null;
}
usr = (Usr) usrs.get(0);
db_pwd = usr.getPassword();
password = MD5.encode(password);
if (!password.equals(db_pwd)) usr = null;
return usr;
}

[b]Full stack trace of any exception that occurs:[/b]
2005-1-27 13:43:00 net.sf.hibernate.util.ReflectHelper getBulkBean
信息: reflection optimizer disabled for: com.cwitg.xxt.base.Usr, BulkBeanExcepti
on: null (property setPassword)
[b]Name and version of the database you are using:[/b]
sql-server2000
[b]The generated SQL (show_sql=true):[/b]
Hibernate: update usr set password=? where usr_id=?

[b]Debug level Hibernate log excerpt:[/b]
2005-1-27 13:43:00 net.sf.hibernate.util.ReflectHelper getBulkBean
信息: reflection optimizer disabled for: com.cwitg.xxt.base.Usr, BulkBeanExcepti
on: null (property setPassword)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 4:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If you change the set value in your setter, Hibernate of course thinks it was modified. (the value returned by get is different than the one originally set by Hibernate)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 5:10 am 
Newbie

Joined: Tue Dec 28, 2004 4:43 am
Posts: 2
Location: Beijing China
thanks michael !

I change setPassword method in usr_ ,not use extends ,

from :

public void setPassword(String password) {
this.password = password;
}

to :

public void setPassword(String password) {
this.password = MD5.encode(password);
}


so the same result,

so i do it only in jsp files,

who can provide orther method to solve it?

thanks.

_________________
Have a nice day!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.