You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Leandro Melo <lt...@yahoo.com.br> on 2004/08/09 20:39:33 UTC

BeanUtils question

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