Class SDataLoader<T extends SRecordInstance>


  • 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"); <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 Detail

      • 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.
    • 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) in record 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 to insert(String[]).