You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Brett Gullan <br...@mac.com> on 2002/05/19 09:36:47 UTC

How to use IDBroker to create Torque IDs?

Hi,
I need to "manually" construct primary keys for a Torque object model. I
have a tree of Torque object instances that I'd like to generate
"in-memory" without hitting the database after each object is created in
order to set the PK.
 
I'm currently using the following code:
 
int pk = Torque.getDatabaseMap().getIDBroker().getIdAsInt(
null,"PROCESS_ENTRY");
nk = new NumberKey( pk );
setId( nk );
 
This seems to work fine, however at runtime Torque (IDBroker) will
frequently print out a message that mentions the "Unscheduled Retrieval"
of primary keys.
 
Is the above the "correct" way to generate a Primary Key value? Is there
a better alternative?
 
Sorry if this question has been asked (and answered) before, but I can't
find anything that specifically addresses this issue in the Turbine mail
archives.
 
TIA,
 
Brett
 
--
Brett Gullan
brettgullan@mac.com