7 Replies Latest reply on Nov 1, 2012 9:02 AM by Adam Warski

    EntityNotFoundException after AuditReaderFactory.get(...)

    Yury T Newbie

      I have:

       

      @Table(name = "TARIFFS")

      @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

      public class Tariff

          @OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "tariff")

          private Set<TariffEntry> entries;

      }

       

      @Table(name = "TARIFF_ENTRIES")

      @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)

       

      public class TariffEntry {

          // I tried to use RelationTargetAuditMode.AUDITED for this field, with same result

          @ManyToOne

          @JoinColumn(name = "TARIFF_ID", referencedColumnName = "TARIFF_ID", insertable = true, updatable = true, nullable = false)

          private Tariff tariff;

      }

       

      I want to get history via AuditReaderFactory, but getting exception:

      "EntityNotFoundException: Unable to Tariff with id 682"

      I sure that Tariff with id=682 exist in table TARIFFS and exist record in table TARIFFS_AUD

       

      What am I doing wrong?