Author: max.andersen(a)jboss.com
Date: 2006-10-20 04:35:35 -0400 (Fri, 20 Oct 2006)
New Revision: 10634
Added:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/newformat.reveng
Removed:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml
Modified:
branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml
branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/codegen.xml
branches/Branch_3_2/HibernateExt/tools/etc/hibernate.properties
branches/Branch_3_2/HibernateExt/tools/etc/log4j.properties
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java
branches/Branch_3_2/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl
Log:
merge from trunk to 3.2
Modified: branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml 2006-10-19
17:38:50 UTC (rev 10633)
+++ branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml 2006-10-20
08:35:35 UTC (rev 10634)
@@ -22,8 +22,9 @@
e.g. Hibernate 3.2 jar's with e.g. an Hibernate 3.1 project since
the output generated will work with previous Hibernate 3 versions.
</para>
-
- <section>
+ </section>
+
+ <section>
<title>The <literal><hibernatetool></literal> ant
Task</title>
<para>To use the ant tasks you need to have the hibernatetool task
@@ -825,5 +826,4 @@
</section>
</section>
</section>
- </section>
</chapter>
Modified: branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/codegen.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/codegen.xml 2006-10-19
17:38:50 UTC (rev 10633)
+++ branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/codegen.xml 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
<chapter id="codegen">
<title>Controlling POJO code generation</title>
@@ -24,26 +24,26 @@
<para>The following example shows how to use various <meta>
attributes and the resulting java code.</para>
- <programlisting><![CDATA[<class name="Person">
- <meta attribute="class-description">
+ <programlisting><class name="Person">
+ <meta attribute="class-description">
Javadoc for the Person class
@author Frodo
- </meta>
- <meta attribute="implements">IAuditable</meta>
- <id name="id" type="long">
- <meta attribute="scope-set">protected</meta>
- <generator class="increment"/>
- </id>
- <property name="name" type="string">
- <meta attribute="field-description">The name of the
person</meta>
- </property>
-</class>]]></programlisting>
+ </meta>
+ <meta attribute="implements">IAuditable</meta>
+ <id name="id" type="long">
+ <meta
attribute="scope-set">protected</meta>
+ <generator class="increment"/>
+ </id>
+ <property name="name" type="string">
+ <meta attribute="field-description">The name of the
person</meta>
+ </property>
+</class></programlisting>
<para>The above hbm.xml will produce something like the following (code
shortened for better understanding). Notice the Javadoc comment and the
protected set methods:</para>
- <programlisting><![CDATA[// default package
+ <programlisting>// default package
import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
@@ -86,7 +86,7 @@
this.name = name;
}
-}]]></programlisting>
+}</programlisting>
<table frame="topbot">
<title>Supported meta tags</title>
@@ -244,5 +244,294 @@
attribute, e.g. <literal><meta attribute="scope-class"
inherit="false">public abstract</meta></literal>
will restrict
the "class-scope" to the current class, not the subclasses.</para>
+
+ <section>
+ <title>Recomendations</title>
+
+ <para>The following are some good practices when using
+ <literal><meta></literal> attributes.</para>
+
+ <section>
+ <title>Dangers of a class level <literal>use-in-string and
+ use-in-equals</literal> meta attributes when having bi-directional
+ associations</title>
+
+ <para>If we have two entities with a bi-directional association
+ between them and define at class scope level the meta attributes:
+ <literal>use-in-string, use-in-equals</literal>:</para>
+
+ <programlisting><hibernate-mapping>
+ <class name="Person">
+ <meta attribute="use-in-tostring">true</meta>
+ <meta attribute="use-in-equals">true</meta>
+ ...
+ </class>
+</hibernate-mapping></programlisting>
+
+ <para>and for <literal>Event.hbm</literal> file:</para>
+
+ <programlisting><hibernate-mapping>
+ <class name="events.Event" table="EVENTS">
+ <meta attribute="use-in-tostring">true</meta>
+ <meta attribute="use-in-equals">true</meta>
+ <id name="id" column="EVENT_ID">
+ <generator class="native"/>
+ </id>
+ <property name="date" type="timestamp"
column="EVENT_DATE"/>
+ <property name="title"/>
+ <set name="participants" table="PERSON_EVENT"
inverse="true">
+ <key column="EVENT_ID"/>
+ <many-to-many column="PERSON_ID"
class="events.Person"/>
+ </set>
+ </class>
+</hibernate-mapping></programlisting>
+
+ <para>Then <literal><hbm2java></literal> will
assume you want to
+ include all properties and collections in the
+ <literal>toString()/equals()</literal> methods and this can result
in
+ infinite recursive calls.</para>
+
+ <para>To remedy this you have to decide which side of the association
+ will include the other part (if at all) in the
+ <literal>toString()/equals()</literal> methods. Therefore it is not
a
+ good practice to put at class scope such meta attributes, unless you
+ are defining a class without bi-directional associations</para>
+
+ <para>We recomend instead to add the <literal>meta</literal>
+ attributes at the property level:</para>
+
+ <programlisting><hibernate-mapping>
+ <class name="events.Event" table="EVENTS">
+ <id name="id" column="EVENT_ID">
+ <meta
attribute="use-in-tostring">true</meta>
+ <generator class="native"/>
+ </id>
+ <property name="date" type="timestamp"
column="EVENT_DATE"/>
+ <property name="title">
+ <meta
attribute="use-in-tostring">true</meta>
+ <meta attribute="use-in-equals">true</meta>
+ </property>
+ <set name="participants" table="PERSON_EVENT"
inverse="true">
+ <key column="EVENT_ID"/>
+ <many-to-many column="PERSON_ID"
class="events.Person"/>
+ </set>
+ </class>
+</hibernate-mapping></programlisting>
+
+ <para>and now for <literal>Person</literal>:</para>
+
+ <programlisting><hibernate-mapping>
+ <class name="Person">
+ <meta attribute="class-description">
+ Javadoc for the Person class
+ @author Frodo
+ </meta>
+ <meta attribute="implements">IAuditable</meta>
+ <id name="id" type="long">
+ <meta
attribute="scope-set">protected</meta>
+ <meta
attribute="use-in-tostring">true</meta>
+ <generator class="increment"/>
+ </id>
+ <property name="name" type="string">
+ <meta attribute="field-description">The name of the
person</meta>
+ <meta
attribute="use-in-tostring">true</meta>
+ </property>
+ </class>
+</hibernate-mapping></programlisting>
+ </section>
+
+ <section>
+ <title>Be aware of putting at class scope level
+ <literal><meta></literal> attribute
+ <literal>use-in-equals</literal></title>
+
+ <para>For <literal>equal()/hashCode()</literal> method
generation, you
+ have to take into account that the attributes that participate on such
+ method definition, should take into account only attributes with
+ business meaning (the name, social security number, etc, but no
+ generated id's, for example).</para>
+
+ <para>This is important because Java's hashbased collections, such as
+ java.util.Set relies on equals() and hashcode() to be correct and not
+ change for objects in the set; this can be a problem if the id gets
+ assigned for an object after you inserted it into a set.</para>
+
+ <para>Therefore automatically configuration the generation of
+ <literal>equals()/hashCode()</literal> methods specifying at class
+ scope level the <literal><meta></literal> attribute
+ <literal>use-in-equals</literal> could be a dangerous decision that
+ could produce non expected side-effect.</para>
+
+ <para>See
http://www.hibernate.org/109.html for an more in-depth
+ explanation on the subject of equals() and hashcode().</para>
+ </section>
+ </section>
+
+ <section>
+ <title>Advanced <literal><meta></literal>
attribute
+ examples</title>
+
+ <para>This section shows an example for using meta attributes (including
+ userspecific attributes) together with the code generation features in
+ Hibernate Tools.</para>
+
+ <para>The usecase being implemented is to automatically insert some pre-
+ and post-conditions into the getter and setters of the generated POJO.
+ </para>
+
+ <section>
+ <title>Generate pre/post-conditions for methods</title>
+
+ <para>With an <literal><meta
attribute="class-code"></literal>,
+ you can add addional methods on a given class, nevertheless such
+ <literal><meta></literal> attribute can not be used at
property
+ scope level and Hibernatetools does not provide such
+ <literal><meta></literal> attributes.</para>
+
+ <para>A possibly solution for this is to modify the freemarker
+ templates responsable for generating the POJO's. If you look inside
+ <literal>hibernate-tools.jar</literal>, you can find the template:
+ <literal>pojo/PojoPropertyAccessor.ftl</literal></para>
+
+ <para>This file is as the named indicates used to generate property
+ accessors for pojo's.</para>
+
+ <para>Extract the <literal>PojoPropertyAccessor.ftl</literal>
into a
+ local folder i.e. <literal>${hbm.template.path}</literal>,
respecting
+ the whole path, for example:
+
<literal>${hbm.template.path}/pojo/PojoPropertyAccessor.ftl</literal></para>
+
+ <para>The contents of the file is something like this:</para>
+
+ <programlisting><#foreach property in
pojo.getAllPropertiesIterator()>
+ ${pojo.getPropertyGetModifiers(property)} ${pojo.getJavaTypeName(property, jdk5)}
${pojo.getGetterSignature(property)}() {
+ return this.${property.name};
+ }
+
+ ${pojo.getPropertySetModifiers(property)} void
set${pojo.getPropertyName(property)}(${pojo.getJavaTypeName(property, jdk5)}
${property.name}) {
+ this.${property.name} = ${property.name};
+ }
+</#foreach></programlisting>
+
+ <para>We can add conditionally pre/post-conditions on our
+ <literal>set</literal> method generation just adding a little
+ Freemarker syntax to the above source code:</para>
+
+ <programlisting><#foreach property in
pojo.getAllPropertiesIterator()>
+ ${pojo.getPropertyGetModifiers(property)} ${pojo.getJavaTypeName(property, jdk5)}
${pojo.getGetterSignature(property)}() {
+ return this.${property.name};
+ }
+
+ ${pojo.getPropertySetModifiers(property)} void
set${pojo.getPropertyName(property)}(${pojo.getJavaTypeName(property, jdk5)}
${property.name}) {
+ <#if pojo.hasMetaAttribute(property, "pre-cond")>
+ ${c2j.getMetaAsString(property, "pre-cond","\n")}
+ </#if>
+ this.${property.name} = ${property.name};
+ <#if pojo.hasMetaAttribute(property, "post-cond")>
+ ${c2j.getMetaAsString(property, "post-cond","\n")}
+ </#if>
+}
+</#foreach>
+</programlisting>
+
+ <para>Now if in any <literal>*hbm.xml</literal> file we define
the
+ <literal><meta></literal> attributes:
+ <literal>pre-cond</literal> or
<literal>post-cond</literal>, their
+ contents will be generated into the body of the relevant
+ <literal>set</literal> method.</para>
+
+ <para>As an examlpe let us add a pre-condition for property
+ <literal>name</literal> preventing no
<literal>Person</literal> can
+ have an empty name. So we have to modify the
+ <literal>Person.hbm.xml</literal> file like this:</para>
+
+ <programlisting><hibernate-mapping>
+ <class name="Person">
+ <id name="id" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="firstName" type="string">
+ <meta attribute="pre-cond"><![CDATA[
+ if ((firstName != null) && (firstName.length() == 0) ) {
+ throw new IllegalArgumentException("firstName can not be an empty
String");
+ }]]>
+ </meta>
+ </property>
+</class>
+</hibernate-mapping></programlisting>
+
+ <para>Notes: i) If you don't use
<literal><[[CDATA[]]></literal>
+ you have to scape the & symbol, i.e.: &amp; ii). Note that we
+ are referring to "firstName" directly and this is the parameter name
+ not the actual field name. If you want to refer the field you have to
+ use "this.firstName" instead. </para>
+
+ <para>Finally we have to generate the
<literal>Person.java</literal>
+ class, for this we can use both Eclipse and Ant as long as you
+ remember to set or fill in the templatepath setting. For Ant we
+ configure <literal><hibernatetool></literal> task via
+ <literal>the templatepath</literal> attribute as in:</para>
+
+ <programlisting>
+ <target name="hbm2java">
+ <taskdef name="hibernatetool"
+ classname="org.hibernate.tool.ant.HibernateToolTask"
+ classpathref="lib.classpath"/>
+ <hibernatetool destdir="${hbm2java.dest.dir}"
+ templatepath="${hbm.template.path}">
+ <classpath>
+ <path refid="pojo.classpath"/>
+ </classpath>
+ <configuration>
+ <fileset dir="${hbm2java.src.dir}">
+ <include name="**/*.hbm.xml"/>
+ </fileset>
+ </configuration>
+ <hbm2java/>
+ </hibernatetool>
+ </target></programlisting>
+
+ <para>Invoking the target
<literal><hbm2java></literal> will
+ generate on the <literal>${hbm2java.dest.dir}</literal> the file:
+ <literal>Person.java</literal>:</para>
+
+ <programlisting>// default package
+import java.io.Serializable;
+public class Person implements Serializable {
+
+ public Long id;
+
+ public String name;
+
+ public Person(java.lang.String name) {
+ this.name = name;
+ }
+
+ public Person() {
+ }
+
+ public java.lang.Long getId() {
+ return this.id;
+ }
+
+ public void setId(java.lang.Long id) {
+ this.id = id;
+ }
+
+ public java.lang.String getName() {
+ return this.name;
+ }
+
+ public void setName(java.lang.String name) {
+ if ((name != null) && (name.length() == 0)) {
+ throw new IllegalArgumentException("name can not be an empty
String");
+ }
+ this.name = name;
+ }
+}</programlisting>
+
+ <para></para>
+ </section>
+ </section>
</section>
</chapter>
\ No newline at end of file
Modified: branches/Branch_3_2/HibernateExt/tools/etc/hibernate.properties
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/etc/hibernate.properties 2006-10-19 17:38:50
UTC (rev 10633)
+++ branches/Branch_3_2/HibernateExt/tools/etc/hibernate.properties 2006-10-20 08:35:35
UTC (rev 10634)
@@ -15,7 +15,7 @@
## JNDI Datasource
#hibernate.connection.datasource jdbc/test
-#hibernate.connection.username db2
+##hibernate.connection.username db2
#hibernate.connection.password db2
@@ -40,7 +40,7 @@
#hibernate.connection.url jdbc:hsqldb:hsql://localhost
hibernate.connection.url jdbc:hsqldb:testdb/hsqldb;shutdown=true
#hibernate.connection.url jdbc:hsqldb:.
-#hibernate.connection.shutdown=true
+hibernate.connection.shutdown=true
## Derby
@@ -68,7 +68,7 @@
#hibernate.dialect org.hibernate.dialect.OracleDialect
#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
-#hibernate.connection.url jdbc:oracle:thin:@localhost:1522:XE
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:XE
## PostgreSQL
@@ -315,7 +315,7 @@
## specify a default schema and catalog for unqualified tablenames
-hibernate.default_schema PUBLIC
+#hibernate.default_schema PUBLIC
#hibernate.default_catalog PUBLIC
@@ -406,7 +406,7 @@
## choose a cache implementation
-#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
+hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
Modified: branches/Branch_3_2/HibernateExt/tools/etc/log4j.properties
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/etc/log4j.properties 2006-10-19 17:38:50 UTC
(rev 10633)
+++ branches/Branch_3_2/HibernateExt/tools/etc/log4j.properties 2006-10-20 08:35:35 UTC
(rev 10634)
@@ -14,18 +14,19 @@
log4j.rootLogger=info, stdout
-log4j.logger.org.hibernate=warn
+log4j.logger.org.hibernate=info
log4j.logger.org.hibernate.cfg.reveng=debug
log4j.logger.org.hibernate.cfg.JDBCMetaDataConfiguration=debug
+#log4j.logger.freemarker=debug
### log just the SQL
-log4j.logger.org.hibernate.SQL=debug
+#log4j.logger.org.hibernate.SQL=debug
### log JDBC bind parameters ###
-log4j.logger.org.hibernate.type=info
+#log4j.logger.org.hibernate.type=info
### log schema export/update ###
-log4j.logger.org.hibernate.tool.hbm2ddl=debug
+#log4j.logger.org.hibernate.tool.hbm2ddl=debug
### log cache activity ###
#log4j.logger.org.hibernate.cache=debug
@@ -37,6 +38,6 @@
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
-log4j.logger.org.hibernate.tool=debug
-log4j.logger.org.hibernate.tool.hbm2x.TemplateHelper=info
+#log4j.logger.org.hibernate.tool=debug
+#log4j.logger.org.hibernate.tool.hbm2x.TemplateHelper=info
#log4j.logger.org.apache.velocity=off
\ No newline at end of file
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -217,9 +217,11 @@
}
public boolean equals(Object obj) {
+ if(obj==null) return false;
+ if(!(obj instanceof TypeMappingKey)) return false;
TypeMappingKey other = (TypeMappingKey) obj;
- if(obj==null) return false;
+
return type==other.type && length==other.length;
}
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -75,38 +75,42 @@
public ExporterTask createHbm2DDL() {
ExporterTask generator = new Hbm2DDLExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbmTemplate() {
ExporterTask generator = new GenericExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbm2CfgXml() {
ExporterTask generator = new Hbm2CfgXmlExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
+
+ protected boolean addGenerator(ExporterTask generator) {
+ return generators.add(generator);
+ }
public ExporterTask createHbm2Java() {
ExporterTask generator = new Hbm2JavaExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbm2HbmXml() {
ExporterTask generator= new Hbm2HbmXmlExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbm2Doc() {
ExporterTask generator= new Hbm2DocExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
@@ -118,7 +122,7 @@
public ExporterTask createHbm2DAO(){
ExporterTask generator= new Hbm2DAOExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -76,6 +76,7 @@
return; // don't do anything to avoid crippled db
}
+ Statement statement = null;
Connection con = null;
try {
@@ -85,10 +86,11 @@
storesLowerCaseIdentifiers = metaData.storesLowerCaseIdentifiers();
storesUpperCaseIdentifiers = metaData.storesUpperCaseIdentifiers();
- Statement statement = con.createStatement();
+ statement = con.createStatement();
+
for (int i = 0; i < sqls.length; i++) {
String ddlsql = sqls[i];
System.out.println("Execute: " + ddlsql);
@@ -104,10 +106,11 @@
}
}
}
- if (statement!=null) statement.close();
con.commit();
} finally {
+ if (statement!=null) statement.close();
testSettings.getConnectionProvider().closeConnection(con);
+
}
}
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -36,7 +36,7 @@
}
protected void tearDown() throws Exception {
- //super.tearDown();
+ super.tearDown();
}
public void testExporter() {
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -107,8 +107,10 @@
ge.setOutputDirectory(getOutputDir());
Properties p = new Properties();
p.setProperty("proptest", "A value");
+ p.setProperty( "refproperty", "proptest=${proptest}" );
p.setProperty("hibernatetool.booleanProperty", "true");
p.setProperty("hibernatetool.myTool.toolclass",
"org.hibernate.tool.hbm2x.Cfg2JavaTool");
+
ge.setProperties(p);
ge.setTemplateName("generictemplates/pojo/generic-class.ftl");
ge.setFilePattern("{package-name}/generic{class-name}.txt");
@@ -121,6 +123,8 @@
assertEquals(generated.getProperty("hibernatetool.booleanProperty"),
"true");
assertNull(generated.getProperty("booleanWasTrue"));
assertEquals(generated.getProperty("myTool.value"), "value");
+ assertEquals(generated.getProperty("refproperty"), "proptest=A
value");
+
}
protected String getBaseForMappings() {
Copied: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint (from
rev 10633, trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.tool.hbmlint">
-
- <!-- category has caching for collection but its target is not cached -->
- <class name="BrokenLazy" lazy="true">
-
- <id name="id" type="long">
- <generator class="native"/>
- </id>
-
- </class>
-
- <class name="BrokenNonLazy" lazy="false">
- <id name="id" type="long">
- <generator class="native" />
- </id>
-
- </class>
-
- <class name="FakeNonLazy" lazy="false">
- <id name="id" type="long">
- <generator class="native" />
- </id>
-
- </class>
-
-
-</hibernate-mapping>
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,11 +0,0 @@
-package org.hibernate.tool.hbmlint;
-
-public class BrokenLazy {
-
- long id;
-
- public BrokenLazy(long id) {
- this.id = id;
- }
-}
-
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,11 +0,0 @@
-package org.hibernate.tool.hbmlint;
-
-public class BrokenNonLazy {
-
- long id;
-
- public BrokenNonLazy(long id) {
- this.id = id;
- }
-}
-
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.tool.hbmlint">
-
- <!-- category has caching for collection but its target is not cached -->
- <class name="Category">
-
- <id name="id" type="long">
- <generator class="native"/>
- </id>
-
- <set name="childCategories">
- <cache usage="read-only"/>
- <key column="PARENT_ID"/>
- <one-to-many class="Category"/>
- </set>
-
- </class>
-
- <class name="NoTable">
- <id name="id" type="long">
- <generator class="native"/>
- </id>
-
- </class>
-</hibernate-mapping>
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,37 +0,0 @@
-package org.hibernate.tool.hbmlint;
-
-import org.hibernate.bytecode.javassist.FieldHandled;
-import org.hibernate.bytecode.javassist.FieldHandler;
-
-import net.sf.cglib.transform.impl.InterceptFieldCallback;
-import net.sf.cglib.transform.impl.InterceptFieldEnabled;
-
-public class FakeNonLazy implements InterceptFieldEnabled, FieldHandled {
-
- long id;
-
- public FakeNonLazy(long id) {
- this.id = id;
- }
-
- public InterceptFieldCallback getInterceptFieldCallback() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setInterceptFieldCallback(InterceptFieldCallback callback) {
- // TODO Auto-generated method stub
-
- }
-
- public FieldHandler getFieldHandler() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setFieldHandler(FieldHandler handler) {
- // TODO Auto-generated method stub
-
- }
-}
-
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,17 +0,0 @@
-package org.hibernate.tool.hbmlint;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class HbmLintAllTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite( "Test for org.hibernate.tool.hbmlint" );
- //$JUnit-BEGIN$
- suite.addTestSuite( HbmLintTest.class );
- suite.addTestSuite( SchemaAnalyzerTest.class );
- //$JUnit-END$
- return suite;
- }
-
-}
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,94 +0,0 @@
-package org.hibernate.tool.hbmlint;
-
-import java.util.List;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.tool.JDBCMetaDataBinderTestCase;
-import org.hibernate.tool.hbm2x.HbmLintExporter;
-import org.hibernate.tool.hbmlint.detector.BadCachingDetector;
-import org.hibernate.tool.hbmlint.detector.InstrumentationDetector;
-import org.hibernate.tool.hbmlint.detector.ShadowedIdentifierDetector;
-
-public class HbmLintTest extends JDBCMetaDataBinderTestCase {
-
- public HbmLintTest() {
- super();
- }
-
- protected String[] getMappings() {
- return new String[] { "hbmlint/CachingSettings.hbm.xml",
"hbmlint/IdentifierIssues.hbm.xml", "hbmlint/BrokenLazy.hbm.xml" };
- }
-
- public void testExporter() {
-
- Configuration cfg = new Configuration();
- addMappings( getMappings(), cfg );
- cfg.buildMappings();
-
- new HbmLintExporter(cfg, getOutputDir()).start();
-
- }
- public void testValidateCache() {
-
- Configuration cfg = new Configuration();
- addMappings( getMappings(), cfg );
- cfg.buildMappings();
-
- HbmLint analyzer = new HbmLint(new Detector[] { new BadCachingDetector() });
-
- analyzer.analyze(cfg);
-
- List result = analyzer.getResults();
-
- assertEquals(1,result.size());
-
- System.out.println(result);
-
- }
-
- public void testValidateIdentifier() {
-
- Configuration cfg = new Configuration();
- addMappings( getMappings(), cfg );
- cfg.buildMappings();
-
- HbmLint analyzer = new HbmLint(new Detector[] { new ShadowedIdentifierDetector() });
-
- analyzer.analyze(cfg);
-
- List result = analyzer.getResults();
-
- assertEquals(1,result.size());
-
- System.out.println(result);
-
- }
-
- public void testBytecodeRestrictions() {
-
- Configuration cfg = new Configuration();
- addMappings( getMappings(), cfg );
- cfg.buildMappings();
-
- HbmLint analyzer = new HbmLint(new Detector[] { new InstrumentationDetector() });
-
- analyzer.analyze(cfg);
-
- List result = analyzer.getResults();
-
- assertEquals(2,result.size());
-
- System.out.println(result);
-
- }
-
- protected String[] getCreateSQL() {
- return new String[0];// { "create table Category (id numeric(5), parent_id
numeric(5))" };
- }
-
- protected String[] getDropSQL() {
- return new String[0];// { "drop table Category" };
- }
-
-
-}
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.tool.hbmlint">
-
- <!-- category has caching for collection but its target is not cached -->
- <class name="IdentifierProblem">
-
- <id name="name" type="long">
- <generator class="native"/>
- </id>
-
- <property name="id" type="string"/>
-
- </class>
-
-</hibernate-mapping>
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,100 +0,0 @@
-package org.hibernate.tool.hbmlint;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.mapping.Table;
-import org.hibernate.tool.JDBCMetaDataBinderTestCase;
-import org.hibernate.tool.hbm2x.HbmLintExporter;
-import org.hibernate.tool.hbmlint.detector.SchemaByMetaDataDetector;
-
-public class SchemaAnalyzerTest extends JDBCMetaDataBinderTestCase {
-
- public SchemaAnalyzerTest() {
- super();
- }
-
- protected String[] getMappings() {
- return new String[] { "hbmlint/SchemaIssues.hbm.xml" };
- }
-
- static class MockCollector implements IssueCollector {
- List problems = new ArrayList();
-
- public void reportIssue(Issue analyze) {
-
- problems.add(analyze);
- }
- }
-
- public void testSchemaAnalyzer() {
- Configuration cfg = new Configuration();
- addMappings( getMappings(), cfg );
- cfg.buildMappings();
-
- SchemaByMetaDataDetector analyzer = new SchemaByMetaDataDetector();
- analyzer.initialize( cfg, cfg.buildSettings() );
-
- Iterator tableMappings = cfg.getTableMappings();
-
-
- while ( tableMappings.hasNext() ) {
- Table table = (Table) tableMappings.next();
-
- MockCollector mc = new MockCollector();
-
- if(table.getName().equalsIgnoreCase( "missingtable" )) {
- analyzer.visit( cfg, table, mc );
- assertEquals(mc.problems.size(),1);
- Issue ap = (Issue) mc.problems.get( 0 );
- assertTrue(ap.getDescription().indexOf( "Missing table" ) >=0);
- } else if(table.getName().equalsIgnoreCase( "category" )) {
- analyzer.visit( cfg, table, mc );
- assertEquals(mc.problems.size(),1);
- Issue ap = (Issue) mc.problems.get( 0 );
- assertTrue(ap.getDescription().indexOf( "missing column: name" )
>=0);
- } else if(table.getName().equalsIgnoreCase( "badtype" )) {
- analyzer.visit( cfg, table, mc );
- assertEquals(mc.problems.size(),1);
- Issue ap = (Issue) mc.problems.get( 0 );
- assertTrue(ap.getDescription().indexOf( "wrong column type for name" )
>=0);
- } else {
- fail("Unkown table " + table);
- }
- }
-
- MockCollector mc = new MockCollector();
- analyzer.visitGenerators( cfg, mc );
- assertEquals(1,mc.problems.size());
- Issue issue = (Issue) mc.problems.get( 0 );
- assertTrue(issue.getDescription().indexOf( "hibernate_unique_key" ) >=0);
-
- }
-
-
-
- public void testExporter() {
-
- Configuration cfg = new Configuration();
- addMappings( getMappings(), cfg );
- cfg.buildMappings();
-
- new HbmLintExporter(cfg, getOutputDir()).start();
-
- }
-
- protected String[] getCreateSQL() {
- return new String[] { "create table Category (id int, parent_id
numeric(5))",
- "create table BadType (id int, name varchar(100))",
- "create sequence should_be_there start with 1",
- "create table hilo_table (id int)"};
- }
-
- protected String[] getDropSQL() {
- return new String[] { "drop table Category", "drop table BadType",
"drop sequence should_be_there", "drop table hilo_table" };
- }
-
-
-}
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java)
Deleted:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml 2006-10-20
08:35:35 UTC (rev 10634)
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.tool.hbmlint">
-
- <class name="Category">
-
- <id name="id" type="int">
- <generator class="sequence">
- <param name="sequence">should_be_there</param>
- </generator>
- </id>
-
- <property name="name" type="string"/>
-
- </class>
-
- <class name="BadType">
-
- <id name="id" type="int">
- <generator class="hilo"/>
- </id>
-
- <property name="name" type="text"/>
-
- </class>
-
- <class name="MissingTable">
- <id name="id" type="long">
- <generator class="hilo">
- <param name="table">hilo_table</param>
- </generator>
- </id>
- </class>
-</hibernate-mapping>
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml)
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -86,8 +86,23 @@
System.out.println(map);
}
+ }
+
+ public void testCaseTest() {
-
+
+ MetaDataDialect dialect = new JDBCMetaDataDialect();
+
+ Settings settings = cfg.buildSettings();
+
+ dialect.configure( settings.getConnectionProvider(),
settings.getSQLExceptionConverter() );
+
+ Iterator tables = dialect.getTables( settings.getDefaultCatalogName(),
settings.getDefaultSchemaName(), identifier( "TAB_MASTER"));
+
+ assertHasNext( 1, tables );
+
+
+
}
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -265,8 +265,10 @@
}
assertFalse("hashcode should be different from system",
hash==System.identityHashCode(object));
+ factory.close();
Thread.currentThread().setContextClassLoader(ucl.getParent() );
+
TestHelper.deleteDir(outputdir);
}
protected String getCustomerOrderQuery() {
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java 2006-10-20
08:35:35 UTC (rev 10634)
@@ -169,6 +169,7 @@
assertFalse(Hibernate.isInitialized(order.getItemsForOrderId() ) );
t.commit();
session.close();
+ sf.close();
}
/**
Copied:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/newformat.reveng
(from rev 10633,
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/newformat.reveng)
Modified:
branches/Branch_3_2/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl 2006-10-19
17:38:50 UTC (rev 10633)
+++
branches/Branch_3_2/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl 2006-10-20
08:35:35 UTC (rev 10634)
@@ -6,3 +6,7 @@
booleanProperty=${booleanProperty?if_exists?string}
<#if booleanProperty?exists &&
!booleanProperty>booleanWasTrue=true</#if>
myTool.value=<#if
myTool?exists>${myTool.unqualify("myTool.value")}</#if>
+<#if refproperty?exists>
+<#assign inline= refproperty?interpret>
+refproperty=<@inline/>
+</#if>