java - Hibernate wrong generate auto id increment -
i not sure happened 1 day hibernate started wrong generate auto id in osoba.
what mean when add person(osoba) gets id 60, next 1 gets 64 should 61... how can fix that? increment 1 no 4 or other now... how can "reset" id value? clean whole table, , start counting id 1
<class name="osoba" table="daneosobowe"> <id name="id" type="int" column="id"> <generator class="native"/> </id>
public class osoba implements interface { private int id; private string imie; private string nazwisko; private string email; private string telefon; private string uczelnia; private string doswiadczenie; private string skadslyszal; private list zainteresowania = new arraylist(); public osoba(){ // domyslny } // konstruktor zeby mozna bylo sobie w jednej linijce dodawac osobe public osoba(string imie1, string nazwisko1, string telefon1, string email1, string uczelnia1, string doswiadczenie1, string skadslyszal1 ){ this.imie = imie1; this.nazwisko = nazwisko1; this.email = email1; this.telefon = telefon1; this.uczelnia = uczelnia1; this.doswiadczenie = doswiadczenie1; this.skadslyszal = skadslyszal1; }
using annotations -
@id @generatedvalue(strategy=generationtype.sequence, generator="course_seq") @sequencegenerator( name="course_seq", sequencename="course_sequence", allocationsize=1 ) private int id;
allocation size of 1 increment 1.
Comments
Post a Comment