jpa Omitting field from the mapping


Example

@Entity
class Note {
    @Id
    Integer id;
 
    @Basic
    String note;

    @Transient
    String parsedNote;

    String readParsedNote() {
        if (parsedNote == null) { /* initialize from note */ }
        return parsedNote;
    }
}

If your class needs fields that should not be written to the database, mark them as @Transient. After reading from the database, the field will be null.