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]