Hibernate-GWT type issue
|Note : this issue is now
solved by GWT 1.5 and only concerns previous releases.
Hibernate replaces some basic Java types
with various subclassed implementation :
can be replaced with java.sql.Date or java.sql.Timestamp
is implemented by Hibernate's PersistentList
is implemented by Hibernate's PersistentSet
these classes fails, since they do not belong to the JRE
emulation supported by GWT.
The easiest way to solve this issue if to
convert back the Hibernate types to the JRE ones.
Dozer and BeanLib do
it well (hibernate4gwt too, since it uses BeanLib :) )... except for
As specified in the associated JavaDoc
"Note: This type is a composite of a
java.util.Date and a separate nanoseconds
to the differences between the
The fact is that
Hibernate does consider
Timestamp as a type inheritance of Date, but GWT don't.
class and the
java.util.Date class mentioned
above, it is recommended that code not view
values generically as an instance of
The inheritance relationship between
java.util.Date really denotes
implementation inheritance, and not type inheritance."
Hopefully, since release 0.5, hibernate4gwt supports native
java.sql.Timestamp both for clone and merge and adds JSNI port of this
class (and java.sql.Date too), so usage of Timestamp is not an issue