Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-1793

CriteriaObjectInitializer causes too many object loads in cross hierarchy queries

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.0.Beta1
    • Component/s: None
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

      Description

      When executing the following query:

      final QueryBuilder builder = fullTextSession
      		.getSearchFactory()
      		.buildQueryBuilder()
      		.forEntity( Object.class )
      		.get();
      
      Query query = builder.all().createQuery();
      List<?> results = fullTextSession
      		.createFullTextQuery( query, Object.class )
      		.list();
      

      Then too many objects will be loaded from the database. Specifically, for each entity type, a statement with all the ids returned from the index will be issued, rather than one statement per entity type with only those ids matching the entity type.

      Matters get worse when different id types are involved. This will cause ClassCastException when binding e.g. Long ids obtained from the index to statements for fetching entities with an Integer id.

      When working with different id property names, I'm also randomly seeing {{QueryException}}s caused by rendering statements for one entity with the property name from another entity.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                gunnar.morling Gunnar Morling
                Reporter:
                gunnar.morling Gunnar Morling
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: