1 Reply Latest reply on Sep 27, 2008 4:27 AM by adamw

    Can an entity detect if it was loaded via Envers?

    adepue

      Envers does not yet support all relation types, and there are a few methods in my entity that could benefit if they knew the entity was loaded by Envers (oh, I'm a versioned entity loaded by Envers, so I cannot rely on that relation). Is there a way for an entity to detect when it is loaded by Envers?

        • 1. Re: Can an entity detect if it was loaded via Envers?
          adamw

          Hello,

          well ... if the relation isn't versioned, then when you read a historical entity it will be null (which cannot happen if you read it with Hibernate, as there is no way of telling if a collection should be null or empty, so it's always empty). Another "hack" would be to check if a collection that is versioned is an instance of one of Enverses proxies.

          --
          Adam