jpa - GenerationType and MySQL Errors -


i have web form user inserts datas. there stored in database. have got problem record in db. use spring 3, jpa, eclipselink , mysql. in entity @id generated. when use strategy: generationtype.auto, generationtype.table datas not stored , error:
exception [eclipselink-4002] (eclipse persistence services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.databaseexception internal exception: java.sql.sqlexception: base table or view not found, message server: "table 'sklep.sequence' doesn't exist" error code: 1146 call: update sequence set seq_count = seq_count + ? seq_name = ?bind => [2 parameters bound]
when use generationtype.identity, generationtype.sequence, first data storing , : javax.persistence.persistenceexception: exception [eclipselink-4002] (eclipse persistence services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.databaseexception internal exception: java.sql.sqlexception: null, message server: "duplicate entry '0' key 'primary'" error code: 1062
going on? problem mysql or something? help! thanks!

you need create table sequence when using table id generation. if use eclipselink generate ddl created you. need insert row each generator name.

for identity id generation need use identity type id when creating table.

see, http://en.wikibooks.org/wiki/java_persistence/identity_and_sequencing#sequencing


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -