2 Replies Latest reply on Sep 14, 2002 5:30 PM by Greg Turner

    How to use Integer as primary key ?

    tsangcn Newbie


      Originally, my database contains tables with composite primary keys.
      But since JBossCMP's CMR does not support primary key fields as foreign key fields, I plan to assign a Integer id to replace the compsite key.
      A table is used to contain the name of the ejb and the last used value for id.
      Whenever an ejb is created, the value is retrieved from the table and incremented by 1.

      Is there any better method?

      The id will be assigned as 1, 2, 3, ...
      Since deleted record's id will not be reused, it may reaches Integer.MAX_VALUE in one day.
      Is it need a checking for Integer.MAX_VALUE?
      How to handle when it is Integer.MAX_VALUE?