Reputation: 229
Is it possible for a JPA entity to have a field which is not mapped to any column in the data base table. Basically I need to store some additional data on my front end but I do not want to create an extra column in the table for this.
Upvotes: 16
Views: 17173
Reputation: 229
Marking @Transient annotation solve this problem but it will work after restart host server(application/web).
Upvotes: 3
Reputation: 26522
Just mark the field or getter with @javax.persistence.Transient
annotation.
The data stored there will not be persisted, nor the ddl generator, if you use any, will pick that one up as an additional column of the table.
Upvotes: 22