Hibernate: Add a property in my class that is not mapped to a db-table Hibernate: Add a property in my class that is not mapped to a db-table java java

Hibernate: Add a property in my class that is not mapped to a db-table


Use @Transient annotation for field you are not going to store in DB:

@Transientpublic String getStatus() {    return status;}

or:

@Transientprivate String status;


Mark it as @Transient, and it won't be part of the DB schema.


If you annotate a field with @Transient it will not be persisted.