BTW, this *does* work: <insert id="createDeployment" parameterClass="deployment"> <selectKey resultClass="int" keyProperty="deploymentId"> SELECT MAX(deploymentId) + 1 FROM Deployment </selectKey>
INSERT INTO Deployment (deploymentId, environmentId, deploymentTypeId, userName, deploymentStatusId, deploymentTime, threadCountOverride) VALUES (#deploymentId#, #environmentId#, #deploymentTypeId#, #userName#, #deploymentStatusId#, #deploymentTime#, #threadCountOverride#) </insert> BUT it directly contradicts the thread here: http://www.mail-archive.com/user-java@ibatis.apache.org/msg00044.html ...in which the consensus that the selectKey operation for sybase is identical to MSSQL in a) being after the insert and b) using @@IDENTITY. Also it would seem to be counter to the examples in the docs, which don't require that "deploymentId" be explicity passed to the insert. What am I missing? Are these differences due to which JDBC driver I'm using? (Jconn3) #2 (below) still stands. Thanks > #2 -- Given that the insert/update statements are very much alike, is > there a clean way to share the SQL between the two?