1

尝试将应用程序部署到 Glassfish 时收到以下错误。显然我的人际关系有问题。

尝试部署时来自 Glassfish 服务器的错误:

        ValidationException Exception Description: [class edu...clinic.Treatment] 
uses a non-entity [class long] as target entity in the relationship attribute 
[field providerId]

我的“治疗”类文件中的多对一关系:

@Entiity
... 
@ManyToOne
    @JoinColumn(name = "provider_fk", referencedColumnName = "npi")
    private long providerId;

我的“提供者”类文件中的一对多关系:

 @Entity
    ...
@Id
    @Column(name = "NPI")
    private long npi;
...
    @OneToMany(mappedBy = "providerId", targetEntity=Treatment.class)
        @OrderBy
        private List<Treatment> treatments;

我相信我的注释是正确的,但有些不对劲。我将不胜感激有关如何纠正此问题的任何建议。

4

1 回答 1

1

在处理实体更改中尝试以下操作

private long providerId;

private Provider provider;

在 Provider 实体变更中

@OneToMany(mappedBy = "providerId", targetEntity=Treatment.class)

@OneToMany(mappedBy = "provider", targetEntity=Treatment.class)
于 2013-03-07T04:36:23.490 回答