I am using Hibernate as my JPA provider, and I want one of the fields in an entity to be ignored when calling save()
. However, I do have a matching column in the corresponding database table and I want my entity field to be populated with the database value when I fetch the entity. So, I want the field to be ignored when saving the entity, but not when fetching it.
If I use @Transient
, the field is completely ignored, which is not what I want. Is there any way to do this?
Best Solution
From the excellent book Pro JPA 2 :