Обсуждение: feature request

Поиск
Список
Период
Сортировка

feature request

От
"Jan Blok"
Дата:
Hi

I did find the following:

If I have a table with a timestamp column it is not allowed to do the
following

Date start_date = new java.util.Date(); //now
ps4.setObject(2,start_date); //this throws exception "cannot map class
java.util.Date"

but I have todo:

ps4.setTimestamp(2,new java.sql.Timestamp( start_date.getTime()));

which is ugly in my opinion and other database driver do support this...
(under the hood every thing is a java.util.Date right? all classes
java.sql.Date/Time/TimeStamp extend java.util.Date.)






Re: feature request

От
Dave Cramer
Дата:
Jan,

Well the reason that this is a problem is that the driver has some
"extra" features in it which allow you to store an object into a table
automagically. Specifically the serialization code.


Also, what would you like the driver to do with setObject(n, date) since
there is a setDate(), and a setTimestamp, which should the driver map
to? How do other drivers handle this?

Dave
On Mon, 2002-05-20 at 15:35, Jan Blok wrote:
> Hi
>
> I did find the following:
>
> If I have a table with a timestamp column it is not allowed to do the
> following
>
> Date start_date = new java.util.Date(); //now
> ps4.setObject(2,start_date); //this throws exception "cannot map class
> java.util.Date"
>
> but I have todo:
>
> ps4.setTimestamp(2,new java.sql.Timestamp( start_date.getTime()));
>
> which is ugly in my opinion and other database driver do support this...
> (under the hood every thing is a java.util.Date right? all classes
> java.sql.Date/Time/TimeStamp extend java.util.Date.)
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>