Announcement Announcement Module
No announcement yet.
DBRE and Broken Integration Tests (Cascading) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DBRE and Broken Integration Tests (Cascading)

    It appears that during DBRE, Roo doesn't (or can't) deduce a cascading setting for entity relationships. As a result, the integration tests for entities with foreign key references generated by Roo fail because their DataOnDemand classes aren't setting up the required relationships (the init() method calls persist() on the entity, but the entity was not assigned a required object reference when it was created in the getNewTransientXXX() method). The database has a NOT NULL constraint on the foreign key column and this is getting violated.

    What are the recommended steps to fix this? Push-in refactor the attributes and add the desired cascade settings? What else? Am I also expected to push-in refactor the init() and getNewTransientXXX() methods for all my DataOnDemand classes and manually create the foreign key objects, then add them to the entity?

    What are others doing to get around this issue with minimal pain?



  • #2
    Just wanted to add, the dbre.xml has the onDelete and onUpdate attributes for all the entities set to "none". I don't know what influences these settings, or if I'm supposed to modify these and then do something else? The DBRE was done with MySQL 5.5.

    If these attributes are changed to something else, can Roo then generate correct DataOnDemand implementations?



    • #3
      Hi Jeff,

      I stumbled on the very same issue with Roo. I first thought it warranted a Jira but the nice Roo people didn't see it this way or my explanation was not clear enough. Anyway, I also have all my integration tests failing for the same reason as yours. I have lots of foreign key relationships that are not null and it feels like a lot of work to do manually. I don't know if Roo will one day take care of this.


      • #4
        To be fair, DBRE does a good job of converting java.sql.DataMetadata into JPA entities and their interlationships. Data-on-Demand and Integration test generation is somewhat lacking in full the support of such artifacts (at present)!