One solution is to use properties other than columns and encapsulate them using getters / setters.
To tell JPA to use getters / setters instead of directly accessing private fields, you should annotate @Id on public Long getId () instead of private Long id . In doing so, just remember to use @Transient for each recipient that does not correspond directly to the column.
The following example creates a Date column named myDate , while the application will have the DateTime getTs () and setTs () methods available. (not sure about the DateTime API, so please forgive the small errors :))
import org.joda.time.DateTime; @Entity public class Foo { private Long id; private DateTime ts; @Id public Long getId() { return id; } public void setId(Long id) { this.id = id; }
AndrΓ© willik valenti
source share