You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by aw...@apache.org on 2006/09/12 18:41:10 UTC
svn commit: r442643 -
/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Author: awhite
Date: Tue Sep 12 09:41:09 2006
New Revision: 442643
URL: http://svn.apache.org/viewvc?view=rev&rev=442643
Log:
Fix failure to close some empty result sets.
Modified:
incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?view=diff&rev=442643&r1=442642&r2=442643
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java (original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java Tue Sep 12 09:41:09 2006
@@ -268,43 +268,43 @@
Object oid = sm.getObjectId();
ClassMapping mapping = (ClassMapping) sm.getMetaData();
Result res = null;
- if (info != null && info.result != null) {
- res = info.result;
- info.sm = sm;
- if (info.mapping == null)
- info.mapping = mapping;
- mapping = info.mapping;
- } else if (oid instanceof OpenJPAId
- && !((OpenJPAId) oid).hasSubclasses()) {
- Boolean custom = customLoad(sm, mapping, state, fetch);
- 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];
+ try {
+ if (info != null && info.result != null) {
+ res = info.result;
+ info.sm = sm;
+ if (info.mapping == null)
+ info.mapping = mapping;
+ mapping = info.mapping;
+ } else if (oid instanceof OpenJPAId
+ && !((OpenJPAId) oid).hasSubclasses()) {
Boolean custom = customLoad(sm, mapping, state, fetch);
if (custom != null)
return custom.booleanValue();
res = getInitializeStateResult(sm, mapping, fetch,
- Select.SUBS_ANY_JOINABLE);
+ Select.SUBS_EXACT);
if (res == null && !selectPrimaryKey(sm, mapping, fetch))
return false;
- } else
- res = getInitializeStateUnionResult(sm, mapping, mappings,
- fetch);
- if (res != null && !res.next())
- 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);
+ 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
// only guarantees to provide a base class
Class type;
@@ -454,9 +454,9 @@
// if the instance is hollow and there's a customized
// get by id method, use it
- if (sm.getLoaded().length() == 0)
- if (mapping.customLoad(sm, this, null, jfetch))
- removeLoadedFields(sm, fields);
+ if (sm.getLoaded().length() == 0
+ && mapping.customLoad(sm, this, null, jfetch))
+ removeLoadedFields(sm, fields);
//### 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