Results 1 to 7 of 7

Thread: perform test fail with OneToOne relationship

  1. #1
    Join Date
    Sep 2010
    Posts
    12

    Default perform test fail with OneToOne relationship

    I created a new roo project and performed the following commands

    Code:
    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

    Code:
        @NotNull
        @OneToOne(targetEntity = Person.class)
        @JoinColumn
        private Person person;
    and run 'perform test' which throws :

    Code:
    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?

    Thanks

  2. #2
    Join Date
    Dec 2005
    Posts
    930

    Default

    Please log a Jira ticket and I will look into it.
    Thanks
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  3. #3
    Join Date
    Sep 2010
    Posts
    12

  4. #4
    Join Date
    Dec 2005
    Posts
    930

    Default

    https://jira.springframework.org/browse/ROO-469 addresses this issue. If you build Roo from Git, you should find all your tests pass now
    Alan
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  5. #5
    Join Date
    Sep 2010
    Posts
    12

    Smile

    Thank you Alan for you reply

    I've compliled roo from git and the test works fine

    PD. I just had a problem with a dependency when compiling roo.
    I made following change in order to compile

    Code:
    diff --git a/addon-gwt/pom.xml b/addon-gwt/pom.xml
    index 289c62e..b800a27 100644
    --- a/addon-gwt/pom.xml
    +++ b/addon-gwt/pom.xml
    @@ -125,7 +125,7 @@
                    <dependency>
                            <groupId>org.springframework.roo.wrapping</groupId>
                            <artifactId>org.springframework.roo.wrapping.hapax</artifactId>
    -                       <version>2.3.4.0001</version>
    +                       <version>2.3.3.0001</version>
                    </dependency>
            </dependencies>
     </project>

  6. #6
    Join Date
    Dec 2005
    Posts
    930

    Default

    What JDK are you using 5 or 6?. There was a problem with the original 2.3.4 hapax jar - I built it using JDK6 instead of 5 and GWT wouldn't compile as a result with JDK 5. It should be OK though as of last Monday. I'll take another look at it anyway.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  7. #7
    Join Date
    Sep 2010
    Posts
    12

    Default

    I'm sorry for not clarify this.

    I changed the hapax version beacause the source version wasn't available in the maven repository (error 404).

    How do I configure maven so that I can use the 2.3.4 hapex version ?

    PD:
    Code:
    rene@callo:~$ java -version
    java version "1.6.0_21"
    Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 17.0-b16, mixed mode)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •