Package simpleorm.sessionjdbc
Class SDataLoader<T extends SRecordInstance>
- java.lang.Object
-
- simpleorm.sessionjdbc.SDataLoader<T>
-
public class SDataLoader<T extends SRecordInstance> extends java.lang.Object
This class provides simple bulk data loading facilities which are particularly handy for developing test data. It is used as follows:-SSession.rawJDBC("DELETE FROM XX_EMPLOYEE"); SDataLoader<Employee> empDL = new SDataLoader(Employee.meta);
Employee e1 = empDL.insert("100", "One00", "123 4567", "50000"});
empDL.insert(new String[][]{ {"200", "Two00", "123 4567", "50000"}, {"200", "Two00", "123 4567", "50000"}, {"300", "Three00", "123 4567", "50000"}});
-
-
Constructor Summary
Constructors Constructor Description SDataLoader(SSessionJdbc session, SRecordMeta<T> meta)
SDataLoader(SSessionJdbc session, SRecordMeta<T> meta, SFieldScalar[] fields)
A data loader for recordsRecordMeta
will loadfields
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SRecordInstance
insertRecord(java.lang.Object... record)
Inserts (or updates) one record in the databases, and returns it.SRecordInstance[]
insertRecords(java.lang.Object[][] records)
Conveniently inserts multiple records in one go.
-
-
-
Constructor Detail
-
SDataLoader
public SDataLoader(SSessionJdbc session, SRecordMeta<T> meta, SFieldScalar[] fields)
A data loader for recordsRecordMeta
will loadfields
. The primary key fields are always implicitly included at the beginning and need not be repeated here. The default forfields
is all fields except those flaggedSQY_UNQUERIED
.
-
SDataLoader
public SDataLoader(SSessionJdbc session, SRecordMeta<T> meta)
-
-
Method Detail
-
insertRecord
public SRecordInstance insertRecord(java.lang.Object... record)
Inserts (or updates) one record in the databases, and returns it. The first element(s) inrecord
contain the primary key field(s), the rest contain the public
-
insertRecords
public SRecordInstance[] insertRecords(java.lang.Object[][] records)
Conveniently inserts multiple records in one go. Each inner array is simply passed toinsert(String[])
.
-
-