java - JavaDB - autoincrement among several tables -


is possible have autoincrementing id among several tables?
what mean - have (let's five) tables, 1 of them table containing information sales (sale_id, sold_item_id) , 4 contain info different kind of sold stuff. want these 4 share 1 pool of ids. how do that?

edit.
decided choose juxhin solution , created additional table. everytime create record in 1 of these 4 tables, autoincrement new id in additional table , id in 1 of columns of new row.

this sounds use case sequence , link seems indicate javadb supports this.

so create 1 common sequence tables:

create sequence masequence 

and use when inserting tables:

 insert tab1(id,....) values(next value mysequence,...) 

each next value advance sequence , ids unique across tables.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -