From: Magnus BlĂ„udd Date: November 28 2012 3:09pm Subject: Re: NDB API: PK Autoincrement List-Archive: http://lists.mysql.com/cluster/8448 Message-Id: <50B62933.9020508@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, you need to use Ndb::getAutoIncrementValue() to fetch (and reserve) one or more autoincrement values for the table you are inserting into. Then use the returned value you get in subsequent insert. Normally it's not recommended to use auto increment columns for NDB tables since there is an extra roundtrip consumed when fetching the autoincrement value using the above function. Even though you can fetch something like 64 values at a time, you'd get gaps in the range unless you really insert 64 rows. If possible try to use different primary key. Unless anything obvious is available, you can always generate a UUID. Sorry, couldn't find any simple example. / Magnus On 11/28/2012 02:51 PM, Mazen Hajri wrote: > Hello there, > > > > I'm currently implementing some application on top of NDB API, but I'm > facing a problem of incrementing the PK with an auto_increment attribute. Do > I have to read the last value then do the auto increment explicitly in the > code, or is there an easier way? > > > > A simple example would be of great help. > > > > Kind regards, > > Mazen > >