[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5492) PostInsertListener doing new insert works on Mysql/HSQLDB, but not on Oracle.

Barry (JIRA) noreply at atlassian.com
Fri Aug 20 10:22:41 EDT 2010


PostInsertListener doing new insert works on Mysql/HSQLDB, but not on Oracle.
-----------------------------------------------------------------------------

                 Key: HHH-5492
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5492
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.4
         Environment: Oracle Database 10g Express Edition Release 10.2.0.1.0 and Oracle Database 11g Release 11.1.0.0.0
            Reporter: Barry
         Attachments: EventListener-test.zip

I'm trying to implement a hibernate event listener that inserts a new record every time a specific entity is updated, deleted or inserted. I've implemented a listener for post-insert, post-update, post-delete. Its a requirement that the new record is inserted in the same transaction as the one that originally triggered the update/deletion/insert.

The relevant section of my listener looks like this (similar for postInsert & postDelete):
{code}
    public void onPostUpdate(PostUpdateEvent event) {
        if (isAuditable(event.getEntity())) {
            saveAuditRecord(event.getSession());
        }
    }

    private boolean isAuditable(Object entity) {
        return entity instanceof SomeEntity;
    }

    private void saveAuditRecord(Session session) {
        AuditRecord record = new AuditRecord();
        record.setId(Double.doubleToLongBits(Math.random()));
        session.save(record);
    }
{code}

The listener is triggered for each event, but it seems as though the AuditRecord is not saved when using an Oracle database. Using MySQL or HSQLDB works fine. So my guess is that it has something to do with the Oracle dialect?

I've attached a test case which demonstrates it failing (but you will need to connect to an Oracle DB :-)) Same result for Oracle XE and the full monty.



-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list