ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <larry.mead...@gmail.com>
Subject Re: iBATIS insert does not execute
Date Fri, 18 Apr 2008 14:39:34 GMT
I pass null in all the time for that, so that seems kind of unlikely
(of course mine is M$SQL-2K5).

Maybe you could try jdbc? If that doesn't work, we know it's not
ibatis. If it does, then we may need to step through the code and see
where it's failing...


On Fri, Apr 18, 2008 at 8:29 AM, Chris Marshall
<chris@campsbayterrace.com> wrote:
> Sorry to bug you again but I think that the problem is related to
>  passing a null primary key in the insert statement when the key is
>  autogenerated (by MySQL).
>  What is the best practice here?  I have tried the following MySQL
>  specific SqlMap snippet with success, but was hoping for a solution
>  portable among databases:
>   <insert id="insert" parameterClass="net.mycompany.Role">
>           <selectKey resultClass="java.lang.Integer" keyProperty="roleid">
>                 select LAST_INSERT_ID() AS value
>           </selectKey>
>     insert into role (RoleID, ParentID, Name, Notes)
>     values (#roleid:INTEGER#, #parentid:INTEGER#, #name:VARCHAR#,
>  #notes:VARCHAR#)
>   </insert>
>  Thanks Chris
>  On 18/04/2008, Brandon Goodin <brandon.goodin@gmail.com> wrote:
> > Is this the only insert that is not working for you? Do you have others that
>  > are working? What version of iBATIS are you using?
>  >
>  > Brandon Goodin

View raw message