7 Replies Latest reply on Sep 20, 2010 9:32 AM by jb cazaux

    Audited relations lazy by default?

    Dirk Eismann Newbie

      I just realized that an entity instance loaded by the AuditReader has its audited relations set to lazy even if the FetchType on the defining entity is marked as EAGER. E.g. on an audited class Notif there's an audited relation to the audited class Country which is marked as EAGER:

       

      @Audited
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn(name = "country_id", nullable = false)
      public Country getCountry()
      {
        return this.country;
      }

       

      So - when loading a Notif object by the entityManager, the country is fetched eagerly. However, when loading a historic Notif object by using the AuditReader, the country property is an uninitialized Javassist proxy.

       

      Is there any way to make Envers respect the FetchType specified on the "original" entity?

       

      Dirk