Sverker Abrahamsson wrote:

Hi again,
I reworked the support for hibernate 3 so that it can coexsist with hibernate2 templates and the choise between which to use is done by the hibernateVersion property.

Cool :)


However, I've got stuck on the following issues:
1. How do I control which templates are run? I want to run either templates/hibernate/* or templates/hibernate3/*, not both.

You can control them by modeling an attribute that returns which version the metafacade should run within. For example:


<template
path="templates/hibernate/hibernate.hbm.xml.vsl"
outputPattern="$generatedFile"
outlet="entities"
overwrite="true"
required="true">
<modelElements variable="entity">
<modelElement>
<type name="org.andromda.cartridges.hibernate.metafacades.HibernateEntity">
<property name="requiresMapping"/>
</type>
</modelElement>
</modelElements>
</template>


The requiresMapping flag indicates that a template for any HibernateEntity where requiresMapping evalutes to true should be processed, so you can do something like this with a version attribute you can model on the metafacade, so the template will be processed where the version equals '3'.

<template
path="templates/hibernate/hibernate.hbm.xml.vsl"
outputPattern="$generatedFile"
outlet="entities"
overwrite="true"
required="true">
<modelElements variable="entity">
<modelElement>
<type name="org.andromda.cartridges.hibernate.metafacades.HibernateEntity">
<property name="version">3</property>
</type>
</modelElement>
</modelElements>
</template>



2. In andromda-cartridge.xml there is a reference to macrolibrary which is for hibernate2. I have a different file for hibernate3 since the macros are different. Should I rename the macros for hibernate 3 and add both to templateEngine.

Yes that sounds like a good idea.


3. The templates that hasn't changed should be moved to templates/common for easier maintainance.

Sounds good.


How should I proceed? /Sverker

----- Original Message ----- From: "Sverker Abrahamsson" <[EMAIL PROTECTED]>
To: "Chad Brandon" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Thursday, March 17, 2005 12:25 AM
Subject: Re: [Andromda-devel] Hibernate 3 cartridge



Hi,
yes, that make sence. It's probably the best solution.
/Sverker

----- Original Message ----- From: "Chad Brandon" <[EMAIL PROTECTED]>
To: "Sverker Abrahamsson" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Wednesday, March 16, 2005 11:59 PM
Subject: Re: [Andromda-devel] Hibernate 3 cartridge



Sverker Abrahamsson wrote:

Hi,
I've adapted the hibernate cartridge to support Hibernate 3. The tests have worked fine, except for a few bugs I found in Hibernate, but it solved many of the loading issues I had with Hibernate 2.
Are you interested to have it contributed back to the project? I think that the best would be to add it as a new cartridge, since Hibernate 3 is not source code compatible with Hibernate 2. On the other hand, the porting is quite easy and in my project it was mostly changing package name from net.sf.hibernate to org.hibernate and you made a lot of major changes in AndroMDA so that people have to update their code anyway.
The main issue however is that I'm afraid that Hibernate 3 is not stable enough for production yet, I've already found a number of bugs, although it works quite ok with the classic HQL parser (the new one rendered my queries wrong). Therefore I think it would be best to add it as a new cartridge and let people choose if they want to be on the bleading edge or on the safe side.
/Sverker


Carlos and I have been discussing this, and we were actually thinking of keeping the templates in the same cartridge (just in difference directories), and making it configuable through a namespace property or something (the version that is)...since as you said not much as changed in terms of the API except the package name. You can read some of the discussion that carlos started here: http://galaxy.andromda.org:8080/confluence/display/DEVEL/Hibernate+3+Migration?focusedCommentId=392#comment-392





------------------------------------------------------- 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-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-devel




------------------------------------------------------- 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-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to