IDBroker.getNextId(tableName, connection) Bill Schneider wrote: > > Is there a canonical way in Torque to do something like this: > > 1. Create a new object with its constructor (e.g., new Category(), new > Author()) > > 2. get the ID value that the object *will have* if I called save(), even > if I'm not ready to call save yet > > If I were writing Oracle-specific code, I would use a sequence and > select xxx.nextval from dual, use this value as my ID if I save the > object, and throw the ID away if I don't. > > In Torque, there are a lot of different permutations: different > databases (not all have sequences) and different ID method generation > techniques (Torque id broker vs. native, and native might generate > post-insertion). So there's probably not a way to do this with native > sequences that will work on on all DBs. > > (Here's a kludge, though: .save() the record and doDelete() it > immediately; the ID will then be legal if you save it again. :-)) > > So I'm wondering, if I commit to the ID broker, is there a good way to > fetch an ID without inserting a record, that is guaranteed to be legal > if I *do* insert the record, similar to the get-sequence-value, > maybe-insert pattern with Oracle? > > Thanks, > > -- Bill > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
