Hi Bernard,
to get rid of all those outer joins when creating a simple query, just turn on the hibernate proxies. Namespace property "hibernateProxy=true"
Carlos
Bernard Sirius wrote:
Hi!
Again, I have this problem with hibernate: a simple query generates an incredible amount of SQL. I was thinking that specifying outer-join="false" would solve this, but it doesn't as you probably guess.
I can't figure out how to tell hibernate NOT to eagerly load relations. It seems to be completely ignorant of the "lazy=true" attribute.
Now that I've set outer-join="auto", which is AndroMDA's default, I have hibernate complain that "MySQL can only use 31 tables in a join", which is documented in their faq (http://hibernate.bluemars.net/117.html#A29).
So, as a last resort, as is stated there, I'd like to try setting max_fetch_depth to 1 or 2, only I don't know how to let AndroMDA specify that.
Of course please let me know if you have other suggestions
bernard
PS: the hibernate query:
String query = "SELECT person FROM fractals.psychos.core.ontology.entity.PersonImpl " + "person LEFT JOIN person.properties as property WHERE " + "property.predicate=:pred";
the generated SQL:
Hibernate: select userimpl0_.ID as ID, userimpl0_.USERNAME as USERNAME, userimpl 0_.PASSWORD as PASSWORD, userimpl0_.TIMESTAMP as TIMESTAMP, userimpl0_.PERSON_FK as PERSON_FK, userimpl0_.THUMBNAIL_FK as THUMBNAI6_, userimpl0_.ROLODEX_FK as R OLODEX_FK, userimpl0_.CALENDAR_FK as CALENDAR8_ from USER userimpl0_ left outer join PERSON personimpl1_ on userimpl0_.PERSON_FK=personimpl1_.ID left outer join PROPERTY properties2_ on personimpl1_.ID=properties2_.RESOURCE_FK left outer jo in ABSTRACT_OBJECT properties2__1_ on properties2_.ID=properties2__1_.ID left ou ter join RESOURCE properties2__2_ on properties2_.ID=properties2__2_.ID where (p roperties2_.PREDICATE=? ) Hibernate: select personimpl0_.ID as ID10_, personimpl0_.FIRSTNAME as FIRSTNAME1 3_10_, personimpl0_.LASTNAME as LASTNAME13_10_, personimpl0_.BIRTHDATE as BIRTHD ATE13_10_, personimpl0_.MIDDLE_NAME as MIDDLE_N5_13_10_, personimpl0_.EMAIL as E MAIL13_10_, personimpl0_.PHONE as PHONE13_10_, personimpl0_.MOBILE as MOBILE13_1 0_, personimpl0_.WORK_PHONE as WORK_PHONE13_10_, personimpl0_.PERSONAL_EMAIL as PERSONA10_13_10_, personimpl0_.ICQ_NUMBER as ICQ_NUMBER13_10_, personimpl0_.MSN_ ID as MSN_ID13_10_, personimpl0_.SKYPE_ID as SKYPE_ID13_10_, personimpl0_.SKYPE_ NUMBER as SKYPE_N14_13_10_, personimpl0_.FAX as FAX13_10_, personimpl0__2_.TIMES TAMP as TIMESTAMP0_10_, personimpl0__2_.CORE_M_D_FK as CORE_M_D3_0_10_, userimpl 1_.ID as ID0_, userimpl1_.USERNAME as USERNAME0_, userimpl1_.PASSWORD as PASSWOR D0_, userimpl1_.TIMESTAMP as TIMESTAMP0_, userimpl1_.PERSON_FK as PERSON_FK0_, u serimpl1_.THUMBNAIL_FK as THUMBNAI6_0_, userimpl1_.ROLODEX_FK as ROLODEX_FK0_, u serimpl1_.CALENDAR_FK as CALENDAR8_0_, imageimpl2_.ID as ID1_, imageimpl2__1_.ME DIA_PATH as MEDIA_PATH2_1_, imageimpl2__1_.ORIGINAL_MEDIA_PATH as ORIGINAL3_2_1_ , imageimpl2__1_.MEDIA_U_R_L as MEDIA_U_4_2_1_, imageimpl2__1_.IS_REMOTE as IS_R EMOTE2_1_, imageimpl2__3_.TIMESTAMP as TIMESTAMP0_1_, imageimpl2__3_.CORE_M_D_FK as CORE_M_D3_0_1_, rolodeximp3_.ID as ID2_, rolodeximp3_.TIMESTAMP as TIMESTAMP 2_, calendarim4_.ID as ID3_, calendarim4_.TIMESTAMP as TIMESTAMP3_, coremetada5_ .ID as ID4_, coremetada5_.TYPE as TYPE4_, coremetada5_.LANGUAGE as LANGUAGE4_, c oremetada5_.DATE_FK as DATE_FK4_, coremetada5_.TEMPORAL_COVERAGE_FK as TEMPORAL5 _4_, coremetada5_.IDENTIFIER_FK as IDENTIFI6_4_, coremetada5_.PUBLISHER_FK as PU BLISHE7_4_, coremetada5_.OBJECT_FK as OBJECT_FK4_, coremetada5_.CREATOR_FK as CR EATOR_FK4_, datetermim6_.ID as ID5_, datetermim6_.AVAILABLE_FK as AVAILABL2_5_, datetermim6_.DATE_CREATED_FK as DATE_CRE3_5_, datetermim6_.DATE_ACCEPTED_FK as D ATE_ACC4_5_, datetermim6_.DATE_COPYRIGHTED_FK as DATE_COP5_5_, datetermim6_.DATE _SUBMITTED_FK as DATE_SUB6_5_, datetermim6_.VALID_FK as VALID_FK5_, datetermim6_ .DATE_MODIFIED_FK as DATE_MOD8_5_, datetermim6_.DATE_ISSUED_FK as DATE_ISS9_5_, abstractte7_.ID as ID6_, case when abstractte7__1_.ID is not null then 1 when ab stractte7__2_.ID is not null then 2 when abstractte7_.ID is not null then 0 end as clazz_6_, abstractte7__1_.START_TIME as START_TIME45_6_, abstractte7__1_.END_ TIME as END_TIME45_6_, abstractte7__2_.TIME as TIME46_6_, resourceim8_.ID as ID7 _, case when resourceim8__3_.ID is not null then 1 when resourceim8__4_.ID is no t null then 2 when resourceim8__5_.ID is not null then 3 when resourceim8__6_.ID is not null then 4 when resourceim8__7_.ID is not null then 5 when resourceim8_ _8_.ID is not null then 6 when resourceim8__11_.ID is not null then 7 when resou rceim8__12_.ID is not null then 8 when resourceim8__15_.ID is not null then 9 wh en resourceim8__2_.ID is not null then 10 when resourceim8__9_.ID is not null th en 11 when resourceim8__10_.ID is not null then 12 when resourceim8__13_.ID is n ot null then 13 when resourceim8__14_.ID is not null then 14 when resourceim8__1 6_.ID is not null then 15 when resourceim8__17_.ID is not null then 16 when reso urceim8__18_.ID is not null then 17 when resourceim8__19_.ID is not null then 18 when resourceim8__20_.ID is not null then 19 when resourceim8__21_.ID is not nu ll then 20 when resourceim8__1_.ID is not null then 21 when resourceim8__22_.ID is not null then 22 when resourceim8__23_.ID is not null then 23 when resourceim 8_.ID is not null then 0 end as clazz_7_, resourceim8_.TIMESTAMP as TIMESTAMP0_7 _, resourceim8_.CORE_M_D_FK as CORE_M_D3_0_7_, resourceim8__2_.MEDIA_PATH as MED IA_PATH2_7_, resourceim8__2_.ORIGINAL_MEDIA_PATH as ORIGINAL3_2_7_, resourceim8_ _2_.MEDIA_U_R_L as MEDIA_U_4_2_7_, resourceim8__2_.IS_REMOTE as IS_REMOTE2_7_, r esourceim8__3_.TEXT as TEXT3_7_, resourceim8__9_.STRING_VALUE as STRING_V2_9_7_, resourceim8__9_.BOOLEAN_VALUE as BOOLEAN_3_9_7_, resourceim8__9_.FLOAT_VALUE as FLOAT_VA4_9_7_, resourceim8__9_.INT_VALUE as INT_VALUE9_7_, resourceim8__9_.DAT E_VALUE as DATE_VALUE9_7_, resourceim8__9_.VALUE_TYPE as VALUE_TYPE9_7_, resourc eim8__9_.PREDICATE as PREDICATE9_7_, resourceim8__10_.PLACE_FK as PLACE_FK10_7_, resourceim8__10_.TIME_INFO_FK as TIME_INF3_10_7_, resourceim8__13_.FIRSTNAME as FIRSTNAME13_7_, resourceim8__13_.LASTNAME as LASTNAME13_7_, resourceim8__13_.BI RTHDATE as BIRTHDATE13_7_, resourceim8__13_.MIDDLE_NAME as MIDDLE_N5_13_7_, reso urceim8__13_.EMAIL as EMAIL13_7_, resourceim8__13_.PHONE as PHONE13_7_, resource im8__13_.MOBILE as MOBILE13_7_, resourceim8__13_.WORK_PHONE as WORK_PHONE13_7_, resourceim8__13_.PERSONAL_EMAIL as PERSONA10_13_7_, resourceim8__13_.ICQ_NUMBER as ICQ_NUMBER13_7_, resourceim8__13_.MSN_ID as MSN_ID13_7_, resourceim8__13_.SKY PE_ID as SKYPE_ID13_7_, resourceim8__13_.SKYPE_NUMBER as SKYPE_N14_13_7_, resour ceim8__13_.FAX as FAX13_7_, resourceim8__14_.ADDRESS_FK as ADDRESS_FK14_7_, reso urceim8__14_.LOCATION_FK as LOCATION3_14_7_, resourceim8__15_.ORGANIZATION_FK as ORGANIZA2_15_7_, resourceim8__16_.TRACKS_FK as TRACKS_FK16_7_, resourceim8__19_ .SUPER_ACTIVITY_FK as SUPER_AC2_19_7_, resourceim8__20_.PERSON_FK as PERSON_FK20 _7_, resourceim8__20_.TIME_INFO_FK as TIME_INF3_20_7_, resourceim8__20_.ACTIVITY _FK as ACTIVITY4_20_7_, resourceim8__21_.NAME as NAME21_7_, resourceim8__22_.DUR ATION as DURATION22_7_, resourceim8__22_.PERIODICITY as PERIODIC3_22_7_, resourc eim8__23_.STREET as STREET23_7_, resourceim8__23_.STREET2 as STREET223_7_, resou rceim8__23_.NUMBER as NUMBER23_7_, resourceim8__23_.LOCALITY as LOCALITY23_7_, r esourceim8__23_.COUNTRY as COUNTRY23_7_, resourceim8__23_.POST_CODE as POST_CODE 23_7_, abstractid9_.ID as ID8_, abstractob10_.ID as ID9_, case when abstractob10..............
__________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list Andromda-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-user
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list Andromda-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-user