Class SDataLoader<T extends SRecordInstance>

java.lang.Object
simpleorm.sessionjdbc.SDataLoader<T>

public class SDataLoader<T extends SRecordInstance> extends 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"); <p> SDataLoader&lt;Employee&gt; empDL = new SDataLoader(Employee.meta); <p> Employee e1 = empDL.insert("100", "One00", "123 4567", "50000"}); <p> empDL.insert(new String[][]{ {"200", "Two00", "123 4567", "50000"}, {"200", "Two00", "123 4567", "50000"}, {"300", "Three00", "123 4567", "50000"}});
  • Constructor Details

    • SDataLoader

      public SDataLoader(SSessionJdbc session, SRecordMeta<T> meta, SFieldScalar[] fields)
      A data loader for record sRecordMeta will load fields. The primary key fields are always implicitly included at the beginning and need not be repeated here. The default for fields is all fields except those flagged SQY_UNQUERIED.
    • SDataLoader

      public SDataLoader(SSessionJdbc session, SRecordMeta<T> meta)
  • Method Details

    • insertRecord

      public SRecordInstance insertRecord(Object... record)
      Inserts (or updates) one record in the databases, and returns it. The first element(s) in record contain the primary key field(s), the rest contain the public
    • insertRecords

      public SRecordInstance[] insertRecords(Object[][] records)
      Conveniently inserts multiple records in one go. Each inner array is simply passed to insert(String[]).