Meindert:

Thanks. I could not see the javadoc now.
The iBatis.apache.org is down currently.

How can I use the <selectKey> tag ?
Do you have an example ? 

Suppose the table is A, and its primary key is id. The sequence of table A is seq_A.
The bean that conatains the data to be inserted is called DataBean which
properties are id, column1, column2.

Can I specify the statement as:


<statement id="insertA" parameterClass="DataBean" resultClass="Integer">

    <selectKey property="id" type="pre" resultClass="int">

        select seq_A.nextval as value from dual

    </selectKey>            

    INSERT INTO A

        (id, column1, column2) 
    VALUES

        (#id#, #column1#, #column2#)

</statement>


Thanks,




Meindert wrote:

  
Uhm, insert() does not return an int.
    
According to the Developer Guide (page 43) it does.
The javadoc say's that it returns a java.lang.Object containing the primary
key, the primary key field is defined with the <selectKey> tag in the Sql.

Meindert

  
Larry
    


On 12/13/05, Leonardo Kenji Shikida <[EMAIL PROTECTED]> wrote:
  
I believe it means the number of affected rows (just like jdbc)

On 12/13/05, John Chien <[EMAIL PROTECTED]> wrote:
    
The SqlMapClient API indicates:

public int insert(String statementName, Object parameterObject) throws
SQLException.
public int update(String statementName, Object parameterObject) throws
SQLException
public int delete(String statementName, Object parameterObject) throws
SQLException

what does the return int repesent ?

the example shows

int rows = sqlMap.insert("insertProduct", product);

Does the return int represent the number of rows being inserted, updated
or deleted ?

Is there anyway of returning the Object or the List of the rows being
inserted, updated or deleted ?


Thanks,

John Chien



      
--

[]

Kenji
_______________________
http://kenjiria.blogspot.com
http://gaitabh.blogspot.com

    

  
begin:vcard
fn:John Chien
n:Chien;John
email;internet:[EMAIL PROTECTED]
tel;work:919-715-2510
version:2.1
end:vcard

Reply via email to