|
From: <hib...@li...> - 2006-04-28 13:47:54
|
Author: max...@jb...
Date: 2006-04-28 09:47:28 -0400 (Fri, 28 Apr 2006)
New Revision: 9827
Added:
trunk/HibernateExt/tools/doc/reference/en/images/entitymodel.gif
Removed:
trunk/HibernateExt/tools/doc/reference/en/images/entitymodel_zoomout.png
Modified:
trunk/HibernateExt/tools/lib/testlibs/jboss-annotations-ejb3.jar
trunk/HibernateExt/tools/lib/testlibs/jboss-seam.jar
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Version.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
trunk/HibernateExt/tools/src/templates/hbm/column.hbm.ftl
trunk/HibernateExt/tools/src/templates/hbm/set.hbm.ftl
trunk/HibernateExt/tools/src/templates/pojo/PojoConstructors.ftl
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Customer.hbm.xml
Log:
Added: trunk/HibernateExt/tools/doc/reference/en/images/entitymodel.gif
===================================================================
(Binary files differ)
Property changes on: trunk/HibernateExt/tools/doc/reference/en/images/entitymodel.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/HibernateExt/tools/doc/reference/en/images/entitymodel_zoomout.png
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/tools/lib/testlibs/jboss-annotations-ejb3.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/tools/lib/testlibs/jboss-seam.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2006-04-28 13:47:28 UTC (rev 9827)
@@ -98,11 +98,20 @@
return isOneToMany(property.getValue());
}
+ public boolean isManyToMany(Property property) {
+ Value value = property.getValue();
+ if(value instanceof Collection && !((Collection)value).isOneToMany()) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
public boolean isOneToMany(Value value) {
if(value instanceof Collection) {
return ( (Collection)value ).isOneToMany();
}else if(value instanceof OneToMany){
- return true;
+ return true;
}
return false;
}
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2JavaTool.java 2006-04-28 13:47:28 UTC (rev 9827)
@@ -461,4 +461,8 @@
public String simplePluralize(String str) {
return ReverseEngineeringStrategyUtil.simplePluralize(str);
}
+
+ public boolean isArray(String typeName) {
+ return typeName!=null && typeName.endsWith("[]");
+ }
}
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Version.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Version.java 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Version.java 2006-04-28 13:47:28 UTC (rev 9827)
@@ -1,11 +1,20 @@
package org.hibernate.tool.hbm2x;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
final public class Version {
- public static final String VERSION = "3.1.0.beta4";
+ public static final String VERSION = "3.1.0.beta5";
private static final Version instance = new Version();
+ private static Log log = LogFactory.getLog( Version.class );
+
+ static {
+ log.info( "Hibernate Tools " + VERSION );
+ }
+
private Version() {
// dont instantiate me
}
@@ -21,4 +30,10 @@
public String toString() {
return getVersion();
}
+
+ public static void touch() {}
+
+ public static void main(String[] args) {
+ System.out.println(new Version());
+ }
}
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java 2006-04-28 13:47:28 UTC (rev 9827)
@@ -251,6 +251,8 @@
else {
if(useCompareTo( typeName )) {
return "( (" + lh + "==" + rh + ") || ( " + lh + "!=null && " + rh + "!=null && " + lh + ".compareTo(" + rh + ")==0 ) )";
+ } else if ( c2j.isArray( typeName ) ) {
+ return "( java.util.Arrays.equals(" + lh + "," + rh + ") )";
} else {
return "( (" + lh + "==" + rh + ") || ( " + lh + "!=null && " + rh + "!=null && " + lh + ".equals(" + rh + ") ) )";
}
Modified: trunk/HibernateExt/tools/src/templates/hbm/column.hbm.ftl
===================================================================
--- trunk/HibernateExt/tools/src/templates/hbm/column.hbm.ftl 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/templates/hbm/column.hbm.ftl 2006-04-28 13:47:28 UTC (rev 9827)
@@ -1,11 +1,8 @@
<#if column.isFormula()>
-<formula>${column.formula}</formula>
+<formula>${column.getFormula()}</formula>
<#else>
-<column name="${column.quotedName}" ${c2h.columnAttributes(column)}
-<#if column.comment?exists>>
- <comment>${column.comment}</comment>
-</column>
-<#else>
-/>
+<column name="${column.quotedName}" ${c2h.columnAttributes(column)}<#if column.comment?exists>>
+<comment>${column.comment}</comment>
+</column><#else>/>
</#if>
</#if>
\ No newline at end of file
Modified: trunk/HibernateExt/tools/src/templates/hbm/set.hbm.ftl
===================================================================
--- trunk/HibernateExt/tools/src/templates/hbm/set.hbm.ftl 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/templates/hbm/set.hbm.ftl 2006-04-28 13:47:28 UTC (rev 9827)
@@ -3,9 +3,23 @@
inverse="${property.value.inverse?string}"
>
<key>
- <#foreach column in property.value.key.columnIterator> <#include "column.hbm.ftl"> </#foreach> </key>
- <#if c2h.isOneToMany(property)> <one-to-many
+ <#foreach column in property.value.key.columnIterator>
+ <#include "column.hbm.ftl">
+ </#foreach>
+ </key>
+<#if c2h.isOneToMany(property)>
+ <one-to-many
class="${property.getValue().getElement().getAssociatedClass().getClassName()}"
-<#if !property.getValue().getElement().getAssociatedClass().getClassName().equals(property.getValue().getElement().getReferencedEntityName())> entity-name="${property.getValue().getElement().getReferencedEntityName()}"
-</#if> />
- </#if> </set>
+<#if !property.getValue().getElement().getAssociatedClass().getClassName().equals(property.getValue().getElement().getReferencedEntityName())>
+ entity-name="${property.getValue().getElement().getReferencedEntityName()}"
+</#if>
+ />
+<#elseif c2h.isManyToMany(property)>
+ <many-to-many
+ entity-name="${property.getValue().getElement().referencedEntityName}"> <#-- lookup needed classname -->
+<#foreach column in property.getValue().getElement().columnIterator>
+ <#include "column.hbm.ftl">
+</#foreach>
+ </many-to-many>
+</#if>
+ </set>
Modified: trunk/HibernateExt/tools/src/templates/pojo/PojoConstructors.ftl
===================================================================
--- trunk/HibernateExt/tools/src/templates/pojo/PojoConstructors.ftl 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/templates/pojo/PojoConstructors.ftl 2006-04-28 13:47:28 UTC (rev 9827)
@@ -6,13 +6,21 @@
<#if pojo.needsMinimalConstructor()> /** minimal constructor */
public ${pojo.getDeclarationName()}(${c2j.asParameterList(pojo.getPropertyClosureForMinimalConstructor(), jdk5, pojo)}) {
-<#if pojo.isSubclass() && !pojo.getPropertyClosureForSuperclassMinimalConstructor().isEmpty()> super(${c2j.asArgumentList(pojo.getPropertyClosureForSuperclassMinimalConstructor())});
-</#if><#foreach field in pojo.getPropertiesForMinimalConstructor()> this.${field.name} = ${field.name};
-</#foreach> }
+<#if pojo.isSubclass() && !pojo.getPropertyClosureForSuperclassMinimalConstructor().isEmpty()>
+ super(${c2j.asArgumentList(pojo.getPropertyClosureForSuperclassMinimalConstructor())});
+</#if>
+<#foreach field in pojo.getPropertiesForMinimalConstructor()>
+ this.${field.name} = ${field.name};
+</#foreach>
+ }
</#if>
/** full constructor */
public ${pojo.getDeclarationName()}(${c2j.asParameterList(pojo.getPropertyClosureForFullConstructor(), jdk5, pojo)}) {
-<#if pojo.isSubclass() && !pojo.getPropertyClosureForSuperclassFullConstructor().isEmpty()> super(${c2j.asArgumentList(pojo.getPropertyClosureForSuperclassFullConstructor())});
-</#if><#foreach field in pojo.getPropertiesForFullConstructor()> this.${field.name} = ${field.name};
-</#foreach> }
+<#if pojo.isSubclass() && !pojo.getPropertyClosureForSuperclassFullConstructor().isEmpty()>
+ super(${c2j.asArgumentList(pojo.getPropertyClosureForSuperclassFullConstructor())});
+</#if>
+<#foreach field in pojo.getPropertiesForFullConstructor()>
+ this.${field.name} = ${field.name};
+</#foreach>
+ }
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Customer.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Customer.hbm.xml 2006-04-28 01:00:21 UTC (rev 9826)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Customer.hbm.xml 2006-04-28 13:47:28 UTC (rev 9827)
@@ -32,6 +32,10 @@
<property name="customDate" type="org.hibernate.tool.hbm2x.DummyDateType" not-null="true" length="200"/>
+ <property name="acl" type="byte[]">
+ <meta attribute="use-in-equals">true</meta>
+ </property>
+
<component name="addressComponent" class="Address">
<property name="streetAddress1" type="string"
column="StreetAddress1" not-null="true">
|