Module org.eclipse.persistence.core
Class SimpleResultSetRecord
java.lang.Object
org.eclipse.persistence.internal.core.sessions.CoreAbstractRecord
org.eclipse.persistence.internal.sessions.AbstractRecord
org.eclipse.persistence.sessions.DatabaseRecord
org.eclipse.persistence.internal.sessions.ArrayRecord
org.eclipse.persistence.internal.sessions.ResultSetRecord
org.eclipse.persistence.internal.sessions.SimpleResultSetRecord
- All Implemented Interfaces:
Serializable
,Cloneable
,Map
,DataRecord
PERF: Record used by ObjectLevelReadQuery ResultSet optimization.
This is a subclass of ResultSetRecord that's used with simple descriptors
(descriptor.getObjectBuilder().isSimple()) - those having only DirectToField mappings.
In this case the record is not cached by any mapping therefore could be reused
in ReadAllQuery - (which calls resultSet.next()).
In case the cached object used instead of creating a new one from the record,
the not needed fields' values are never obtained from resultSet
(that's especially important for expensive LOBs).
If alternatively the record is used to populate an object then all
the values obtained from resultSet are nullified after use.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
AbstractRecord.EntrySet, AbstractRecord.KeySet, AbstractRecord.NoEntry, AbstractRecord.RecordEntry, AbstractRecord.RecordEntryIterator, AbstractRecord.RecordKeyIterator, AbstractRecord.RecordValuesIterator, AbstractRecord.ValuesSet
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Indicates that the whole object is being populated.protected boolean
Indicates whether the values requested while populating object (isPopulatingObject == true) should be saved in valuesArrayprotected boolean
Indicates whether to use optimization while getting values from result set instead of calling accessor.getObject method.Fields inherited from class org.eclipse.persistence.internal.sessions.ResultSetRecord
accessor, metaData, optimizeData, platform, resultSet, session
Fields inherited from class org.eclipse.persistence.internal.sessions.ArrayRecord
fieldsArray, valuesArray
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
fields, lookupField, noEntry, nullValueInFields, size, sopObject, values
-
Constructor Summary
ModifierConstructorDescriptionprotected
SimpleResultSetRecord
(Vector fields, DatabaseField[] fieldsArray, ResultSet resultSet, ResultSetMetaData metaData, DatabaseAccessor accessor, AbstractSession session, DatabasePlatform platform, boolean optimizeData) -
Method Summary
Modifier and TypeMethodDescriptionget
(DatabaseField key) INTERNAL: Retrieve the value for the field.INTERNAL: Retrieve the value for the field.protected Object
getValueFromResultSet
(int index, DatabaseField field) boolean
boolean
void
Obtains all the value from resultSet and removes it.void
reset()
void
setShouldKeepValues
(boolean shouldKeepValues) void
setShouldUseOptimization
(boolean shouldUseOptimization) void
setSopObject
(Object sopObject) INTERNAL:boolean
boolean
protected String
Methods inherited from class org.eclipse.persistence.internal.sessions.ResultSetRecord
checkValues, clear, containsValue, hasResultSet, removAllValue, removeNonIndirectionValues, removeResultSet
Methods inherited from class org.eclipse.persistence.internal.sessions.ArrayRecord
add, clone, containsKey, getField, getFields, getValues, put, remove, replaceAt, replaceAt, setFields, setValues, size, toString
Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractRecord
contains, containsKey, containsKey, elements, entrySet, get, get, getIndicatingNoEntry, getLookupField, getSopObject, getValues, getValues, hasNullValueInFields, hasSopObject, isEmpty, keys, keySet, mergeFrom, put, put, putAll, remove, remove, resetSize, setNullValueInFields, values
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
shouldKeepValues
protected transient boolean shouldKeepValuesIndicates whether the values requested while populating object (isPopulatingObject == true) should be saved in valuesArray -
shouldUseOptimization
protected transient boolean shouldUseOptimizationIndicates whether to use optimization while getting values from result set instead of calling accessor.getObject method. -
isPopulatingObject
protected transient boolean isPopulatingObjectIndicates that the whole object is being populated. At first the primary key is extracted from the row - to see if the object with the same pk is already in the cache. Then in case of refresh the locking field value is extracted, too. Indication of the object being populated from the record (looping through all the mappings) is request for a value, which has been already returned before (usually primary key, but may be version). At this point the flag is set to true.
-
-
Constructor Details
-
SimpleResultSetRecord
protected SimpleResultSetRecord() -
SimpleResultSetRecord
public SimpleResultSetRecord(Vector fields, DatabaseField[] fieldsArray, ResultSet resultSet, ResultSetMetaData metaData, DatabaseAccessor accessor, AbstractSession session, DatabasePlatform platform, boolean optimizeData)
-
-
Method Details
-
loadAllValuesFromResultSet
public void loadAllValuesFromResultSet()Obtains all the value from resultSet and removes it. resultSet must be non null.- Overrides:
loadAllValuesFromResultSet
in classResultSetRecord
-
get
INTERNAL: Retrieve the value for the field. If missing null is returned.- Overrides:
get
in classResultSetRecord
-
getIndicatingNoEntry
INTERNAL: Retrieve the value for the field. If missing DatabaseRow.noEntry is returned. PERF: This method is a clone of get() for performance.- Overrides:
getIndicatingNoEntry
in classResultSetRecord
-
getValueFromResultSet
-
reset
public void reset() -
shouldKeepValues
public boolean shouldKeepValues() -
setShouldKeepValues
public void setShouldKeepValues(boolean shouldKeepValues) -
shouldUseOptimization
public boolean shouldUseOptimization() -
setShouldUseOptimization
public void setShouldUseOptimization(boolean shouldUseOptimization) -
hasValues
public boolean hasValues() -
isPopulatingObject
public boolean isPopulatingObject() -
toStringAditional
- Overrides:
toStringAditional
in classResultSetRecord
-
setSopObject
Description copied from class:AbstractRecord
INTERNAL:- Overrides:
setSopObject
in classResultSetRecord
-