Hello again, and thank you - you saved my life. One more point, maybe for discussion: My solution: - i did not you the SimpleDateTimeFormat but load the java-util.Date into a GregorianCalendar, - create a second GregorianCalendar and explicitly clear this (this seems to be the important step) - i load the DATE, MONTH and YEAR data into the second Calendar - and do not touch the time parts - then i create a java.sql.Date object an return this value - everything seems to work fine
I testet this be adjusting the source code of the org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConversion Now my questions: - is a FieldConverter the proper place to do this and if 'yes', isn't it the intended behaviour of JavaDate2SqlDateFieldConversion? - is ist better do do it within the java class corresponding to the table - should it be done in the code, where the resprctive values are created or processed? Where do you do it? OK, thanks again for helping and for listening I love this mailing list. Regards Max > -----Ursprüngliche Nachricht----- > Von: Edson Carlos Ericksson Richter > [mailto:[EMAIL PROTECTED] > Gesendet: Donnerstag, 17. Juli 2003 19:38 > An: OJB Users List > Betreff: Re: [MAPPING] MS SQL Server and DATETIME conversion > > > I'm using a SimpleDateTimeFormat to format (cutting time > part) and parse > again into date. It's not elegant, but works. > > Edson Richter > > ----- Original Message ----- > From: "Geigl Maximilian, R235" <[EMAIL PROTECTED]> > To: "OJB Users List" <[EMAIL PROTECTED]> > Sent: Thursday, July 17, 2003 1:15 PM > Subject: AW: [MAPPING] MS SQL Server and DATETIME conversion > > > Hello Edson, > > i'm still struggling with my problem. Can you pleas tell me > how you ensure > not to deliver time part. > > Max > > > -----Ursprüngliche Nachricht----- > > Von: Edson Carlos Ericksson Richter > > [mailto:[EMAIL PROTECTED] > > Gesendet: Dienstag, 15. Juli 2003 21:08 > > An: OJB Users List > > Betreff: Re: [MAPPING] MS SQL Server and DATETIME conversion > > > > > > I'm not sure, but I think you need a conversion: > > > > <field-descriptor > > name="edatum" > > > > conversion="org.apache.ojb.broker.accesslayer.conversions.Java > > Date2SqlTimest > > ampFieldConversion" > > column="EDATUM" > > jdbc-type="DATE" > > /> > > > > I've used this with SapDB and MS SQL 2K in my apps and worked > > fine. You > > should remember that java.sql.Date have different treatment than > > java.util.Date. > > > > Of course, you should guarantee that you are not capturing > > the time part > > when inserting data... I'm using a function to truncate the > > time part in my > > apps. > > > > Best regards, > > > > Edson Richter > > > > ----- Original Message ----- > > From: "Geigl Maximilian, R235" <[EMAIL PROTECTED]> > > To: "OJB Users List" <[EMAIL PROTECTED]> > > Sent: Tuesday, July 15, 2003 3:54 PM > > Subject: [MAPPING] MS SQL Server and DATETIME conversion > > > > > > Hello, > > > > i use OJB 1.0 rc2, MS SQL Server 2000 on WIN2K with the MS > > JDBC driver and > > have a date field: > > > > <field-descriptor > > name="edatum" > > column="EDATUM" > > jdbc-type="DATE" > > /> > > > > with the corresponding data type DATETIME in the datebase, > > which can stores > > date and time information in one field. > > When i issue an INSERT that only has date information (like > > '2003-03-04') > > and execute a subsequent SELECT with a WHERE clause like > > field='2003-03-04' > > i do not get any result (all through OJB naturally). > > > > As far as i found out for the leading INSERT the (not given) > > time part is > > generated as 12:00:00.000, the SELECT looks for a DATETIME > > value with the > > time part like 00:00:00.000. and does not find any rows. > > > > Can somebody explain to me, how the generation of time parts > > is working or > > if i can configure this. Is it happening inside OJB (i don't > > think as is > > examined the p6spy log), the sql server or inside the jdbc > > driver (which i > > suspect, because the same example in query analyzer works). > > > > What can i do to work around this problem? Thank you for any > > suggestions. > > > > Regards > > Max > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.501 / Virus Database: 299 - Release Date: 14/7/2003 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]