That was it! Damn copy-paste bites me in the ass again. Thank you VERY much!
On 1/29/07, Larry Meadors <[EMAIL PROTECTED]> wrote:
Are you sure you are calling insert() and not update()?
Larry
On 1/29/07, Robert Campbell <[EMAIL PROTECTED]> wrote:
> I've used iBatis for a while, and selectKey without trouble. For some
> reason, however, the following code won't work. It never calls setId()
on
> the object passed in as a parameter. Basically i'm getting an Oracle
error
> telling me id can't be null.. so selectKey isn't calling setId() before
the
> Insert as it should. Any ideas? Thanks everyone!
>
> <insert id="addUser" parameterClass="credential">
> <selectKey resultClass="java.lang.Long" keyProperty="id"
type="pre">
> select gw_sequence.nextval as id from dual
> </selectKey>
> <![CDATA[
> insert into credentials (
> id,
> username,
> password,
> organization_id
> ) values (
> #id#,
> #username#,
> #password#,
> #organizationId#
> )
> ]]>
> </insert>
>
> Model:
>
> ....
>
> protected Long id;
>
> /**
> * @return Returns the id.
> */
> public Long getId() {
> log.error("******************* User.getId() returned " + id);
> return id;
> }
>
> /**
> * @param id
> * The id to set.
> */
> public void setId(Long id) {
> log.error("******************* User.setId() set to " + id);
> this.id = id;
> }
> ...
>