Name and version of the database you are using: mysql 5
Hibernate version: 3
Mapping documents:
<hibernate-mapping>
<class name="buildlistbytype.Debat" table="debat">
<id name="id" type="java.lang.Integer" column="id">
<generator class="increment"/>
</id>
<property name="description" column="description"/>
<list name="lstLiensSeance">
<key column="id"/>
<list-index column="list_index"/>
<one-to-many class="buildlistbytype.Passage"/>
</list>
</class>
<class name="buildlistbytype.Passage" table="debat_action" discriminator-value="PASSAGE">
<id name="id" type="java.lang.Integer" column="id">
<generator class="increment"/>
</id>
<discriminator column="action_type" type="java.lang.String"/>
<property name="datePassage" column="datePassage"/>
<subclass name="buildlistbytype.PassageCommission" discriminator-value="PASSCOM">
<property name="intitule" column="intituleCom"/>
</subclass>
<subclass name="buildlistbytype.PassageConference" discriminator-value="PASSCONF">
<property name="nbMembres" column="nb_membres_conf"/>
</subclass>
<subclass name="buildlistbytype.PassageSeance" discriminator-value="PASSSEANCE">
<property name="ordreJour" column="ordre_jour_seance"/>
</subclass>
</class>
</hibernate-mapping>
PassageConference, PassageCommission and PassageSeance are inherited from Passage. These 4 classes are differents actions that can be done on Debat (= debate, political discussion).
Code between sessionFactory.openSession() and session.close():
Debat deb=new Debat();
Session session=HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
session.save(deb);
session.getTransaction().commit();
HibernateUtil.getSessionFactory().close();
Full stack trace of any exception that occurs:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:93)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:79)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at buildlistbytype.Main.main(Main.java:35)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
Tables description :
sorry the tables names are in french
I have two tables : -debat (in english, debate or political discussion)
-debat_action, this one contains actions about the debate. If a debate is asked by a politician, it will be an new entry in this table. If a debate is evacuated, it will be another entry in this table for the debate.
I hope my explanation of the problem is quiet clear.
Thank you for helping
Bye
|