Brandon
On 9/9/05, Meindert <[EMAIL PROTECTED]> wrote:
I would think you should add tag <selectKey> in your <insert>.
Not to sure how this works with a key that isn't a int.
-----Original Message-----
From: Karthikeyan Pandurangan [mailto: [EMAIL PROTECTED]]
Sent: 09 September 2005 05:45 AM
To: [email protected]; [EMAIL PROTECTED]
Subject: Re: help required for insert()
hi,
Thanks much for the reply and i appreciate the promptness in
replying. Pardon me to ask again, i have the following statement for
insert statement and tried to process the Object returned from the
insert().The record which i inserted was inserted to DB successfully.
But the object returned was null.
My table struct
**************
CREATE TABLE SC_USER_LICENCE_TYPE (
USER_ID VARCHAR2 (60) NOT NULL,
LICENCE_TYPE VARCHAR2 (10) NOT NULL,
GROUP_CD VARCHAR2 (10) NOT NULL,
CREATED_BY VARCHAR2 (60) NOT NULL,
DATE_CREATED DATE,
UPDATED_BY VARCHAR2 (60),
DATE_UPDATED DATE,
ADD_ACCESS CHAR (1),
AMEND_ACCESS CHAR (1),
READ_ACCESS CHAR (1),
DELETE_ACCESS CHAR (1),
EMAIL_ALERT_ACCESS CHAR (1),
PRIMARY KEY ( USER_ID, LICENCE_TYPE )
**********
My insert xml
********
<insert id="insertUserLicenceType">
insert into
SC_USER_LICENCE_TYPE
(USER_ID, LICENCE_TYPE, GROUP_CD,
ADD_ACCESS, AMEND_ACCESS, READ_ACCESS,
DELETE_ACCESS, EMAIL_ALERT_ACCESS,
CREATED_BY, DATE_CREATED)
values
(#strUserId#, #strLicenceType#, #strLicGroupCd#,
#strAddAccess#, #strAmendAccess#, #strReadAccess#,
#strDeleteAccess#, #strEmailAccess#,
#strCreatedBy#, sysdate)
</insert>
******************************
I am calling the insert() as follows.
sqlMap.insert(" insertUserLicenceType",<object>);
How i suppose to configure or check whether the record was inserted
successfully to DB. Also i have some part of my biz logic requirement
where i have to insert multiple records in transaction block and have
to return how many rows inserted to the View Tier.
Thanks in advance.
Regards,
karthi
On 9/9/05, Brandon Goodin <[EMAIL PROTECTED]> wrote:
> The following is provided in the javadoc. I hope that helps.
>
> insertpublic 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.________________________________
>
> updatepublic 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.________________________________
>
> deletepublic 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 < [EMAIL PROTECTED]> wrote:
> > ---------- Forwarded message ----------
> > From: Karthikeyan Pandurangan <[EMAIL PROTECTED]>
> > Date: Sep 9, 2005 9:01 AM
> > Subject: help required for insert()
> > To: [EMAIL PROTECTED]
> >
> >
> > 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
> >
>
>
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/92 - Release Date: 07/09/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/92 - Release Date: 07/09/2005
