The scenario is like I have a page where I can create a new entity, the first time when I create the entity it works fine with a particular code which is a Unique key on the table, then I tried to create a new entity with a different code that also worked fine. But when I tried to change the code of second entity to the same as that of the first one, in my *validate method* which tries to *find* whether there any enitity with such a code, it gives the follwoing stack trace. This is happening before the save is called also if I try to refresh the page after the error occurs it works fine and gives a proper validation failed message.
Hibernate version:3.2
Full stack trace of any exception that occurs:
ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:954)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1099)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
Name and version of the database you are using:Oracle 10g R2
The generated SQL (show_sql=true):
2006-11-16 16:15:20,660 [SQL] [181-Processor24] DEBUG - update prashant.POSITION set NUMBER_IN_ORG=?, POSITION_CODE=?, TITLE=?, LANGUAGE=?, COST_CODE=?, START_DATE=?, END_DATE=?, BUDGETED=?, WORK_SCHEDULE=?, JOB_CODE=?, FLSA_EXEMPT=?, SOURCE_SYS_REF_KEY=?, LOCATION=?, CUSTOM_FIELD_VALUE_ID=?, ORGANIZATION_ID=?, EEO_CATEGORY_ID=?, SALARY_GRADE_ID=?, POSITION_TYPE_ID=?, JOB_FAMILY_ID=?, POSITION_OPENING_TEMPLATE_ID=?, AUDIT_TRAIL_ID=? where ID=?
|