commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leandro Melo <ltcmelo_j...@yahoo.com.br>
Subject BeanUtils question
Date Mon, 09 Aug 2004 18:39:33 GMT
Hi,
i have a CompanyVO class, wich also has members such
AddressVO, UserVO. As you can see, i have some other
value objects inside CompanyVO.

When i do this:

CompanyVO companyVO = new
CompanyVO();BeanUtils.copyProperties(companyVO,
customCompanyVO);



CustomCompanyVO is an object that has only "direct"
properties of CompanyVO, stuff like companyName,
companyID, companyType (basically all of them are
String).

But when i do this.



CompanyVO companyVO = new
CompanyVO();BeanUtils.copyProperties(companyVO,
customCompanyVO);BeanUtils.copyProperties(companyVO.getAddressVO(),
addressVO);




I get the following excetion just on the third line
(note the addressVO contain the values to be
transfered to AddressVO, wich a VO inside the
CompanyVO, as i said).

java.lang.IllegalArgumentException: No destination
bean specified
at
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:220)
at
ltcmelo.session.RegisterCompanyBean.saveCompanyAddressInfo(RegisterCompanyBean.java:157)


So, if i already initialize the companyVO doesn't the
addressVO and the userVO memers have to be initialized
too ???

This way i'm force to do such thing.



CompanyVO companyVO = new
CompanyVO();BeanUtils.copyProperties(companyVO,
customCompanyVO);AddressVO auxAddressVO = new
AddressVO();BeanUtils.copyProperties(auxAddressVO,
addressVO);companyVO.setAddressVO(auxAddressVO);




Is there a better option???? 

=====
_________________________________
Leandro Terra C. Melo
Eng. de Controle e Automação - UFMG

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message