mirror of https://github.com/apache/openjpa.git
Fix failure to close some empty result sets.
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@442643 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2dfe77f2ca
commit
d1e7a817d2
|
@ -268,43 +268,43 @@ public class JDBCStoreManager
|
||||||
Object oid = sm.getObjectId();
|
Object oid = sm.getObjectId();
|
||||||
ClassMapping mapping = (ClassMapping) sm.getMetaData();
|
ClassMapping mapping = (ClassMapping) sm.getMetaData();
|
||||||
Result res = null;
|
Result res = null;
|
||||||
if (info != null && info.result != null) {
|
try {
|
||||||
res = info.result;
|
if (info != null && info.result != null) {
|
||||||
info.sm = sm;
|
res = info.result;
|
||||||
if (info.mapping == null)
|
info.sm = sm;
|
||||||
info.mapping = mapping;
|
if (info.mapping == null)
|
||||||
mapping = info.mapping;
|
info.mapping = mapping;
|
||||||
} else if (oid instanceof OpenJPAId
|
mapping = info.mapping;
|
||||||
&& !((OpenJPAId) oid).hasSubclasses()) {
|
} else if (oid instanceof OpenJPAId
|
||||||
Boolean custom = customLoad(sm, mapping, state, fetch);
|
&& !((OpenJPAId) oid).hasSubclasses()) {
|
||||||
if (custom != null)
|
|
||||||
return custom.booleanValue();
|
|
||||||
res = getInitializeStateResult(sm, mapping, fetch,
|
|
||||||
Select.SUBS_EXACT);
|
|
||||||
if (res == null && !selectPrimaryKey(sm, mapping, fetch))
|
|
||||||
return false;
|
|
||||||
if (res != null && !res.next())
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
ClassMapping[] mappings = mapping.
|
|
||||||
getIndependentAssignableMappings();
|
|
||||||
if (mappings.length == 1) {
|
|
||||||
mapping = mappings[0];
|
|
||||||
Boolean custom = customLoad(sm, mapping, state, fetch);
|
Boolean custom = customLoad(sm, mapping, state, fetch);
|
||||||
if (custom != null)
|
if (custom != null)
|
||||||
return custom.booleanValue();
|
return custom.booleanValue();
|
||||||
res = getInitializeStateResult(sm, mapping, fetch,
|
res = getInitializeStateResult(sm, mapping, fetch,
|
||||||
Select.SUBS_ANY_JOINABLE);
|
Select.SUBS_EXACT);
|
||||||
if (res == null && !selectPrimaryKey(sm, mapping, fetch))
|
if (res == null && !selectPrimaryKey(sm, mapping, fetch))
|
||||||
return false;
|
return false;
|
||||||
} else
|
if (res != null && !res.next())
|
||||||
res = getInitializeStateUnionResult(sm, mapping, mappings,
|
return false;
|
||||||
fetch);
|
} else {
|
||||||
if (res != null && !res.next())
|
ClassMapping[] mappings = mapping.
|
||||||
return false;
|
getIndependentAssignableMappings();
|
||||||
}
|
if (mappings.length == 1) {
|
||||||
|
mapping = mappings[0];
|
||||||
|
Boolean custom = customLoad(sm, mapping, state, fetch);
|
||||||
|
if (custom != null)
|
||||||
|
return custom.booleanValue();
|
||||||
|
res = getInitializeStateResult(sm, mapping, fetch,
|
||||||
|
Select.SUBS_ANY_JOINABLE);
|
||||||
|
if (res == null && !selectPrimaryKey(sm, mapping, fetch))
|
||||||
|
return false;
|
||||||
|
} else
|
||||||
|
res = getInitializeStateUnionResult(sm, mapping, mappings,
|
||||||
|
fetch);
|
||||||
|
if (res != null && !res.next())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
// figure out what type of object this is; the state manager
|
// figure out what type of object this is; the state manager
|
||||||
// only guarantees to provide a base class
|
// only guarantees to provide a base class
|
||||||
Class type;
|
Class type;
|
||||||
|
@ -454,9 +454,9 @@ public class JDBCStoreManager
|
||||||
|
|
||||||
// if the instance is hollow and there's a customized
|
// if the instance is hollow and there's a customized
|
||||||
// get by id method, use it
|
// get by id method, use it
|
||||||
if (sm.getLoaded().length() == 0)
|
if (sm.getLoaded().length() == 0
|
||||||
if (mapping.customLoad(sm, this, null, jfetch))
|
&& mapping.customLoad(sm, this, null, jfetch))
|
||||||
removeLoadedFields(sm, fields);
|
removeLoadedFields(sm, fields);
|
||||||
|
|
||||||
//### select is kind of a big object, and in some cases we don't
|
//### select is kind of a big object, and in some cases we don't
|
||||||
//### use it... would it be worth it to have a small shell select
|
//### use it... would it be worth it to have a small shell select
|
||||||
|
|
Loading…
Reference in New Issue