ConstraintViolationException « Insert « JPA Q&A





1. Random fired ConstraintViolationException at row insertion?!    forum.hibernate.org

Hello i have made a jsp page that uses a simple hibernate code. its so simple that i doesnt differ from that in documentation. its a basic call to session.save with opening transaction prior to that. The page shows a form that contains input fields that match those in the db table. Most of the times it works fine. But sometimes ...

2. ConstraintViolationException problem at db insert    forum.hibernate.org

nCarId nCompanyId dAmount .... 1 1 0.0 ...

3. ConstraintViolationException: could not insert, but I dont't    forum.hibernate.org

I alwaya get this exception: Code: exception javax.servlet.ServletException: could not insert: [beans.Maschinendaten] javax.faces.webapp.FacesServlet.service(FacesServlet.java:154) root cause org.hibernate.exception.ConstraintViolationException: could not insert: [beans.Maschinendaten] org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40) org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158) org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638) org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48) org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298) org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181) ...