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
public class SimpleResultSetRecord extends ResultSetRecord
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:
- Serialized Form
-
-
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
Fields Modifier and Type Field Description protected booleanisPopulatingObjectIndicates that the whole object is being populated.protected booleanshouldKeepValuesIndicates whether the values requested while populating object (isPopulatingObject == true) should be saved in valuesArrayprotected booleanshouldUseOptimizationIndicates 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
Constructors Modifier Constructor Description protectedSimpleResultSetRecord()SimpleResultSetRecord(Vector fields, DatabaseField[] fieldsArray, ResultSet resultSet, ResultSetMetaData metaData, DatabaseAccessor accessor, AbstractSession session, DatabasePlatform platform, boolean optimizeData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectget(DatabaseField key)INTERNAL: Retrieve the value for the field.ObjectgetIndicatingNoEntry(DatabaseField key)INTERNAL: Retrieve the value for the field.protected ObjectgetValueFromResultSet(int index, DatabaseField field)booleanhasValues()booleanisPopulatingObject()voidloadAllValuesFromResultSet()Obtains all the value from resultSet and removes it.voidreset()voidsetShouldKeepValues(boolean shouldKeepValues)voidsetShouldUseOptimization(boolean shouldUseOptimization)voidsetSopObject(Object sopObject)INTERNAL:booleanshouldKeepValues()booleanshouldUseOptimization()protected StringtoStringAditional()-
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 Detail
-
shouldKeepValues
protected transient boolean shouldKeepValues
Indicates whether the values requested while populating object (isPopulatingObject == true) should be saved in valuesArray
-
shouldUseOptimization
protected transient boolean shouldUseOptimization
Indicates whether to use optimization while getting values from result set instead of calling accessor.getObject method.
-
isPopulatingObject
protected transient boolean isPopulatingObject
Indicates 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 Detail
-
SimpleResultSetRecord
protected SimpleResultSetRecord()
-
SimpleResultSetRecord
public SimpleResultSetRecord(Vector fields, DatabaseField[] fieldsArray, ResultSet resultSet, ResultSetMetaData metaData, DatabaseAccessor accessor, AbstractSession session, DatabasePlatform platform, boolean optimizeData)
-
-
Method Detail
-
loadAllValuesFromResultSet
public void loadAllValuesFromResultSet()
Obtains all the value from resultSet and removes it. resultSet must be non null.- Overrides:
loadAllValuesFromResultSetin classResultSetRecord
-
get
public Object get(DatabaseField key)
INTERNAL: Retrieve the value for the field. If missing null is returned.- Overrides:
getin classResultSetRecord
-
getIndicatingNoEntry
public Object getIndicatingNoEntry(DatabaseField key)
INTERNAL: Retrieve the value for the field. If missing DatabaseRow.noEntry is returned. PERF: This method is a clone of get() for performance.- Overrides:
getIndicatingNoEntryin classResultSetRecord
-
getValueFromResultSet
protected Object getValueFromResultSet(int index, DatabaseField field)
-
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
protected String toStringAditional()
- Overrides:
toStringAditionalin classResultSetRecord
-
setSopObject
public void setSopObject(Object sopObject)
Description copied from class:AbstractRecordINTERNAL:- Overrides:
setSopObjectin classResultSetRecord
-
-