Spring Roo
  1. Spring Roo
  2. ROO-83

Integration test does not support entities which have timestamps as version

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.0.M1
    • Fix Version/s: 1.0.0.M2
    • Component/s: TESTING
    • Labels:
      None

      Description

      If an entity has a timestamp field specified as the versioning field (the field is annotated with @Version) then the generated integration test has a compile error as it compares obj.getVersionTimestamp() > currentVersion (assuming the annotated timestamp field is called versionTimestamp). Instead if the version field is a timestamp the comparison should presumably be made using obj.getVersionTimestamp().after(currentVersion).

        Activity

        Hide
        Ben Alex added a comment -

        Fixed in SVN revision 98 and 99 using approach suggested above.

        Tested with the following entity:

        @RooEntity
        @RooJavaBean
        @RooToString
        public class TheData {

        @javax.persistence.Version
        @javax.persistence.Column(name = "UPDATE_DATE", nullable = false)
        @javax.persistence.Temporal(javax.persistence.TemporalType.TIMESTAMP)
        @NotNull
        private Date updateDate;

        @NotNull
        private String someString;

        public Date getUpdateDate()

        { return updateDate; }

        public void setUpdateDate(Date updateDate)

        { this.updateDate = updateDate; }

        }

        Tests pass:

        -------------------------------------------------------
        T E S T S
        -------------------------------------------------------
        Running com.foo.TheDataIntegrationTest
        Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.573 sec

        Normal operation tested using script clinic.roo and tests pass.

        Show
        Ben Alex added a comment - Fixed in SVN revision 98 and 99 using approach suggested above. Tested with the following entity: @RooEntity @RooJavaBean @RooToString public class TheData { @javax.persistence.Version @javax.persistence.Column(name = "UPDATE_DATE", nullable = false) @javax.persistence.Temporal(javax.persistence.TemporalType.TIMESTAMP) @NotNull private Date updateDate; @NotNull private String someString; public Date getUpdateDate() { return updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } } Tests pass: ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.foo.TheDataIntegrationTest Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.573 sec Normal operation tested using script clinic.roo and tests pass.

          People

          • Assignee:
            Ben Alex
            Reporter:
            Chris Messina
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: