[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-679) Entity whose related entity collection is updated causes loading of @ContainedIn entities

Adam Harris (JIRA) noreply at atlassian.com
Thu May 19 11:00:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42352#action_42352 ] 

Adam Harris commented on HSEARCH-679:
-------------------------------------

I'm running Hibernate Search 3.4.0.Final with Hibernate Core 3.6.3.Final, and this doesn't appear to be fixed.  Perhaps I have another corner-case that isn't accounted for in this patch.

Here is my model:

public class A {
   @Field
   private String name;

   @ContainedIn
   private Collection<B> b;

   private A parent;  // Not indexed
   private Collection<A> children;  // Not indexed
}

public class B {
   @IndexEmbedded
   private A a;
}

USE CASE #1
If I add a new instance of B to A's collection, the only change to A is the row version is incremented.  This not only leads to Hibernate Search updating the index for A, but then it cascades to all of the B's in the collection even though there is nothing to change.

USE CASE #2
In addition, if I add a new instance of A to A's "children" collection (which this hierarchy isn't even represented in the index), it performs all the same index updates as USE CASE #1.  

For simplicity, I've eliminated some other classes that are referenced in class B, but this problem results in an explosion of objects being unnecessarily loaded from the DB and indexes updated with zero new information.


> Entity whose related entity collection is updated causes loading of @ContainedIn entities
> -----------------------------------------------------------------------------------------
>
>                 Key: HSEARCH-679
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-679
>             Project: Hibernate Search
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 3.2.1, 3.3.0.Final
>         Environment: Hibernate 3.6.1-SNAPSHOT/Hibernate Search 3.4.0-SNAPSHOT and Hibernate 3.5.6/Hibernate Search 3.2.1
>            Reporter: Tom Waterhouse
>            Assignee: Sanne Grinovero
>             Fix For: 3.4.0.CR2
>
>         Attachments: HSEARCH-679-test-updated.zip, HSEARCH-679-test.zip, HSEARCH-679.zip
>
>
> This problem seems related to HSEARCH-361.  An entity that references another entity as @ContainedIn is causing the load of entities related to the other entity.  
> Using the model below, the update of the collection of D instances in the class C causes the load of related classes B and A.
> {code}
> public class A {
>    @Field
>    private String name;
>    @IndexEmbedded
>    private B
> }
> {code}
> {code}
> public class B {
>    @ContainedIn
>    private A a;
>    @IndexEmbedded
>    private C c;
> }
> {code}
> {code}
> public class C {
>    @ContainedIn
>    private Collection<B> b;
>    // NOT INDEXED
>    private Collection<D> d;
> }
> {code}
> {code}
> public class D {
>    public String value;
> }
> {code}

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