Hi,
I am developing an application using JPA 2.1 and org.eclipse.persistence.jpa.PersistenceProvider but on running the application it is giving following error:
seLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclip se.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist Error Code: 1146 Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [2 parameters bound] Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_ COUNT + ? WHERE SEQ_NAME = ?") [WARNING] java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:724) Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v2 0130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: T able 'jpa.sequence' doesn't exist Error Code: 1146 Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [2 parameters bound] Query: DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_ COUNT + ? WHERE SEQ_NAME = ?") at org.eclipse.persistence.exceptions.DatabaseException.sqlException(Dat abaseException.java:331) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.exec uteDirectNoSelect(DatabaseAccessor.java:895) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.exec uteNoSelect(DatabaseAccessor.java:957) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basi cExecuteCall(DatabaseAccessor.java:630) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.exec uteCall(DatabaseAccessor.java:558) at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecut eCall(AbstractSession.java:1995) at org.eclipse.persistence.sessions.server.ClientSession.executeCall(Cli entSession.java:296) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism .executeCall(DatasourceCallQueryMechanism.java:242) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism .executeCall(DatasourceCallQueryMechanism.java:228) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism .executeNoSelectCall(DatasourceCallQueryMechanism.java:271) at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism .executeNoSelect(DatasourceCallQueryMechanism.java:251) at org.eclipse.persistence.queries.DataModifyQuery.executeDatabaseQuery( DataModifyQuery.java:85) at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.j ava:899) at org.eclipse.persistence.internal.sessions.AbstractSession.internalExe cuteQuery(AbstractSession.java:3207) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuer y(AbstractSession.java:1797) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuer y(AbstractSession.java:1779) at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuer y(AbstractSession.java:1744) at org.eclipse.persistence.sequencing.QuerySequence.update(QuerySequence .java:340) at org.eclipse.persistence.sequencing.QuerySequence.updateAndSelectSeque nce(QuerySequence.java:277) at org.eclipse.persistence.sequencing.StandardSequence.getGeneratedVecto r(StandardSequence.java:71) at org.eclipse.persistence.sequencing.DefaultSequence.getGeneratedVector (DefaultSequence.java:163) at org.eclipse.persistence.sequencing.Sequence.getGeneratedVector(Sequen ce.java:257) at org.eclipse.persistence.internal.sequencing.SequencingManager$Preallo cation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:468) at org.eclipse.persistence.internal.sequencing.SequencingManager.getNext Value(SequencingManager.java:1067) at org.eclipse.persistence.internal.sequencing.ClientSessionSequencing.g etNextValue(ClientSessionSequencing.java:70) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequ enceNumber(ObjectBuilder.java:359) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequ enceNumber(ObjectBuilder.java:318) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.assignSequen ceNumber(UnitOfWorkImpl.java:484) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNotR egisteredNewObjectForPersist(UnitOfWorkImpl.java:4284) at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.r egisterNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:518) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewO bjectForPersist(UnitOfWorkImpl.java:4229) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(Entity ManagerImpl.java:496) at net.roseindia.AppTest.main(AppTest.java:31) ... 6 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa .sequence' doesn't exist at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC onstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja va:1734) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java :2019) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java :1937) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java :1922) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.exec uteDirectNoSelect(DatabaseAccessor.java:885) ... 37 more [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.075s [INFO] Finished at: Mon Nov 25 17:35:20 IST 2013 [INFO] Final Memory: 14M/34M
Let's know the solution of this.
Thanks
Hi,
Since you are using MySQL and your field is autoincrement you should add the following entry in your entity class:
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id;
Thaks
Ads