|Lazy OneToOne Relationship traversed on Insert [message #1478892]
|Wed, 19 November 2014 02:31
| Jason Spies
Registered: November 2014
Hi - I am running Eclipselink 2.5.1 in JBoss with JPA and have a table/entity class Indicator with a FetchType.Lazy OneToOne relationship to four other tables.
Based on the type of Indicator - none or only one of the other tables will have data added. The OneToOne Lazy relationship actually works fine on select. If I select all indicators or a specific indicator, no other tables are fetched from the database until I call the appropriate getter for the specific table/relationship.
However, on persist/insert of a record to the Indicator table, it immediately selects the last inserted ID (it's using Identity Generation), selects the Indicator record with that id, and then does a select for each of the other four tables.
On bulk loading of data this is creating a huge amount of extra selects.
I saw this behavior on Glassfish with Eclipselink 2.4.x as well as now on JBoss with 2.5.2. I have tried both dynamic weaving and static weaving. All have worked correctly for selecting data, but all have always selected all related OneToOne relationships immediately after insert.
Any thoughts or help would be greatly appreciated.
Powered by FUDForum
. Page generated in 0.02130 seconds