0

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?

ErstwhileIII
  • 4,829
  • 2
  • 23
  • 37

1 Answers1

0

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

Thanks.

Nikunj
  • 3,100
  • 2
  • 20
  • 19
  • The JPA specification says "Note that `SEQUENCE` and `IDENTITY` are not portable across all databases." `native` is not a value that the JPA allows. Did you mean `TABLE` or `AUTO`? – Raedwald Aug 25 '12 at 11:34