--- D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/array.hbm.ftl (revision 16054) +++ D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/array.hbm.ftl (working copy) @@ -6,7 +6,9 @@ element-class="${value.elementClassName}" + <#if value.collectionTable?exists> table="${value.collectionTable.quotedName}" + <#if property.cascade != "none"> cascade="${property.cascade}" @@ -14,8 +16,7 @@ <#assign metaattributable=property> <#include "meta.hbm.ftl"> <#include "key.hbm.ftl"> - <#if c2h.isManyToOne(indexValue)> - + <#foreach column in indexValue.columnIterator> <#include "column.hbm.ftl"> @@ -20,8 +21,5 @@ <#include "column.hbm.ftl"> - <#else> - column="${column.quotedName}"/> - <#include "${elementTag}-element.hbm.ftl"> Index: D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/bag.hbm.ftl =================================================================== --- D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/bag.hbm.ftl (revision 16054) +++ D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/bag.hbm.ftl (working copy) @@ -3,7 +3,11 @@ <#assign elementValue = value.getElement()> <#assign elementTag = c2h.getCollectionElementTag(property)> - + table="${value.collectionTable.quotedName}" + + inverse="${value.inverse?string}" lazy="${c2h.getCollectionLazy(value)}" <#if property.cascade != "none"> cascade="${property.cascade}" Index: D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/idbag.hbm.ftl =================================================================== --- D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/idbag.hbm.ftl (revision 16054) +++ D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/idbag.hbm.ftl (working copy) @@ -3,7 +3,10 @@ <#assign elementValue = value.getElement()> <#assign elementTag = c2h.getCollectionElementTag(property)> - + table="${value.collectionTable.quotedName}" + lazy="${c2h.getCollectionLazy(value)}" <#if property.cascade != "none"> cascade="${property.cascade}" Index: D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/list.hbm.ftl =================================================================== --- D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/list.hbm.ftl (revision 16054) +++ D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/list.hbm.ftl (working copy) @@ -4,7 +4,10 @@ <#assign indexValue = value.getIndex()> <#assign elementTag = c2h.getCollectionElementTag(property)> - + table="${value.collectionTable.quotedName}" + lazy="${c2h.getCollectionLazy(value)}" <#if property.cascade != "none"> cascade="${property.cascade}" @@ -13,8 +16,7 @@ <#assign metaattributable=property> <#include "meta.hbm.ftl"> <#include "key.hbm.ftl"> - <#if c2h.isManyToOne(indexValue)> - + <#foreach column in indexValue.columnIterator> <#include "column.hbm.ftl"> @@ -19,11 +21,6 @@ <#include "column.hbm.ftl"> - <#else> - - column="${column.quotedName}" - /> - <#include "${elementTag}-element.hbm.ftl"> Index: D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/persistentclass.hbm.ftl =================================================================== --- D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/persistentclass.hbm.ftl (revision 16596) +++ D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/persistentclass.hbm.ftl (working copy) @@ -6,7 +6,7 @@ <#if clazz.superclass?exists> extends="${clazz.getSuperclass().className}" -<#if c2h.needsTable(clazz)> +<#if c2h.needsTable(clazz) && clazz.table?exists> table="${clazz.table.quotedName}" <#if clazz.table.schema?exists> Index: D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/primitive-array.hbm.ftl =================================================================== --- D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/primitive-array.hbm.ftl (revision 16054) +++ D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/templates/hbm/primitive-array.hbm.ftl (working copy) @@ -1,8 +1,11 @@ <#assign value = property.value> -<#assign table = value.collectionTable.name> <#assign dependentValue = value.getKey()> - + + table="${value.collectionTable.quotedName}" + + > <#assign metaattributable=property> <#include "meta.hbm.ftl"> Index: D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ListArrayTest.java =================================================================== --- D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ListArrayTest.java (revision 16054) +++ D:/workspaces/RedHat/hibernate-galileo2/hibernateext_tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ListArrayTest.java (working copy) @@ -84,16 +84,19 @@ List list = xpath.selectNodes(document); assertEquals("Expected to get two list element", 2, list.size()); Element node = (Element) list.get(1); //second list - assertEquals(node.attribute( "name" ).getText(),"fooComponents"); - assertEquals(node.attribute( "lazy" ).getText(),"true"); - assertEquals(node.attribute( "cascade" ).getText(),"all"); + assertEquals("fooComponents", node.attribute( "name" ).getText()); + assertEquals("true", node.attribute( "lazy" ).getText()); + assertEquals("all", node.attribute( "cascade" ).getText()); - list = node.elements("index"); - assertEquals("Expected to get one index element", 1, list.size()); + list = node.elements("list-index"); + assertEquals("Expected to get one list-index element", 1, list.size()); + + list = ((Element) list.get(0)).elements("column"); + assertEquals("Expected to get one column element", 1, list.size()); node = (Element) list.get(0); - assertEquals(node.attribute( "column" ).getText(),"tha_indecks"); + assertEquals("tha_indecks", node.attribute( "name" ).getText()); - node = node.getParent();//list + node = node.getParent().getParent();//list list = node.elements("composite-element"); assertEquals("Expected to get one composite-element element", 1, list.size()); node = (Element) list.get(0); @@ -100,8 +103,8 @@ assertEquals("Expected to get two property element", 2, node.elements("property").size()); node = node.element("many-to-one"); - assertEquals(node.attribute( "name" ).getText(),"fee"); - assertEquals(node.attribute( "cascade" ).getText(),"all"); + assertEquals("fee", node.attribute( "name" ).getText()); + assertEquals("all", node.attribute( "cascade" ).getText()); //TODO :assertEquals(node.attribute( "outer-join" ).getText(),"true"); node = node.getParent();//composite-element @@ -106,8 +109,8 @@ node = node.getParent();//composite-element node = node.element("nested-composite-element"); - assertEquals(node.attribute( "name" ).getText(),"subcomponent"); - assertEquals(node.attribute( "class" ).getText(),"org.hibernate.tool.hbm2x.hbm2hbmxml.FooComponent"); + assertEquals("subcomponent", node.attribute( "name" ).getText()); + assertEquals("org.hibernate.tool.hbm2x.hbm2hbmxml.FooComponent", node.attribute( "class" ).getText()); } public void testArrayNode() throws DocumentException { @@ -122,15 +125,17 @@ List list = xpath.selectNodes(document); assertEquals("Expected to get one array element", 1, list.size()); Element node = (Element) list.get(0); - assertEquals(node.attribute( "name" ).getText(),"proxyArray"); - assertEquals(node.attribute( "element-class" ).getText(),"org.hibernate.tool.hbm2x.hbm2hbmxml.GlarchProxy"); + assertEquals("proxyArray", node.attribute( "name" ).getText()); + assertEquals("org.hibernate.tool.hbm2x.hbm2hbmxml.GlarchProxy", node.attribute( "element-class" ).getText()); - list = node.elements("index"); - assertEquals("Expected to get one index element", 1, list.size()); + list = node.elements("list-index"); + assertEquals("Expected to get one list-index element", 1, list.size()); + list = ((Element) list.get(0)).elements("column"); + assertEquals("Expected to get one column element", 1, list.size()); node = (Element) list.get(0); - assertEquals(node.attribute( "column" ).getText(),"array_indecks"); + assertEquals("array_indecks", node.attribute( "name" ).getText()); - node = node.getParent();//array + node = node.getParent().getParent();//array list = node.elements("one-to-many"); assertEquals("Expected to get one 'one-to-many' element", 1, list.size());