From: Chad B. <chd...@ya...> - 2004-07-21 23:32:42
|
----- Original Message ----- From: "Tomasz Lempart" <tle...@ss...> To: <and...@li...> Sent: Wednesday, July 21, 2004 2:41 PM Subject: [Andromda-user] Hibernate component and Spring > Hi all, > > I am impressed with the work of andromda team. I am sure that > andromda can do my job easier :-). > > I want ask you for two things. > > 1. I try to extend hibernate cartridge. I need values object in > model, they should be interpreted as hibernate component. First of all I > have tried to add new stereotype (Value) to cartridge (I think it is > better to use ValueObject from java cartridge, but it comes later). I > added to andromda-cartridge.xml template element: > > <template > sheet="templates/HibernateValue.vsl" > outputPattern="{0}/{1}.java" > outlet="values" > overWrite="true"> > <modelElements variable="class"> > <modelElement stereotype="Value"/> > </modelElements> > </template> > > and template to src/templates. When I try to build my project with > my new hibernate cartridge (I use maven) I get such error: > > > <verbatim> > > andromda:run: > [echo] +--------------------------------------------+ > [echo] | R u n n i n g A n d r o M D A | > [echo] +--------------------------------------------+ > 19:59:20,635 INFO [CartridgeFinder] found cartridge --> 'hibernate' > 19:59:20,739 INFO [CartridgeFinder] found cartridge --> 'spring' > 19:59:25,898 INFO [andromda] Input model --> > 'jar:file:/home/tlempart/workspace/BusinessTrip/mda/src/uml/BusinessTrip.xml .zip!/BusinessTrip.xml' > 19:59:32,119 INFO [MetafacadeMappings] found metafacades --> 'default' > 19:59:32,991 INFO [hibernate] Output: > 'file:/home/tlempart/workspace/BusinessTrip/mda/../hibernate/target/src/java /pl/sst/businesstrip/model/Role.java' > 19:59:33,221 ERROR [DefaultAndroMDACartridge] Error performing > DefaultAndroMDACartridge.processWithTemplate with template > 'templates/HibernateEntity.vsl', template context > '{class=org.andromda.metafacades.uml14.EntityFacadeLogicImpl@7b8, > str=org.andromda.core.common.StringUtilsHelper@14560cf}' and cartridge > 'hibernate' > org.apache.velocity.exception.MethodInvocationException: Invocation of > method 'getColumnName' in class > org.andromda.metafacades.uml14.EntityAssociationEndFacadeLogicImpl threw > exception class java.lang.ClassCastException : null > at > org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier. java:193) > > </verbatim> > > The problem is association (one to one) between Entity and Value. It > looks like stereotype Value is interpreted as Classifier and not Entity > and it is good for me but why andromda try to cast it to Entity? How can > I associate some stereotype with uml element (i.e. Classifier or > Entity). I checked hibernate cartridge and I could not find association > between Entity stereotype and Entity facade. -- It associates it with an Entity because the hibernate cartridge metafacades extend the basic metafacades. You can find what metamodel elements are mapped to what metafacades by looking in andromda-all/metafacades/uml/uml14/src/META-INF/andromda-metafacades.xml > > 2. I want to use Spring instead of EJB so I created spring cartridge > with one stereotype Service. I use it instead of Service from hibernate > cartridge. It works :-) but I feel it is not perfect solution. I think > there should be some way in hibernate cartridge to choose kind of > service (ejb, spring or something else). There could be division of > stereotype Service into two or more Services i.e. ServiceEJB, > ServiceSpring ... but it does not look perfectly for me. Do you know > some other solution? -- I think a better solution is just to have another outlet for your spring-services (so you can still use the same stereotype), and set that outlet's required attribute to false, and also set the EJB service outlet's required attribute to false as well (see this page for the required attribute description: http://team.andromda.org/docs/andromda-cartridges/index.html) this way you can just specify the outlets you want in your cartridge namespace. So if you wanted to generate spring services, you'd just add the spring-services outlet, if you wanted EJB instead, you define the ejb-services outlet (instead of the spring-services outlet), etc. > > Thanks Tomek > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click > _______________________________________________ > Andromda-user mailing list > And...@li... > https://lists.sourceforge.net/lists/listinfo/andromda-user |