Uploaded image for project: 'Spring Data JPA'
  1. Spring Data JPA
  2. DATAJPA-589

findOne: result of fetching too many relations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 1.6.1 (Dijkstra SR1), 1.6.2 (Dijkstra SR2)
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
    • Environment:
      Spring 4.0.6 Release;Windows 8.1;maven 3;Hibernate Entity Manager 4.3.6.Final

      Description

      I have one main entity called Report. I have several entities connect to Report with @ManyToMany relations. The connection is done via extra table, i.e. with @JoinTable annotation. Each relation is lazy. I have a function that fetches the report with all its relations. now, if i do fetch by fetch (i.e mark the function as @Transcational and access to each one of the property) everything works as expected. But, if I do

      Report r = reportRepository.findOne(
        where(DomainSpecification.<Report>eager()).and(DomainSpecification.<Report>idIsEqual(id)));
      

      I get all the relations as well but one of the relation (that has been connected to another table NOT by primary key) is fetching 13823 times. This means that the length of r.getProjects() is 13823 of the same Project. I attaching here the source of DomainSpecification.java / Report.java / Project.java and Keyword.java (the keyword is just to show an example for an entity that works good with this kind of fetching). Maybe one can throw some light on this issues.

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            oak oaktree
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: