Eclipse Duplicate Generator named "ID_GENERATOR" defined in this save module

I currently have this problem that I don't have before I switched to eclipse-jee-kepler. What I have:

I have 2 classes, base and extensible 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 throws it. I can compile, build and deploy successfully, but the error marker makes it difficult to pinpoint compilation errors when you really have one.

The error seems obvious because I have ID_GENERATOR on all expandable classes. My question is: 1.) Can I ignore this error? 2.) Any work around? Perhaps a different approach is used.

+4
source share
3 answers

I solved the problem, it was more likely a JPA attenuation test condition. To disable:

  • Select Preferences Window
  • Expand Saving Java "JPA" Errors / Warnings
  • Click Queries and Generators
  • Install a Duplicate Generator defined to: Ignore
  • Click OK to apply the changes and close the dialog box.

You can also set the Warning value instead of Ignore .

+10
source

For MyEclipse

1.Windows-> Preferences

2.Myeclipse-> Validation-> JPA

3.Queries and generators

Generators are not defined in the storage module;

+3
source

The name of the generator must be a unique generator, and one or more classes can refer to it.

The javadoc clearly states:

(required) The unique name of the generator that one or more classes can refer to will be the generator for the primary key values.

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

The scope of the generator name is global for the persistence unit (for all types of generators)

+1
source