mysql hibernate

51 views
Skip to first unread message

Konstantin

unread,
Jan 21, 2011, 3:36:57 AM1/21/11
to resthub-dev
Hello
I start learning resthub few days ago (so assume that my question is
stupid :))
I have problem with switching to Mysql from h2.
Here is error log:
[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))

I think problem is in generated keyword. But 'id' field is defined in
Resource, not sure how to change it in my entities. Or is there some
better approach?

Florian Traverse

unread,
Jan 21, 2011, 6:33:47 PM1/21/11
to resth...@googlegroups.com
Hello ! And welcome in the RestHub Community :)

Have you checked your database user's rights, and are you sure it is allowed to create tables?

An "id" field should work perfectly in any Mysql database I know, so this is the best guess I have with the amount of information you gave us ;)

If this isn't user's right, then I think we'll need more details

Regards,
Florian
2011/1/21 Konstantin <konstantin...@gmail.com>

Konstantin

unread,
Jan 21, 2011, 6:43:06 PM1/21/11
to resthub-dev
If i understand correctly, problem is that mysql don't understand
"generated by default" part of query.
Not sure, maybe it is possible to add annotation @GeneratedValue with
some specific value to make it working. But i can't override this
annotation for getId() from Resource class.

PS: user have correct rights, as if i create table beforehand - it
works fine.
Reply all
Reply to author
Forward
0 new messages