Hello!
I'm using hibernate2.1 and firebirdsql (dialect=net.sf.hibernate.dialect.InterbaseDialect). I have problem for inheritance.
I have 3 classes - Person and Organization inherits Subject (joined-subclass).
For expression:
session.load(Subject.class, new Integer(1));
, hibernate generates next SQL-query:
select organiza1_.ID as ID0_, organiza1_.FULLNAME as FULLNAME2_0_, organiza1_.BRIEFNAME as BRIEFNAME2_0_, organiza1_.ORGPHONE as ORGPHONE2_0_, organiza1_.ORGMAILTO as ORGMAILTO2_0_, organiza1_.ID_PARENT as ID_PARENT2_0_, organiza2_.ID as ID1_, organiza2_.FULLNAME as FULLNAME2_1_, organiza2_.BRIEFNAME as BRIEFNAME2_1_, organiza2_.ORGPHONE as ORGPHONE2_1_, organiza2_.ORGMAILTO as ORGMAILTO2_1_, organiza2_.ID_PARENT as ID_PARENT2_1_, subject0_.id as id2_,
case
when subject0__1.ID is not null
then 1
when subject0__2.ID is not null
then 2
when subject0_.id is not null
then 0
end as clazz_2_,
subject0__1.FIRSTNAME as FIRSTNAME1_2_, subject0__1.MIDDLENAME as MIDDLENAME1_2_, subject0__1.LASTNAME as LASTNAME1_2_, subject0__1.BIRTHDAY as BIRTHDAY1_2_, subject0__1.SEX as SEX1_2_, subject0__1.HOMEPHONE as HOMEPHONE1_2_, subject0__1.MOBILEPHONE as MOBILEPH8_1_2_, subject0__1.PRIVATEMAILTO as PRIVATEM9_1_2_, subject0__2.FULLNAME as FULLNAME2_2_, subject0__2.BRIEFNAME as BRIEFNAME2_2_, subject0__2.ORGPHONE as ORGPHONE2_2_, subject0__2.ORGMAILTO as ORGMAILTO2_2_, subject0__2.ID_PARENT as ID_PARENT2_2_ from SUBJECT subject0_ left outer join PERSON subject0__1 on subject0_.id=subject0__1.ID left outer join ORGANIZATION subject0__2 on subject0_.id=subject0__2.ID left outer join ORGANIZATION organiza1_ on subject0__2.ID_PARENT=organiza1_.ID left outer join SUBJECT organiza1__1 on organiza1_.ID=organiza1__1.id left outer join ORGANIZATION organiza2_ on organiza1_.ID_PARENT=organiza2_.ID left outer join SUBJECT organiza2__1 on organiza2_.ID=organiza2__1.id where subject0_.id=?
, but Interbase/Firebird not support 'case' expression in SQL-statement.
What to do?
_________________ Yakov Revyakin
"Ukrgazprompolis" Ins. Co.
"UGP-Net" ISP
|