[
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-605?pag...
]
Kyrill Alyoshin commented on HSEARCH-605:
-----------------------------------------
Yes, I think we're talking about the same thing. I realize that whenever a child
entity is modified, Hibernate Search will behind the scene fetch its parent to reindex it.
I realize it. I just thought that having to manually remove a given child from the
collection inside the parent may be too restrictive. I probably should go and submit a
patch in the documentation to clearly state that, "if the child is going to be
deleted, it must be manually removed from the collection inside the parent for the index
to be updated".
This requirement did catch me by surprise, I must say... It is so easy to introduce
asymmetry between what's in the DB and what's in the index. Think about it...
@ContainedIn does not work on deletes.
--------------------------------------
Key: HSEARCH-605
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-605
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 3.2.1
Reporter: Kyrill Alyoshin
So, let's say we have a @Indexed entity Vendor (the parent) that is in a
bi-directional @OneToMany relationship with entity Address (the child). Vendor maps the
collection of Address'es as @IndexedEmbedded. Address is NOT @Indexed but does map its
parent vendor association as @ContainedIn.
Whenever Address entity is retrieved and session.delete'ed, the parent Vendor's
index is NOT updated. Everything works fine with update operations.
This obviously happens because the collection of addresses in parent vendor still
contains the deleted address. (If the deleted address is manually removed from collection,
everything works fine).
Now... I realize that it is not in Hibernate style to automatically severe the
association when a child entity is deleted. However, it seems that Hibernate Search should
provide such functionality. This does lead to very subtle, hard to diagnose bugs. I assume
when Vendor's collection is flushed it is fairly trivial to detect which addresses
have been deleted and which not (inside the listener).
--
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