eclipse Duplicate generator named “ID_GENERATOR” defined in this persistence unit

拟墨画扇 提交于 2019-12-01 18:13:59
czetsuya

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

  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.

For MyEclipse

1.Windows->Preferences

2.Myeclipse->Validation->JPA

3.Queries and generators

Generators is not defined in the persistence unit;

The generator's name must to be unique by generator and it can be referenced by one or more classes.

The javadoc clearly says:

(Required) A unique generator name that can be referenced by one or more classes to be the generator for primary key values.

According to the java JPA 2.1 specification (SequenceGenerator Annotation of the JPA 2.1 - section 11.1.48):

The scope of the generator name is global to the persistence unit (across all generator types)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!