How do I get the primary key after inserting a record with the SQLmap api.

10 views
Skip to first unread message

Rubén V

unread,
Oct 28, 2020, 5:52:54 PM10/28/20
to CodenameOne Discussions
Hi,

I am using the classes that implement "PropertyBusinessObject".

Create a table as follows:
             Menu mu = new Menu ();
             sqlMap.setPrimaryKeyAutoIncrement (mu, mu.sequence);
             sqlMap.createTable (mu);

When I try to insert a record I do this:
sqlMap.insert (mu);

Since mu.sequence is autoIncrement, how do I know which number was generated?

Shai Almog

unread,
Oct 28, 2020, 11:33:45 PM10/28/20
to CodenameOne Discussions
Hi,
unfortunately the current API is a bit limited and expects you to select to find the primary key after the fact.
Reply all
Reply to author
Forward
0 new messages