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

perform test fail with OneToOne relationship

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.0.M3
    • Fix Version/s: 1.1.0.RC1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Fedora 13 + sts-2.5.0.M3

      Description

      I created a new roo project and performed the following commands

      persistence setup --provider HIBERNATE --database POSTGRES --databaseName db --userName user --password pass
      
      entity --class ~.domain.Person --testAutomatically
      field string --fieldName firstName --notNull 
      field string --fieldName lastName --notNull 
      field date --fieldName birthDate --notNull  --type java.util.Date
      
      entity --class ~.domain.Profile --testAutomatically
      field string --fieldName username --notNull 
      field string --fieldName password --notNull 
      field reference --fieldName person --notNull --type ~.domain.Person

      Then I changed the relationship of ManyToOne to OneToOne

          @NotNull
          @OneToOne(targetEntity = Person.class)
          @JoinColumn
          private Person person;

      and run 'perform test' which throws :

      Caused by: org.postgresql.util.PSQLException: ERROR: update o delete en «person» viola la llave foránea «fked8e89a96dc6e8df» en la tabla «profile»
        Detail: La llave (id)=(5) todavía es referida desde la tabla «profile».
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:321)
      	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      	at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2694)
      	... 52 more
      Tests run: 9, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.21 sec <<< FAILURE!

      The error message is correct. The question is why the test crashes if it knows about the integrity constraint?
      shouldn't the test just give back a notification of a passed integrity test?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stewarta Alan Stewart
              Reporter:
              rvimer René Vielma
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: