Grails
  1. Grails
  2. GRAILS-8898

delete() does not cascade in unit tests

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1, 2.2.3
    • Fix Version/s: None
    • Component/s: Testing
    • Labels:
      None
    • Testcase included:
      yes

      Description

      When using hasMany and belongsTo as described in the documentation Airport/Flights example, it should delete all flights when deleting an airport. However, this does not work in unit tests using the @Mock annotation. We're attaching an example project with the same test case in unit and integration environment, with the first one failing unexpectedly.

        Activity

        Hide
        Malte Huebner added a comment -

        It's the same if you try to removeFromXY(). The instances are removed from the belonging Object but are staying in the persistence context.

        Show
        Malte Huebner added a comment - It's the same if you try to removeFromXY(). The instances are removed from the belonging Object but are staying in the persistence context.

          People

          • Assignee:
            Unassigned
            Reporter:
            Christoph Neuroth
          • Votes:
            6 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development