Package simpleorm.sessionjdbc
Class SDataLoader<T extends SRecordInstance>
java.lang.Object
simpleorm.sessionjdbc.SDataLoader<T>
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
ConstructorsConstructorDescriptionSDataLoader
(SSessionJdbc session, SRecordMeta<T> meta) SDataLoader
(SSessionJdbc session, SRecordMeta<T> meta, SFieldScalar[] fields) A data loader for recordsRecordMeta
will loadfields
. -
Method Summary
Modifier and TypeMethodDescriptioninsertRecord
(Object... record) Inserts (or updates) one record in the databases, and returns it.insertRecords
(Object[][] records) Conveniently inserts multiple records in one go.
-
Constructor Details
-
SDataLoader
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
-
-
Method Details
-
insertRecord
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
Conveniently inserts multiple records in one go. Each inner array is simply passed toinsert(String[])
.
-