db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Roth" <matthias.r...@impart.ch>
Subject FW: additional function for PlatformDb2Impl
Date Wed, 17 Dec 2003 22:13:59 GMT


Hi Thomas
I had added the function getLastInsertIdentityQuery to the class
PlatformDb2Impl.
This call is testet and works for DB2 Version 7.x (z/OS) and 8.x (NT):
// matthias.roth@impart.ch
//the function is used by the
org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
//this call must be made before commit the insert cammand, so you
//must turn off autocommit by stting the useAutoCommit="2"
public String getLastInsertIdentityQuery(String tableName)
{
return "select IDENTITY_VAL_LOCAL() from sysibm.sysdummy1";
}

and

to the class PlatformMsSQLServerImpl:

// matthias.roth@impart.ch
//the function is used by the
org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
//this call must be made before commit the insert cammand, so you
//must turn off autocommit by stting the useAutoCommit="2"
public String getLastInsertIdentityQuery(String tableName)
{
return "SELECT @@IDENTITY AS id FROM "+tableName;
}

regards

Matthias Roth
Dipl. Ing. HTL
in Wirtschaftsinformatik

impart Software Engineering GmbH
Chasseralstrasse 13
Postfach
CH-3063 Ittigen

Phone           +41 (0)31 922 39 25
Fax             +41 (0)31 922 39 18
EMail           mailto:matthias.roth@impart.ch
Homepage        http://www.impart.ch


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message