Hibernate Static Inner
ID |
java.hibernate_static_inner |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Java |
Tags |
hibernate, orm |
Description
Reports @Entity annotations on non-static inner classes. Hibernate requires persistent inner classes to be declared static because a non-static inner class holds an implicit reference to the enclosing instance, which cannot be serialized or persisted.
Rationale
Reliability — Hibernate throws a MappingException at startup when attempting to map a non-static inner class as an entity.