ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Shea" <js...@traq.com>
Subject RE: selectKey and Oracle
Date Thu, 05 May 2005 13:21:45 GMT
I don't know if this is relevant or not, but I noticed the typeAlias
element defines an alias of "costCenter" rather than "costObject".

Jim

-----Original Message-----
From: Darek Dober [mailto:dooverone@op.pl] 
Sent: Thursday, May 05, 2005 4:01 AM
To: ibatis-user-java@incubator.apache.org; Don Pendergast
Subject: Re: selectKey and Oracle


How do you invoke your sqlmap statement.

I had the same problem

You should use:
insert("createObject", costObject);

instead of

update("createObject", costObject);

with update method selectKey is'nt invoked, as someone mentioned before
for
me:)

Darek
----- Original Message ----- 
From: "Don Pendergast" <don.pendergast@gmail.com>
To: <ibatis-user-java@incubator.apache.org>
Sent: Wednesday, May 04, 2005 10:25 PM
Subject: selectKey and Oracle


Is there something special I need to do to get the selectKey tag to
populate a field?  I've been looking at this thing for quite a while now
and cannot figure out what I'm doing wrong.

Here is the entry in the sqlmap file:

<typeAlias alias="costCenter" type="edu.ohio.cost.domain.CostObject"/>

<insert id="createObject" parameterClass="costObject">
  <selectKey resultClass="int" keyProperty="costObjectId">
    select COST_OBJECT_S.nextval as costObjectId from dual
  </selectKey>
  insert into COST_OBJECT
 (COST_OBJECT_ID, COST_OBJECT_TYPE, STATUS, CREATED_BY, DATE_CREATED,
OBJECT_VERSION)
 values
 (#costObjectId#, #costObjectType#, #status#, #createdBy#, sysdate, 1)
</insert>

The CostObject.java file has a getter/setter for costObjectId (int).

The sequence (COST_OBJECT_S) is set up and works fine.

When I turn on logging, there is no reference to anything in the
<selectKey..> portion of the insert statement and the costObjectId is
always 0.  I've tried to change from the primitive int to the object,
but the value of costObjectId is null then.

I'm hoping I've just overlooked something small, but at this point I
wouldn't know what...

Any assistance would be greatly appreciated.
~Don

p.s. I'm using the 2.0.9 release of iBatis.  Also, sorry if this appears
twice - I sent it several hours ago and it has never shown up.


Mime
View raw message