Jan,
In my recent projects, I found (the hard way...) that this is _not_ the way to go...
It foud much easier to change the code generation template. In some sense, injecting
this interface at model level tends to increase a model's complexity, adding in little value...
I think UML is supposed to give you a higher view for your system, and details like this particular
interface (Lifecycle in your case. Mine was Validatable) should be added elsewhere (templates
or aspects).
In my case, every <<entity>> was supposed to implement the Validatable interface, so I simply
changed the vsl. If you want to add some common behaviour for a subset of your classes, you can
use a different stereotype (e.g. <<LifecycleEntity>>) and adjust the cartridge accordingly.
Jan Heise wrote:
Hi,
today I tried to change my model to have the following:
- a base class that implements net.sf.hibernate.Lifecycle - adds another custom method that should also be implemented in this class - adds no attributes
If I model this as a base class, I get errors while generating the sources. I have to specify the <<Entity>>-stereotype on the base class so this error goes away. But this gives me all kinds of problems with the different inheritance-strategies you can have with hibernate. I have to say that nothing worked as expected. (I don't know if this is broken in the andromda/spring cartridge or if I'm simply to stupid to grasp the concepts and use it correctly)
Having <<Entity>> on my baseclass gives me a extra table that I don't want. Also the mappings in applicationContext.xml are not correct if I set "concrete" for inheritance, my derived class is missing. "subclass" is not an option, as I just want to add 5 methods that work the same for each derived class. I could live with the extra table.
If I move my methods to an interface and model this accordingly (although I now have to implement the methods in every derived class) the interface get's not picked up in code-generation. I have to overwrite one of the methods in the UML so the Impl class is generated and I can change the signature to also include my interface and add all the methods.
This gives me the sourcecode to solve my requirements but looks not very nice in my model.
Am I doing something wrong or do I have to stay with this kind of workaround?
Jan
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user
