3 Replies Latest reply on Jun 7, 2008 1:23 PM by Adam Warski

    Create versioned entities groups [ENVERS-6]

    Alejandro Montenegro Novice

      I was thinking a little bit about how to implement this feature. The RevisionEntity annotation could have a name and possibility to define if its default (a boolean). The name so I can associate an Entity with an RevisionEntity, adding an attribute to the @Versioned indicating to what RevisionEntity the Entity is associated, if none is indicated it's associated to the default.
      The default for the Entities that are not associated to a specific RevisionEntity would be associated to the default RevisionEntity

      What do you think about it?

        • 1. Re: Create versioned entities groups [ENVERS-6]
          Adam Warski Master

          Hello,

          yes, I think that would be a good way. If I understand you correctly, your name is my group name? :) But I think that a "default" field is not necessary - an empty name (which would be the default value for the name attribute in @Versioned and @RevisionEntity) could take that role.

          One more thing ... there is a possibility that you don't mark the whole entity with @Versioned, but only individual fields (if you don't want everything to be versioned). And when you do so, where do you put the information about the group name? Maybe it would make sense then to have an additional @VersionedGroup annotation, which would always be at the class level? What do you think?

          --
          Adam

          • 2. Re: Create versioned entities groups [ENVERS-6]
            Alejandro Montenegro Novice

             

            "adamw" wrote:
            Hello,
            yes, I think that would be a good way. If I understand you correctly, your name is my group name? :)


            Yes, name == group name

            "adamw" wrote:

            But I think that a "default" field is not necessary - an empty name (which would be the default value for the name attribute in @Versioned and @RevisionEntity) could take that role.


            Ok, but then Envers should restrict that there can only be one @RevisionEntity without a name (kind of obvious :S). What about if there is an Entity without a group name and no default @RevisionEntity, should this Entity be associated with any @RevisionEntity, or should it throw an exception?
            I like the second option

            "adamw" wrote:

            One more thing ... there is a possibility that you don't mark the whole entity with @Versioned, but only individual fields (if you don't want everything to be versioned). And when you do so, where do you put the information about the group name? Maybe it would make sense then to have an additional @VersionedGroup annotation, which would always be at the class level? What do you think?

            --
            Adam


            I like this idea, again if the @VersionedGroup is not set, then associate it with the default and if default doesn't exist throw an exception.

            If you're agree I will start working on it.

            • 3. Re: Create versioned entities groups [ENVERS-6]
              Adam Warski Master

              Hello,

              sounds great :). I also think that an exception should be thrown when no @VersionedGroup is set, and there is no @RevisionEntity with an empty group name.

              Let me know if you'd need any help.

              --
              Adam