Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-1040

Integration tests fail for RooDbManaged Entity with RooEntity(identifierType = String.class)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.1.0.M2
    • Fix Version/s: 1.1.0.RC1
    • Component/s: TESTING
    • Labels:
      None

      Description

      Integration test generated from a database reengineered Entity with a primary key of type string currently fail with:

      org.springframework.orm.jpa.JpaSystemException: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String; nested exception is javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String

      Solution: remove

      @GeneratedValue(strategy = GenerationType.AUTO)
      

      from the field annotated with @ID for privileged aspect Whatever_Roo_Entity

      and make sure the primary key is set to something useful before the entity is persisted, e.g

      @Entity
      @RooJavaBean
      @RooToString
      @RooEntity(identifierType = String.class, identifierField = "securityquestionId", identifierColumn = "securityquestion_id")
      @RooDbManaged
      @Table(name = "t_securityquestion")
      public class TSecurityquestion {
      
          @PrePersist
          public void generateSecurityQuestionId() {
      	setSecurityquestionId(java.util.UUID.randomUUID().toString());
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stewarta Alan Stewart
                Reporter:
                andams An Dams
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: