annotations - Auto Increment A Column With Hibernate -


i have situation need increment non primary key column upon insert of every new record. column not primary key. has unique constraint. how can use hibernate annotations accomplish auto increment of particular column? know can done quite primary keys, want same thing done non primary key column (meaning without using @id annotation?)

--thanks

as far can see, can use hibernate specific annotation @generated. field this:

@generated(value="generationtime.insert") @genericgenerator(name="fieldgenerator", strategy="sequence") private x field; 

you can read different types of strategies here.

i'm 90% sure should work. if doesn't let me know.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -