Trying to work with inheritance on entities, I followed instructions on this page : http://web.aanet.com.au/persabi/andromda/howto9.html
I created a mapped superclass and added a <<Identifier>> id : Long property to the superclass, then created classes that inherit this superclass. But the identifier property is never generated in the mapped superclass !
After debugging, it looks like there's a problem with the way we retrieve attributes in the EntityEmbeddable.vsl template :
## Only declare instance attributes that are NOT inherited.
## If a mapped superclass then don't generate auto identifier - but include
## normal defined identifier if one is defined.
#if ($entity.embeddableSuperclass && $entity.dynamicIdentifiersPresent)
#**##set ($attributes = $entity.getInstanceAttributes(false, false))
#**##set ($attributes = $entity.getInstanceAttributes(false, true))
Call to $entity.dynamicIdentifiersPresent returns true while, so $entity.geInstanceAttributes method is called with "withIdentifiers" parameter as false and it never retrieves my identifier attributes. For what I understand about dynamicIdentifiersPresent, it should return false, not true ...
I had a look in AndroMDA EMF / UML2 EntityLogicImpl class, and found this implementation of isDynamicIdentifiersPresent :
* @see org.andromda.metafacades.uml.Entity#isDynamicIdentifiersPresent()
protected boolean handleIsDynamicIdentifiersPresent()
And dynamicIdentifiersPresent is populated this way :
public void initialize()
// if there are no identifiers on this entity, create and add one.
// enumerations don't have identifiers since they are not entities
if (!this.isIdentifiersPresent() && this.isAllowDefaultIdentifiers())
Reading this piece of code, I think dynamicIdentifierPresent should be empty, but it looks like it is not ! Don't really understand what happens ... Anyone has an idea ?
Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=26309#26309
Posting to http://forum.andromda.org/ is preferred over posting to the mailing list!