This is now fixed.
You must set the persistenceProviderExtensions property to hibernate if you have OneToMany or ManyToMany references to unmapped entities (mapped superclass).
I used this modification and encoutered several problems/ errors:
1. With stereotype <<MappedSuperclass>> the class is generated without the member "id" and methods getId and setId. But this methods are called in the derived classes.
2. When I model the "id" member explictly in the <<MappedSuperclass>> the model will not be validated. For each derived class I get the following message:
2007-05-17 13:59:55,013 ERROR [AndroMDA] 1) [Data::aiinfosys::de.amnesty.bezirk.aiinfosys::domain::EinzelMitglied]:An undocumented constraint has been violated: context EJB3EntityFacade\r\ninv: identifiersPresent
This also happens if I annote the "id" member with @andromda.persistence.coulmn
3. I would like to have the <<MappedSuperclass>> to be abstract. If I set the flag in MagicDraw for the class I get the following error:
------- AndroMDA Exception Recording -------
Version ........: 3.3-SNAPSHOT
Error ..........: Error performing ModelProcessor.process with model(s) --> 'C:\Projects\aiinfosys\mda\src\main\uml\aiinfosys.uml2'
Build ..........: ${build.date}
Build System ...: Linux-2.4.29-su-1.2
Build JDK ......: Sun Microsystems Inc.-1.5.0_07-b03
Build Builder ..: su-builder
Run System .....: Windows XP5.1
Run JDK ........: Sun Microsystems Inc.1.5.0_06-b05
Main Exception .: org.andromda.core.cartridge.CartridgeException: Error processing template 'templates/ejb3/EntityEmbeddable.vsl' with template context '{entity=org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogicImpl[Adresse], stringUtils=org.apache.commons.lang.StringUtils@15ece16, collectionUtils=org.apache.commons.collections.CollectionUtils@12c384b, transform=org.andromda.cartridges.ejb3.EJB3ScriptHelper@23cfcf, converter=org.andromda.utils.JavaTypeConverter@1204c3e, driver=com.mysql.jdbc.Driver, username=amnesty, password=andisherpa, connectionUrl=jdbc:
mysql://localhost:3306/aiinfosys, dataSource=java:/jdbc/aiinfosys, dataSourceName=jdbc/aiinfosys, entityManagerName=aiinfosys, hibernateHbm2DDLAuto=update, hibernateDialect=org.hibernate.dialect.MySQLInnoDBDialect, hibernateShowSql=null, hibernateMaxFetchDepth=null, hibernateJdbcFetchSize=null, hibernateJdbcBatchSize=null, hibernateJdbcUseScrollableResultSet=null, hibernateJdbcUseStreamsForBinary=null, hibernateCacheProvider=org.jboss.ejb3.entity.TreeCacheProviderHook, hibernateTreecacheMbeanObject=jboss.cache:service=EJB3EntityTreeCache, hibernateEnableCache=false, hibernateEnableAssociationsCache=false, hibernateUseQueryCache=false, useDefaultCacheRegion=false, hibernateTransactionManagerLookupClass=null, hibernateTransactionFlushBeforeCompletion=null, hibernateTransactionAutoCloseSession=null, serviceLocatorName=ServiceLocator, manageableServiceLocatorName=ManageableServiceLocator, ejb3TypesPackage=de.amnesty.bezirk.infosys, persistenceProviderExtensions=none, persistenceContextUnitName=aiinfosys, persistenceContainerName=jboss, parameterRequiredCheck=true, xmlEncoding=UTF-8, enableTemplating=true, jndiNamePrefix=aiinfosys-1.0, securityRealm=null, manageableRolesAllowed=Admin, enableClustering=false, webServiceContextRoot=/aiinfosys-ws, webServiceUrlPattern=/services, dao-impls=C:\Projects\aiinfosys\mda/../core/src/main/java, daos=C:\Projects\aiinfosys\mda/../core/target/src, daoInheritanceEnabled=false, enableDaoPropertiesCreateMethod=true, seamEnabled=false, jarFiles=null}' using cartridge 'ejb3'
Root Exception .: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getAllEntityRelations' in class org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogicImpl threw exception class java.lang.IllegalStateException : Relation 'adresse2adressierbar' has the abstract target 'Adressierbar'. Abstract targets are not allowed in EJB.
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getAllEntityRelations' in class org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogicImpl threw exception class java.lang.IllegalStateException : Relation 'adresse2adressierbar' has the abstract target 'Adressierbar'. Abstract targets are not allowed in EJB.
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:193)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:327)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:51)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:95)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.andromda.templateengines.velocity.VelocityTemplateEngine.processTemplate(VelocityTemplateEngine.java:240)
at org.andromda.core.cartridge.Cartridge.processWithTemplate(Cartridge.java:373)
at org.andromda.core.cartridge.Cartridge.processTemplateWithMetafacades(Cartridge.java:235)
at org.andromda.core.cartridge.Cartridge.processTemplate(Cartridge.java:111)
at org.andromda.core.cartridge.Cartridge.processModelElements(Cartridge.java:62)
at org.andromda.core.engine.ModelProcessor.processModels(ModelProcessor.java:249)
at org.andromda.core.engine.ModelProcessor.process(ModelProcessor.java:146)
at org.andromda.core.engine.ModelProcessor.process(ModelProcessor.java:82)
at org.andromda.core.engine.Engine.run(Engine.java:82)
at org.andromda.core.AndroMDA.run(AndroMDA.java:197)
at org.andromda.maven.plugin.AndroMDAMojo.execute(AndroMDAMojo.java:92)
at org.andromda.maven.plugin.AbstractAndroMDAMojo.execute(AbstractAndroMDAMojo.java:106)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
After many days of debugging, I could not work out a way to avoid having to model the Entity stereotype as well as the MappedSuperclass stereotype and have a working uml2 model. I will be applying a patch to roll back this part of the original patch in the next day or two. This will mean that to model a mapped superclass, you will need to model the Entity and MappedSuperclass stereotypes on the class, as was the case originally with the cartridge.
If there are any objections, feel free to have a stab at this.
I've applied this patch. You now need to model the Entity and MappedSuperclass stereotypes again, but you should not longer have the problem with uml2 models.
Can one of the guys watching this issue pls try this fix and provide feedback.