|
JDBaccess API 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Insert
Interface for inserting objects: with Insert you insert of one or more rows into a database table. To do that you normally define transfer objects, set some fields of them as modified set them with "setTOs" and execute the insert object. But you can also do an insert without transfer objects and set the single values with "setParameters". A batch insert is done if more than one transfer object is set (with better performance than single inserts). For a better performance there also exists special methods for getting sequence ids.
Example: Insert insert = DAReader.getInsert(t); Row row1 = new Row(); row1.setValueModified(“id”, new Long(4711)); row1.setValueModified(“name”, “yourName”); Row row2 = new Row(); row2.setValueModified(“id”, new Long(4712)); row2.setValueModified(“name”, “yourName”); ArrayList transferObjects = new ArrayList(); transferObjects.add(row1); transferObjects.add(row2); insert.setPackage(„yourPackage“); insert.setName(“yourName”); insert.setTOs(transferObjects); ArrayList createdTransferObjects = insert.execute(); insert.end();Example with transfer objects: Employee emp = new Employee(); emp1.setValueModified("name", "tim"); BigDecimal timSal = BigDecimal.valueOf(5000002, 2); emp.setValueModified("salary", timSal); emp.setValueModified("description", "description ....."); emp.setValueModified("picture", picture); emp.setValueModified("creation", now); emp.setValueModified("modification", now); Insert insert = DAReader.getInsert(t); insert.setTO(emp); insert.execute(); insert.end();
Method Summary | |
---|---|
void |
end()
Ends this data access, so that it can be moved to the internal cache (in statement pool) for reuse |
java.lang.Object |
execute()
Execute the given Insert-object. |
void |
setTO(TransferObject to)
Set one transfer object which should be inserted. |
void |
setTOs(java.util.ArrayList tos)
Set the transfer objects which should be inserted. |
Methods inherited from interface com.jdbaccess.da.DataAccess |
---|
getName, getObjectType, getPackageName, getSize, getSql, setName, setObjectType, setPackageName, setParameters, setSql, toString |
Method Detail |
---|
java.lang.Object execute() throws ApplicationException
ApplicationException
void end() throws ApplicationException
end
in interface DataAccess
ApplicationException
void setTOs(java.util.ArrayList tos) throws ApplicationException
tos
- transfer objects as an ArrayList
ApplicationException
void setTO(TransferObject to) throws ApplicationException
to
- transfer object
ApplicationException
|
JDBaccess API 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |