Index: cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vm
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vm,v
retrieving revision 1.23
diff -u -r1.23 hibernate.hbm.xml.vm
--- cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vm	11 Mar 2005 19:18:08 -0000	1.23
+++ cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vm	15 Mar 2005 03:32:39 -0000
@@ -3,12 +3,27 @@
 ##
 #macro (renderSubClass $entity)
 ## Should only get get invoked for inheritance class or subclass.
-        <$entity.mappingClassName name="$entity.fullyQualifiedEntityImplementationName"#if($entity.tableRequired) table="$entity.tableName"#else discriminator-value="$entity.entityImplementationName"#end#if($entity.hibernateProxy) proxy="$entity.fullyQualifiedEntityImplementationName"#end dynamic-insert="$entity.dynamicInsert" dynamic-update="$entity.dynamicUpdate">
+        <$entity.mappingClassName 
+            name="$entity.fullyQualifiedEntityImplementationName"
+#if($entity.tableRequired)
+            table="$entity.tableName"
+#else
+            discriminator-value="$entity.entityImplementationName"
+#end
+#if($entity.hibernateProxy)
+            proxy="$entity.fullyQualifiedEntityImplementationName"
+#end
+            dynamic-insert="$entity.dynamicInsert" 
+            dynamic-update="$entity.dynamicUpdate">
+        >
 #if($entity.subclassKeyColumn)
-            <key column="$entity.subclassKeyColumn"/>
+
+        <key column="$entity.subclassKeyColumn"/>
 #end
+
 #renderPropertiesAndAssociations($entity)
 #foreach ($subentity in $entity.specializations)
+
 #renderSubClass($subentity)
 #end
         </$entity.mappingClassName>
@@ -20,8 +35,19 @@
 #macro (renderPropertiesAndAssociations $entity)
 #foreach ($attribute in $entity.attributes)
 #if (!$attribute.identifier)
-        <property name="$attribute.name" type="$attribute.type.fullyQualifiedHibernateType">
-            <column name="$attribute.columnName" not-null="$attribute.required" unique="$attribute.unique" sql-type="$attribute.sqlType"#if($attribute.columnIndex) index="$attribute.columnIndex"#end/>
+        <property
+            name="$attribute.name"
+            type="$attribute.type.fullyQualifiedHibernateType"
+        >
+            <column
+                name="$attribute.columnName"
+                not-null="$attribute.required"
+                unique="$attribute.unique"
+                sql-type="$attribute.sqlType"
+#if($attribute.columnIndex)
+                index="$attribute.columnIndex"
+#end
+            />
         </property>
 #end
 #end
@@ -30,24 +56,86 @@
 #if ($otherEnd.navigable || ($sourceEnd.child && $entity.foreignHibernateGeneratorClass))
 #if ($sourceEnd.one2One)
 #if ($sourceEnd.one2OneSecondary)
-        <one-to-one name="$otherEnd.name" class="$otherEnd.type.fullyQualifiedEntityImplementationName" outer-join="$otherEnd.outerJoin"#if ($otherEnd.child) cascade="$otherEnd.hibernateCascade"#end constrained="false"/>
+        <one-to-one
+            name="$otherEnd.name"
+            class="$otherEnd.type.fullyQualifiedEntityImplementationName"
+            outer-join="$otherEnd.outerJoin"
+#if ($otherEnd.child)
+            cascade="$otherEnd.hibernateCascade"
+#end
+            constrained="false"
+        />
 #else
 #if($sourceEnd.one2OnePrimary)
-        <many-to-one name="$otherEnd.name" class="$otherEnd.type.fullyQualifiedEntityImplementationName" outer-join="$otherEnd.outerJoin" unique="true"#if ($otherEnd.child) cascade="$otherEnd.hibernateCascade"#end>
-            <column name="$otherEnd.columnName" not-null="$otherEnd.required"/>
+        <many-to-one
+            name="$otherEnd.name"
+            class="$otherEnd.type.fullyQualifiedEntityImplementationName"
+            outer-join="$otherEnd.outerJoin"
+            unique="true"
+#if ($otherEnd.child)
+            cascade="$otherEnd.hibernateCascade"
+#end
+        >
+            <column
+                name="$otherEnd.columnName"
+                not-null="$otherEnd.required"
+            />
         </many-to-one>
 #else
-        <one-to-one name="$otherEnd.name" class="$otherEnd.type.fullyQualifiedEntityImplementationName" outer-join="$otherEnd.outerJoin" property-ref="$sourceEnd.name"/>
+        <one-to-one
+            name="$otherEnd.name"
+            class="$otherEnd.type.fullyQualifiedEntityImplementationName"
+            outer-join="$otherEnd.outerJoin"
+            property-ref="$sourceEnd.name"
+        />
 #end
 #end
 #end
 #if ($sourceEnd.one2Many)
 #if ($otherEnd.set || $otherEnd.map) 
-        <$otherEnd.collectionType name="$otherEnd.name" order-by="$otherEnd.orderByColumns" lazy="$otherEnd.lazy" outer-join="$otherEnd.outerJoin" inverse="$otherEnd.hibernateInverse"#if ($otherEnd.child) cascade="$otherEnd.hibernateCascade"#end#if ($otherEnd.whereClause) where="$otherEnd.whereClause"#end#if ($otherEnd.sortType) sort="$otherEnd.sortType"#end>
+        <$otherEnd.collectionType 
+            name="$otherEnd.name"
+            order-by="$otherEnd.orderByColumns"
+            lazy="$otherEnd.lazy"
+            outer-join="$otherEnd.outerJoin"
+            inverse="$otherEnd.hibernateInverse"
+#if ($otherEnd.child)
+            cascade="$otherEnd.hibernateCascade"
+#end
+#if ($otherEnd.whereClause)
+            where="$otherEnd.whereClause"
+#end
+#if ($otherEnd.sortType)
+            sort="$otherEnd.sortType"
+#end
+        >
 #elseif ($otherEnd.bag)
-        <$otherEnd.collectionType name="$otherEnd.name" order-by="$otherEnd.orderByColumns" lazy="$otherEnd.lazy" outer-join="$otherEnd.outerJoin" inverse="$otherEnd.hibernateInverse"#if ($otherEnd.child) cascade="$otherEnd.hibernateCascade"#end#if ($otherEnd.whereClause) where="$otherEnd.whereClause"#end>
+        <$otherEnd.collectionType
+            name="$otherEnd.name"
+            order-by="$otherEnd.orderByColumns"
+            lazy="$otherEnd.lazy"
+            outer-join="$otherEnd.outerJoin"
+            inverse="$otherEnd.hibernateInverse"
+#if ($otherEnd.child)
+            cascade="$otherEnd.hibernateCascade"
+#end
+#if ($otherEnd.whereClause)
+            where="$otherEnd.whereClause"
+#end
+        >
 #elseif ($otherEnd.list)
-        <$otherEnd.collectionType name="$otherEnd.name" lazy="$otherEnd.lazy" outer-join="$otherEnd.outerJoin" inverse="$otherEnd.hibernateInverse"#if ($otherEnd.child) cascade="$otherEnd.hibernateCascade"#end#if ($otherEnd.whereClause) where="$otherEnd.whereClause"#end>
+        <$otherEnd.collectionType
+            name="$otherEnd.name"
+            lazy="$otherEnd.lazy"
+            outer-join="$otherEnd.outerJoin"
+            inverse="$otherEnd.hibernateInverse"
+#if ($otherEnd.child)
+            cascade="$otherEnd.hibernateCascade"
+#end
+#if ($otherEnd.whereClause)
+            where="$otherEnd.whereClause"
+#end
+        >
 #end
 #if(($hibernateEnableCache == "true") && ($hibernateEnableAssociationsCache == "true"))
             <cache usage="$sourceEnd.association.hibernateCacheType" />
@@ -56,20 +144,53 @@
                 <column name="$sourceEnd.columnName"/>
             </key>
 #if ($otherEnd.indexedCollection)
-            <index column="$otherEnd.collectionIndexName"#if($otherEnd.map) type="$otherEnd.collectionIndexType"#end/>
-#end
-            <one-to-many class="$otherEnd.type.fullyQualifiedEntityImplementationName"/>
+            <index 
+                column="$otherEnd.collectionIndexName"
+#if($otherEnd.map)
+                type="$otherEnd.collectionIndexType"
+#end
+            />
+#end
+            <one-to-many
+                class="$otherEnd.type.fullyQualifiedEntityImplementationName"
+            />
         </$otherEnd.collectionType>
 #elseif ($sourceEnd.many2One)
-        <many-to-one name="$otherEnd.name" class="$otherEnd.type.fullyQualifiedEntityImplementationName" outer-join="$otherEnd.outerJoin"#if ($otherEnd.child) cascade="$otherEnd.hibernateCascade"#end>
-            <column name="$otherEnd.columnName" not-null="$otherEnd.required"/>
+        <many-to-one
+            name="$otherEnd.name"
+            class="$otherEnd.type.fullyQualifiedEntityImplementationName"
+            outer-join="$otherEnd.outerJoin"
+#if ($otherEnd.child)
+            cascade="$otherEnd.hibernateCascade"
+#end
+        >
+            <column
+                name="$otherEnd.columnName"
+                not-null="$otherEnd.required"
+            />
         </many-to-one>
 #elseif ($sourceEnd.many2Many)
-        <set name="$otherEnd.name" table="$otherEnd.association.tableName" order-by="$sourceEnd.orderByColumns" outer-join="$otherEnd.outerJoin" lazy="$otherEnd.lazy" inverse="$otherEnd.hibernateInverse"#if ($otherEnd.child) cascade="$otherEnd.hibernateCascade"#end#if ($otherEnd.whereClause) where="$otherEnd.whereClause"#end>
+        <set 
+            name="$otherEnd.name"
+            table="$otherEnd.association.tableName"
+            order-by="$sourceEnd.orderByColumns"
+            outer-join="$otherEnd.outerJoin"
+            lazy="$otherEnd.lazy"
+            inverse="$otherEnd.hibernateInverse"
+#if ($otherEnd.child)
+            cascade="$otherEnd.hibernateCascade"
+#end
+#if ($otherEnd.whereClause)
+            where="$otherEnd.whereClause"
+#end
+        >
             <key>
                 <column name="$sourceEnd.columnName"/>
             </key>
-            <many-to-many class="$otherEnd.type.fullyQualifiedEntityImplementationName" column="$otherEnd.columnName"/>
+            <many-to-many 
+                class="$otherEnd.type.fullyQualifiedEntityImplementationName"
+                column="$otherEnd.columnName"
+            />
         </set>
 #end
 #end
Index: cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vsl
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vsl,v
retrieving revision 1.19
diff -u -r1.19 hibernate.hbm.xml.vsl
--- cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vsl	1 Mar 2005 06:14:24 -0000	1.19
+++ cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vsl	15 Mar 2005 03:35:27 -0000
@@ -4,16 +4,31 @@
      Attention: Generated code! Do not modify by hand!
      Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
   -->
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
-          "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
+<!DOCTYPE hibernate-mapping PUBLIC
+    "-//Hibernate/Hibernate Mapping DTD 2.0//EN" 
+    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
 
 <hibernate-mapping default-cascade="$entity.hibernateDefaultCascade">
-    <class name="$entity.fullyQualifiedEntityImplementationName" table="$entity.tableName"#if($entity.hibernateProxy) proxy="$entity.fullyQualifiedEntityImplementationName"#end dynamic-insert="$entity.dynamicInsert" dynamic-update="$entity.dynamicUpdate">
+    <class
+        name="$entity.fullyQualifiedEntityImplementationName"
+        table="$entity.tableName"
+#if($entity.hibernateProxy)
+        proxy="$entity.fullyQualifiedEntityImplementationName"
+#end
+        dynamic-update="$entity.dynamicUpdate"
+        dynamic-insert="$entity.dynamicInsert"
+    >
 #if($hibernateEnableCache == "true")
+
         <cache usage="$entity.hibernateCacheType" />
 #end
 #set ($identifier = $entity.identifiers.iterator().next())
-        <id name="$identifier.name" type="$identifier.type.fullyQualifiedName" column="$identifier.columnName" unsaved-value="null">
+
+        <id
+            name="$identifier.name"
+            column="$identifier.columnName" unsaved-value="null"
+            type="$identifier.type.fullyQualifiedName"
+        >
             <generator class="$entity.hibernateGeneratorClass">
 #if ($entity.sequenceHibernateGeneratorClass)
                 <param name="sequence">${entity.tableName}${sequenceIdentifierSuffix}</param>
@@ -23,19 +38,31 @@
             </generator>
         </id>
 #if (!$entity.specializations.empty && $entity.hibernateInheritanceClass)
-        <discriminator column="$entity.hibernateDiscriminatorColumn" type="$entity.hibernateDiscriminatorType"/>
+
+        <discriminator
+            column="$entity.hibernateDiscriminatorColumn"
+            type="$entity.hibernateDiscriminatorType"
+        />
 #end
 #if ($stringUtils.isNotBlank($versionProperty))
-        <version name="$versionProperty" type="int" column="$versionProperty"/>
+
+        <version
+            name="$versionProperty"
+            type="int"
+            column="$versionProperty"
+        />
 #end
 ## If super inheritance is 'interface', render super properties etc
 #foreach ($generalization in $entity.allGeneralizations)
+
 #if($generalization.mappingRequiresSuperProperties)
 #renderPropertiesAndAssociations($generalization)
 #end
 #end
+
 ## render the properties and associations (if any)
 #renderPropertiesAndAssociations($entity)
+
 ## render the subclass elements if class or subclass strategy.
 #if ($entity.requiresSpecializationMapping)
 #foreach ($entity in $entity.specializations)
Index: cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionBean.vsl
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionBean.vsl,v
retrieving revision 1.12
diff -u -r1.12 HibernateSessionBean.vsl
--- cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionBean.vsl	6 Mar 2005 21:33:39 -0000	1.12
+++ cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionBean.vsl	14 Mar 2005 01:21:51 -0000
@@ -109,7 +109,12 @@
 #end
         catch (Throwable th)
         {
-            throw new EJBException("${service.name}Bean.${operation.name}: " + th.toString());
+           this.ctx.setRollbackOnly();
+           if(th instanceof Exception) {
+                throw new EJBException("${service.name}Bean.${operation.name}: " + th.toString(), (Exception) th);
+           } else {
+                throw new EJBException("${service.name}Bean.${operation.name}: " + th.toString());
+           }
         }
         finally
         {
Index: cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionEJBLocator.vsl
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionEJBLocator.vsl,v
retrieving revision 1.5
diff -u -r1.5 HibernateSessionEJBLocator.vsl
--- cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionEJBLocator.vsl	23 Feb 2005 12:24:41 -0000	1.5
+++ cartridges/andromda-hibernate/src/templates/hibernate/ejb/HibernateSessionEJBLocator.vsl	13 Mar 2005 23:13:51 -0000
@@ -70,6 +70,8 @@
 
     /**
      * Gets an instance of <code>$service.fullyQualifiedName</code>
+     *
+     * @return an instance of $service.fullyQualifiedName
      */
     public final $service.fullyQualifiedName get${service.name}()
     {
@@ -90,5 +92,27 @@
         }
     }
 
+    /**
+     * Gets an instance of <code>$service.fullyQualifiedName</code>
+     *
+     * @param environment the environment for InitialContext
+     * @return an instance of $service.fullyQualifiedName
+     */
+    public final $service.fullyQualifiedName get${service.name}(java.util.Hashtable environment)
+    {
+        try
+        {
+            $home = ($homeClassName)lookupHome(
+                    environment,
+                    ${homeClassName}.JNDI_NAME,
+                    ${homeClassName}.class);
+            return ${home}.create();
+        }
+        catch (Exception ex)
+        {
+            throw new javax.ejb.EJBException(ex);
+        }
+    }
+
 #end
 }
\ No newline at end of file
