In a Transaction, Delete on unindexed entities referenced by indexed entities with ContainedIn throw LazyInitializationException

Description

Delete on unindexed entities referenced by indexed entities with ContainedIn annotation failed.

On PostCommit Transaction, I get a LazyInitializationException on the collection with the ContainedIn annotation.

I upload a test case to reproduce this, run the Boot class.

1/ Entity2 is not lacking @DocumentId, I read the doc again and again (my english is very poor, but ...) : "In fact since the 3.1.0 release of Hibernate Search @DocumentId is optional in the case where an @Id annotation exists."
2/ Entity2 is not lacking @IndexedEmbedded, see the "entity1" association.
3/ From Hibernate Entity Manager Doc : "In an EXTENDED persistence context, all read only operations of the entity manager can be executed outside a transaction (find(), getReference(), refresh(), and read queries). Some modifications operations can be executed outside a transaction, but they are queued until the persistence context join a transaction. This is the case of persist(), merge(), remove(). Some operations cannot be called outside a transaction: flush(), lock(), and update/delete queries.". This is the case of the attached test. I attach a second testcase with all the operation in a transaction, the result is the same.
4/ I check 3.1.1-GA, the problem occurs alway.
5/ All the operation are in a transaction.

Please read and run my testcase and if I missuse hibernate say me where.

I can't reopen the bug HSEARCH-342, I open a new bug because the resolution of the bug don't resolve this problem.

Thank you.

Attachments

2

Activity

Show:

Emmanuel Bernard April 9, 2010 at 5:35 PM

Ah I managed to reproduce and fix

Emmanuel Bernard April 8, 2010 at 2:12 PM

I can't reproduce on 3.2. Assuming it's fixed.

Grégoire Rolland July 2, 2009 at 5:47 PM

This is the test case for the 3/.

Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Priority

Created July 2, 2009 at 5:46 PM
Updated July 1, 2010 at 12:38 PM
Resolved April 9, 2010 at 5:37 PM