ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: help required for insert()
Date Fri, 09 Sep 2005 02:41:39 GMT
The following is provided in the javadoc. I hope that helps.
 
 insert 

public java.lang.Object *insert*(java.lang.String id,
                               java.lang.Object parameterObject)
                        throws java.sql.SQLException

 Executes a mapped SQL INSERT statement. Insert is a bit different from 
other update methods, as it provides facilities for returning the primary 
key of the newly inserted row (rather than the effected rows). This 
functionality is of course optional. 

The parameter object is generally used to supply the input data for the 
INSERT values. 

*Parameters:*id - The name of the statement to execute.parameterObject - The 
parameter object (e.g. JavaBean, Map, XML etc.). *Returns:*The primary key 
of the newly inserted row. This might be automatically generated by the 
RDBMS, or selected from a sequence table or other source. *Throws:* 
java.sql.SQLException - If an error occurs.  
------------------------------
 update 

public int *update*(java.lang.String id,
                  java.lang.Object parameterObject)
           throws java.sql.SQLException

 Executes a mapped SQL UPDATE statement. Update can also be used for any 
other update statement type, such as inserts and deletes. Update returns the 
number of rows effected. 

The parameter object is generally used to supply the input data for the 
UPDATE values as well as the WHERE clause parameter(s). 

*Parameters:*id - The name of the statement to execute.parameterObject - The 
parameter object (e.g. JavaBean, Map, XML etc.). *Returns:*The number of 
rows effected. *Throws:* java.sql.SQLException - If an error occurs.  
------------------------------
 delete 

public int *delete*(java.lang.String id,
                  java.lang.Object parameterObject)
           throws java.sql.SQLException

 Executes a mapped SQL DELETE statement. Delete returns the number of rows 
effected. 

The parameter object is generally used to supply the input data for the 
WHERE clause parameter(s) of the DELETE statement. 

*Parameters:*id - The name of the statement to execute.parameterObject - The 
parameter object (e.g. JavaBean, Map, XML etc.). *Returns:*The number of 
rows effected. *Throws:* java.sql.SQLException - If an error occurs.  

On 9/8/05, Karthikeyan Pandurangan <pkarth@gmail.com> wrote:
> 
> ---------- Forwarded message ----------
> From: Karthikeyan Pandurangan <pkarth@gmail.com>
> Date: Sep 9, 2005 9:01 AM
> Subject: help required for insert()
> To: user-java-info@ibatis.apache.org
> 
> 
> Hi,
> I have a problem in using insert() in ibatis 2.1.5 with SQLMap. As
> there is no proper sample and doc explaining the usage of
> insert and the type of the returned object when insert is carried out.
> As i used Ibatis 1.3 SQLMap update() for insertion,
> i don't know how to handle the insertion using v2.1.5 insert(). Even
> the sample application packaged with v2.1.5 doesn't
> seams to use insert(), instead it is using insert(). Please help me to
> solve this problem. Thanks in advance.
> 
> Regards
> karthi
>

Mime
View raw message