JPA
- Association field marked with @Colum
Detects incorrect use of @Column annotation for association attributes with @OneToOne and @ManyToOne annotations.
- Entity attribute is not marked with association annotation
Checks for associations that are not marked with corresponding annotations.
- Entity has more than one id attribute.
Checks for multiple id attributes in one entity.
- Entity listener problems
Reports the following JPA specification errors:.
- Entity listener warnings
Reports entity listener classes without any entity listener methods.
- Equals() method should check the class of its parameter
Checks that equals() method checks class of its parameter.
- For @ManyToMany associations, the REMOVE entity state transition doesn't make sense to be cascaded because it will propagate beyond the link table.
Checks for @ManyToMany associations with the CascadeType.REMOVE attribute.
- JPA converter must be annotated with @Converter annotation
Checks for the presence of @Converter annotation on JPA converter.
- Lombok @Builder needs a proper constructor for this class
Checks that all-args constructor exists for @lombok.Builder in JPA entities.
- Orm.xml problems
Reports unresolved references to any database objects inside `orm.xml` configuration files:.
- Persistence.xml is not added to facet
Reports missing persistence.xml configuration files and suggests adding the file to the persistence facet.
- Persistent attribute signature checks
Reports the following JPA specification errors:.
- Persistent attribute type checks
Reports property type mismatch for JPA attributes.
- Persistent entity misses primary key
Reports missing identification property persistence objects.
- Persistent object class signature checks
Reports incorrectly defined persistent object classes in the following cases:.
- Query language checks
Reports the following errors inside Persistence QL queries: Mismatching expression types Incorrect parameters Empty or constant conditions Unresolved symbols Example queries: SELECT OBJECT(e) FROM JavaEntity e WHERE TRUE // Warning: constant condition SELECT OBJECT(e) FROM JavaEntity e WHERE e.id BETWEEN 0 AND '2' // Error: expected a numeric value but got a string SELECT e from JavaEntity e where e.id=?1 and e.name=?3 // Error: there are only 2 actual query parameters.
- Specifying FetchType.LAZY for the non-owning side of the @OneToOne association will not affect the loading. The related entity will still be loaded as if the FetchType.EAGER is defined.
Checks for the non-owning side of the @OneToOne associations with the FetchType.Lazy attribute.
- Unresolved database references in XML
Reports Persistence ORM XML descriptors that cannot be resolved within the configured datasource and suggests refreshing the datasource or assigning a different one.
- Unresolved database references in annotations
Reports references inside the following Persistence ORM annotations if they cannot be resolved within the configured datasource:.
- Unresolved entity graph names
Reports the following unresolved attributes inside EntityGraph-related annotations:.
- Unresolved queries and query parameters
Reports unresolved symbols in named and native queries and related API methods: Unknown named query Unknown query parameter Example: @Entity @NamedQuery(name = "SelectByConditionQuery", query = "...") public class JavaEntity { ..
- Unresolved references in queries
Reports unresolved symbols in the following JPA annotations and API methods:.
- Using @AllArgsConstructor for JPA entities without defined no-argument constructor breaks JPA specification.
Checks that @lombok.AllArgsConstructor used in JPA entities.
- Using @Builder for JPA entities without defined no-argument constructor breaks JPA specification.
Checks that @lombok.Builder used in JPA entities.
- persistence.xml problems
Reports the following problems inside XML configuration files:.