I use play! framework 2.0 and postgresql.
in my db there is users table and every user ofcourse has a unique id.
so I defined it as serial.
my question is: how to represent a field which it’s data type is serial
in my java project.
p.s. I understood play! framework uses Hibernate annotation
From the PostgreSQL documentation, the
SERIALtype is equivalent to an ìnteger` with a sequence, so:is equivalent to specifying:
The
@IdJPA annotation on theLongtype will provide a sequence (equivalent toAUTO_INCREMENTin MySQL).So, in you class, just use: