ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "m.montano" <koalin...@gmail.com>
Subject Help with identity
Date Wed, 20 May 2009 19:25:32 GMT

Hi all, i'm a newbie in ibatis... I'm working on MS sql server 2000, driver
jtds.
The problem is: I have this transaction to execute

begin transaction
declare @id_audio varchar(20)
set @id_a = cast(IDENT_CURRENT('file') + ident_incr('file') as varchar)
INSERT INTO FILEMD (furl, F1, F2, IDA)
VALUES ('val furl', 'val f1', 'val f2', @id_a)
INSERT INTO ANNUNCI (idann, F3, F4, ida)
VALUES ('val idann', 'val f3', 'valore f4', @id_a)
commit transaction
GO

I'm trying with:
//begin transaction
sqlMap.startTransaction();

int idAudio = 000;//to retrieve + increment ...how?

amdr.setIdAudio(idAudio );
sqlMap.insert("insertFileMD", amdr);
ann.setIdAudio(idAudio );
sqlMap.insert("insertAnnuncio", ann);

sqlMap.commitTransaction();
//commit transaction


I'm not sure how to retrieve the idAudio (the identity column in FILEMD)...
can please you help me?
thanx for support,
have a nice day,
Michela
-- 
View this message in context: http://www.nabble.com/Help-with-identity-tp23641858p23641858.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message