[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ojb-user
Subject:    RE: ClassCastException when storing a Date
From:       Ribi Roland <Roland.Ribi () braunvieh ! ch>
Date:       2004-05-27 15:43:14
Message-ID: 6FC2B4C5FA24D4118DAD00508BC74A5D4D61E9 () sbzvzgsrv1 ! braunvieh ! ch
[Download RAW message or body]

Use jdbc-type="TIMESTAMP" in the repository.xml for DATE-Fields and
java.util.Date will work.

If you use java.sql.Date you can only handle days and not the hours, minuts
and seconds.


Roland Ribi


> -----Original Message-----
> From: Marco José [mailto:marco-jose@criticalsoftware.com]
> Sent: Wednesday, May 26, 2004 5:14 PM
> To: ojb-user@db.apache.org
> Subject: ClassCastException when storing a Date
> 
> 
> Hi.
>  
> I'm working under Oracle9 and have a problem when I try to insert a
> date. 
> I have already some data in the DB which was inserted with a 
> SQL Client.
> When I query these data with OJB, the dates are listed in the 
> following
> pattern: "yyyy-MM-dd". 
> Now when I insert a date into an object (java.util.Date) it uses the
> pattern: "EEE, MMM dd HH:mm:ss Z yyyy" and therefore the
> PersistenceBroker throws a ClassCastException when trying to 
> store this
> object. 
> Can anybody tell me how to resolve this problem? Do I have to edit the
> repository.xml file?
>  
>  
> Thank you in advance,
>  
> Marco José
> 
> 
> 
> --- This message may contain confidential information or 
> privileged material, and is intended only for the 
> individual(s) named. If you are not a named addressee you 
> should not disseminate, distribute or copy this e-mail. 
> Please notify the sender immediately by e-mail if you have 
> received this e-mail by mistake and delete this e-mail from 
> your system. E-mail transmission cannot be guaranteed to be 
> secure or error-free as information could be intercepted, 
> corrupted, lost, destroyed, arrive late or incomplete, or 
> contain viruses. The sender therefore does not accept 
> liability for any errors or omissions in the contents of this 
> message which arise as a result of e-mail transmission. If 
> verification is required please request a hard-copy version. 
> Critical Software.
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic