hi!

i have this code to insert a usercase:

<insert id="insertUserCase" parameterType="watchabbits.vo.UserCase"
keyProperty="id" useGeneratedKeys="true">
                insert into usercase(gender,age)
                values(#{gender},#{age});
        </insert>

how can i retrieve the id?
i wrote this code:
public Integer saveUserCase(UserCase theCase){
                int userCaseId =0;
                SqlSession session = sqlMapper.openSession();
                try {
                        userCaseId =
session.insert("watchabbits.ibatis.UserCaseMapper.insertUserCase", theCase);
                        
                } finally {
                        session.close();
                }
                return userCaseId;
        }
but i don't get the id..


-- 
View this message in context: 
http://old.nabble.com/how-to-retrieve-the-keyProperty-in-useGeneratedKeys-tp26353033p26353033.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to