-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David R. Allen Sent: Friday, February 11, 2005 9:22 AM To: Jan Heise; 'Andromda User' Subject: Re: [Andromda-user] Spring cartridge, Hibernate inheritance/inheritance strategies broken?
Hi Jan, What version are you using? I am using 3.0-RC1 with just the Hibernate cartridge (the Spring cartridge is now using the Hibernate cartridge supposedly). [CB] One clarification: the spring cartridge is not using the hibernate cartridge yet (we moved the spring cartridge support of hibernate to the hibernate cartridge (and with it the removal of Xdoclet) - the spring cartridge will be using the hibernate cartridge soon however. I have a base class with the <<Entity>> stereotype, marked abstract, and the inheritance strategy is "interface". The derived classes have their inheritance strategy set to "concrete". The latter may be just something left over from earlier experiments and not relevant, but it might be. With that model, it generates what you expect: only the concrete derived classes are persistent with Hibernate, and each inherits all the attributes (and hopefully methods, which I have none right now). The base class is generated as an abstract class which also has an *Impl class where methods could be defined. I think that is basically what you want to do given your description. Feel free to ask anything I might have left out. On Friday 11 February 2005 08:35 am, 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 -- David Allen [EMAIL PROTECTED] ------------------------------------------------------- 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
