Hi Carl,

java.sql.Date represents a date only, not a date/time.  The database
should be a datetime field, the JDBC type should be TIMESTAMP and you
must use a conversion field to convert to java.util.Date.

This is an extract from one of my repository.xml files.

<field-descriptor
    name="updated"
    column="Updated"
    jdbc-type="TIMESTAMP"
 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTi
mestampFieldConversion"
  />

Wally

-----Original Message-----
From: Boyes, Carl [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 14, 2003 11:01 AM
To: OJB Users List (E-mail)
Subject: Problem persisting dates


Hi all,

I have an object that has a java.util.Date attribute.  When persisting
this date, the time portion is stripped. Although dates with times are
successfully retrieved from the database.

I've tried using
org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDateFieldConve
rsio
n without success.

I've also tried modifying the jdbc-type in the sql repository to
TIMESTAMP and using
org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampField
Conv
ersion, but this made no difference.

I'm using MS SQLServer, the current attribute mapping is:

        <field-descriptor name="actionDueDate" column="ActionDueDate"
jdbc-type="DATE"
        
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDa
teFi
eldConversion" />

I've looked through the archives and have not found a solution to my
problem, I'm sure I'm missing something obvious!

Regards,

Carl.

The contents of this email are confidential to the intended recipient at
the email address to which it has been addressed.  It may not be
disclosed to or used by anyone other than this addressee, nor may it be
copied in any way. If received in error, please contact DLA, a UK law
firm, (http://www.dla.com/) on +44 (0) 8700 111111 quoting the name of
the sender and the addressee and then delete it from your system.
 
Please note that neither DLA nor the sender accepts any responsibility
for viruses and it is your responsibility to scan the email and
attachments (if any).  No contracts may be concluded on behalf of DLA by
means of email communications.

A list of the names of the partners of DLA (who are either solicitors or
registered foreign lawyers) and their qualifications is available for
inspection at 3 Noble Street, London, EC2V 7EE, UK.

Regulated by the Law Society.



---------------------------------------------------------------------
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]

Reply via email to