One solution is to use non-column properties and encapsulate them with getters/setters.
To tell JPA to use getters/setters instead of directly accesing private fields, you must annotate @Id on public Long getId() instead of private Long id. When doing this, just remember to use @Transient for every getter that does not correspond directly to a column.
The following example would create a Date column named myDate, while the application would have DateTime getTs() and setTs() methods available for it. (not sure about DateTime API, so please forgive minor 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; }
// These should be accessed only by JPA, not by your application;
// hence they are marked as protected
protected Date getMyDate() { return ts == null ? null : ts.toDate(); }
protected void setMyDate(Date myDate) {
ts = myDate == null ? null : new DateTime(myDate);
}
// These are to be used by your application, but not by JPA;
// hence the getter is transient (if it s not, JPA will
// try to create a column for it)
@Transient
public DateTime getTs() { return ts; }
public void setTs(DateTime ts) { this.ts = ts; }
}