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

mappedsuperclass implementation

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.0.2.RELEASE
    • Fix Version/s: 1.1.0.RC1
    • Component/s: PERSISTENCE
    • Labels:
      None

      Description

      I think Roo's implementation of mappedsuperclass could be improved.
      e.g. currently a script like:

      persistence setup --provider HIBERNATE --database MYSQL --databaseName roodb
      entity --class ~.domain.Human --abstract --mappedsuperclass
      entity --class ~.domain.Man --extends ~.domain.Human --testautomatically

      seems to be the suggested way to create a mappedsuperclass inheritance structure.

      However, this results in 2 problems:

      1) The mappedsuperclass itself is generated with an @entity annotation. I don't think this is correct as it results in the ORM creating a DB table for the mappedsuperclass, this doesn't seem right and is never populated with any data.
      Also, the sun docs say a mappedsuperclass shouldn't have an @entity annotation.

      2) The tests fail, as Alex observes in ROO-292. This is an AssertError, and it kind of kills the advantage of auto generated tests when you can't build the project in mvn. Something which may be preferable at times.

      Possible solutions could be:

      1) Maybe the --mappedsuperclass option should be moved to the Roo class command? It may be a better fit as a mappedsuperclass isn't a standard @entity.

      2) Manually remove the @entity annotation from the mappedsuperclass after Roo makes it? This makes the tests work again and hibernate no longer makes the redundent superclass table.

      Suggestions welcome.

      Nick.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stewarta Alan Stewart
                Reporter:
                nickl Nick L
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: