ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Pannell <steven.pann...@zooplus.com>
Subject RE: Getting the generate primary key
Date Thu, 17 Mar 2005 16:05:40 GMT
Hi,

Thanks James.

Anyone know how I can the last generated key from oracle then??  I don't
know of any such function.

Cheers
Steve.

-----Original Message-----
From: James, Steven [mailto:Steven.James@logicacmg.com]
Sent: 17 March 2005 17:03
To: ibatis-user-java@incubator.apache.org
Subject: RE: Getting the generate primary key


you need to add the 
<selectKey resultClass="int" keyProperty="id" > 
			select LAST_INSERT_ID()  
		</selectKey>
above is for mysql just change to olacle specific code. etc

steve

-----Original Message-----
From: Steven Pannell [mailto:steven.pannell@zooplus.com]
Sent: Thu 3/17/2005 3:52 PM
To: 'ibatis-user-java@incubator.apache.org'
Subject: Getting the generate primary key
 
Hi,

I want to get the automatically generated key from a newly inserted row (my
oracle database handles the generation of the key via a trigger).  

I followed the docs but it does not appear to be working.

SqlMap:

<insert id="writeOrder" parameterClass="Order"  >
	INSERT INTO
	ORDERS(order_price)
	values(#orderPrice#)
</insert>

Code:

Long id = (Long)client.insert(new SqlMapId("writeOrder"),order);


The returned value is always null. but I want the primary key id.

am I doing anything wrong here (using ibatis 2.0.9.496)  I'm sure when i
tried this on an earlier version if iBatis it was working.

Thanks,
Steve.


This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.

Mime
View raw message