0

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: com.hna.adt.orm.User.setAuthorities を呼び出せません - 引数の型が一致しません

どうしたの ?

BeanUtils.copyProperties(entity, value);
4

2 に答える 2

1

権限と協定の種類を確認すると、他のクラス定義と一致しません。beanutils が正しく機能するためには、属性のタイプが一致していることを確認してください。

于 2013-09-28T07:15:02.913 に答える