These are some of the advantages of using inline methods:
All inline methods are defined in the Data interface, which defines methods for querying and updating databases, running stored procedures, querying Collection and Iterator objects, and for managing transactions.
The query methods can be classified into two groups.
Employee employee = data.queryFirst("SELECT * FROM HRDEPT.EMP WHERE lastname = ?1", Employee.class, lastName);
List<Employee> employees = data.queryList("SELECT * FROM HRDEPT.EMP", Employee.class);
Employee[] employees = data.queryArray("SELECT * FROM HRDEPT.EMP", Employee.class);
Iterator<Employee> employees = data.queryIterator("SELECT * FROM HRDEPT.EMP", Employee.class);
Map<String,Object> employee = data.queryFirst("SELECT * FROM HRDEPT.EMP WHERE lastname=?1", lastName);
List<Map<String,Object>> employees = data.queryList("SELECT * FROM HRDEPT.EMP" + "WHERE lastname LIKE ?", "Br%");
You use the Data.update() method for single operations.
Employee newEmployee = new Employee("000010", "CHRISTINE", "I", "HAAS", "A00", "3978", new java.sql.Date(System.currentTimeMillis())); int rowsAffected = data.update("insert into hrdept.emp (id, firstname, midinit, lastname, deptno," + "phoneext, hiredate) VALUES (:id, :firstName, :midInit, :lastName, :deptNo, :phoneExt, :hireDate)", newEmployee);
Employee employee = new Employee("000010", "CHRISTINE", "I", "HAAS", "A00", "3978", new java.sql.Date(System.currentTimeMillis())); int rowsAffected = data.update("update hrdept.emp set firstname = :firstName, midinit = :midInit," + "lastname = :lastName, deptno = :deptNo, phoneext = :phoneExt, hiredate = :hireDate WHERE id = :id", employee);
int rowsAffected = data.update("delete from hrderp.emp where id=?1", id);
You use the Data.updateMany() method to perform an update operation multiple times.