java - Getting error when using BeanUtils.copyProperties(dest, src) -


i have 2 form classes

public class form1{  int id,  string name,  datetime lastmodified;   //setters , getters  }   public class form2 {  int id,  string name,  date lastmodified;   //setters , getters  } 

ie., 1 of form has same variable name lastmodified date type , other 1 joda datetime type

i trying copy form1 values form2

form1 form1 = dao.getform1(); form2 form2 = new form2();  beanutils.copyproperties(form2,form1) 

but giving me error

 org.apache.commons.beanutils.conversionexception: dateconverter not        support default string 'date' conversion. 

i tried solution given in

https://stackoverflow.com/a/5757379/1370555

but giving me error

org.apache.commons.beanutils.conversionexception: error converting 'org.joda.time.datetime' 'date' using pattern 'yyyy-mm-dd hh:mm:ss.0 z' 

i think can solved apache convertutils not getting how done

can 1 me solve this?

beanutils.copyproperties(form2,form1) copies property values of 1 form form.since both forms have lastmodified property different data types , org.joda.time.datetime not compatible java.util.date , getting exception.

you can change property same reference types or have constructor assign value matching data type of same variable reference


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -