Hi Roger
Thanks for the reply.
I've taken a look at the debug a bit more closely and the huge query I'm expecting is actually being generated correctly (see the first line). I think this is all I need Hibernate to do for me. But then it goes off and at least logs select statements for each relationship.
The many-to-many mappings are linked via their primary keys, although the primary key is not necessarily a sequence - not sure if that makes a difference. For example, the ID for ProductSubTypeValue is defined simply as:
<id name="id" column="product_subtype_id" unsaved-value="0"/>
(I guess because it's read-only data - the code is never going to input new values into this table)
The other thing I noticed is that each select is being performed at least twice (including the first correct one). Do you think this is just overly-verbose logging on Hibernate's part, or is it really executing each one twice?
Code:
DEBUG hibernate.SQL - select productval0_.PLAN_ID as PLAN1_34_0_, poolvalue1_.POOL_ID as POOL1_35_1_, productgro2_.PRODUCT_GROUP_ID as PRODUCT1_41_2_, generalref3_.GENERAL_REFERENCE_ID as GENERAL1_44_3_, generalref4_.GENERAL_REFERENCE_ID as GENERAL1_44_4_, productsub5_.product_subtype_id as product1_43_5_, generalref6_.GENERAL_REFERENCE_ID as GENERAL1_44_6_, redemption7_.ID as ID36_7_, productval0_.DESCRIPTION as DESCRIPT2_34_0_, productval0_.STANDARD_CONSTRUCTION as STANDARD3_34_0_, productval0_.MIN_PROPERTY_VALUE as MIN4_34_0_, productval0_.MIN_AGE as MIN5_34_0_, productval0_.MAX_AGE as MAX6_34_0_, productval0_.MIN_TERM_MONTHS as MIN7_34_0_, productval0_.LOAN_TO_VALUE as LOAN8_34_0_, productval0_.MIN_LOAN as MIN9_34_0_, productval0_.MAX_LOAN as MAX10_34_0_, productval0_.INCOME_MULTIPLE as INCOME11_34_0_, productval0_.SUBORDINATE_LEVEL as SUBORDI12_34_0_, productval0_.LTV_BASED_ON_GROSS_LOAN as LTV13_34_0_, productval0_.INTEREST_RATE as INTEREST14_34_0_, productval0_.INCOME_TEST_1 as INCOME15_34_0_, productval0_.INCOME_TEST_2 as INCOME16_34_0_, productval0_.DAY_OF_MONTH as DAY17_34_0_, productval0_.POOL_ID as POOL18_34_0_, productval0_.PRODUCT_GROUP_ID as PRODUCT19_34_0_, productval0_.PRODUCT_CODE as PRODUCT20_34_0_, productval0_.COOLING_OFF_PERIOD as COOLING21_34_0_, productval0_.AUTOMATIC_CANCELLATION_ARREARS as AUTOMATIC22_34_0_, productval0_.PAYMENT_OFFSET as PAYMENT23_34_0_, productval0_.PRODUCT_STATUS_ID as PRODUCT24_34_0_, productval0_.REGULATED_BY_ID as REGULATED25_34_0_, productval0_.PRODUCT_SUBTYPE_ID as PRODUCT26_34_0_, productval0_.PAYMENT_FREQUENCY_ID as PAYMENT27_34_0_, productval0_.REDEMPTION_PENALTY_ID as REDEMPTION28_34_0_, productval0_.LAST_MODIFIED_BY as LAST29_34_0_, productval0_.LAST_MODIFIED_ON as LAST30_34_0_, productval0_1_.MAX_MONTH_COVER as MAX2_37_0_, productval0_1_.MAX_LUMPSUM_COVER as MAX3_37_0_, productval0_1_.LAST_MODIFIED_BY as LAST4_37_0_, productval0_1_.LAST_MODIFIED_ON as LAST5_37_0_, productval0_1_.INSURER_ID as INSURER6_37_0_, case when productval0_1_.PRODUCT_ID is not null then 1 when productval0_.PLAN_ID is not null then 0 end as clazz_0_, poolvalue1_.POOL_CODE as POOL2_35_1_, poolvalue1_.LIBOR as LIBOR35_1_, productgro2_.DESCRIPTION as DESCRIPT2_41_2_, productgro2_.ROLE as ROLE41_2_, generalref3_.DESCRIPTION as DESCRIPT2_44_3_, generalref3_.GENERAL_REFERENCE_GROUP_ID as GENERAL3_44_3_, generalref3_.MAS_GENERAL_REFERENCE_ID as MAS4_44_3_, generalref4_.DESCRIPTION as DESCRIPT2_44_4_, generalref4_.GENERAL_REFERENCE_GROUP_ID as GENERAL3_44_4_, generalref4_.MAS_GENERAL_REFERENCE_ID as MAS4_44_4_, productsub5_.description as descript2_43_5_, generalref6_.DESCRIPTION as DESCRIPT2_44_6_, generalref6_.GENERAL_REFERENCE_GROUP_ID as GENERAL3_44_6_, generalref6_.MAS_GENERAL_REFERENCE_ID as MAS4_44_6_, redemption7_.DESCRIPTION as DESCRIPT2_36_7_, redemption7_.ONGOING_CHARGE as ONGOING3_36_7_, redemption7_.YEAR1_CHARGE as YEAR4_36_7_, redemption7_.YEAR1_PERCENTAGE as YEAR5_36_7_, redemption7_.YEAR2_CHARGE as YEAR6_36_7_, redemption7_.YEAR2_PERCENTAGE as YEAR7_36_7_, redemption7_.YEAR3_CHARGE as YEAR8_36_7_, redemption7_.YEAR3_PERCENTAGE as YEAR9_36_7_, redemption7_.YEAR4_CHARGE as YEAR10_36_7_, redemption7_.YEAR4_PERCENTAGE as YEAR11_36_7_, redemption7_.YEAR5_CHARGE as YEAR12_36_7_, redemption7_.YEAR5_PERCENTAGE as YEAR13_36_7_, redemption7_.YEAR6_CHARGE as YEAR14_36_7_, redemption7_.YEAR6_PERCENTAGE as YEAR15_36_7_, redemption7_.YEAR7_CHARGE as YEAR16_36_7_, redemption7_.YEAR7_PERCENTAGE as YEAR17_36_7_, redemption7_.YEAR8_CHARGE as YEAR18_36_7_, redemption7_.YEAR8_PERCENTAGE as YEAR19_36_7_, redemption7_.LAST_MODIFIED_BY as LAST20_36_7_, redemption7_.LAST_MODIFIED_ON as LAST21_36_7_ from mortgage_plans productval0_ left outer join PRODUCT_PPI productval0_1_ on productval0_.PLAN_ID=productval0_1_.PRODUCT_ID left outer join POOL poolvalue1_ on productval0_.POOL_ID=poolvalue1_.POOL_ID left outer join product_group productgro2_ on productval0_.PRODUCT_GROUP_ID=productgro2_.PRODUCT_GROUP_ID left outer join GENERAL_REFERENCE generalref3_ on productval0_.PRODUCT_STATUS_ID=generalref3_.GENERAL_REFERENCE_ID left outer join GENERAL_REFERENCE generalref4_ on productval0_.REGULATED_BY_ID=generalref4_.GENERAL_REFERENCE_ID left outer join product_subtype productsub5_ on productval0_.PRODUCT_SUBTYPE_ID=productsub5_.product_subtype_id left outer join GENERAL_REFERENCE generalref6_ on productval0_.PAYMENT_FREQUENCY_ID=generalref6_.GENERAL_REFERENCE_ID left outer join redemption_penalties redemption7_ on productval0_.REDEMPTION_PENALTY_ID=redemption7_.ID where productval0_.PLAN_ID=?
DEBUG hibernate.SQL - select productval0_.PLAN_ID as PLAN1_34_0_, poolvalue1_.POOL_ID as POOL1_35_1_, productgro2_.PRODUCT_GROUP_ID as PRODUCT1_41_2_, generalref3_.GENERAL_REFERENCE_ID as GENERAL1_44_3_, generalref4_.GENERAL_REFERENCE_ID as GENERAL1_44_4_, productsub5_.product_subtype_id as product1_43_5_, generalref6_.GENERAL_REFERENCE_ID as GENERAL1_44_6_, redemption7_.ID as ID36_7_, productval0_.DESCRIPTION as DESCRIPT2_34_0_, productval0_.STANDARD_CONSTRUCTION as STANDARD3_34_0_, productval0_.MIN_PROPERTY_VALUE as MIN4_34_0_, productval0_.MIN_AGE as MIN5_34_0_, productval0_.MAX_AGE as MAX6_34_0_, productval0_.MIN_TERM_MONTHS as MIN7_34_0_, productval0_.LOAN_TO_VALUE as LOAN8_34_0_, productval0_.MIN_LOAN as MIN9_34_0_, productval0_.MAX_LOAN as MAX10_34_0_, productval0_.INCOME_MULTIPLE as INCOME11_34_0_, productval0_.SUBORDINATE_LEVEL as SUBORDI12_34_0_, productval0_.LTV_BASED_ON_GROSS_LOAN as LTV13_34_0_, productval0_.INTEREST_RATE as INTEREST14_34_0_, productval0_.INCOME_TEST_1 as INCOME15_34_0_, productval0_.INCOME_TEST_2 as INCOME16_34_0_, productval0_.DAY_OF_MONTH as DAY17_34_0_, productval0_.POOL_ID as POOL18_34_0_, productval0_.PRODUCT_GROUP_ID as PRODUCT19_34_0_, productval0_.PRODUCT_CODE as PRODUCT20_34_0_, productval0_.COOLING_OFF_PERIOD as COOLING21_34_0_, productval0_.AUTOMATIC_CANCELLATION_ARREARS as AUTOMATIC22_34_0_, productval0_.PAYMENT_OFFSET as PAYMENT23_34_0_, productval0_.PRODUCT_STATUS_ID as PRODUCT24_34_0_, productval0_.REGULATED_BY_ID as REGULATED25_34_0_, productval0_.PRODUCT_SUBTYPE_ID as PRODUCT26_34_0_, productval0_.PAYMENT_FREQUENCY_ID as PAYMENT27_34_0_, productval0_.REDEMPTION_PENALTY_ID as REDEMPTION28_34_0_, productval0_.LAST_MODIFIED_BY as LAST29_34_0_, productval0_.LAST_MODIFIED_ON as LAST30_34_0_, productval0_1_.MAX_MONTH_COVER as MAX2_37_0_, productval0_1_.MAX_LUMPSUM_COVER as MAX3_37_0_, productval0_1_.LAST_MODIFIED_BY as LAST4_37_0_, productval0_1_.LAST_MODIFIED_ON as LAST5_37_0_, productval0_1_.INSURER_ID as INSURER6_37_0_, case when productval0_1_.PRODUCT_ID is not null then 1 when productval0_.PLAN_ID is not null then 0 end as clazz_0_, poolvalue1_.POOL_CODE as POOL2_35_1_, poolvalue1_.LIBOR as LIBOR35_1_, productgro2_.DESCRIPTION as DESCRIPT2_41_2_, productgro2_.ROLE as ROLE41_2_, generalref3_.DESCRIPTION as DESCRIPT2_44_3_, generalref3_.GENERAL_REFERENCE_GROUP_ID as GENERAL3_44_3_, generalref3_.MAS_GENERAL_REFERENCE_ID as MAS4_44_3_, generalref4_.DESCRIPTION as DESCRIPT2_44_4_, generalref4_.GENERAL_REFERENCE_GROUP_ID as GENERAL3_44_4_, generalref4_.MAS_GENERAL_REFERENCE_ID as MAS4_44_4_, productsub5_.description as descript2_43_5_, generalref6_.DESCRIPTION as DESCRIPT2_44_6_, generalref6_.GENERAL_REFERENCE_GROUP_ID as GENERAL3_44_6_, generalref6_.MAS_GENERAL_REFERENCE_ID as MAS4_44_6_, redemption7_.DESCRIPTION as DESCRIPT2_36_7_, redemption7_.ONGOING_CHARGE as ONGOING3_36_7_, redemption7_.YEAR1_CHARGE as YEAR4_36_7_, redemption7_.YEAR1_PERCENTAGE as YEAR5_36_7_, redemption7_.YEAR2_CHARGE as YEAR6_36_7_, redemption7_.YEAR2_PERCENTAGE as YEAR7_36_7_, redemption7_.YEAR3_CHARGE as YEAR8_36_7_, redemption7_.YEAR3_PERCENTAGE as YEAR9_36_7_, redemption7_.YEAR4_CHARGE as YEAR10_36_7_, redemption7_.YEAR4_PERCENTAGE as YEAR11_36_7_, redemption7_.YEAR5_CHARGE as YEAR12_36_7_, redemption7_.YEAR5_PERCENTAGE as YEAR13_36_7_, redemption7_.YEAR6_CHARGE as YEAR14_36_7_, redemption7_.YEAR6_PERCENTAGE as YEAR15_36_7_, redemption7_.YEAR7_CHARGE as YEAR16_36_7_, redemption7_.YEAR7_PERCENTAGE as YEAR17_36_7_, redemption7_.YEAR8_CHARGE as YEAR18_36_7_, redemption7_.YEAR8_PERCENTAGE as YEAR19_36_7_, redemption7_.LAST_MODIFIED_BY as LAST20_36_7_, redemption7_.LAST_MODIFIED_ON as LAST21_36_7_ from mortgage_plans productval0_ left outer join PRODUCT_PPI productval0_1_ on productval0_.PLAN_ID=productval0_1_.PRODUCT_ID left outer join POOL poolvalue1_ on productval0_.POOL_ID=poolvalue1_.POOL_ID left outer join product_group productgro2_ on productval0_.PRODUCT_GROUP_ID=productgro2_.PRODUCT_GROUP_ID left outer join GENERAL_REFERENCE generalref3_ on productval0_.PRODUCT_STATUS_ID=generalref3_.GENERAL_REFERENCE_ID left outer join GENERAL_REFERENCE generalref4_ on productval0_.REGULATED_BY_ID=generalref4_.GENERAL_REFERENCE_ID left outer join product_subtype productsub5_ on productval0_.PRODUCT_SUBTYPE_ID=productsub5_.product_subtype_id left outer join GENERAL_REFERENCE generalref6_ on productval0_.PAYMENT_FREQUENCY_ID=generalref6_.GENERAL_REFERENCE_ID left outer join redemption_penalties redemption7_ on productval0_.REDEMPTION_PENALTY_ID=redemption7_.ID where productval0_.PLAN_ID=?
DEBUG hibernate.SQL - select generalref0_.GENERAL_REFERENCE_GROUP_ID as GENERAL1_45_0_, generalref0_.DESCRIPTION as DESCRIPT2_45_0_ from GENERAL_REFERENCE_GROUP generalref0_ where generalref0_.GENERAL_REFERENCE_GROUP_ID=?
DEBUG hibernate.SQL - select generalref0_.GENERAL_REFERENCE_GROUP_ID as GENERAL1_45_0_, generalref0_.DESCRIPTION as DESCRIPT2_45_0_ from GENERAL_REFERENCE_GROUP generalref0_ where generalref0_.GENERAL_REFERENCE_GROUP_ID=?
DEBUG hibernate.SQL - select generalref0_.GENERAL_REFERENCE_GROUP_ID as GENERAL1_45_0_, generalref0_.DESCRIPTION as DESCRIPT2_45_0_ from GENERAL_REFERENCE_GROUP generalref0_ where generalref0_.GENERAL_REFERENCE_GROUP_ID=?
DEBUG hibernate.SQL - select generalref0_.GENERAL_REFERENCE_GROUP_ID as GENERAL1_45_0_, generalref0_.DESCRIPTION as DESCRIPT2_45_0_ from GENERAL_REFERENCE_GROUP generalref0_ where generalref0_.GENERAL_REFERENCE_GROUP_ID=?
DEBUG hibernate.SQL - select generalref0_.GENERAL_REFERENCE_GROUP_ID as GENERAL1_45_0_, generalref0_.DESCRIPTION as DESCRIPT2_45_0_ from GENERAL_REFERENCE_GROUP generalref0_ where generalref0_.GENERAL_REFERENCE_GROUP_ID=?
DEBUG hibernate.SQL - select generalref0_.GENERAL_REFERENCE_GROUP_ID as GENERAL1_45_0_, generalref0_.DESCRIPTION as DESCRIPT2_45_0_ from GENERAL_REFERENCE_GROUP generalref0_ where generalref0_.GENERAL_REFERENCE_GROUP_ID=?
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productsub0_.product_group_id as product1_1_, productsub0_.product_subtype_id as product2_1_, productsub1_.product_subtype_id as product1_43_0_, productsub1_.description as descript2_43_0_ from product_group_subtype productsub0_ left outer join product_subtype productsub1_ on productsub0_.product_subtype_id=productsub1_.product_subtype_id where productsub0_.product_group_id=? order by productsub0_.product_subtype_id
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?
DEBUG hibernate.SQL - select productgro0_.product_subtype_id as product2_1_, productgro0_.product_group_id as product1_1_, productgro1_.PRODUCT_GROUP_ID as PRODUCT1_41_0_, productgro1_.DESCRIPTION as DESCRIPT2_41_0_, productgro1_.ROLE as ROLE41_0_ from product_group_subtype productgro0_ left outer join product_group productgro1_ on productgro0_.product_group_id=productgro1_.PRODUCT_GROUP_ID where productgro0_.product_subtype_id=?