|
From: <jue...@we...> - 2004-08-31 22:15:01
|
Good point. However, the driver respectively database might behave = differently, as the passed-in object implicitly leads to a corresponding = SQL type (i.e. DATE or TIMESTAMP): Will the database complain if it = receives a timestamp value for a date field? Will it complain the other = way round? =20 It's certainly recommendable to pass the SQL type in for such a value. = The question is: What's the safest default for the type if we receive a = plain java.util.Date? Which implicit SQL type will work with most = databases in a predictable manner? =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von tho...@tr... Gesendet: Di 31.08.2004 22:56 An: spr...@li... Betreff: Re: [Springframework-developer] StatementCreatorUtils Wouldn't java.sql.Timestamp be a better choice for java.util.Date and java.util.Calendar with unknow SQL type? That way you would not lose = the time portion. Thomas Quoting "j=FCrgen h=F6ller [werk3AT]" <jue...@we...>: > I've adapted StatementCreatorUtils as follows: > > * StatementCreatorUtils uses specific PreparedStatement parameter = setter =3D > methods, as far as possible > * added auto-conversion of java.util.Calendar to =3D > java.sql.Date/Time/Timestamp, for SQL types DATE/TIME/TIMESTAMP > * added auto-conversion of java.util.Date and java.util.Calendar to = =3D > java.sql.Date, in case of an unknown SQL type > > This was partly triggered by > http://opensource.atlassian.com/projects/spring/browse/SPR-301 > > Thomas and co, please give the new version a try. It should = essentially =3D > work the same as before, just do a few more auto-conversions. > > Juergen > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: <jue...@we...> - 2004-09-01 21:34:43
|
Changing auto-conversion in the unknown type case to java.sql.Timestamp = is fine with me. =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von tho...@tr... Gesendet: Mi 01.09.2004 23:23 An: spr...@li... Betreff: Re: [Springframework-developer] StatementCreatorUtils I tested setObject with both a java.sql.Date and a java.sql.Timestamp = and the databases I tested on (MSSQL Server, MySQL, Postgres, Oracle) all = behaved well for both. The advatage with the Timstamp is that you retain the time = portion. If no one objects I'll change the auto conversion to use a Timestamp. Thomas Quoting "j=FCrgen h=F6ller [werk3AT]" <jue...@we...>: > Good point. However, the driver respectively database might behave =3D > differently, as the passed-in object implicitly leads to a = corresponding =3D > SQL type (i.e. DATE or TIMESTAMP): Will the database complain if it = =3D > receives a timestamp value for a date field? Will it complain the = other =3D > way round? > =3D20 > It's certainly recommendable to pass the SQL type in for such a value. = =3D > The question is: What's the safest default for the type if we receive = a =3D > plain java.util.Date? Which implicit SQL type will work with most =3D > databases in a predictable manner? > =3D20 > Juergen > =3D20 > > ________________________________ > > Von: spr...@li... im Auftrag = =3D > von tho...@tr... > Gesendet: Di 31.08.2004 22:56 > An: spr...@li... > Betreff: Re: [Springframework-developer] StatementCreatorUtils > > > > Wouldn't java.sql.Timestamp be a better choice for java.util.Date and > java.util.Calendar with unknow SQL type? That way you would not lose = =3D > the time > portion. > > Thomas > > > Quoting "j=3DFCrgen h=3DF6ller [werk3AT]" = <jue...@we...>: > > > I've adapted StatementCreatorUtils as follows: > > > > * StatementCreatorUtils uses specific PreparedStatement parameter = =3D > setter =3D3D > > methods, as far as possible > > * added auto-conversion of java.util.Calendar to =3D3D > > java.sql.Date/Time/Timestamp, for SQL types DATE/TIME/TIMESTAMP > > * added auto-conversion of java.util.Date and java.util.Calendar to = =3D > =3D3D > > java.sql.Date, in case of an unknown SQL type > > > > This was partly triggered by > > http://opensource.atlassian.com/projects/spring/browse/SPR-301 > > > > Thomas and co, please give the new version a try. It should =3D > essentially =3D3D > > work the same as before, just do a few more auto-conversions. > > > > Juergen > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by BEA Weblogic Workshop > > FREE Java Enterprise J2EE developer tools! > > Get your free copy of BEA WebLogic Workshop 8.1 today. > > http://ads.osdn.com/?ad_id=3D3D5047&alloc_id=3D3D10808&op=3D3Dclick > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > = https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=3D3D5047&alloc_id=3D3D10808&op=3D3Dclick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Dmitriy K. <dko...@ru...> - 2004-09-01 21:37:01
|
I don't see any problems with that. +1. Dmitriy. jürgen höller [werk3AT] wrote: >Changing auto-conversion in the unknown type case to java.sql.Timestamp is fine with me. > >Juergen > > >________________________________ > >Von: spr...@li... im Auftrag von tho...@tr... >Gesendet: Mi 01.09.2004 23:23 >An: spr...@li... >Betreff: Re: [Springframework-developer] StatementCreatorUtils > > > >I tested setObject with both a java.sql.Date and a java.sql.Timestamp and the >databases I tested on (MSSQL Server, MySQL, Postgres, Oracle) all behaved well >for both. The advatage with the Timstamp is that you retain the time portion. >If no one objects I'll change the auto conversion to use a Timestamp. > >Thomas > > >Quoting "jürgen höller [werk3AT]" <jue...@we...>: > > > >>Good point. However, the driver respectively database might behave = >>differently, as the passed-in object implicitly leads to a corresponding = >>SQL type (i.e. DATE or TIMESTAMP): Will the database complain if it = >>receives a timestamp value for a date field? Will it complain the other = >>way round? >>=20 >>It's certainly recommendable to pass the SQL type in for such a value. = >>The question is: What's the safest default for the type if we receive a = >>plain java.util.Date? Which implicit SQL type will work with most = >>databases in a predictable manner? >>=20 >>Juergen >>=20 >> >>________________________________ >> >>Von: spr...@li... im Auftrag = >>von tho...@tr... >>Gesendet: Di 31.08.2004 22:56 >>An: spr...@li... >>Betreff: Re: [Springframework-developer] StatementCreatorUtils >> >> >> >>Wouldn't java.sql.Timestamp be a better choice for java.util.Date and >>java.util.Calendar with unknow SQL type? That way you would not lose = >>the time >>portion. >> >>Thomas >> >> >>Quoting "j=FCrgen h=F6ller [werk3AT]" <jue...@we...>: >> >> >> >>>I've adapted StatementCreatorUtils as follows: >>> >>>* StatementCreatorUtils uses specific PreparedStatement parameter = >>> >>> >>setter =3D >> >> >>>methods, as far as possible >>>* added auto-conversion of java.util.Calendar to =3D >>>java.sql.Date/Time/Timestamp, for SQL types DATE/TIME/TIMESTAMP >>>* added auto-conversion of java.util.Date and java.util.Calendar to = >>> >>> >>=3D >> >> >>>java.sql.Date, in case of an unknown SQL type >>> >>>This was partly triggered by >>>http://opensource.atlassian.com/projects/spring/browse/SPR-301 >>> >>>Thomas and co, please give the new version a try. It should = >>> >>> >>essentially =3D >> >> >>>work the same as before, just do a few more auto-conversions. >>> >>>Juergen >>> >>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by BEA Weblogic Workshop >>>FREE Java Enterprise J2EE developer tools! >>>Get your free copy of BEA WebLogic Workshop 8.1 today. >>>http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick >>>_______________________________________________ >>>Springframework-developer mailing list >>>Spr...@li... >>>https://lists.sourceforge.net/lists/listinfo/springframework-developer >>> >>> >>> >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by BEA Weblogic Workshop >>FREE Java Enterprise J2EE developer tools! >>Get your free copy of BEA WebLogic Workshop 8.1 today. >>http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick >>_______________________________________________ >>Springframework-developer mailing list >>Spr...@li... >>https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by BEA Weblogic Workshop >>FREE Java Enterprise J2EE developer tools! >>Get your free copy of BEA WebLogic Workshop 8.1 today. >>http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click >>_______________________________________________ >>Springframework-developer mailing list >>Spr...@li... >>https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> >> > > > > > >------------------------------------------------------- >This SF.Net email is sponsored by BEA Weblogic Workshop >FREE Java Enterprise J2EE developer tools! >Get your free copy of BEA WebLogic Workshop 8.1 today. >http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > >------------------------------------------------------- >This SF.Net email is sponsored by BEA Weblogic Workshop >FREE Java Enterprise J2EE developer tools! >Get your free copy of BEA WebLogic Workshop 8.1 today. >http://ads.osdn.com/?ad_idP47&alloc_id808&op=click >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |
|
From: <tho...@tr...> - 2004-09-01 21:23:19
|
I tested setObject with both a java.sql.Date and a java.sql.Timestamp and the databases I tested on (MSSQL Server, MySQL, Postgres, Oracle) all behaved well for both. The advatage with the Timstamp is that you retain the time portion. If no one objects I'll change the auto conversion to use a Timestamp. Thomas Quoting "jürgen höller [werk3AT]" <jue...@we...>: > Good point. However, the driver respectively database might behave = > differently, as the passed-in object implicitly leads to a corresponding = > SQL type (i.e. DATE or TIMESTAMP): Will the database complain if it = > receives a timestamp value for a date field? Will it complain the other = > way round? > =20 > It's certainly recommendable to pass the SQL type in for such a value. = > The question is: What's the safest default for the type if we receive a = > plain java.util.Date? Which implicit SQL type will work with most = > databases in a predictable manner? > =20 > Juergen > =20 > > ________________________________ > > Von: spr...@li... im Auftrag = > von tho...@tr... > Gesendet: Di 31.08.2004 22:56 > An: spr...@li... > Betreff: Re: [Springframework-developer] StatementCreatorUtils > > > > Wouldn't java.sql.Timestamp be a better choice for java.util.Date and > java.util.Calendar with unknow SQL type? That way you would not lose = > the time > portion. > > Thomas > > > Quoting "j=FCrgen h=F6ller [werk3AT]" <jue...@we...>: > > > I've adapted StatementCreatorUtils as follows: > > > > * StatementCreatorUtils uses specific PreparedStatement parameter = > setter =3D > > methods, as far as possible > > * added auto-conversion of java.util.Calendar to =3D > > java.sql.Date/Time/Timestamp, for SQL types DATE/TIME/TIMESTAMP > > * added auto-conversion of java.util.Date and java.util.Calendar to = > =3D > > java.sql.Date, in case of an unknown SQL type > > > > This was partly triggered by > > http://opensource.atlassian.com/projects/spring/browse/SPR-301 > > > > Thomas and co, please give the new version a try. It should = > essentially =3D > > work the same as before, just do a few more auto-conversions. > > > > Juergen > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by BEA Weblogic Workshop > > FREE Java Enterprise J2EE developer tools! > > Get your free copy of BEA WebLogic Workshop 8.1 today. > > http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |