How to get the value of auto generated primary key

Hello:
I have created a table with auto generated primary key, and I want to get/access the value of that auto generated primary key by querying the table. How can I do that?

Thank You!

CUBA entities creates his own primary key called id. This property is used automatically to reference a entity with another (Associations Many to one, One to many, etc). If you want a second unique key + autoincrement. just add it to entity, set unique and call where you need it from.
About autoincrement, I prefer to use unique number mechanism. Take a look here and here

PS Dont create tables on you Database. Create entities on your cuba-platform. CUBA will create all tables automatically.

1 Like