[Opensource] Accessing auto-inc key fields after add()

Mike Traum mtraum at cirnetwork.org
Thu Nov 7 10:58:46 PST 2002


Someone correct me if I'm wrong, but I don't think you'll want to use
auto-inc if you need to access the number without doing a query afterwards.
Use the NextNumber object instead:

(out of the Expresso How-to guide)
import com.jcorporate.expresso.core.dbobj.NextNumber;
NextNumber myNext = NextNumber.getInstance();
int uniqNum = (int)myNext.getNext(request.getDBName(), yourDBObj, "id");
yourDBObj.setField("id", uniqNum);
yourDBObj.add();

Mike

-----Original Message-----
From: opensource-admin at jcorporate.com
[mailto:opensource-admin at jcorporate.com]On Behalf Of Tayfun Elmas
Sent: Thursday, November 07, 2002 7:30 AM
To: opensource at jcorporate.com
Subject: [Opensource] Accessing auto-inc key fields after add()


Hi,
If my DBObject has a key as an auto-inc field, how can
i access this key after adding the DBObject to the
database, namely ,is it set after the add() operation
and can i get it with getField()?

Thanks...

=====

####################################
TAYFUN ELMAS
 #_#_#   elmas at bilmuh.ege.edu.tr
 (`|4)   telmas at bornova.ege.edu.tr
__)W(__  tayfunelmas at yahoo.com
Ege \niversitesi
Bilgisayar M|hendisligi
35100 Bornova - IZMIR
####################################


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2
_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/




More information about the Opensource mailing list