Search code examples
subsonic

Subsonic generate table without primary key


I need to generate a table without primary key. Its absolutely neccessary that the table dosen't have primary key. Please help.


Solution

  • Is there any reason you cannot use something like sequences?

    class Something {
         private static final SEQUENCE seq = getDBsequence()
    
         @id
         private final long id = seq.newNumber();
    
         private final String whateverData;
    }
    

    EDIT:The way I wrote this was kinda dumb because once you reboot the app. you'll get duplicate keys.. You should use a sequence provided by the DB. Sorry about that.