hibernate - ID auto generation for MySQL on JBoss AS 7 -



hibernate - ID auto generation for MySQL on JBoss AS 7 -

i need help resolve such problem. application needs back upwards several db (mysql, oracle). after migration jboss 7 entity id auto generation broken. etity example:

@entity @table(name="foo") public class foo { private integer id; private string model; @id @sequencegenerator(name="foo_seq_gen", sequencename="foo_0", initialvalue=1, allocationsize=1) @column(name="id", updatable=false) @generatedvalue(generator = "foo_seq_gen") public integer getid() { homecoming id; } public void setid(integer id) { this.id = id; } @column(name="model", length=64, updatable=false) public string getmodel() { homecoming model; } public void setmodel(string model) { this.model = model; } }

for oracle works fine. when trying perform create operation on mysql next error occures:

15:34:56,290 error [org.hibernate.util.jdbcexceptionreporter] (http-localhost-127.0.0.1-8080-1) table 'scheme.foo_0' doesn't exist

thus mysql tries access non-existent table sequence instead of using native autogeneration mechanism.

does know cure?

using "table" generator strategy didn't help.

environment:

mysql 5.5.16; jboss 7.1.0.beta1; hibernate 3.6.1.

thanks.

i' not sure if need @sequencegenerator oracle, jboss 7.1.0.cr1b , mysql have no problems id auto generation , annotations:

@id @generatedvalue(strategy=generationtype.auto) private long id;

mysql hibernate jboss7.x

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -