ADF中Create CreateInsert CreateWithParams的区别

来源:互联网 发布:ati mac驱动放在哪里 编辑:程序博客网 时间:2024/06/05 09:15

先用代码来描述一下使用不同的Operation在创建一行记录时的情景

1.Create

[java] view plaincopy
  1. // create a new row for the view object  
  2. Row newRow = yourViewObject.createRow();  
  3. // mark the row as being "initialized", but not yet new  
  4. newRow.setNewRowState(Row.STATUS_INITIALIZED);  

提交时才执行insert操作


2.CreateInsert

在Create的基础上,再多执行了如下代码

[java] view plaincopy
  1. // insert the new row into the view object's default rowset  
  2. yourViewObject.insertRow(newRow);  

3.CreateWithParams

在CreateInsert的基础上再执行以下代码,给新创建的行设置默认值

[java] view plaincopy
  1. newRow.setAttribute("attributeName", attibuteValue);  
同时,Row的状态由Row.STATUS_INITIALIZED变为Row.STATUS_NEW

由此我们想到,在创建新行时界面上表现的两种常用方式:form和table,form是直接绑定了新创建的Row,而table则是绑定了一个集合,所以在table中创建行时,只能使用CreateInsert,而在form中既可以使用Create,也可以使用CreateInsert。


转自:http://blog.csdn.net/ygj26/article/details/8010123

0 0