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

Description

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):

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.

Environment

Oracle Database 10g Express Edition Release 10.2.0.1.0 and Oracle Database 11g Release 11.1.0.0.0

Activity

Show:
Barry
December 1, 2010, 3:52 PM

I forgot to mention that the database driver I was using was ojdbc 10.1.0.5.0 (and same with 10.2.0.5.0)

Anyway, I managed to get around this issue by using a PreInsertEventListener instead. In the pre insert stage I register a transaction synchronization to do the actual work (I still want it to happen post-insert). This seems to work.

Brett Meyer
April 7, 2014, 5:43 PM

In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.

If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.

Thank you!

Brett Meyer
July 8, 2014, 3:11 PM

Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!

Rejected

Assignee

Unassigned

Reporter

Barry

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major