8 Replies Latest reply on Feb 22, 2010 11:31 AM by gauchoproluanco

    Revision Entity timestamp datatype Long

    bestage

      Hi,

      currently envers uses Long Type for timestamp.
      What was actually the reason for that?

      In my particular case Hibernate requires BIGINT(8) on DB2 Linux in order to persist java type Long. On DB2 Host(OS390) there is no BIGINT(8) yet, at least in the version we have.

      Now I have found this patch:
      http://opensource.atlassian.com/projects/hibernate/browse/HHH-4540

      @Adam: will this patch make it into the new version? If not, is there any workaround around this issue?

        • 1. Re: Revision Entity timestamp datatype Long
          adamw

          Hello,

          I've applied the patch and uploaded a snapshot version to the jboss maven2 repository.

          However, take care when mapping the revision column, not to loose precision - for example using @Temporal(DATE) is wrong, as you loose the time, so all revisions at one day would appear to happen at that same time. So either TIMESTAMP or using long/Long is best.

          Adam

          • 2. Re: Revision Entity timestamp datatype Long

            Hi guys,

            I'm trying to configure my revision class with @RevisionTimestamp@Temporal(TemporalType.TIMESTAMP)private Date data;
            but i'm still getting the "@RevisionTimestamp must be of type long or Long" error and then i saw this thread. Does that patch you mentioned up there, is applicable to the version Envers1.2.1.GA-hibernate-3.3 ??? If so how should i proceed? otherwise how could I make it work using this version?

            t.i.a

            • 3. Re: Revision Entity timestamp datatype Long
              adamw

              Hello,

               

              could you try version 1.2.2.GA-hibernate-3.3?

               

              Adam

              • 4. Re: Revision Entity timestamp datatype Long

                Hi Adam,

                when changing to version 1.2.2, the last error was fixed, but there comes another one "Type not supported: org.hibernate.type.ManyToOneType"
                any idea?
                t.i.a.

                • 5. Re: Revision Entity timestamp datatype Long
                  adamw

                  Well, not really, you gave very little information .

                  Do you have a many-to-one relation in your primary key?

                   

                  Adam

                  • 6. Re: Revision Entity timestamp datatype Long

                    yes I do.

                    @ManyToOne(cascade={}, fetch=FetchType.LAZY)
                    @JoinColumn(name="OID_COD_REMESSA", referencedColumnName="OID_COD_REMESSA")
                    public Remessa getRemessa() {
                       return remessa;

                    }

                     

                    Well, i've just decided to use Long as the date type.

                    Thanks Adam... I'll post something about it(date type) later.

                    • 7. Re: Revision Entity timestamp datatype Long
                      adamw

                      Relations in the primary key are not currently supported (not sure about JPA2, but so far it was a Hibernate-only feature, not included in JPA).

                      So this won't work unfortunately.

                       

                      Adam

                      • 8. Re: Revision Entity timestamp datatype Long

                        Hi get boa!

                         

                        I 've seen that you have implemented your own revision entity. I'm trying to doing the same, but when jboss start to deploy my webapp I get an ArrayStoreException.

                         

                        Any idea?

                         

                        Thanks in advance