These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Double Quoting DateTime Fields
PostPosted: Fri Nov 02, 2007 1:55 pm 
Newbie

Joined: Fri Nov 02, 2007 1:51 pm
Posts: 3
Hey guys and girls..

I've been using Cuyahoga and open source CMS which heavily makes use of nhibnerate.

Everything is great but I recently tried writing a Windows application rather than a web application using my current libraries and have his a strange problem.

The SQL being generated by Nibernate seems to be getting screwed when it comes to date time variables

Here is an example of the ADO Exception SQL statement...

Code:
exec sp_executesql N'INSERT INTO THINK_user (updatetimestamp, username, password, firstname, lastname, company, email, website, timezone, isactive, lastlogin, lastip,
inserttimestamp) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12); select SCOPE_IDENTITY()',N'@p0 datetime,@p1 nvarchar(4000),@p2
nvarchar(4000),@p3 nvarchar(4000),@p4 nvarchar(4000),@p5 nvarchar(4000),@p6 nvarchar(18),@p7 nvarchar(4000),@p8 int,@p9 bit,@p10 datetime,@p11 nvarchar(4000),@p12
datetime',@p0=''2007-11-02 17:41:57:460'',@p1=NULL,@p2=NULL,@p3=NULL,@p4=NULL,@p5=NULL,@p6=N'vijay@ukwalasm.com',@p7=NULL,@p8=0,@p9=1,@p10=NULL,@p11=NULL,@p12=''2007-11-02 17:41:52:000''


As you can see it is putting double quotes around the date time fields which is causing the stored proc to fail

Any ideas as this is for a major deadline so any help would be appreciated


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 03, 2007 9:09 am 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
Did you copy-and-pasted the SQL statement from MS SQL Profiler earlier than 2005 SP2? If so, you are experiencing a bug in MS SQL Profiler:
http://geekswithblogs.net/influent1/arc ... 12897.aspx

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 04, 2007 11:53 am 
Newbie

Joined: Fri Nov 02, 2007 1:51 pm
Posts: 3
I think you may be right.

In the mean time I downloaded the Nhibernate source and debugged into that and that told me that I was not passing some params for fields which were set to not null. Which it seems was the problem after all.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.