java - How force Hibernate create table with type Serial for primary Key -


in spring project, field id (used primary key entity classes), have annotations:

@id @column(name = "id") @generatedvalue(strategy=generationtype.auto) private integer id; 

but when hibernate create table in postgresql database, field created type integer. field created type serial. there way that?

update

i change declaration field if this:

@id @column(name = "id", columndefinition = "serial") @generatedvalue(strategy=generationtype.auto) 

and now, nothing created in database when start application blank database.

update 2

i tested configuration:

@sequencegenerator(allocationsize=1, initialvalue=1, sequencename="usuario_id_seq", name="usuario_id_seq") @generatedvalue(generator="usuario_id_seq", strategy=generationtype.sequence) @generated(generationtime.insert) @id @column(name="id", columndefinition="serial") private integer id; 

the tables created, primary key created integer, , not serial, want.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -