Hibernate SVN: r10701 - in branches/Branch_3_2/HibernateExt/tools/src: java/org/hibernate/tool/hbm2x/doc java/org/hibernate/tool/hbm2x/pojo templates/doc templates/doc/entities
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-11-03 07:20:54 -0500 (Fri, 03 Nov 2006)
New Revision: 10701
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/ComponentPOJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl
Log:
HBX-805 Split property summaries into id, version and simple property sections
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java 2006-11-03 02:35:50 UTC (rev 10700)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java 2006-11-03 12:20:54 UTC (rev 10701)
@@ -521,14 +521,44 @@
public List getOrderedProperties(POJOClass pojoClass)
{
- List orderedProperties = new ArrayList();
+ List orderedProperties = getAllProperties(pojoClass);
+
+ Collections.sort(orderedProperties, PROPERTY_COMPARATOR);
- for (Iterator iterator = pojoClass.getAllPropertiesIterator(); iterator.hasNext(); )
- orderedProperties.add(iterator.next());
+ return orderedProperties;
+ }
+
+ public List getSimpleProperties(POJOClass pojoClass)
+ {
+ List properties = getAllProperties(pojoClass);
+ if (pojoClass.hasIdentifierProperty())
+ properties.remove(pojoClass.getIdentifierProperty());
+
+ // TODO: do we need to also remove component id properties?
+
+ if (pojoClass.hasVersionProperty())
+ properties.remove(pojoClass.getVersionProperty());
+
+ return properties;
+ }
+
+ public List getOrderedSimpleProperties(POJOClass pojoClass)
+ {
+ List orderedProperties = getSimpleProperties(pojoClass);
+
Collections.sort(orderedProperties, PROPERTY_COMPARATOR);
return orderedProperties;
}
-
-}
\ No newline at end of file
+
+ private List getAllProperties(POJOClass pojoClass)
+ {
+ List properties = new ArrayList();
+
+ for (Iterator iterator = pojoClass.getAllPropertiesIterator(); iterator.hasNext(); )
+ properties.add(iterator.next());
+
+ return properties;
+ }
+}
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/ComponentPOJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/ComponentPOJOClass.java 2006-11-03 02:35:50 UTC (rev 10700)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/ComponentPOJOClass.java 2006-11-03 12:20:54 UTC (rev 10701)
@@ -163,5 +163,12 @@
public boolean hasVersionProperty() {
return false;
}
-
+
+ /*
+ * @see org.hibernate.tool.hbm2x.pojo.POJOClass#getVersionProperty()
+ */
+ public Property getVersionProperty()
+ {
+ return null;
+ }
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-11-03 02:35:50 UTC (rev 10700)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2006-11-03 12:20:54 UTC (rev 10701)
@@ -150,7 +150,7 @@
public boolean hasIdentifierProperty() {
- return clazz.hasIdentifierProperty();
+ return clazz.hasIdentifierProperty() && clazz instanceof RootClass;
}
public Property getIdentifierProperty() {
@@ -799,4 +799,12 @@
public boolean hasVersionProperty() {
return clazz.isVersioned() && clazz instanceof RootClass;
}
+
+ /*
+ * @see org.hibernate.tool.hbm2x.pojo.POJOClass#getVersionProperty()
+ */
+ public Property getVersionProperty()
+ {
+ return clazz.getVersion();
+ }
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java 2006-11-03 02:35:50 UTC (rev 10700)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/POJOClass.java 2006-11-03 12:20:54 UTC (rev 10701)
@@ -107,5 +107,6 @@
public Property getIdentifierProperty();
public boolean hasVersionProperty();
+ public Property getVersionProperty();
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css 2006-11-03 02:35:50 UTC (rev 10700)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/doc/doc-style.css 2006-11-03 12:20:54 UTC (rev 10701)
@@ -24,9 +24,9 @@
color: #888888;
}
-p, ul
+p, ul, hr
{
- margin: 1em 0;
+ margin: 0.5em 0;
}
h1
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl 2006-11-03 02:35:50 UTC (rev 10700)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/doc/entities/entity.ftl 2006-11-03 12:20:54 UTC (rev 10701)
@@ -156,9 +156,104 @@
</#if>
</tbody>
</table>
+ <#else>
+ <#list superClasses as superClass>
+ <#if superClass.hasIdentifierProperty()>
+ <#assign identifier = superClass.identifierProperty>
+ <#assign superClassRef = docFileManager.getRef(docFile, docFileManager.getEntityDocFileByDeclarationName(superClass))>
+ <p id="identifier_summary" class="MainTableHeading">
+ Identifier Summary
+ </p>
+ <table id="identifier_inherited_from_entity_${superClass.shortName}">
+ <tr>
+ <th>
+ Identifier inherited from entity <a href="${superClassRef}">${superClass.shortName}</a>
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <a href="${superClassRef}#identifier_detail_${identifier.name}">${identifier.name}</a>
+ </td>
+ </tr>
+ </table>
+ </#if>
+ </#list>
</#if>
+
+ <#if class.hasVersionProperty()>
+ <#assign version = class.versionProperty>
+
+ <table id="version_summary">
+ <thead>
+ <tr>
+ <th class="MainTableHeading" colspan="4">
+ Version Summary
+ </th>
+ </tr>
+ <tr>
+ <th style="width: 14%">
+ Name
+ </th>
+ <th style="width: 14%">
+ Column
+ </th>
+ <th style="width: 14%">
+ Type
+ </th>
+ <th style="width: 58%">
+ Description
+ </th>
+ </tr>
+ </thead>
- <#assign properties = dochelper.getOrderedProperties(class)>
+ <tbody>
+ <tr>
+ <td>
+ <a href="#version_detail_${version.name}">
+ ${version.name}
+ </a>
+ </td>
+ <td>
+ Column
+ </td>
+ <td>
+ ${class.getJavaTypeName(version, jdk5)?html?default(" ")}
+ </td>
+ <td>
+ <#if class.hasFieldJavaDoc(version)>
+ ${class.getFieldDescription(version)?default(" ")}
+ <#else>
+
+ </#if>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <#else>
+ <#list superClasses as superClass>
+ <#if superClass.hasVersionProperty()>
+ <#assign version = superClass.versionProperty>
+ <#assign superClassRef = docFileManager.getRef(docFile, docFileManager.getEntityDocFileByDeclarationName(superClass))>
+ <p id="version_summary" class="MainTableHeading">
+ Version Summary
+ </p>
+ <table id="version_inherited_from_entity_${superClass.shortName}">
+ <tr>
+ <th>
+ Version inherited from entity <a href="${superClassRef}">${superClass.shortName}</a>
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <a href="${superClassRef}#version_detail_${version.name}">${version.name}</a>
+ </td>
+ </tr>
+ </table>
+ </#if>
+ </#list>
+ </#if>
+
+ <#assign properties = dochelper.getOrderedSimpleProperties(class)>
<#if !properties.empty>
<table id="property_summary">
<thead>
@@ -255,10 +350,17 @@
</table>
</#if>
+ <#assign propertyHeader = properties.empty>
<#list superClasses as superClass>
- <#assign properties = dochelper.getOrderedProperties(superClass)>
- <#if !properties.empty>
+ <#assign superProperties = dochelper.getOrderedSimpleProperties(superClass)>
+ <#if !superProperties.empty>
<#assign superClassRef = docFileManager.getRef(docFile, docFileManager.getEntityDocFileByDeclarationName(superClass))>
+ <#if propertyHeader>
+ <#assign propertyHeader = false>
+ <p id="properties_summary" class="MainTableHeading">
+ Property Summary
+ </p>
+ </#if>
<table id="properties_inherited_from_entity_${superClass.shortName}">
<tr>
<th>
@@ -267,7 +369,7 @@
</tr>
<tr>
<td>
- <#list properties as property>
+ <#list superProperties as property>
<a href="${superClassRef}#property_detail_${property.name}">${property.name}</a><#if property_has_next>, </#if>
</#list>
</td>
@@ -277,7 +379,7 @@
</#list>
<#if class.hasIdentifierProperty()>
- <#assign identifier = class.getIdentifierProperty()>
+ <#assign identifier = class.identifierProperty>
<p id="identifier_detail" class="MainTableHeading">
Identifier Detail
</p>
@@ -291,8 +393,17 @@
</#if>
</#if>
- <#assign properties = class.allPropertiesIterator>
- <#if properties.hasNext()>
+ <#if class.hasVersionProperty()>
+ <#assign version = class.versionProperty>
+ <p id="version_detail" class="MainTableHeading">
+ Version Detail
+ </p>
+ <#assign version = class.versionProperty>
+ <h3 id="version_detail_${version.name}">${version.name}</h3>
+ </#if>
+
+ <#assign properties = dochelper.getSimpleProperties(class)>
+ <#if !properties.empty>
<p id="property_detail" class="MainTableHeading">
Property Detail
</p>
17 years, 5 months
Hibernate SVN: r10700 - branches/Lucene_Integration/HibernateExt/metadata/src/java/org/hibernate/lucene/query
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-11-02 21:35:50 -0500 (Thu, 02 Nov 2006)
New Revision: 10700
Modified:
branches/Lucene_Integration/HibernateExt/metadata/src/java/org/hibernate/lucene/query/LuceneQueryImpl.java
Log:
minor
Modified: branches/Lucene_Integration/HibernateExt/metadata/src/java/org/hibernate/lucene/query/LuceneQueryImpl.java
===================================================================
--- branches/Lucene_Integration/HibernateExt/metadata/src/java/org/hibernate/lucene/query/LuceneQueryImpl.java 2006-11-02 20:01:04 UTC (rev 10699)
+++ branches/Lucene_Integration/HibernateExt/metadata/src/java/org/hibernate/lucene/query/LuceneQueryImpl.java 2006-11-03 02:35:50 UTC (rev 10700)
@@ -75,10 +75,9 @@
LuceneEventListener listener = ContextHelper.getLuceneEventListener( session );
//find the directories
Searcher searcher = buildSearcher( listener );
- Hits hits;
try {
org.apache.lucene.search.Query query = filterQueryByClasses( luceneQuery );
- hits = searcher.search( query );
+ Hits hits = searcher.search( query );
setResultSize( hits );
int first = first();
int max = max( first, hits );
17 years, 5 months
Hibernate SVN: r10699 - branches/Branch_3_2/Hibernate3/src/org/hibernate/impl
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-11-02 15:01:04 -0500 (Thu, 02 Nov 2006)
New Revision: 10699
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java
Log:
HHH-1767 : incorrect warnings when building collection caches
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java 2006-11-02 20:00:53 UTC (rev 10698)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java 2006-11-02 20:01:04 UTC (rev 10699)
@@ -194,7 +194,7 @@
settings.getDefaultCatalogName(),
settings.getDefaultSchemaName(),
(RootClass) model
- );
+ );
identifierGenerators.put( model.getEntityName(), generator );
}
}
@@ -238,11 +238,11 @@
while ( collections.hasNext() ) {
Collection model = (Collection) collections.next();
CacheConcurrencyStrategy cache = CacheFactory.createCache(
- model.getCacheConcurrencyStrategy(),
- model.getCacheRegionName(),
- true,
- settings,
- properties
+ model.getCacheConcurrencyStrategy(),
+ model.getCacheRegionName(),
+ model.isMutable(),
+ settings,
+ properties
);
if ( cache != null ) {
allCacheRegions.put( cache.getRegionName(), cache.getCache() );
17 years, 5 months
Hibernate SVN: r10698 - trunk/Hibernate3/src/org/hibernate/impl
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-11-02 15:00:53 -0500 (Thu, 02 Nov 2006)
New Revision: 10698
Modified:
trunk/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java
Log:
HHH-1767 : incorrect warnings when building collection caches
Modified: trunk/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java 2006-11-02 19:28:32 UTC (rev 10697)
+++ trunk/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java 2006-11-02 20:00:53 UTC (rev 10698)
@@ -217,7 +217,7 @@
model.isMutable(),
settings,
properties
- );
+ );
if (cache!=null) {
caches.put(cacheRegion, cache);
allCacheRegions.put( cache.getRegionName(), cache.getCache() );
@@ -238,11 +238,11 @@
while ( collections.hasNext() ) {
Collection model = (Collection) collections.next();
CacheConcurrencyStrategy cache = CacheFactory.createCache(
- model.getCacheConcurrencyStrategy(),
- model.getCacheRegionName(),
- true,
- settings,
- properties
+ model.getCacheConcurrencyStrategy(),
+ model.getCacheRegionName(),
+ model.isMutable(),
+ settings,
+ properties
);
if ( cache != null ) {
allCacheRegions.put( cache.getRegionName(), cache.getCache() );
17 years, 5 months
Hibernate SVN: r10697 - branches/Branch_3_2/Hibernate3/src/org/hibernate/engine
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-11-02 14:28:32 -0500 (Thu, 02 Nov 2006)
New Revision: 10697
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java
Log:
HHH-1756 : BatchFetchQueue and evicted proxies
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java 2006-11-02 19:28:15 UTC (rev 10696)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java 2006-11-02 19:28:32 UTC (rev 10697)
@@ -836,10 +836,20 @@
}
/**
- * Remove a proxy from the session cache
+ * Remove a proxy from the session cache.
+ * <p/>
+ * Additionally, ensure that any load optimization references
+ * such as batch or subselect loading get cleaned up as well.
+ *
+ * @param key The key of the entity proxy to be removed
+ * @return The proxy reference.
*/
public Object removeProxy(EntityKey key) {
- return proxiesByKey.remove(key);
+ if ( batchFetchQueue != null ) {
+ batchFetchQueue.removeBatchLoadableEntityKey( key );
+ batchFetchQueue.removeSubselect( key );
+ }
+ return proxiesByKey.remove( key );
}
/**
17 years, 5 months
Hibernate SVN: r10696 - trunk/Hibernate3/src/org/hibernate/engine
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-11-02 14:28:15 -0500 (Thu, 02 Nov 2006)
New Revision: 10696
Modified:
trunk/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java
Log:
HHH-1756 : BatchFetchQueue and evicted proxies
Modified: trunk/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java 2006-11-02 19:18:52 UTC (rev 10695)
+++ trunk/Hibernate3/src/org/hibernate/engine/StatefulPersistenceContext.java 2006-11-02 19:28:15 UTC (rev 10696)
@@ -836,10 +836,20 @@
}
/**
- * Remove a proxy from the session cache
+ * Remove a proxy from the session cache.
+ * <p/>
+ * Additionally, ensure that any load optimization references
+ * such as batch or subselect loading get cleaned up as well.
+ *
+ * @param key The key of the entity proxy to be removed
+ * @return The proxy reference.
*/
public Object removeProxy(EntityKey key) {
- return proxiesByKey.remove(key);
+ if ( batchFetchQueue != null ) {
+ batchFetchQueue.removeBatchLoadableEntityKey( key );
+ batchFetchQueue.removeSubselect( key );
+ }
+ return proxiesByKey.remove( key );
}
/**
17 years, 5 months
Hibernate SVN: r10695 - in branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument: cases domain runtime
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-11-02 14:18:52 -0500 (Thu, 02 Nov 2006)
New Revision: 10695
Added:
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java
Modified:
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
Log:
added tests specific for lazy properties using user-type mappings
Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java 2006-11-02 19:17:39 UTC (rev 10694)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java 2006-11-02 19:18:52 UTC (rev 10695)
@@ -1,28 +1,43 @@
-package org.hibernate.test.instrument.cases;
-
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.Environment;
-
-/**
- * @author Steve Ebersole
- */
-public abstract class AbstractExecutable implements Executable {
-
- private SessionFactory factory;
-
- public void prepare() {
- factory = new Configuration()
- .setProperty( Environment.HBM2DDL_AUTO, "create-drop" )
- .addResource( "org/hibernate/test/instrument/domain/Documents.hbm.xml" )
- .buildSessionFactory();
- }
-
- public void complete() {
- factory.close();
- }
-
- protected SessionFactory getFactory() {
- return factory;
- }
-}
+package org.hibernate.test.instrument.cases;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+
+/**
+ * @author Steve Ebersole
+ */
+public abstract class AbstractExecutable implements Executable {
+
+ private SessionFactory factory;
+
+ public final void prepare() {
+ Configuration cfg = new Configuration()
+ .setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
+ String[] resources = getResources();
+ for ( int i = 0; i < resources.length; i++ ) {
+ cfg.addResource( resources[i] );
+ }
+ factory = cfg.buildSessionFactory();
+ }
+
+ public final void complete() {
+ try {
+ cleanup();
+ }
+ finally {
+ factory.close();
+ }
+ }
+
+ protected SessionFactory getFactory() {
+ return factory;
+ }
+
+ protected void cleanup() {
+ }
+
+ protected String[] getResources() {
+ return new String[] { "org/hibernate/test/instrument/domain/Documents.hbm.xml" };
+ }
+}
Added: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java 2006-11-02 19:17:39 UTC (rev 10694)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java 2006-11-02 19:18:52 UTC (rev 10695)
@@ -0,0 +1,71 @@
+package org.hibernate.test.instrument.cases;
+
+import java.util.Iterator;
+
+import junit.framework.Assert;
+
+import org.hibernate.Session;
+import org.hibernate.intercept.FieldInterceptionHelper;
+import org.hibernate.test.instrument.domain.Problematic;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class TestLazyPropertyCustomTypeExecutable extends AbstractExecutable {
+
+ protected String[] getResources() {
+ return new String[] { "org/hibernate/test/instrument/domain/Problematic.hbm.xml" };
+ }
+
+ public void execute() {
+ Session s = getFactory().openSession();
+ s.beginTransaction();
+ Problematic p = new Problematic();
+ p.setName( "whatever" );
+ p.setBytes( new byte[] { 1, 0, 1, 1, 0 } );
+ s.save( p );
+ s.getTransaction().commit();
+ s.close();
+
+ // this access should be ok because p1 is not a lazy proxy
+ s = getFactory().openSession();
+ s.beginTransaction();
+ Problematic p1 = ( Problematic ) s.get( Problematic.class, p.getId() );
+ Assert.assertTrue( FieldInterceptionHelper.isInstrumented( p1 ) );
+ p1.getRepresentation();
+ s.getTransaction().commit();
+ s.close();
+
+ // this should cause problems
+ s = getFactory().openSession();
+ s.beginTransaction();
+ p1 = ( Problematic ) s.load( Problematic.class, p.getId() );
+ Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
+ p1.getRepresentation();
+ s.getTransaction().commit();
+ s.close();
+
+ // this should cause problems
+ s = getFactory().openSession();
+ s.beginTransaction();
+ p1 = ( Problematic ) s.load( Problematic.class, p.getId() );
+ Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
+ p1.setRepresentation( p.getRepresentation() );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ protected void cleanup() {
+ Session s = getFactory().openSession();
+ s.beginTransaction();
+ Iterator itr = s.createQuery( "from Problematic" ).list().iterator();
+ while( itr.hasNext() ) {
+ Problematic p = ( Problematic ) itr.next();
+ s.delete( p );
+ }
+ s.getTransaction().commit();
+ s.close();
+ }
+}
Added: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java 2006-11-02 19:17:39 UTC (rev 10694)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java 2006-11-02 19:18:52 UTC (rev 10695)
@@ -0,0 +1,109 @@
+package org.hibernate.test.instrument.domain;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Arrays;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Hibernate;
+import org.hibernate.usertype.UserType;
+
+/**
+ * A simple byte[]-based custom type.
+ */
+public class CustomBlobType implements UserType {
+ /**
+ * {@inheritDoc}
+ */
+ public Object nullSafeGet(ResultSet rs, String names[], Object owner) throws SQLException {
+ // cast just to make sure...
+ return ( byte[] ) Hibernate.BINARY.nullSafeGet( rs, names );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void nullSafeSet(PreparedStatement ps, Object value, int index) throws SQLException, HibernateException {
+ // cast just to make sure...
+ Hibernate.BINARY.nullSafeSet( ps, ( byte[] ) value, index );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object deepCopy(Object value) {
+ byte result[] = null;
+
+ if ( value != null ) {
+ byte bytes[] = ( byte[] ) value;
+
+ result = new byte[bytes.length];
+ System.arraycopy( bytes, 0, result, 0, bytes.length );
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isMutable() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int[] sqlTypes() {
+ return new int[] { Types.VARBINARY };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Class returnedClass() {
+ return byte[].class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(Object x, Object y) {
+ return Arrays.equals( ( byte[] ) x, ( byte[] ) y );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object assemble(Serializable arg0, Object arg1)
+ throws HibernateException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Serializable disassemble(Object arg0)
+ throws HibernateException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode(Object arg0)
+ throws HibernateException {
+ return 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object replace(Object arg0, Object arg1, Object arg2)
+ throws HibernateException {
+ return null;
+ }
+}
\ No newline at end of file
Added: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml 2006-11-02 19:17:39 UTC (rev 10694)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml 2006-11-02 19:18:52 UTC (rev 10695)
@@ -0,0 +1,14 @@
+ <?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.test.instrument.domain">
+ <class name="Problematic">
+ <id name="id" type="long" column="ID">
+ <generator class="increment" />
+ </id>
+ <property name="name" type="string" column="NAME" />
+ <property name="bytes" type="org.hibernate.test.instrument.domain.CustomBlobType" column="DATA" lazy="true" />
+ </class>
+ </hibernate-mapping>
Added: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java 2006-11-02 19:17:39 UTC (rev 10694)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java 2006-11-02 19:18:52 UTC (rev 10695)
@@ -0,0 +1,69 @@
+package org.hibernate.test.instrument.domain;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Problematic {
+ private Long id;
+ private String name;
+ private byte[] bytes;
+
+ private Representation representation;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public void setBytes(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ public Representation getRepresentation() {
+ if ( representation == null ) {
+ representation = ( ( bytes == null ) ? null : new Representation( bytes ) );
+ }
+ return representation;
+ }
+
+ public void setRepresentation(Representation rep) {
+ bytes = rep.getBytes();
+ }
+
+ public static class Representation {
+ private byte[] bytes;
+
+ public Representation(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public String toString() {
+ String result = "";
+ for ( int i = 0; i < bytes.length; i++ ) {
+ result += bytes[i];
+ }
+ return result;
+ }
+ }
+}
Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2006-11-02 19:17:39 UTC (rev 10694)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2006-11-02 19:18:52 UTC (rev 10695)
@@ -70,6 +70,9 @@
executeExecutable( "org.hibernate.test.instrument.cases.TestManyToOneProxyExecutable" );
}
+ public void testLazyPropertyCustomType() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable" );
+ }
// reflection code to ensure isolation into the created classloader ~~~~~~~
17 years, 5 months
Hibernate SVN: r10694 - in trunk/Hibernate3/test/org/hibernate/test/instrument: cases domain runtime
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-11-02 14:17:39 -0500 (Thu, 02 Nov 2006)
New Revision: 10694
Added:
trunk/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
trunk/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java
trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java
Modified:
trunk/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java
trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
Log:
added tests specific for lazy properties using user-type mappings
Modified: trunk/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java 2006-11-02 19:14:21 UTC (rev 10693)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/cases/AbstractExecutable.java 2006-11-02 19:17:39 UTC (rev 10694)
@@ -11,18 +11,33 @@
private SessionFactory factory;
- public void prepare() {
- factory = new Configuration()
- .setProperty( Environment.HBM2DDL_AUTO, "create-drop" )
- .addResource( "org/hibernate/test/instrument/domain/Documents.hbm.xml" )
- .buildSessionFactory();
+ public final void prepare() {
+ Configuration cfg = new Configuration()
+ .setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
+ String[] resources = getResources();
+ for ( int i = 0; i < resources.length; i++ ) {
+ cfg.addResource( resources[i] );
+ }
+ factory = cfg.buildSessionFactory();
}
- public void complete() {
- factory.close();
+ public final void complete() {
+ try {
+ cleanup();
+ }
+ finally {
+ factory.close();
+ }
}
protected SessionFactory getFactory() {
return factory;
}
+
+ protected void cleanup() {
+ }
+
+ protected String[] getResources() {
+ return new String[] { "org/hibernate/test/instrument/domain/Documents.hbm.xml" };
+ }
}
Added: trunk/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java 2006-11-02 19:14:21 UTC (rev 10693)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java 2006-11-02 19:17:39 UTC (rev 10694)
@@ -0,0 +1,71 @@
+package org.hibernate.test.instrument.cases;
+
+import java.util.Iterator;
+
+import junit.framework.Assert;
+
+import org.hibernate.Session;
+import org.hibernate.intercept.FieldInterceptionHelper;
+import org.hibernate.test.instrument.domain.Problematic;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class TestLazyPropertyCustomTypeExecutable extends AbstractExecutable {
+
+ protected String[] getResources() {
+ return new String[] { "org/hibernate/test/instrument/domain/Problematic.hbm.xml" };
+ }
+
+ public void execute() {
+ Session s = getFactory().openSession();
+ s.beginTransaction();
+ Problematic p = new Problematic();
+ p.setName( "whatever" );
+ p.setBytes( new byte[] { 1, 0, 1, 1, 0 } );
+ s.save( p );
+ s.getTransaction().commit();
+ s.close();
+
+ // this access should be ok because p1 is not a lazy proxy
+ s = getFactory().openSession();
+ s.beginTransaction();
+ Problematic p1 = ( Problematic ) s.get( Problematic.class, p.getId() );
+ Assert.assertTrue( FieldInterceptionHelper.isInstrumented( p1 ) );
+ p1.getRepresentation();
+ s.getTransaction().commit();
+ s.close();
+
+ // this should cause problems
+ s = getFactory().openSession();
+ s.beginTransaction();
+ p1 = ( Problematic ) s.load( Problematic.class, p.getId() );
+ Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
+ p1.getRepresentation();
+ s.getTransaction().commit();
+ s.close();
+
+ // this should cause problems
+ s = getFactory().openSession();
+ s.beginTransaction();
+ p1 = ( Problematic ) s.load( Problematic.class, p.getId() );
+ Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
+ p1.setRepresentation( p.getRepresentation() );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ protected void cleanup() {
+ Session s = getFactory().openSession();
+ s.beginTransaction();
+ Iterator itr = s.createQuery( "from Problematic" ).list().iterator();
+ while( itr.hasNext() ) {
+ Problematic p = ( Problematic ) itr.next();
+ s.delete( p );
+ }
+ s.getTransaction().commit();
+ s.close();
+ }
+}
Added: trunk/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java 2006-11-02 19:14:21 UTC (rev 10693)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/domain/CustomBlobType.java 2006-11-02 19:17:39 UTC (rev 10694)
@@ -0,0 +1,109 @@
+package org.hibernate.test.instrument.domain;
+
+import java.io.Serializable;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Arrays;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Hibernate;
+import org.hibernate.usertype.UserType;
+
+/**
+ * A simple byte[]-based custom type.
+ */
+public class CustomBlobType implements UserType {
+ /**
+ * {@inheritDoc}
+ */
+ public Object nullSafeGet(ResultSet rs, String names[], Object owner) throws SQLException {
+ // cast just to make sure...
+ return ( byte[] ) Hibernate.BINARY.nullSafeGet( rs, names );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void nullSafeSet(PreparedStatement ps, Object value, int index) throws SQLException, HibernateException {
+ // cast just to make sure...
+ Hibernate.BINARY.nullSafeSet( ps, ( byte[] ) value, index );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object deepCopy(Object value) {
+ byte result[] = null;
+
+ if ( value != null ) {
+ byte bytes[] = ( byte[] ) value;
+
+ result = new byte[bytes.length];
+ System.arraycopy( bytes, 0, result, 0, bytes.length );
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isMutable() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int[] sqlTypes() {
+ return new int[] { Types.VARBINARY };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Class returnedClass() {
+ return byte[].class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean equals(Object x, Object y) {
+ return Arrays.equals( ( byte[] ) x, ( byte[] ) y );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object assemble(Serializable arg0, Object arg1)
+ throws HibernateException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Serializable disassemble(Object arg0)
+ throws HibernateException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int hashCode(Object arg0)
+ throws HibernateException {
+ return 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object replace(Object arg0, Object arg1, Object arg2)
+ throws HibernateException {
+ return null;
+ }
+}
\ No newline at end of file
Added: trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml 2006-11-02 19:14:21 UTC (rev 10693)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.hbm.xml 2006-11-02 19:17:39 UTC (rev 10694)
@@ -0,0 +1,14 @@
+<?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.test.instrument.domain">
+ <class name="Problematic">
+ <id name="id" type="long" column="ID">
+ <generator class="increment" />
+ </id>
+ <property name="name" type="string" column="NAME" />
+ <property name="bytes" type="org.hibernate.test.instrument.domain.CustomBlobType" column="DATA" lazy="true" />
+ </class>
+</hibernate-mapping>
Added: trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java 2006-11-02 19:14:21 UTC (rev 10693)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/domain/Problematic.java 2006-11-02 19:17:39 UTC (rev 10694)
@@ -0,0 +1,69 @@
+package org.hibernate.test.instrument.domain;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Problematic {
+ private Long id;
+ private String name;
+ private byte[] bytes;
+
+ private Representation representation;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public void setBytes(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ public Representation getRepresentation() {
+ if ( representation == null ) {
+ representation = ( ( bytes == null ) ? null : new Representation( bytes ) );
+ }
+ return representation;
+ }
+
+ public void setRepresentation(Representation rep) {
+ bytes = rep.getBytes();
+ }
+
+ public static class Representation {
+ private byte[] bytes;
+
+ public Representation(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public String toString() {
+ String result = "";
+ for ( int i = 0; i < bytes.length; i++ ) {
+ result += bytes[i];
+ }
+ return result;
+ }
+ }
+}
Modified: trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2006-11-02 19:14:21 UTC (rev 10693)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2006-11-02 19:17:39 UTC (rev 10694)
@@ -70,8 +70,12 @@
executeExecutable( "org.hibernate.test.instrument.cases.TestManyToOneProxyExecutable" );
}
+ public void testLazyPropertyCustomType() {
+ executeExecutable( "org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable" );
+ }
+
// reflection code to ensure isolation into the created classloader ~~~~~~~
private static final Class[] SIG = new Class[] {};
17 years, 5 months
Hibernate SVN: r10693 - in branches/Branch_3_2/HibernateExt/tools/src: templates/doc/tables test/org/hibernate/tool/hbm2x
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-11-02 14:14:21 -0500 (Thu, 02 Nov 2006)
New Revision: 10693
Added:
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-table-list.ftl
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml
Log:
missing file + updated test to include a second schema.
Added: branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-table-list.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-table-list.ftl 2006-11-02 19:12:37 UTC (rev 10692)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-table-list.ftl 2006-11-02 19:14:21 UTC (rev 10693)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+ <head>
+ <title>Hibernate Mappings - Table List</title>
+ <link rel="stylesheet" type="text/css" href="${docFileManager.getRef(docFile, docFileManager.getCssStylesDocFile())}" title="Style"/>
+ </head>
+ <body class="List">
+
+ <p class="ListTitleFont">
+ <a href="${docFileManager.getRef(docFile, docFileManager.getSchemaSummaryDocFile(title))}" target="generalFrame">${title}</a>
+ </p>
+
+ <p>
+ <#foreach table in tableList>
+ <a href="${docFileManager.getRef(docFile, docFileManager.getTableDocFile(table))}" target="generalFrame">${table.name}</a><br/>
+ </#foreach>
+ </p>
+
+ </body>
+</html>
\ No newline at end of file
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml 2006-11-02 19:12:37 UTC (rev 10692)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/UnionSubclass.hbm.xml 2006-11-02 19:14:21 UTC (rev 10693)
@@ -27,7 +27,7 @@
</column>
</property>
- <union-subclass name="UUser" table="CROWN_USERS" lazy="false">
+ <union-subclass name="UUser" table="CROWN_USERS" schema="CROWN" lazy="false">
<comment>Table of crown users</comment>
<property name="userName" type="string">
<column name="USER_NAME" length="15" not-null="true" unique="true">
17 years, 5 months
Hibernate SVN: r10692 - in branches/Branch_3_2/HibernateExt/tools/src: java/org/hibernate/tool/hbm2x templates/doc/tables
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-11-02 14:12:37 -0500 (Thu, 02 Nov 2006)
New Revision: 10692
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-summary.ftl
branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/summary.ftl
Log:
HBX-806 Improve usability of table pages
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java 2006-11-02 18:59:45 UTC (rev 10691)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java 2006-11-02 19:12:37 UTC (rev 10692)
@@ -105,6 +105,11 @@
private static final String FTL_TABLES_TABLE_LIST = "doc/tables/table-list.ftl";
/**
+ * Template used for table lists for a specific schema.
+ */
+ private static final String FTL_TABLES_PERSCHEMA_TABLE_LIST = "doc/tables/schema-table-list.ftl";
+
+ /**
* Template used for schema lists.
*/
private static final String FTL_TABLES_SCHEMA_LIST = "doc/tables/schema-list.ftl";
@@ -568,7 +573,7 @@
parameters.put("title", schemaName);
parameters.put("tableList", docHelper.getTables(schemaName) );
- processTemplate(parameters, FTL_TABLES_TABLE_LIST, file);
+ processTemplate(parameters, FTL_TABLES_PERSCHEMA_TABLE_LIST, file);
}
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-summary.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-summary.ftl 2006-11-02 18:59:45 UTC (rev 10691)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/schema-summary.ftl 2006-11-02 19:12:37 UTC (rev 10692)
@@ -12,7 +12,7 @@
<table>
<thead>
<tr>
- <th class="MainTableHeading" colspan="2">
+ <th class="MainTableHeading">
Tables
</th>
</tr>
@@ -25,44 +25,6 @@
${table.name}
</a>
</td>
- <td>
- <table>
- <thead>
- <tr>
- <th style="width: 50%">
- Name
- </th>
- <th style="width: 30%">
- SQL Type
- </th>
- <th style="width: 15%">
- Nullable
- </th>
- <th style="width: 15%">
- Unique
- </th>
- </tr>
- </thead>
- <tbody>
- <#foreach column in table.columnIterator>
- <tr>
- <td>
- ${column.name}
- </td>
- <td>
- ${dochelper.getSQLTypeName(column)}
- </td>
- <td>
- ${column.nullable?string}
- </td>
- <td>
- ${column.unique?string}
- </td>
- </tr>
- </#foreach>
- </tbody>
- </table>
- </td>
</tr>
</#foreach>
</tbody>
Modified: branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/summary.ftl
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/summary.ftl 2006-11-02 18:59:45 UTC (rev 10691)
+++ branches/Branch_3_2/HibernateExt/tools/src/templates/doc/tables/summary.ftl 2006-11-02 19:12:37 UTC (rev 10692)
@@ -18,68 +18,26 @@
</p>
</#if>
- <#foreach schema in dochelper.tablesBySchema.keySet()>
- <table>
- <thead>
+ <table>
+ <thead>
+ <tr>
+ <th class="MainTableHeading">
+ Schemas
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <#foreach schema in dochelper.tablesBySchema.keySet()>
<tr>
- <th class="MainTableHeading" colspan="2">
- ${schema}
- </th>
+ <td>
+ <a href="${docFileManager.getRef(docFile, docFileManager.getSchemaSummaryDocFile(schema))}" target="generalFrame">
+ ${schema}
+ </a>
+ </td>
</tr>
- </thead>
- <tbody>
- <#foreach table in dochelper.getTables(schema)>
- <tr>
- <td>
- <a href="${docFileManager.getRef(docFile, docFileManager.getTableDocFile(table))}" target="generalFrame">
- ${table.name}
- </a>
- </td>
- <td>
- <table>
- <thead>
- <tr>
- <th style="width: 50%">
- Name
- </th>
- <th style="width: 30%">
- SQL Type
- </th>
- <th style="width: 15%">
- Nullable
- </th>
- <th style="width: 15%">
- Unique
- </th>
- </tr>
- </thead>
- <tbody>
- <#foreach column in table.columnIterator>
- <tr>
- <td>
- <a href="${docFileManager.getRef(docFile, docFileManager.getTableDocFile(table))}#column_detail_${column.name}" target="generalFrame">
- ${column.name}
- </a>
- </td>
- <td>
- ${dochelper.getSQLTypeName(column)}
- </td>
- <td>
- ${column.nullable?string}
- </td>
- <td>
- ${column.unique?string}
- </td>
- </tr>
- </#foreach>
- </tbody>
- </table>
- </td>
- </tr>
- </#foreach>
- </tbody>
- </table>
- </#foreach>
+ </#foreach>
+ </tbody>
+ </table>
</body>
</html>
17 years, 5 months