resthub hibernate mysql id generated error

422 views Asked by At

I'm trying to use Mysql database instead of H2 for a simple resthub project, but I get a runtime error.

I get next error, when it tries create table:

[INFO] [SchemaExport.java:226] Running hbm2ddl schema export
[INFO] [SchemaExport.java:251] exporting generated schema to database
[ERROR] [SchemaExport.java:348] Unsuccessful: create table SampleResource (id bigint generated by default as identity, name varchar(255), primary key (id))

As I understand i need to somehow set annotation to id field. But the problem is that this field is already set in class that i'm extending (Resource.class).

PS: is

@GeneratedValue(strategy=GenerationType.IDENTITY) 

correct way to set it for mysql?

1

There are 1 answers

1
Nikunj On

I think MySql does not support IDENTITY type generator. Try using native. It will select what is appropriate to MySql.

Thanks.