2017-06-29 116 views
0

我们得到了Eclipse的错误(从JPA Problem验证)是这样的:属性覆盖“...”不能被解析为一个属性上

Attribute override "<myAttrName>" cannot be resolved to an attribute on the embeddable "..." 

embeddable(也许还像mapped super class)上的一些JPA我们想要正确覆盖的属性,例如像这样:

@Embeddable 
public class DaoUsrMod { 

    @ManyToOne(fetch = FetchType.LAZY) 
    @JoinColumn(name = "u_lmod_id" , insertable = false , updatable = false) 
    private DaoUser usr ; 
    ... 
} 


@Entity 
public class DaoFoo { 

    @Embedded 
    @AttributeOverrides({ 
     @AttributeOverride(name = "usr" , column = @Column(name = "u_created_id")) 
    }) 
    private DaoUsrMod            usrModAngel ; 

    ... 
} 

回答

0

看来,这是一个Eclipse的bug,所以你可以在此类型的错误更改为少占主导地位的水平(我们把它改为警告)这里(为Eclipse Neon):

Project -> Properties -> JPA -> Errors/Warnings -> Database 
    -> Attribute/association overrides 
    (2nd entry:) 
    -> Attribute override name cannot be resolved to an attribute: [Error] 

例如到:

-> Attribute override name cannot be resolved to an attribute: [Warning] 

注意到从zonacroft blog

溶液