Created: 09-Ian-2004

Document content: this is a simple, experimental cartridge
for Andromda to generate hbm mappings for hibernate 2. It is far
from complete but I find it quite usefull.

Links: Hibernate(the
DB persistence), AndroMDA,
Nemesis IT(me)

Model tagging:

  • PrimaryKey: stereotype for an attribute tagging it a the primary
    key
  • SQLType: taggedValue for an attribute generating an optional
    hibernate sql-type = …
  • NotNull: taggedValue marking an attribute as not null
  • seq: optional per table sequence name. Results in a: ```

    $seq



    
    

build.xml user properties

  • generator: sequence generator type
  • tableprefix: table prefix for generated tables

build.xml target to use the hbm cartridge:

    <target name="hbm" depends="init"><br></br>        <taskdef name="andromda"<br></br>            classname="org.andromda.core.anttasks.AndroMDAGenTask"<br></br>            classpathref="http://www.len.ro/work/articles/build.class.path"<br></br>            /><br></br><br></br>        <unzip src="uml/service.zargo" dest="build/model/unzipped" /><br></br><br></br>        <andromda basedir="build/model/unzipped"<br></br>            includes="service.xmi"<br></br>            lastModifiedCheck="false"<br></br>            typeMappings="${umlgen.dir}/TypeMapping.xml"<br></br>            ><br></br>            <userProperty name="generator" value="native" /><br></br>            <userProperty name="tableprefix" value="NITSERVICE" /><br></br><br></br>            <outlet cartridge="hbm" outlet="entities" dir="${src.dir}" /><br></br>       	</andromda><br></br>    </target><br></br>