2 Replies Latest reply on Oct 21, 2009 5:35 AM by gacsal

    Problems with polymorphic queries with SINGLE_TABLE inherita

      Hello!

      I'm running on envers 1.2.1 and Hibernate 3.3.2.
      My inheritance strategy is SINGLE_TABLE (discrim).

      I have two problems, when running polymorphic queries against the auditreader:

      1. query for parentTypes does not instantiate childtypes

      I get wrong types instantiated in the result.
      The testcase "\src\test\java\org\hibernate\envers\test\integration\inheritance\single\ChildAuditing.java"
      passes, but when I change the two sides of the equals method in testPolymorphicQuery()'s second assert the testcase fails, because
      the expected result is a ChildEntity, but in the result we get an instance of ParentEntity.

      your assert (passes)

      assert getAuditReader().createQuery().forEntitiesAtRevision(ParentEntity.class, 1).getSingleResult().equals(childVer1);


      my assert (fails)
      assert (childVer1).equals(getAuditReader().createQuery().forEntitiesAtRevision(ParentEntity.class, 1).getSingleResult());


      2. problems with abstract entities

      Similar to the defect with private constructors (http://opensource.atlassian.com/projects/hibernate/browse/HHH-3736) the queries for abstract entities fail with NullPointerException.

      Probably both problems should be fixed in the method EntityInstantiator.createInstanceFromVersionsEntity.