in situation like this i use SQLProfiler to see the actual SQL as it runs through the server.
-----Original Message----- From: Richard Lawson [mailto:[EMAIL PROTECTED]] Sent: Friday, 1 February 2002 7:39 AM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] java.sql.SQLException: [SQLSVR] Syntax error converting datetime from character string I commented out the one field in the mapping and it works. I have no idea why the same syntax works elsewhere but not here. Anyone spot the error? There's beer in it for you if you can :-) //here is the value being set with a java.util.Date cs.setContractExpiryTimestamp( cal.getTime() ); <!--here is where the mapping chokes castor --> <field name="contractExpiryTimestamp" type="date"> <sql name="contractExpiryTimestamp" type="timestamp" dirty="ignore"/> <bind-xml name="contractExpiryTimestamp" node="element"/> </field> -- Here's the field in the database (SQLServer 2000)-- [contractExpiryTimestamp] [datetime] NULL - rich -----Original Message----- From: Richard Lawson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 30, 2002 3:31 PM This one has me stumped. This happens when i commit one of my objects. The object's class has two fields that hold java.util.Date values. I set them like in my code like: // Set the expiry time based on the current time + contract duration. cal.setTime( new Date() ); cal.add( cal.MONTH, p.getProposalProduct().getFeeSchedule().getContractDuration() ); cs.setContractExpiryTimestamp( cal.getTime() ); cs.setCreatedTimestamp(new Date()); cs.setCreatedBy( m_remoteUserName ); cs.setModifiedBy( m_remoteUserName ); cs.setModifiedTimestamp(new Date()); // .. more setting db.create( cs ); The mapping for the date fields is like: <field name = "createdTimestamp" type = "date"> <sql name = "createdTimestamp" type = "timestamp" dirty = "ignore"/> <bind-xml name = "createdTimestamp" node = "element"/> </field> <field name = "contractExpiryTimestamp" type = "date"> <sql name = "contractExpiryTimestamp" type = "timestamp" dirty = "ignore"/> <bind-xml name = "contractExpiryTimestamp" node = "element"/> </field> <field name = "modifiedTimestamp" type = "date"> <sql name = "modifiedTimestamp" type = "timestamp" dirty = "ignore"/> <bind-xml name = "modifiedTimestamp" node = "element"/> </field> The SQL field type is datetime not smalldatetime I'm using inet opta2000. Does ring a bell to anyone? ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
