Package simpleorm.dataset
Class SDataSet
- java.lang.Object
- 
- simpleorm.dataset.SDataSet
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class SDataSet extends java.lang.Object implements java.io.SerializableA DataSet contains records of various types together with their meta data. The records are indexed by their type and primary keys, and so can be efficiently retrieved. A list of dirty records that need to be updated is also maintained.A DataSet is normally associated with a SSession/Jdbc, and is accessed indirectly via the SSessionJdbc methods. But a DataSet can also be accessed directly when it is detached from the SSession. - See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description SDataSet()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidattach(SRecordInstance rinst)Deprecated.voidclearDirtyList()SDataSetclone()Clone the dataset.<RI extends SRecordInstance>
 RIcreate(SRecordMeta<RI> rmeta, java.lang.Object... keys)static <RI extends SRecordInstance>
 RIcreateDetachedInstance(SRecordMeta<RI> rmeta)Deprecated.<RI extends SRecordInstance>
 RIcreateWithNullKey(SRecordMeta<RI> rmeta)Used if no key is known, and one is to be provided later.voiddestroy()voiddumpDataSet()Dumps out the entire cache of records for this connection.<RI extends SRecordInstance>
 RIfind(SRecordMeta<RI> rmeta, java.lang.Object... keys)<RI extends SRecordInstance>
 RIfindOrCreate(SRecordMeta<RI> rmeta, java.lang.Object... keys)<RI extends SRecordInstance>
 RIfindUsingPrototype(RI rinst)Deprecated.java.util.List<SRecordInstance>getDirtyRecords()Ordered list of SRecordInstances to flush and purge.SLoggetLogger()SSessionIgetSession()booleanisAttached()<RI extends SRecordInstance>
 RInewInstanceNotInDataSet(SRecordMeta<RI> rmeta)Deprecated.voidpokeIntoDataSet(SRecordInstance rinst)Deprecated.voidpurge()Remove all records from cache and update list.java.util.Collection<SRecordInstance>queryAllRecords()<I extends SRecordInstance,R extends SRecordInstance>
 java.util.List<R>queryReferencing(I refed, SFieldReference<I> ref)Return all records in dataset where rec.ref == ref.voidremoveRecord(SRecordInstance rinst)Remove record from cache, does not flag it for deletion.voidsetSession(SSessionI session)java.lang.StringtoString()
 
- 
- 
- 
Method Detail- 
findOrCreatepublic <RI extends SRecordInstance> RI findOrCreate(SRecordMeta<RI> rmeta, java.lang.Object... keys) 
 - 
findpublic <RI extends SRecordInstance> RI find(SRecordMeta<RI> rmeta, java.lang.Object... keys) 
 - 
createpublic <RI extends SRecordInstance> RI create(SRecordMeta<RI> rmeta, java.lang.Object... keys) 
 - 
createWithNullKeypublic <RI extends SRecordInstance> RI createWithNullKey(SRecordMeta<RI> rmeta) Used if no key is known, and one is to be provided later.
 - 
removeRecordpublic void removeRecord(SRecordInstance rinst) Remove record from cache, does not flag it for deletion.
 - 
queryAllRecordspublic java.util.Collection<SRecordInstance> queryAllRecords() 
 - 
queryReferencingpublic <I extends SRecordInstance,R extends SRecordInstance> java.util.List<R> queryReferencing(I refed, SFieldReference<I> ref) Return all records in dataset where rec.ref == ref. Ie. the inverse of findRecrod.
 - 
isAttachedpublic boolean isAttached() 
 - 
clearDirtyListpublic void clearDirtyList() 
 - 
getDirtyRecordspublic java.util.List<SRecordInstance> getDirtyRecords() Ordered list of SRecordInstances to flush and purge.
 - 
purgepublic void purge() Remove all records from cache and update list.
 - 
destroypublic void destroy() 
 - 
clonepublic SDataSet clone() Clone the dataset. Useful befor attempting to attach and commit to recover from errors. (See LongTransactionTest).Curent implementation uses slow serialization alg, should really use clone()/able. - Overrides:
- clonein class- java.lang.Object
 
 - 
newInstanceNotInDataSet@Deprecated public <RI extends SRecordInstance> RI newInstanceNotInDataSet(SRecordMeta<RI> rmeta) Deprecated.Create a new instance of this record, used by SSession during the fiddly doFindOrCreate etc.
 - 
findUsingPrototype@Deprecated public <RI extends SRecordInstance> RI findUsingPrototype(RI rinst) Deprecated.
 - 
pokeIntoDataSet@Deprecated public void pokeIntoDataSet(SRecordInstance rinst) Deprecated.
 - 
getLoggerpublic SLog getLogger() 
 - 
createDetachedInstance@Deprecated public static <RI extends SRecordInstance> RI createDetachedInstance(SRecordMeta<RI> rmeta) Deprecated.Create a new instance of this record, unattached to a dataset. Used for backward compatibility, records normally ONLY live within a DataSet. Detached records are marked as new.
 - 
attach@Deprecated public void attach(SRecordInstance rinst) Deprecated.Attach rinst into the dataset, checking that it is not already there. References should be null. Only for compatibility with 2.*, normally records only normal created within data sets.
 - 
dumpDataSetpublic void dumpDataSet() Dumps out the entire cache of records for this connection. For debugging wierd bugs only.
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getSessionpublic SSessionI getSession() 
 - 
setSessionpublic void setSession(SSessionI session) 
 
- 
 
-