Hi Pavel,
The DATE type column of Derby should be mapped to java.sql.Date in the
entity. Currently you are also required to specify the temporal type on
the property as follows
@Temporal(TemporalType.DATE)
public Date getDate()
Thanks,
Mitesh
Pavel Buzek wrote:
> Does anybody happen to know what Java data type would work for Derby
> DATE type? I have an existing table and need to match its types. To
> test this I use java.util.Date and use createtables. Derby generates
> TIMESTAMP. If I tell it to generate DATE using
> @Column(columnDefinition="DATE") I can read it into java.util.Date but
> setting a Date value generates:
>
> EJB5071: Some remote or transactional roll back exception occurred
> Local Exception Stack:
> Exception [TOPLINK-4002] (Oracle TopLink Essentials - 10g release 4
> (10.1.4.0.0) (Build 060124Dev)):
> oracle.toplink.essentials.exceptions.DatabaseException
> Internal Exception: org.apache.derby.client.am.SqlException: Columns
> of type 'DATE' cannot hold values of type 'TIMESTAMP'. Error Code: -1
> Call:UPDATE TESDDATEGEN SET FOODATE = {ts '2004-02-25 00:00:00.0'}
> WHERE (ID = 1)
> Query:UpdateObjectQuery(foo.TesdDateGen_at_1d2e0bd)
> at
> oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:295)
>
> at
> oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:639)
>
> at
> oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:688)
>
> at
> oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:477)
>
> etc.
>
>
>
> Thanks,
> -pavel