The big difference is of course, is that the java.sql.Date is "A thin wrapper around a millisecond value that allows
JDBCto identify this as a SQL DATE (JDK1.3.1 doco)" - it subclasses java.util.Date so certainly holds time ;)
In relation before that, java.util.Date holds a specific instance in time - without timezones coming into play - in
realitythe amount of seconds since Unix birth or 1970 or whatever it is. I'm not sure about the JDBC driver and backend
interaction,but I'd be using a GregorianCalendar or Calendar instance instead, which is more suitable for manipulating
datesand times. I'm not sure if the setObject() method caters for this though.
Cheers,
Joe
> Never tried it but what about using setObject(java.sql.Date)
> ^^^
>
> The big difference between the objects of course is that the
> java.sql.Date only holds the date part and not the time part.
>
> Tom.
>
> On Wed, Apr 17, 2002 at 02:53:43PM -0300, Leandro Rodrigo Saad Cruz wrote:
> > Hi all, I'm working an a persistence layer API above JDBC
> > that uses setObject() in prepare statements. the problem is :
> > I get a ClassCastException when using setObject(java.util.Date).
> > Can I use setObject(java.util.Date) or I **must** use
> > setDate(java.util.Date) ??
> >
> > --
> > Leandro Rodrigo Saad Cruz
> > IT - Inter Business Tecnologia e Servicos (IB)
> > http://www.ibnetwork.com.br