...
- Make relationships lazy (not recommended -> can introduce problems with code not compatible with laziness)
- Set (non-lazy) relationships to fetch=select, Example:
Code Block | ||||
---|---|---|---|---|
| ||||
<many-to-one name="CalculationSelection"
lazy="false"
fetch="select"
cascade="all-delete-orphan"
class="DeltaShell.Plugins.MorphAn.Models.CalculationSelection"
column="calculation_selection_id"/>
|
...
- Turn 'just my code' off just prior to opening an offending dsproj.
- Determine the extend of the problem: copy the sql query causing the exception (part of exception datacommand object) into a text editor
- Count the number of occurrences of the string 'JOIN' in the file (as a baseline) -> typically between 64 and 100
- Now the hard part: scan through that query and identify plugins / classes that seem to be occurring a lot, or combinations you wouldn't expect
- Apply fetch=select on one or more (non-lazy!) relationships where you think it would reduce the number of joins (see rev #21942 as an example)
- Reload the project; if the exception still occurs check if the number of JOIN has actually lessened (using text editor)
- If not, revert, if it has, find another relationship to change.
- Continue until no exception (preferably a bit longer: eg <40 joins!)