@Transient annotation is used to declare what instance variables cannot be persisted to database. Note that the keyword transient can also be used for that purpose. static fields are also not persisted.
The entity should not use final persistent instance variables. Specification doesn't allow that. Some existing JPA implementations are flexible on that and still support final fields, like in the following example. Example ProjectDependencies and Technologies Used: - h2 1.4.193: H2 Database Engine.
- eclipselink 2.6.4: EclipseLink build based upon Git transaction 44060b6.
Related JPA version: org.eclipse.persistence:javax.persistence version 2.1.1 - javax.persistence 2.1.1: javax.persistence build based upon git transaction 40384f5.
- JDK 1.8
- Maven 3.3.9
|