[hibernate-commits] Hibernate SVN: r17715 - in branches/Branch_3_2/HibernateExt/tools/src: test/org/hibernate/tool/hbm2x/hbm2hbmxml and 1 other directory.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Tue Oct 13 08:25:56 EDT 2009
Author: dgeraskov
Date: 2009-10-13 08:25:56 -0400 (Tue, 13 Oct 2009)
New Revision: 17715
Modified:
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl
branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ListArrayTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4250
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl 2009-10-13 11:52:34 UTC (rev 17714)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/array.hbm.ftl 2009-10-13 12:25:56 UTC (rev 17715)
@@ -14,14 +14,10 @@
<#assign metaattributable=property>
<#include "meta.hbm.ftl">
<#include "key.hbm.ftl">
- <#if c2h.isManyToOne(indexValue)>
- <list-index class="${indexValue.getReferencedEntityName()}">
+ <list-index>
<#foreach column in indexValue.columnIterator>
<#include "column.hbm.ftl">
</#foreach>
</list-index>
- <#else>
- <index <#foreach column in indexValue.columnIterator>column="${column.quotedName}"</#foreach>/>
- </#if>
<#include "${elementTag}-element.hbm.ftl">
</array>
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl 2009-10-13 11:52:34 UTC (rev 17714)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/hbm/list.hbm.ftl 2009-10-13 12:25:56 UTC (rev 17715)
@@ -13,17 +13,11 @@
<#assign metaattributable=property>
<#include "meta.hbm.ftl">
<#include "key.hbm.ftl">
- <#if c2h.isManyToOne(indexValue)>
- <list-index class="${indexValue.getReferencedEntityName()}">
+ <list-index>
<#foreach column in indexValue.columnIterator>
<#include "column.hbm.ftl">
</#foreach>
</list-index>
- <#else>
- <index <#foreach column in indexValue.columnIterator>
- column="${column.quotedName}"
- </#foreach>/>
- </#if>
<#include "${elementTag}-element.hbm.ftl">
</list>
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ListArrayTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ListArrayTest.java 2009-10-13 11:52:34 UTC (rev 17714)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/ListArrayTest.java 2009-10-13 12:25:56 UTC (rev 17715)
@@ -84,30 +84,33 @@
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);
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
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,18 @@
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");
-
- list = node.elements("index");
- assertEquals("Expected to get one index element", 1, list.size());
+ assertEquals("proxyArray", node.attribute( "name" ).getText());
+ assertEquals("org.hibernate.tool.hbm2x.hbm2hbmxml.GlarchProxy", node.attribute( "element-class" ).getText());
+
+ 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());
More information about the hibernate-commits
mailing list