cancel
Showing results for 
Search instead for 
Did you mean: 

Storing autoincrementing property in database.

pawelu
Champ in-the-making
Champ in-the-making
Smiley Very Happy HI Gurus, Could anyone help me with the following problem. I would be very greatful if someone wrote a bit of code. I have created a custom mode. One of the properties has to behave exactly like an autoincrement column in a database. Can anyone tell me with what steps I could implement it. I would like to follow the rules e.g.: use hibernate. I need to create unique incrementing ID for every successfully created custom type. Greetings, Pawel.
6 REPLIES 6

derek
Star Contributor
Star Contributor
Hi,

I assume that your algorithm can withstand holes in the sequence.  Did you know that every new node has its unique database row ID recorded in the metadata?

Regards

kevinr
Star Contributor
Star Contributor
The property is called "sys:node-dbid"

Thanks,

Kevin

pawelu
Champ in-the-making
Champ in-the-making
Hello I need to have ordered list of numbers. Every content/document must have its own number like a record of primary key in a database. These have to be integers numbering documents/content. Greetings, Pawel.
The property is called "sys:node-dbid"

Thanks,

Kevin

binduwavell
Star Contributor
Star Contributor
The property is called "sys:node-dbid"

I don't believe this solution is portable across export/import is it?

Any other suggestions that would be portable?

emperor333
Champ in-the-making
Champ in-the-making
Dear binduwavell,

Please specify your requirement correctly. I assume you are trying to create a custom metadata which you wants to increment upon every new content creation/update. If this is what you intend - you can create your own behaviours, rules to update the custom field upon any content manipulations. Let me know is this something you expect!?

Regards,

mrogers
Star Contributor
Star Contributor
Correct "sys:node-dbid" is not suitable for import/export.

However how would you merge your different sequences on your target system?     The solution is either as simple as copying the value of sys:node-dbid to another property.   Or its far more complicated.