属性覆盖“...”无法解析为

Attribute Override "..." cannot be resolved to an attribute on the

我们收到 Eclipse 错误(来自 JPA Problem 验证器),如下所示:

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

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

    ...
}

这似乎是一个 Eclipse 错误,因此您可以在此处(针对 Eclipse Neon)将此类 ERROR 更改为不太显着的级别(我们将其更改为 WARNING):

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

中获取解决方案