Hi,
I am new and working with the tutorial(
http://www.hibernate.org/hib_docs/v3/re ... orial.html)..
I created Events table in oracle and my Event.hbm.xml is
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.novell.sankar.hibernate.test.Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="native">
<!-- <param name="sequence">queue_sequence</param> -->
</generator>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
</class>
</hibernate-mapping>
I inserted values through hibernate and able to list the values ...
Then i manually entered values in oracle and able to list the values
But i got exeception while trying to insert values after manullay inserted values in oracle..
15:21:07,968 ERROR JDBCExceptionReporter:78 - ORA-00001: unique constraint (WORKS.SYS_C0027956) violated
15:21:07,968 WARN JDBCExceptionReporter:77 - SQL Error: 1, SQLState: 23000
15:21:07,968 ERROR JDBCExceptionReporter:78 - ORA-00001: unique constraint (WORKS.SYS_C0027956) violated
15:21:07,968 ERROR AbstractFlushingEventListener:301 - 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:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
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.novell.sankar.hibernate.test.EventManager.createAndStoreEvent(EventManager.java:49)
at com.novell.sankar.hibernate.test.EventManager.main(EventManager.java:17)
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (ZENWORKS.SYS_C0027956) violated
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:602)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9350)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 9 more
Exception in thread "main" 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:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
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.novell.sankar.hibernate.test.EventManager.createAndStoreEvent(EventManager.java:49)
at com.novell.sankar.hibernate.test.EventManager.main(EventManager.java:17)
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (ZENWORKS.SYS_C0027956) violated
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:602)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9350)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 9 more
my question is after manually entering values in oracle whether the hibernate won't update the counter(event_id) values in session??
Then ..i recreated the table and manually inserted the values thn i tried to insert values through hibernate then also i got the same error..
Pls explain me the behaviour of hibernate.....
Regards
Sankar..