-->
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.  [ 1 post ] 
Author Message
 Post subject: SQL Server Syntax error
PostPosted: Wed Aug 15, 2012 8:56 am 
Newbie

Joined: Wed Aug 15, 2012 8:41 am
Posts: 3
I am using Criteria to perform a query that uses an in clause. The sql being generated is invalid syntax:

select this_.CSWebID as y0_,
this_.CSUserName as y1_,
this_.CSStatus as y2_,
this_.CSDate as y3_,
this_.CSViewEdit as y4_,
this_.CSReviewer as y5_,
this_.CSPreview as y6_,
this_.CSPreviousStatus as y7_,
this_.CSComponentName as y8_
from CSWorkQueue this_ where this_.CSUserName=? and y2_ in (?, ?, ?, ?)

problem is that y2_ in the where clause is invalid, it should be this_.CSStatus instead.

I tried it using disjunctions instead and I get the same issue:

select this_.CSWebID as y0_,
this_.CSUserName as y1_,
this_.CSStatus as y2_,
this_.CSDate as y3_,
this_.CSViewEdit as y4_,
this_.CSReviewer as y5_,
this_.CSPreview as y6_,
this_.CSPreviousStatus as y7_,
this_.CSComponentName as y8_
from CSWorkQueue this_
where (y2_=? or y2_=? or y2_=? or y2_=?) and this_.CSUserName=?

Strange that it works ok for the CSUserName clause. The CSStatus is an integer and the username is a string.

Any ideas? This is hibernate 3.3.1 .

Thanks


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

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.