Hi,
Two questions about DW (6.2) support of Joda DateTime persistence through Hibernate.
@Entity
@NamedQueries({
@NamedQuery(
name="com.example.project.Foo.findByDate",
query="SELECT f FROM Foo f WHERE f.dateTime = :date"
)
})
public class Foo {
@Column(name="date_time", updatable = false)
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
private DateTime dateTime;
}
1. When creating or querying this entity, DW's logs display:
WARN [2013-05-02 11:50:14,202] org.jadira.usertype.spi.reflectionutils.JavaTimeZoneWorkaroundHelper: Under JDK 6 it may not be possible to handle DST transitions correctly
ERROR [2013-05-02 11:50:14,202] org.jadira.usertype.spi.reflectionutils.JavaTimeZoneWorkaroundHelper: Running under a Zone that uses daylight saving time. To avoid incorrect datetimes being stored during DST transition, either update to JDK 7 or use a Timezone for the JDK without Daylight Saving Time
Everything works fine, or at least seems to, but this warning/error message makes me wondering if using Joda Time with JPA entities is realy a good idea (and if it's not, why DW includes Jadira and such ?).
2. How to query for all Foos at a given date (i.e. droping time part)? The named query
"com.example.project.Foo.findByDate" doesn't retrieve entities, using greater comparison works.
Neither
return list(
namedQuery("com.example.project.Foo.findByDate")
.setDate("date", dateTime.toDate())
);
nor
return list(
namedQuery("com.example.project.Foo.findByDate")
.setParameter("date", dateTime.toDate(), DateType.INSTANCE)
);
works (no result returned but entries exists for this date).
Any help apreciated, thanks in advance!