At 2:15 PM -0500 3/13/05, Joe Hertz wrote:
I'm sorry about how lame this question seems. I'm staring quite stunned at
what I'm seeing in my debugger right now, and I'm hoping someone can explain
the behavior.

Using Struts 1.2.4 (BeanUtils 1.7).

I have two objects: A UserEntity and a User. The User is a subclass of
UserEntity.

I call PropertyUtils.copyProperties(user, userEntity) and I'm watching a map
that was an element of the user object (and not of the userEntity) getting
blown away (almost as if the User Object itself was getting reconstructed).

Why does this happen? (I can post to commons-user if I absolutely have to,
but I'm hoping someone can explain this...

Perhaps unintuitively, the order of arguments to copyProperties are (dest, orig) i.e. (to, from)
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/BeanUtils.html#copyProperties(java.lang.Object,%20java.lang.Object)


So, by your example, user should be having all its properties set according to their equivalent values in userEntity.

joe
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex

Reply via email to