executeUpdate (Query object) on entity that have joined-subclass, perform an immediate
commit (updates commits before calling transaction.commit() )
----------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-4746
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4746
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.2, 3.2.7, 3.2.3
Environment: MySql 5.1, hibernate-3.3.2.GA (hibernate-core-3.2.3.ga,
hibernate-3.2.7.ga)
Reporter: Pierpaolo Moio
Attachments: testCase.rar
I'm using the following statements:
*SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();*
*try {*
*sessionFactory.getCurrentSession().beginTransaction();*
*Query q = sessionFactory.getCurrentSession().createQuery("update SceneElement
sceneElement set*
*sceneElement.sequence=(-1)*sceneElement.sequence where
sceneElement.scene.id=?").setParameter(0, 144);*
*q.executeUpdate();*
*if (true) throw new RuntimeException("I'm forcing exception: I want you
rollback!");*
*// unreacheable statement !!*
*sessionFactory.getCurrentSession().getTransaction().commit();*
*}catch (Throwable e) {*
*sessionFactory.getCurrentSession().getTransaction().rollback();*
*e.printStackTrace();*
*} finally {*
*sessionFactory.getCurrentSession().close();*
*}*
The Entity *SceneElement* contains two *joined-subclass*.
This is a snippet of hibernate sql output (hibernate use temporary table on mysql):
*update scene_element set sequence=-1*sequence where ( id ) IN ( select id from
HT_scene_element )*
This update *commit outside the transaction*, so I can't rollback in case of
exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira