enhancement
major
minor
major
minor
major
#29980
Migration: update-class with a new-name in another module does not move the class's associations
Observed with 8.0.0-alpha11 in E-Home (haumacher/ehome, migration Ticket_29806_Dissolve_ehome_mask).
Moving a class to another module with <update-class name="ehome.mask:MaskVersions" new-name="ehome.operational:MaskVersions"/> moves the class, but its association types (here MaskVersions$masks, the backing type of a composition reference) are looked up by the qualified name of the class (ehome.mask:MaskVersions$...) and stay in the old module. A following <delete-module name="ehome.mask"/> then fails with "module not empty" and the startup aborts.
Workaround: an extra SQL UPDATE META_ELEMENT moving the association to the new module.
Expected: update-class moves the associations of the class with it.
Lösung
Ursache. UpdateTLClassProcessor (update-class) sucht die Assoziationstypen der Referenzen der Klasse über das Namenspräfix <Klassenname>$, bildete das Präfix aber aus dem qualifizierten Namen (ehome.mask:MaskVersions$). Die synthetischen Assoziationstypen tragen nur den lokalen Namen (MaskVersions$masks), so dass nie eine Assoziation gefunden wurde. Betroffen sind beide Fälle von new-name:
- Verschieben in ein anderes Modul: die Assoziationen bleiben im alten Modul, ein folgendes delete-module scheitert.
- Umbenennen innerhalb des Moduls: die Assoziationen behalten den alten Namen (Alt$ref), das Modell erwartet Neu$ref.
Änderung. Das Präfix wird aus dem lokalen Typnamen gebildet; die vorhandene Schleife verschiebt bzw. benennt die Assoziationen dann wie vorgesehen mit um.
Test. TestModelPatch führt update-class (Verschieben mit anschließendem delete-module des alten Moduls sowie Umbenennen) auf einem persistenten Modell aus und prüft Modul und Namen der Assoziation.