user489041
user489041

Reputation: 28304

Exclude Field in Class from JPA

I have an entity in JPA. I recently added a field to my entity. I do not want this field to be persisted. However, Eclipselink is complaining about it not being in the table (which it obviously isnt).

How can I exclude this class from be looked at by JPA. Please note that this field cannot be transient.

Upvotes: 2

Views: 1392

Answers (2)

Mite Mitreski
Mite Mitreski

Reputation: 3626

One option is adding @Transient annotation if on the other hand you use transient keyword that means the field won't be serialized. More on Why does JPA have a @Transient annotation?

Upvotes: 0

Semyon Danilov
Semyon Danilov

Reputation: 1773

You can add JPA's @Transient. Field annotated with Transient will not be persisted.

Upvotes: 3

Related Questions