From: Levi P. (JIRA) <no...@at...> - 2006-07-28 20:19:57
|
optimize lazy="no-proxy" on <many-to-one> ----------------------------------------- Key: HHH-1957 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1957 Project: Hibernate3 Type: Improvement Components: core Versions: 3.2.2, 3.2.1, 3.2.0.ga Environment: Hibernate 3.2 cr3 Reporter: Levi Purvis When using lazy="no-proxy" on <many-to-one> relationships, the lazy loading always results in (n * 2) select statements. For each relationship traversed, a select statement is run to get the foreign key, then another select statement is run to fetch the actual entity. The extra select statements are run even if the entity is already loaded! For example, when multiple entities refer to the same lazy entity. Further, the "join fetch" feature doesn't even seem to prevent the (n * 2) selects! This makes the "no-proxy" lazy loading unusuable in many cases. It would be great if "join fetch", batch loading, and subselect loading all worked with lazy="no-proxy". Perhaps if the "no-proxy" option were moved to the <class> level, then the "lazy property" code wouldn't kick in, which seems to be what is causing all of the selects. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |