| 2 |
2 |
** Module : SQLQuery.java
|
| 3 |
3 |
** Abstract : Object which performs an SQL query and processes the results.
|
| 4 |
4 |
**
|
| 5 |
|
** Copyright (c) 2019-2025, Golden Code Development Corporation.
|
|
5 |
** Copyright (c) 2019-2026, Golden Code Development Corporation.
|
| 6 |
6 |
**
|
| 7 |
7 |
** -#- -I- --Date-- ---------------------------------------Description---------------------------------------
|
| 8 |
8 |
** 001 ECF 20191001 Created initial version with stubbed methods.
|
| ... | ... | |
| 73 |
73 |
** 022 LS 20250714 Do not reload an INCOMPLETE record in 'hydrateRecordImpl' if the needed fields are
|
| 74 |
74 |
** already set.
|
| 75 |
75 |
** 023 ECF 20230803 Prototyped lazy hydration.
|
| 76 |
|
** 024 AL2 20231211 Refactor to use new getters for row structure count and DMO iface.
|
|
76 |
** AL2 20231211 Refactor to use new getters for row structure count and DMO iface.
|
| 77 |
77 |
** AL2 20231102 Reworked hydration to better support lazy with partial.
|
| 78 |
78 |
** AL2 20231103 Added JMX to track lazy hydration.
|
| 79 |
79 |
** AL2 20231101 Allow the some result-sets to be owned by the session to make it live longer and honor
|
| 80 |
80 |
** lazy hydration.
|
| 81 |
81 |
** AL2 20231214 Fixed lazy hydration to work with partial hydration as well. Fixed rebase mismatches.
|
|
82 |
** TG 20260407 Added updateIncompleteState which updates cached INCOMPLETE dmo.
|
| 82 |
83 |
*/
|
| 83 |
84 |
|
| 84 |
85 |
/*
|
| ... | ... | |
| 1127 |
1128 |
NEW_LAZY_RECORD.update(1);
|
| 1128 |
1129 |
session.associate(r);
|
| 1129 |
1130 |
}
|
|
1131 |
else
|
|
1132 |
{
|
|
1133 |
updateIncompleteState(r, rowStructure, session);
|
|
1134 |
}
|
| 1130 |
1135 |
|
| 1131 |
1136 |
return r;
|
| 1132 |
1137 |
}
|
|
1138 |
else if (cachedRec != null)
|
|
1139 |
{
|
|
1140 |
// We are not in lazy mode, but in Session cache we have a DMO which was not hydrated yet,
|
|
1141 |
// or we have an INCOMPLETE DMO that needs further hydration.
|
|
1142 |
rowStructure.hydrate(session, resultSet, rsOffset, r);
|
|
1143 |
|
|
1144 |
updateIncompleteState(r, rowStructure, session);
|
|
1145 |
|
|
1146 |
return r;
|
|
1147 |
}
|
| 1133 |
1148 |
|
| 1134 |
1149 |
NON_LAZY_HYDRATE_RECORD.update(1);
|
| 1135 |
1150 |
}
|
| ... | ... | |
| 1162 |
1177 |
|
| 1163 |
1178 |
// cache the hydrated record
|
| 1164 |
1179 |
session.associate(r);
|
| 1165 |
|
} catch (ReflectiveOperationException exc)
|
|
1180 |
}
|
|
1181 |
catch (ReflectiveOperationException exc)
|
| 1166 |
1182 |
{
|
| 1167 |
1183 |
throw new PersistenceException("Error creating record", exc);
|
| 1168 |
1184 |
}
|
| ... | ... | |
| 1181 |
1197 |
|
| 1182 |
1198 |
return r;
|
| 1183 |
1199 |
}
|
| 1184 |
|
|
|
1200 |
|
|
1201 |
/**
|
|
1202 |
* Check the {@link BaseRecord} is it should still be marked as INCOMPLETE or not.
|
|
1203 |
* If it still INCOMPLETE, update {@link BaseRecord#readFields} to match with the current
|
|
1204 |
* {@link RowStructure}.
|
|
1205 |
*
|
|
1206 |
* @param r
|
|
1207 |
* Record to check
|
|
1208 |
* @param rowStructure
|
|
1209 |
* Used if is INCOMPLETE and to get the loaded fields.
|
|
1210 |
* @param session
|
|
1211 |
* Current Session
|
|
1212 |
*/
|
|
1213 |
private static void updateIncompleteState(BaseRecord r, RowStructure rowStructure, Session session)
|
|
1214 |
{
|
|
1215 |
if (r.checkState(DmoState.INCOMPLETE))
|
|
1216 |
{
|
|
1217 |
if (!rowStructure.isIncomplete())
|
|
1218 |
{
|
|
1219 |
r.updateState(session, DmoState.INCOMPLETE, false);
|
|
1220 |
}
|
|
1221 |
else if (r._getReadFields() != null)
|
|
1222 |
{
|
|
1223 |
r._getReadFields().or(rowStructure.getLoadedFields());
|
|
1224 |
}
|
|
1225 |
}
|
|
1226 |
}
|
|
1227 |
|
| 1185 |
1228 |
/**
|
| 1186 |
1229 |
* Closes this object by releasing all acquired resources.
|
| 1187 |
1230 |
*/
|