I think to something like:

with the table:

CREATE TABLE CFG.COMMANDS (
  id_command VARCHAR ( 50 ) NOT NULL,
  descr VARCHAR ( 200 ) NOT NULL,
  CONSTRAINT PK_CMD PRIMARY KEY (id_command)
  );


and with Class
com.domain.Command:

public class Command {
  private int id_command;
  private String descr;

  public String getDescr() {
    return this.descr;
  }
  public void setDescr(String descr) {
    this.descr = descr;
  }
  public int getId_command() {
    return this.id_command;
  }
  public void setId_command(int id_command) {
    this.id_command = id_command;
  }
}


an query like:

<insert id="insertCommands" parameterClass="com.domain.Command">
  <selectKey resultClass="int" >
    SELECT MAX(id_
command) AS id_command FROM CFG.COMMANDS
</selectKey>
insert into CFG.COMMANDS (id_command,descr)
values (#id_command#,#descr
#)
</insert>


is it possible ?

Thank's
   Valerio


Larry Meadors ha scritto:
I do not think I understand the question...if the database doesn't
support auto-generated keys, it'll be awful difficult to get the
auto-generated keys...

Maybe you can clarify your question some.

Larry


On 5/25/06, Valerio Bertoldi [Primeur] <[EMAIL PROTECTED]> wrote:
Hi,
is there any possibility to get the auto-generated key from the INSERT-Statement with the selectKey-Element in RDBMS that not support the auto-generated key ?

Thank's
   Valerio







begin:vcard
fn:Valerio BERTOLDI
n:BERTOLDI;Valerio
org:Primeur Service Integration
adr:;;Vai Enrico Mattei 1/C, interno 106/A;Marcon;VE;30020;Italy
email;internet:[EMAIL PROTECTED]
tel;work:041 5950 116
x-mozilla-html:TRUE
url:http://www.primeur.com
version:2.1
end:vcard

Reply via email to