Thanks for the reply. That was pretty obvious. Really sorry for clogging up
the forum. My bad.

On Sat, Jul 23, 2011 at 7:58 AM, Shammat <[email protected]> wrote:

> You will need to define your column as TIMESTAMP, a DATE column does
> not have a time part.
>
>
>
> On Jul 21, 3:33 pm, gsibley <[email protected]> wrote:
> > Hi
> >
> > I'm extracting data out of an Oracle database, using squirrel, and
> > inserting it into an 'in-memory' H2 database for my integration tests.
> > I'm using hibernate annotations and the 'hbm2ddl.auto' utility to
> > create the schema in the integration tests. I'm using Springs
> > SimpleJdbcTestUtils.executeSqlScript() method to execute the file of
> > insert statements. This all works fine except for when I insert data
> > for DATE fields. The date members in the hibernate classes are
> > specified as java Date types. e.g.
> >
> > @Temporal(TemporalType.DATE)
> > @Column(name = "MY_DATE")
> > private Date myDate;
> >
> > Here's a snippet of my insert ddl statement:-
> >
> > INSERT INTO "MY_TABLE" (ID,MY_DATE) VALUES (1,{ts '2011-07-01
> > 16:19:18.0'});
> >
> > I get the following stack trace:-
> >
> > Caused by: org.h2.jdbc.JdbcSQLException: Cannot parse "DATE" constant
> > "2011-07-01 16:19:18.0"; SQL statement:
> >
> > Caused by: java.lang.NumberFormatException: For input string: "01
> > 16:19:18.0"
> >
> > The above works fine if I remove the time portion of the date.
> >
> > Is there anyway that I can get the time portion recognised?
> >
> > Regards
> >
> > George
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to