DTO对象:参数类型不匹配
public class DTOUser implements UserDetails {
/**
*
*/
private static final long serialVersionUID = -769714837633005963L;
private Long id;
private String account;
private String password;
private String statusStr;
private UserStatus status;
private int systemAdmin;
private long operator;
private String operateTime;
private String name;
private String company;
private String email;
private String telephone;
private List<DTOAuthority> dtoAuthorities = new ArrayList<DTOAuthority>();
private List<DTOAgreement> dtoAgreements = new ArrayList<DTOAgreement>();}
实体:
@Entity
@Table(name="adt_user")
public class User {
private long id;
private String account;
private String password;
private String statusStr;
private UserStatus status;
private int systemAdmin;
private long operator;
private String operateTime;
private String name;
private String company;
private String email;
private String telephone;
private Set<Authority> authorities = new HashSet<Authority>();
private Set<Agreement> agreements = new HashSet<Agreement>();}
我使用波纹管的方法来值复制到实体,但有一个例外:
java.lang.IllegalArgumentException: Cannot invoke com.hna.adt.orm.User.setAuthorities - argument type mismatch
它有什么问题?
BeanUtils.copyProperties(entity, value);
非常感谢你! – xuyaming
@xuyaming欢迎您! – A4L
你也可以使用[Moo](http://github.com/geoffreywiseman/Moo)或Dozer之类的东西,它可以通过转换完成更复杂的映射。 –