Might actually do, though the concepts of what you are asking to add to e.g. a 
F.A.Q. are explained in detail at 
http://castor.codehaus.org/types.html#SQL-Type-Conversion, one could say .. ;_).

Werner

wg> -----Original Message-----
wg> From: Aziz Hammadi [mailto:[EMAIL PROTECTED]
wg> Sent: Tuesday, June 14, 2005 2:20 PM
wg> To: [email protected]
wg> Subject: Re: [castor-user] [JDO] support for the mysql type datetime
wg> 
wg> 
wg> Hi Gurus :-)
wg> it works. Here is a kind of a resum� to be added to the castor
wg> documentation, faq or just to apear in this mail list to help by
wg> similar issues:
wg> 
wg> Problem: how to map an object of type  java.util.Date to 
wg> the mysql DATETIME? 
wg> Solution: the column in the db table has the type DATETIME. The
wg> configuration file  must look like this:
wg> <field name="loginDateTime" type="java.util.Date">
wg>     <sql name="loginDT" type="timestamp"/>
wg> </field>
wg> Note that the sql type is TIMESTAMP und not DATETIME. 
wg> ex.:
wg>  Session ses = new Session();
wg>  Date d = new Date((new 
wg> GregorianCalendar(1990,0,17,10,04,23)).getTime());
wg>  ses.setDate(d);
wg>  
wg>  mapping the object ses to the databse will add the value  
wg> [1990-01-17
wg> 10:04:23] into the
wg>  loginDT filed.
wg> 
wg> et voil�.
wg> 
wg> 
wg> Aziz
wg> 
wg> 
wg> 
wg>              
wg>               
wg> 
wg> 
wg> 
wg> On 6/14/05, Werner Guttmann <[EMAIL PROTECTED]> wrote:
wg> > Thanks, Ralf. That's exactly what I had in mind when 
wg> asking Aziz why he thinks that DATETIME is not supported.
wg> > 
wg> > Werner
wg> > 
wg> > wg> -----Original Message-----
wg> > wg> From: Ralf Joachim [mailto:[EMAIL PROTECTED]
wg> > wg> Sent: Tuesday, June 14, 2005 1:42 PM
wg> > wg> To: [email protected]
wg> > wg> Subject: Re: [castor-user] [JDO] support for the 
wg> mysql type datetime
wg> > wg>
wg> > wg>
wg> > wg> Hi Aziz,
wg> > wg>
wg> > wg> if you use:
wg> > wg>
wg> > wg>      <field name="creationTime" type="java.util.Date">
wg> > wg>        <sql name="ctime" type="timestamp" />
wg> > wg>      </field>
wg> > wg>
wg> > wg> in mapping.xml and create the ctime column with type
wg> > wg> DATETIME then it
wg> > wg> works without patching castor.
wg> > wg>
wg> > wg> Regards
wg> > wg> Ralf
wg> > wg>
wg> > wg>
wg> > wg>
wg> > wg> Aziz Hammadi schrieb:
wg> > wg> > Hi all!
wg> > wg> > I am just wondering while the mysql type  DATETIME has
wg> > wg> not yet been
wg> > wg> > implemented. The MySQL Connector/J supports 
wg> allready this type by
wg> > wg> > using java.sql.Timestamp to model it. I tried to hack the
wg> > wg> castor code
wg> > wg> > (SQLTypes.java) to map datetime to
wg> > wg> java.sql.Timestamp.class. I added
wg> > wg> > the following entry
wg> > wg> >  new TypeInfo( java.sql.Types.TIMESTAMP,      "datetime",
wg> > wg>     =3D20
wg> > wg> > java.sql.Timestamp.class),
wg> > wg> > to the =5FtypeInfos array.
wg> > wg> >
wg> > wg> > Well this little change produced the value "1989-01-24
wg> > wg> 00:00:00" in my
wg> > wg> > table. I guess it needs more modifications to 
wg> handle the 00:00:00
wg> > wg> > part. What do you think=3F is this a correct concept=3F
wg> > wg> >
wg> > wg> > reference:
wg> > 
wg> http://www.issociate.de/board/post/18070/JConnector=5F3.0=5F
wg> and=5FDAT=
wg> > > ETIME.html
wg> > >
wg> > >
wg> > > Cheers
wg> > > Aziz
wg> > >
wg> > > -------------------------------------------------
wg> > > If you wish to unsubscribe from this list, please
wg> > > send an empty message to the following address:
wg> > >
wg> > > [EMAIL PROTECTED]
wg> > > -------------------------------------------------
wg> > 
wg> > --
wg> > 
wg> > Syscon Ingenieurb�ro f�r
wg> > Me�- und Datentechnik GmbH
wg> > Ralf Joachim
wg> > Raiffeisenstra�e 11
wg> > D-72127 Kusterdingen
wg> > Germany
wg> > 
wg> > Tel.   +49 7071 3690 52
wg> > Mobil: +49 173 9630135
wg> > Fax    +49 7071 3690 98
wg> > 
wg> > Email: [EMAIL PROTECTED]
wg> > Web:   www.syscon-world.de
wg> > 
wg> > -------------------------------------------------
wg> > If you wish to unsubscribe from this list, please
wg> > send an empty message to the following address:
wg> > 
wg> > [EMAIL PROTECTED]
wg> > -------------------------------------------------
wg> > 
wg> > 
wg> > -------------------------------------------------
wg> > If you wish to unsubscribe from this list, please
wg> > send an empty message to the following address:
wg> > 
wg> > [EMAIL PROTECTED]
wg> > -------------------------------------------------
wg> > 
wg> > 
wg> 
wg> 
wg> -- 
wg> Aziz Hammadi Lamrani
wg> email: [EMAIL PROTECTED]
wg> url: http://user.et-cip.rub.de/hammadi/
wg> 
wg> -------------------------------------------------
wg> If you wish to unsubscribe from this list, please 
wg> send an empty message to the following address:
wg> 
wg> [EMAIL PROTECTED]
wg> -------------------------------------------------
wg> 
wg> 

-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to