属性覆盖" ..."无法解析为一个属性

时间:2017-06-29 10:16:25

标签: eclipse jpa-2.0

我们得到了Eclipse错误(来自JPA Problem验证程序),如下所示:

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

在某些JPA属性上使用embeddable(也可能类似mapped super class)我们想要正确覆盖,例如像这样:

@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 ;

    ...
}

1 个答案:

答案 0 :(得分:0)

这似乎是一个Eclipse bug,所以你可以在这里将这种类型的ERROR改为不太显性的级别(我们将其改为WARNING)(对于Eclipse Neon):

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

e.g。到:

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

zonacroft blog

取得解决方案
相关问题