-->
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: Sybase dialect, composite keys and subselect
PostPosted: Mon Aug 15, 2005 2:50 pm 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
Hibernate version:
3.1b1

Sybase ASE doesn't support the syntax
where (c1,c2) in (select v1, v2 ...)

This is generated for composite keys in bidi one-to-many
when fetch="subselect" is set.

Isn't that a typical case where the dialect should drive how the query
is being built?

I'd conjecture that the following are equivalent:

1)
select * from T1 where c11,c12 in (select c21,c22 from T2 where clause2 )

2)
select * from T1, T2
where ( clause2 )
and T1.c11=T2.c21
and T1.c21=T2.c22

[ technically the 2nd is not a subselect, but at least it will work for Sybase...]

In fact I'd prefer the 2) form and leave it to the optimizer to figure out
the details.

Hasn't this been adressed before?

Thx!

----------
OT: I realize that I can fetch="join", but there I'm running into
1+N queries.


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.