-->
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.  [ 2 posts ] 
Author Message
 Post subject: Composit primary keys and MS SQLServer
PostPosted: Wed Aug 15, 2007 11:48 am 
Newbie

Joined: Thu Jul 01, 2004 4:53 am
Posts: 2
Location: Denmark
Hi,

Currently we have a working application running on PostgreSQL, we are trying to port the application to SQLServer and have run into some problems regarding composit primary keys.

It seems that the SQLServerDialect uses SQL syntax that SQLServer can not understand, following is two examples:

HQL:
--------------------------------------------------------------
select
cf
from
Classification as cf
where
cf.id in (:ids)

SQL:
--------------------------------------------------------------
select
cf.cfClassId as cfClassId61_,
cf.cfClassSchemeId as cfClassS6_61_,
cf.cfEndDate as cfEndDate61_,
cf.cfSeq as cfSeq61_,
cf.cfStartDate as cfStartD4_61_,
cf.cfURI as cfURI61_
from
cfClass cf
where
(cf.cfClassId, cf.cfClassSchemeId) in ( (10, 10) )


HQL:
--------------------------------------------------------------
select
count( cf )
from
Classification as cf
where
cf.uri in (:v1)

SQL:
--------------------------------------------------------------
select count((cf.cfClassId, cf.cfClassSchemeId)) as col_0_0_
from
cfClass cf
where
cf.cfURI in ( ? )

In both cases I get the following error from SQLServer:
SQL Error: 102, SQLState: S1000
Incorrect syntax near ','.

I was hoping that I was using an old SQLServer dialect, but I cannot seem to find any newer. Any ideas as to what is going wrong?

ps. Using Hibernate 3.2.2

_________________
--
Bo Gundersen


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 5:29 am 
Newbie

Joined: Thu Jul 01, 2004 4:53 am
Posts: 2
Location: Denmark
Update:
Tried it with Hibernate 3.2.5, same problem. Any ideas?

_________________
--
Bo Gundersen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.