0 Replies Latest reply on Mar 9, 2009 9:01 PM by gimpy21

    Able to get a LIE even with FetchMode.JOIN

    gimpy21

      Summary: if I do a Company query just right, I can get a LIE.


      Software: Seam 2.0.2.SP1, Hibernate 3.2.6.ga, JBoss 4.2.2.GA


      Entities: Company with 1:M Contact and 1:M Address


      Setup: A typical company search page: I have a page scoped search bean that takes address, company and contact info and queries using the Criteria API. All of the company's associations to be displayed are pulled using FetchMode.JOIN. A short summary of each company gets displayed in a table after the search button is clicked. Within the short summary table, a details button will present more information in another area. When the details button is clicked and the collections are being displayed in the details area, it is then that a possible LIE is thrown.


      How to trigger LIE: searching for string value on Contact entity. I can search for company name and/or city, and all will work as expected (all collections are loaded properly in the details area). But if I search additionally (or exclusively) for a value on Contact, I get the LIE (and just for Contacts too): all the other collections are loaded properly. The SQL printout verifies that it's pulling Company.contacts on every query.


      In case it matters, Company.contact's definition:


      @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
           @JoinTable(name="company_contact",
                joinColumns={@JoinColumn(name="company_id")},
                inverseJoinColumns={@JoinColumn(name="contact_id")})
           @Sort(type=SortType.NATURAL)
           private SortedSet<Contact> contacts = new TreeSet<Contact>();
      



      I'm outta ideas and can't find prior posts on anything related. Any help is appreciated.