Bugs item #672639, was opened at 2003-01-23 06:08
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=428708&aid=672639&group_id=40712

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Simon Harris (haruki_zaemon)
Assigned to: Nobody/Anonymous (nobody)
Summary: HB2 generating incorrect join query

Initial Comment:
I have the following classes:

Party 1:1 Membership

Party joined-sub-classes Person, Company

When executing a query to find a Person, the following 
two sql statements are executed:

SELECT Membe1_.id as id0, Membe1_.versionId as 
versionId0, Perso0_.partyId as partyId1, 
Perso0_.versionId as versionId0_1, Perso0_.loginName 
as loginName0_1 FROM Party Perso0_, Person 
Perso0__1, Membership Membe1_ WHERE 
Perso0_.partyId=? and Perso0_.partyId=Membe1_.id(+)

followed by:

SELECT Membe0_.id as id, Membe0_.versionId as 
versionId FROM Membership Membe0_ WHERE 
Membe0_.id=?

Firslty, I'm not quite sure why the second query is 
generated at all but more importantly, you will notice the 
addition of an extra table in the FROM clause of the first 
query:

Person Perso0__1

Which is not needed and causes multiple results to be 
returned.

I noticed this when I submitted some patches for the 
decode stuff. I realise hb2 is still beta but I wanted to 
document it anyway. I'll look into this problem and see 
what I can find unless someone else has a slap the 
forehead DOH! moment and realises what is going 
wrong first :-)

Cheers,

Simon

----------------------------------------------------------------------

>Comment By: Gavin King (oneovthafew)
Date: 2003-01-24 01:44

Message:
Logged In: YES 
user_id=384580

Cool, thanks! I will fix this ASAP

----------------------------------------------------------------------

Comment By: Simon Harris (haruki_zaemon)
Date: 2003-01-23 20:49

Message:
Logged In: YES 
user_id=146770

The attached mapping file generates the following SQL:

SELECT Perso0_.partyId as partyId, Perso0_.versionId as 
versionId0_ FROM Party Perso0_, Person Perso0__1 
WHERE Perso0_.partyId=?

Which as you can see is incorrect.

I am using the latest CVS code as I needed it to create the 
CaseFragment patches I uploaded (hint hint).

The problem doesn't show up in the released code.

Cheers,

Simon

----------------------------------------------------------------------

Comment By: Gavin King (oneovthafew)
Date: 2003-01-23 10:25

Message:
Logged In: YES 
user_id=384580

Please, please post the mapping file; I can't reproduce this!

(Did you try the very latest CVS?)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=428708&aid=672639&group_id=40712


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to