2

The question is about suppressing specific JPA warnings in Eclipse, the code below is just for illustration.

I am using JPA for persistence, implemented by Hibernate. The pure JPA doesn't generally like the mappedBy = "bindServiceId" part, although the Hibernate implementation understands it and does what I expect.

@OneToMany(mappedBy = "bindServiceId")
private List<ServiceType> serviceTypes = new ArrayList<>();

However, I have an ugly message in my Eclipse project:

In attribute 'serviceTypes', the "mapped by" attribute 'bindServiceId' has an invalid mapping type for this relationship.

I know that the message can be suppressed globally in Eclipse (Mars) | Window | Preferences | Java Persistence | JPA | Errors/Warnings | Attribute has invalid mapping for this relationship, as in the picture below:

enter image description here

However the solution is not ideal:

  1. It influences globally the whole IDE (or at least the whole project), and I do not want to suppress the warning for all the instances
  2. It is not in the code so it is not part of the codebase (we don't store Eclipse files in GIT) and all the team members would have to set it in their IDEs, too.

Question

Is it possible to suppress a single JPA warning only locally, for one selected place, like you can do with standard compiler messages using the @SuppressWarning annotation?

Community
  • 1
  • 1
Honza Zidek
  • 9,204
  • 4
  • 72
  • 118

0 Answers0