You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Mcclain Looney <mc...@looneys.net> on 2002/04/07 23:56:43 UTC
get next id from idbroker
Greetings all,
I've poked around the turbine site, and searched the archives, but I still
can't figure out how to get the next id from an IdBroker inside of an action.
I have a table which represents a tree of objects, where .., eh, here's the
short version:
<table name="CONTAINER">
<column name="ID" required="true" autoIncrement="true" primaryKey="true"
type="INTEGER"/>
<column name="EID" size="255" type="VARCHAR"/>
<column name="PARENT" required="true" type="INTEGER"/>
</table>
basically, each container can have a parent, a root node's parent id is it's
own id. a simple tree.
my problem is that when saving a root node, i need to know the next id, so as
to set the parent id to the root node's own id.
is it possible to get the next id from the id broker from inside an action? or
should i just change my table so that root nodes use null for parent ?
-mcclain
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: get next id from idbroker
Posted by Mcclain Looney <mc...@looneys.net>.
I figured it out eventually, for posterity, the answer is to get the
databaseMap from TurbineDB thusly:
DatabaseMap dbMap = TurbineDB.getDatabaseMap();
int newId = dbMap.getIDBroker().getNextIds("CONTAINER", 1)[0].intValue();
-mcclain
On Sunday 07 April 2002 04:56 pm, Mcclain Looney wrote:
> Greetings all,
>
> I've poked around the turbine site, and searched the archives, but I still
> can't figure out how to get the next id from an IdBroker inside of an
> action.
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>