[hibernate] probleme avec IDENTITY_INSERT
salut,
j'essaie d'insérer des données dans une base de données mais je recois l'erreur suivante en exécutant le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Exception in thread "main" org.hibernate.exception.ConstraintViolationException: could not insert: [com.cdvm.model.depositaire.Depositaire]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2263)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:52)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.cdvm.utilities.HibernateDaoSupport.save(HibernateDaoSupport.java:22)
at com.cdvm.dao.impl.DepositaireManagerImpl.saveDepositaire(DepositaireManagerImpl.java:11)
at com.cdvm.test.Test.test1(Test.java:21)
at com.cdvm.test.Test.<init>(Test.java:13)
at com.cdvm.test.Test.main(Test.java:31)
Caused by: java.sql.SQLException: Impossible d'insérer une valeur explicite dans la colonne identité de la table 'DEPOSITAIRE' quand IDENTITY_INSERT est défini à OFF.
at net.sourceforge.jtds.jdbc.SqlMessage.toSQLException(SqlMessage.java:392)
at net.sourceforge.jtds.jdbc.SQLWarningChain.addOrReturn(SQLWarningChain.java:91)
at net.sourceforge.jtds.jdbc.Tds.goToNextResult(Tds.java:752)
at net.sourceforge.jtds.jdbc.TdsStatement.getMoreResults(TdsStatement.java:710)
at net.sourceforge.jtds.jdbc.TdsStatement.executeCallImpl(TdsStatement.java:302)
at net.sourceforge.jtds.jdbc.TdsStatement.internalExecuteCall(TdsStatement.java:282)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.execute(PreparedStatement_base.java:136)
at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeUpdate(PreparedStatement_base.java:290)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2243)
... 15 more |
j'aimerais savoir la cause de cette erreur
merci pour votre aide