Hello Rahul,
> I am Using postgresSql As my DB and I am using auto-generated keys as my way
> to create new ID which is as follows:
>
> <insert id="MSCPerfCntrMscMMSTblImpl"
> parameterClass="com.hns.hss.nmf.server.log.manager.gensrc.MSCPerformance.impl.MSCPerfCntrMscMMSTblImpl">
> insert into MSCPerfCntrMscMMSTbl(
> seq_no,
> neinfo_id,
> rectimeStamp,
> index,
> numClsMrkUpdates,
> ciphrModeCntrlAttempt,
> succCiphrModeCntrl
> )
> values
> (
> nextval ('MSCPerfCntrMscMMS_seq'),
> #neInfoId_0#,
> #timeStamp_0#,
> #index_1.value#,
> #numClsMrkUpdates_2.value#,
> #ciphrModeCntrlAttempt_3.value#,
> #succCiphrModeCntrl_4.value#)
> </insert>
You can use the <selectKey> element as described in
http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=407
I'am sure, there is a chapter in "iBATIS in Action" which describes this
feature too.
If your class MSCPerfCntrMscMMSTblImpl contains an instance variable of
type int or Integer and with identifier "id" and corresponding
getters/setters, this looks like
<insert id="MSCPerfCntrMscMMSTblImpl"
parameterClass="com.hns.hss.nmf.server.log.manager.gensrc.MSCPerformance.impl.MSCPerfCntrMscMMSTblImpl">
<selectKey keyProperty="id" resultClass="int" type="pre">
nextval('MSCPerfCntrMscMMS_seq')
</selectKey>
insert into MSCPerfCntrMscMMSTbl(
seq_no,
neinfo_id,
rectimeStamp,
index,
numClsMrkUpdates,
ciphrModeCntrlAttempt,
succCiphrModeCntrl
)
values
(
#id#,
#neInfoId_0#,
#timeStamp_0#,
#index_1.value#,
#numClsMrkUpdates_2.value#,
#ciphrModeCntrlAttempt_3.value#,
#succCiphrModeCntrl_4.value#)
</insert>
Ingmar