eclipse名为“ID_GENERATOR”的重复生成器在此持久性单元中定义 [英] eclipse Duplicate generator named "ID_GENERATOR" defined in this persistence unit

查看:768
本文介绍了eclipse名为“ID_GENERATOR”的重复生成器在此持久性单元中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前遇到这个我没有迁移到eclipse-jee-kepler的问题。我有:

I'm currently having this issue which I don't have before I migrated to eclipse-jee-kepler. What I have:

我有2个班级,基础和延伸课程:

I have 2 classes, base and the extending class:

public abstract class BaseEntity implements Serializable {
    @Id
    @GeneratedValue(generator = "ID_GENERATOR")
    @Column(name = "ID")
    private Long id;
}

@Entity
@Table(name = "CUSTOMER")
@SequenceGenerator(name = "ID_GENERATOR", sequenceName = "CUSTOMER_SEQ")
public class Customer extends BaseEntity {
}

在我没有此验证错误之前但现在日食正在扔它。我可以编译,构建和部署成功,但错误标记使得很难确定编译错误,当你真的有一个。

Before I don't have this validation error but now eclipse is throwing it. I can compile, build and deploy successfully but the error marker is making it hard to pinpoint the compile errors when you really have one.

错误似乎很明显,这是因为我在所有扩展类上都有ID_GENERATOR。我的问题:
1.)我可以忽略这个错误吗?
2.)任何工作?可能使用不同的方法。

The error seems obvious, it's because I have ID_GENERATOR on all the extending classes. My question: 1.) Can I ignore this error? 2.) Any work around? Possibly using a different approach.

推荐答案

我想到了这个问题,这是一个日常的JPA验证设置。要禁用:

I figured the problem, it was more of an eclipse JPA validation setting. To disable:


  1. 选择窗口»首选项

  2. 展开 Java持久性»JPA»错误/警告

  3. 点击查询和生成器

  4. 设置将重复的生成器定义为忽略

  5. 单击确定应用更改并关闭对话框

  1. Select Window » Preferences
  2. Expand Java Persistence » JPA » Errors/Warnings
  3. Click Queries and generators
  4. Set Duplicate generator defined to: Ignore
  5. Click OK to apply changes and close the dialog

您还可以将值设置为警告而不是忽略

You can also set the value to Warning instead of Ignore.

这篇关于eclipse名为“ID_GENERATOR”的重复生成器在此持久性单元中定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆