tracker issue : CF-4207654

select a category, or use search below
(searches all categories and all time range)
Title:

Unable to disable eager fetching of one-to-one relationships

| View in Tracker

Status/Resolution/Reason: Open//

Reporter/Name(from Bugbase): Jon C. / ()

Created: 03/24/2020

Components: ORM Support

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.08+318307 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Mac 10 All

Vote Count: 4

Problem Description:

In CF2018 adding fetch="select" and lazy="true" on an ORM one-to-one relationship should disable eager fetching completely however all one-to-one relationships continue to be eagerly fetched and instantiated.  By default hibernate applies a fetch type of join to one-to-one relationships.  lazy="true" alone will not work as the the fetch still defaults to JOIN and nested one-to-one relationships are fetched along with their child one-to-one.

With a top-level-entity with one-to-one relationships, which have their own one-to-one relationships, the result is instantiated entities all of the way down in the tree. 

This has a significant performance impact when loading multiple entities with nested one-to-one relationships 

Steps to Reproduce:

- Create an entity with a one-to-one relationship to another entity and add fetch="select" lazy="true" as property attributes.   Load the entity and the JDBC activity, along with the the profiled trace will demonstrate that the child entity is being fetched and loaded via a sub-select query.

Actual Result:
- Eager fetching of one-to-one relationships cannot be disabled.

Expected Result:
- A pointer object should represent the relationship, without actual SQL being executed to retreive the relationship

Any Workarounds:
None

Attachments:

Comments: