Search code examples
mappingjpa-2.0eclipselinkglassfish-3

JPA Save list of dates


We must save a entity which holds a list of date objects. The list is annotated as follows:

@ElementCollection
@Temporal(TemporalType.DATE)
public List<Date> dates {
   return dates;
}

This works but the dates are mapped with varchar type in database. Is there another way to store a collection of dates in the database?


Solution

  • That is odd, it should use the DATE type. I assume you are using EclipseLink to generate your DDL?

    You could set the column definition using the @Column annotation to set the type explicitly.

    (also try the latest EclipseLink release, and if it still fails log a bug).