[ http://jira.andromda.org/browse/HIB-165?page=comments#action_15580 ]
Olivier THIERRY commented on HIB-165: ------------------------------------- It looks like it has not been included in final 3.3 release. It would be nice to apply patches I supplied to 3.4-SNAPSHOT. > 'patch' for multiple unique keys > -------------------------------- > > Key: HIB-165 > URL: http://jira.andromda.org/browse/HIB-165 > Project: Hibernate Cartridge > Type: New Feature > Versions: 3.1 > Reporter: Darius Schier > Assignee: Carlos Cuenca > Fix For: 3.2-RC1 > Attachments: andromda-metafacades-uml.xml.zip, > emf.uml2.EntityAssociationEndLogicImpl.diff, > emf.uml2.EntityAttributeLogicImpl.diff, > uml14.EntityAssociationEndLogicImpl.diff, uml14.EntityAttributeLogicImpl.diff > > I've added a 'patch' how to teach Hibernate multipele unique keys. Maybe you > would like to integrate it into your cvs? It is based on 3.1 final. > I've added a new tag called @andromda.persistence.column.uniqueGroup. This > one will be mapped directly to hibernate's unique-key property. Attached you > find the version for hibernate3, hib2 should be exactly the same. > Regards > Darius > ********************* > cartridges/andromda-hibernate/src/templates/hibernate3/hibernate.hbm.xml.vm > for the ordinary column, i've added > #if($attribute.columnUniqueGroup) > unique-key="$attribute.columnUniqueGroup"#end > ********************* > metafacades/uml/common/src/java/org/andromda/metafacades/uml/UMLProfile.java > metafacades/uml/common/src/META-INF/andromda/profile.xml > added the new tag: > /** > * Represents a name that groups columns into one unique key. > */ > public static final String TAGGEDVALUE_PERSISTENCE_COLUMN_UNIQUE_GROUP = > profile.get("PERSISTENCE_COLUMN_UNIQUE_GROUP"); > <element name="PERSISTENCE_COLUMN_UNIQUE_GROUP"> > <documentation></documentation> > <value>@andromda.persistence.column.uniqueGroup</value> > </element> > ********************* > Added the tag within andromda's metamodels (just do it with mc). It's a > standard String tag (comparable to columnIndex): > metafacades/uml/common/src/uml/UMLMetafacadeModel.xml.zip > profiles/uml-1.4/persistence/src/main/uml/andromda-profile-persistence.xml.zip > ********************* > The handler is straight ahead: > metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/EntityAttributeLogicImpl.java > /** > * @see > org.andromda.metafacades.uml.EntityAttribute#getColumnUniqueGroup() > */ > protected java.lang.String handleGetColumnUniqueGroup() > { > final String group = > (String)this.findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_COLUMN_UNIQUE_GROUP); > return group != null ? StringUtils.trimToEmpty(group) : null; > } > ********************* > I am not sure, if the following is ok: I thought the unique="true" has to be > set to false if the attribute is part of a composite unique > /** > * @see org.andromda.metafacades.uml.EntityAttribute#isUnique() > */ > protected boolean handleIsUnique() > { > if( StringUtils.isBlank(this.handleGetColumnIndex())) { > return this.hasStereotype(UMLProfile.STEREOTYPE_UNIQUE); > } > return false; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.andromda.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/