Bug on flushing context with modified non initialized lazy collection ( It works fine on hibernate 3.5.6 )

Description

This is a quite trick problem that only occurs on modified lazy collections that aren't initialized
( Like when you do a add() operation without any previous size() or get() or toString() ... )

I think that it will be easier to show it by a commented source.

I made a little database (with only 3 simple tables to make possible to reproduce the error.) + a maven project
The maven project have 2 file called pom33.xml and pom35.xml so it's possible to easily see how the error occurs on 3.3.2 but not on 3.5.6

the script to recreate the problem is available within the project too.

BTW the source do a rollback ( So it won't change the database ).
If you want changes on db it will be necessary to change the rollback() to commit()

Environment

This problem occurs on hibernate 3.3.2 and 3.3.1
( The latest JPA1 hibernate implementations I've found )

Activity

Show:
Hood Wilson Gusso Silva
April 16, 2012, 4:07 PM

Oh I forgot to inform that this error occurs only when we have cascade DELETE_ORPHAN.
( the exception is thrown from AbstractPersistentCollection.getOrphans() when trying to run a ForeignKeys.getEntityIdentifierIfNotUnsaved() )

Gail Badner
May 7, 2012, 6:52 PM

Is this still a problem in 4.1.3?

Hood Wilson Gusso Silva
May 8, 2012, 8:58 PM

No it works fine on 4.1.3.
It seems to be fixed on all newer versions of hibernate since 3.5.6.
Anyway I think It's quite important to have an bug free JPA 1 implementation since hibernate 4.1.3 don't work with legacy persistence-api-1.0 API.
This way software solutions stuck on persistence 1.0 (maybe for classloader hierarchy sharing inside a application service maybe for other reasons) can go on.

Gail Badner
May 8, 2012, 9:53 PM

Community 3.3.x is no longer supported.

Assignee

Gail Badner

Reporter

Hood Wilson Gusso Silva

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
Configure