I'm not sure, but I think you need a conversion:

    <field-descriptor
         name="edatum"

conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest
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]

Reply via email to