BC4J: Primary Key
From: Michael Klemm <mail_at_michael-klemm.net>
Date: Wed, 05 Feb 2003 12:04:06 +0100
Message-ID: <b1qr1v$5q9$1_at_rznews2.rrze.uni-erlangen.de>
Hi there!
}
catch (Exception e) {
Date: Wed, 05 Feb 2003 12:04:06 +0100
Message-ID: <b1qr1v$5q9$1_at_rznews2.rrze.uni-erlangen.de>
Hi there!
To assign a primary key to my new created entity objects I use the following code snipplet:
long key = 0;
String result = entity.getDBTransaction().dumpQueryResult(
"SELECT schluessel.NEXTVAL FROM DUAL", null, null); try {
StringTokenizer st = new StringTokenizer(result); st.nextToken(); key = Integer.parseInt(st.nextToken());
}
catch (Exception e) {
e.printStackTrace();
}
Now I'm wondering if there's a better way to query the sequencer called schluessel. It seems real unefficient to get the query result as a String-Object and parse it to get the int value.
Has anyone a better solution for my problem?
Thanks!
Regards
-michael Received on Wed Feb 05 2003 - 12:04:06 CET