ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LiborP <liborpre...@seznam.cz>
Subject Obtain generated ID
Date Fri, 09 Jan 2009 13:29:29 GMT

Hi all,
I'm new in iBatis. I'm using Swing, Spring, iBatis and Apache Derby in my
desktop project. I'm struggling with receive inserted ID. I'm not able to
find out last inserted ID. To generate new ID I'm using Derby function
IDENTITY_VAL_LOCAL(). This function works fine for generating ID. This is
snipped of relevant code:
<insert id="insertDictionary"  parameterClass="Dictionary" > 
    insert into Dictionary (  id,  word,  value,  description, idLesson)
    values ( DEFAULT,
    #key#, #translation#, #description# ,#idLesson# ) 
    <selectKey keyProperty="id" type="pre" resultClass="int">
      values IDENTITY_VAL_LOCAL()
DAO snipped:
return getSqlMapClientTemplate().insert("Dictionary.insertDictionary",
I tried to create another select to get last inserted ID like this:
<select id="lastInsertedID" resultClass="Integer">
but it returns null as well. I tried to use "values IDENTITY_VAL_LOCAL()" in
SQL client and it works fine.
I'm not using transactions. iBatis version, Derby version Can anybody help please?
View this message in context: http://www.nabble.com/Obtain-generated-ID-tp21372327p21372327.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message