首页 > 代码库 > Mybatis 错误Illegal overloaded getter method ....

Mybatis 错误Illegal overloaded getter method ....

错误描述:

Illegal overloaded getter method with ambiguous type for property parent in class class cn.domain.Menu.  This breaks the JavaBeans specification and can cause unpredicatble results.

 

javabean:

public class Menu {
    /** 菜单id */
    private Integer id;
    /** 是否作为一个父节点:父节点不需要URL,permission*/
    private boolean isParent;
    /** 菜单名称 */
    private String name;
    /** 菜单备注 */
    private String remark;
    /** 菜单URL */
    private String href;
    /** 菜单图标 */
    private String icon;
    /** 菜单需要的权限 */
    private Permission permission;
    /** 上级菜单:与href属性互斥 */
    private Menu parent;
    
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public boolean isParent() {
        return isParent;
    }
    public void setParent(boolean isParent) {
        this.isParent = isParent;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getHref() {
        return href;
    }
    public void setHref(String href) {
        this.href =http://www.mamicode.com/ href;
    }
    public String getIcon() {
        return icon;
    }
    public void setIcon(String icon) {
        this.icon = icon;
    }
    public Permission getPermission() {
        return permission;
    }
    public void setPermission(Permission permission) {
        this.permission = permission;
    }
    
    public Menu getParent() {
        return parent;
    }
    public void setParent(Menu parent) {
        this.parent = parent;
    }



}

注意isParent属性,boolean型在javabean规范中有特殊性:.....省略。。直接看isParent的get和set方法;

错误原因就是boolean型在javabean规范中有特殊性,改个名字就行了。