Hi Chad,
thanks a lot. I have already one cartridge for hibernate (with spring service) and value stereotype seems to work :-)
Tomek
----- Original Message ----- From: "Tomasz Lempart" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 21, 2004 2:41 PM
Subject: [Andromda-user] Hibernate component and Spring
'jar:file:/home/tlempart/workspace/BusinessTrip/mda/src/uml/BusinessTrip.xmlHi 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 -->
.zip!/BusinessTrip.xml'
'file:/home/tlempart/workspace/BusinessTrip/mda/../hibernate/target/src/java19:59:32,119 INFO [MetafacadeMappings] found metafacades --> 'default' 19:59:32,991 INFO [hibernate] Output:
/pl/sst/businesstrip/model/Role.java'
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.19:59:33,221 ERROR [DefaultAndroMDACartridge] Error performing DefaultAndroMDACartridge.processWithTemplate with template 'templates/HibernateEntity.vsl', template context '[EMAIL PROTECTED], [EMAIL PROTECTED]' 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
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
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user
-------------------------------------------------------
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
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user
------------------------------------------------------- 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 [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user
