org.hibernate.test.hql.WithClauseTest.testWithClause
Stacktrace on db2-10
Output on db2-10
12:50:28,641 DEBUG QueryTranslatorImpl:237 - HQL: from org.hibernate.test.hql.Human h inner join h.friends as f with f.nickName like 'bubba'
12:50:28,641 DEBUG QueryTranslatorImpl:238 - SQL: select human0_.mammal as id1_0_0_, human2_.mammal as id1_0_1_, human0_2_.description as descript2_0_0_, human0_2_.body_weight as body_wei3_0_0_, human0_2_.mother_id as mother_i4_0_0_, human0_2_.father_id as father_i5_0_0_, human0_2_.zoo_id as zoo_id6_0_0_, human0_2_.serialNumber as serialNu7_0_0_, human0_1_.pregnant as pregnant2_11_0_, human0_1_.birthdate as birthdat3_11_0_, human0_.name_first as name_fir2_4_0_, human0_.name_initial as name_ini3_4_0_, human0_.name_last as name_las4_4_0_, human0_.nickName as nickName5_4_0_, human0_.height_centimeters / 2.54E0 as height_c6_4_0_, human0_.intValue as intValue7_4_0_, human0_.floatValue as floatVal8_4_0_, human0_.bigDecimalValue as bigDecim9_4_0_, human0_.bigIntegerValue as bigInte10_4_0_, human2_2_.description as descript2_0_1_, human2_2_.body_weight as body_wei3_0_1_, human2_2_.mother_id as mother_i4_0_1_, human2_2_.father_id as father_i5_0_1_, human2_2_.zoo_id as zoo_id6_0_1_, human2_2_.serialNumber as serialNu7_0_1_, human2_1_.pregnant as pregnant2_11_1_, human2_1_.birthdate as birthdat3_11_1_, human2_.name_first as name_fir2_4_1_, human2_.name_initial as name_ini3_4_1_, human2_.name_last as name_las4_4_1_, human2_.nickName as nickName5_4_1_, human2_.height_centimeters / 2.54E0 as height_c6_4_1_, human2_.intValue as intValue7_4_1_, human2_.floatValue as floatVal8_4_1_, human2_.bigDecimalValue as bigDecim9_4_1_, human2_.bigIntegerValue as bigInte10_4_1_ from Human human0_ inner join Mammal human0_1_ on human0_.mammal=human0_1_.animal inner join Animal human0_2_ on human0_.mammal=human0_2_.id inner join Human_friends friends1_ on human0_.mammal=friends1_.human1 and (human2_.nickName like 'bubba') inner join Human human2_ on friends1_.human2=human2_.mammal and (human2_.nickName like 'bubba') inner join Mammal human2_1_ on human2_.mammal=human2_1_.animal inner join Animal human2_2_ on human2_.mammal=human2_2_.id
12:50:28,641 DEBUG ErrorCounter:82 - throwQueryException() : no errors
12:50:28,642 DEBUG SQL:104 - select human0_.mammal as id1_0_0_, human2_.mammal as id1_0_1_, human0_2_.description as descript2_0_0_, human0_2_.body_weight as body_wei3_0_0_, human0_2_.mother_id as mother_i4_0_0_, human0_2_.father_id as father_i5_0_0_, human0_2_.zoo_id as zoo_id6_0_0_, human0_2_.serialNumber as serialNu7_0_0_, human0_1_.pregnant as pregnant2_11_0_, human0_1_.birthdate as birthdat3_11_0_, human0_.name_first as name_fir2_4_0_, human0_.name_initial as name_ini3_4_0_, human0_.name_last as name_las4_4_0_, human0_.nickName as nickName5_4_0_, human0_.height_centimeters / 2.54E0 as height_c6_4_0_, human0_.intValue as intValue7_4_0_, human0_.floatValue as floatVal8_4_0_, human0_.bigDecimalValue as bigDecim9_4_0_, human0_.bigIntegerValue as bigInte10_4_0_, human2_2_.description as descript2_0_1_, human2_2_.body_weight as body_wei3_0_1_, human2_2_.mother_id as mother_i4_0_1_, human2_2_.father_id as father_i5_0_1_, human2_2_.zoo_id as zoo_id6_0_1_, human2_2_.serialNumber as serialNu7_0_1_, human2_1_.pregnant as pregnant2_11_1_, human2_1_.birthdate as birthdat3_11_1_, human2_.name_first as name_fir2_4_1_, human2_.name_initial as name_ini3_4_1_, human2_.name_last as name_las4_4_1_, human2_.nickName as nickName5_4_1_, human2_.height_centimeters / 2.54E0 as height_c6_4_1_, human2_.intValue as intValue7_4_1_, human2_.floatValue as floatVal8_4_1_, human2_.bigDecimalValue as bigDecim9_4_1_, human2_.bigIntegerValue as bigInte10_4_1_ from Human human0_ inner join Mammal human0_1_ on human0_.mammal=human0_1_.animal inner join Animal human0_2_ on human0_.mammal=human0_2_.id inner join Human_friends friends1_ on human0_.mammal=friends1_.human1 and (human2_.nickName like 'bubba') inner join Human human2_ on friends1_.human2=human2_.mammal and (human2_.nickName like 'bubba') inner join Mammal human2_1_ on human2_.mammal=human2_1_.animal inner join Animal human2_2_ on human2_.mammal=human2_2_.id
12:50:28,673 WARN SqlExceptionHelper:145 - SQL Error: -206, SQLState: 42703
12:50:28,673 ERROR SqlExceptionHelper:147 - DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=HUMAN2_.NICKNAME, DRIVER=4.13.127
12:50:28,673 WARN SqlExceptionHelper:145 - SQL Error: -206, SQLState: 42703
12:50:28,674 ERROR SqlExceptionHelper:147 - DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=HUMAN2_.NICKNAME, DRIVER=4.13.127
12:50:28,674 WARN SqlExceptionHelper:145 - SQL Error: -727, SQLState: 56098
12:50:28,674 ERROR SqlExceptionHelper:147 - DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-206;42703;HUMAN2_.NICKNAME, DRIVER=4.13.127
Generated sql that causes error:
select
human0_.mammal as id1_0_0_,
human2_.mammal as id1_0_1_,
human0_2_.description as descript2_0_0_,
human0_2_.body_weight as body_wei3_0_0_,
human0_2_.mother_id as mother_i4_0_0_,
human0_2_.father_id as father_i5_0_0_,
human0_2_.zoo_id as zoo_id6_0_0_,
human0_2_.serialNumber as serialNu7_0_0_,
human0_1_.pregnant as pregnant2_11_0_,
human0_1_.birthdate as birthdat3_11_0_,
human0_.name_first as name_fir2_4_0_,
human0_.name_initial as name_ini3_4_0_,
human0_.name_last as name_las4_4_0_,
human0_.nickName as nickName5_4_0_,
human0_.height_centimeters / 2.54E0 as height_c6_4_0_,
human0_.intValue as intValue7_4_0_,
human0_.floatValue as floatVal8_4_0_,
human0_.bigDecimalValue as bigDecim9_4_0_,
human0_.bigIntegerValue as bigInte10_4_0_,
human2_2_.description as descript2_0_1_,
human2_2_.body_weight as body_wei3_0_1_,
human2_2_.mother_id as mother_i4_0_1_,
human2_2_.father_id as father_i5_0_1_,
human2_2_.zoo_id as zoo_id6_0_1_,
human2_2_.serialNumber as serialNu7_0_1_,
human2_1_.pregnant as pregnant2_11_1_,
human2_1_.birthdate as birthdat3_11_1_,
human2_.name_first as name_fir2_4_1_,
human2_.name_initial as name_ini3_4_1_,
human2_.name_last as name_las4_4_1_,
human2_.nickName as nickName5_4_1_,
human2_.height_centimeters / 2.54E0 as height_c6_4_1_,
human2_.intValue as intValue7_4_1_,
human2_.floatValue as floatVal8_4_1_,
human2_.bigDecimalValue as bigDecim9_4_1_,
human2_.bigIntegerValue as bigInte10_4_1_
from Human human0_
inner join Mammal human0_1_
on human0_.mammal=human0_1_.animal
inner join Animal human0_2_
on human0_.mammal=human0_2_.id
inner join Human_friends friends1_
on human0_.mammal=friends1_.human1
and human2_.nickName like 'bubba' -- !!! there is problem
inner join Human human2_
on friends1_.human2=human2_.mammal
and human2_.nickName like 'bubba'
inner join Mammal human2_1_
on human2_.mammal=human2_1_.animal
inner join Animal human2_2_
on human2_.mammal=human2_2_.id
If I comment "and human2.nickName like 'bubba'_" sql query works.
|