You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ste...@us...> - 2006-02-21 14:11:39
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19424/src/org/hibernate/cache Modified Files: OptimisticTreeCache.java TreeCache.java Log Message: HHH-1251 : non-replicated clearing of TreeCache on SessionFactory shutdown Index: OptimisticTreeCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache/OptimisticTreeCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OptimisticTreeCache.java 9 Feb 2006 20:48:42 -0000 1.1 +++ OptimisticTreeCache.java 21 Feb 2006 14:11:28 -0000 1.2 @@ -166,7 +166,14 @@ } public void destroy() throws CacheException { - clear(); + try { + Option option = new Option(); + option.setCacheModeLocal( true ); + cache.remove( new Fqn( regionName ), option ); + } + catch( Exception e ) { + throw new CacheException( e ); + } } public void lock(Object key) throws CacheException { Index: TreeCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache/TreeCache.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- TreeCache.java 10 Aug 2005 04:54:07 -0000 1.17 +++ TreeCache.java 21 Feb 2006 14:11:28 -0000 1.18 @@ -126,7 +126,17 @@ } public void destroy() throws CacheException { - clear(); + try { + // NOTE : evict() operates locally only (i.e., does not propogate + // to any other nodes in the potential cluster). This is + // exactly what is needed when we destroy() here; destroy() is used + // as part of the process of shutting down a SessionFactory; thus + // these removals should not be propogated + cache.evict( new Fqn( regionName ) ); + } + catch( Exception e ) { + throw new CacheException( e ); + } } public void lock(Object key) throws CacheException { |
From: <ste...@us...> - 2006-02-21 14:08:08
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17010/src/org/hibernate/cache Modified Files: Tag: Branch_3_1 TreeCache.java Log Message: HHH-1251 : non-replicated clearing of TreeCache on SessionFactory shutdown Index: TreeCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/cache/TreeCache.java,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -u -d -r1.17 -r1.17.2.1 --- TreeCache.java 10 Aug 2005 04:54:07 -0000 1.17 +++ TreeCache.java 21 Feb 2006 14:07:58 -0000 1.17.2.1 @@ -126,7 +126,17 @@ } public void destroy() throws CacheException { - clear(); + try { + // NOTE : evict() operates locally only (i.e., does not propogate + // to any other nodes in the potential cluster). This is + // exactly what is needed when we destroy() here; destroy() is used + // as part of the process of shutting down a SessionFactory; thus + // these removals should not be propogated + cache.evict( new Fqn( regionName ) ); + } + catch( Exception e ) { + throw new CacheException( e ); + } } public void lock(Object key) throws CacheException { |
From: <max...@us...> - 2006-02-21 10:11:24
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22826/src/org/hibernate/dialect Added Files: DataDirectOracle9Dialect.java Log Message: HHH-1516 support DataDirect standard jdbc stored procedures (merge from 3.1 branch) |
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22826/test/org/hibernate/test/sql Added Files: OracleDataDirectDriverStoredProcedures.hbm.xml OracleDriverStoredProcedures.hbm.xml DataDirectOracleSQLTest.java Log Message: HHH-1516 support DataDirect standard jdbc stored procedures (merge from 3.1 branch) |
From: <max...@us...> - 2006-02-21 09:46:47
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11354/test/org/hibernate/test/sql Modified Files: Tag: Branch_3_1 DataDirectOracleSQLTest.java Log Message: HHH-1516 support DataDirect standard jdbc stored procedures Index: DataDirectOracleSQLTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/sql/Attic/DataDirectOracleSQLTest.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- DataDirectOracleSQLTest.java 21 Feb 2006 09:09:37 -0000 1.1.2.1 +++ DataDirectOracleSQLTest.java 21 Feb 2006 09:46:44 -0000 1.1.2.2 @@ -8,7 +8,7 @@ import org.hibernate.dialect.Oracle9Dialect; /** - * @author Gavin King + * @author Max Rydahl Andersen */ public class DataDirectOracleSQLTest extends HandSQLTest { |
From: <max...@us...> - 2006-02-21 09:09:41
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26144/test/org/hibernate/test/sql Modified Files: Tag: Branch_3_1 OracleSQLTest.java OracleEmployment.hbm.xml Added Files: Tag: Branch_3_1 OracleDriverStoredProcedures.hbm.xml OracleDataDirectDriverStoredProcedures.hbm.xml DataDirectOracleSQLTest.java Log Message: HHH-1516 support DataDirect standard jdbc stored procedures --- NEW FILE: OracleDriverStoredProcedures.hbm.xml --- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- This version is for Oracle drivers proprietary handling of stored procedures/functions. --> <hibernate-mapping package="org.hibernate.test.sql" default-access="field"> <sql-query name="simpleScalar" callable="true"> <return-scalar column="name" type="string"/> <return-scalar column="value" type="long"/> { ? = call simpleScalar(:number) } </sql-query> <sql-query name="paramhandling" callable="true"> <return-scalar column="value" type="long" /> <return-scalar column="value2" type="long" /> { ? = call testParamHandling(?,?) } </sql-query> <sql-query name="paramhandling_mixed" callable="true"> <return-scalar column="value" type="long" /> <return-scalar column="value2" type="long" /> { ? = call testParamHandling(?,:second) } </sql-query> <sql-query name="selectAllEmployments" callable="true"> <return alias="emp" class="Employment"> <return-property name="employee" column="EMPLOYEE"/> <return-property name="employer" column="EMPLOYER"/> <return-property name="startDate" column="STARTDATE"/> <return-property name="endDate" column="ENDDATE"/> <return-property name="regionCode" column="REGIONCODE"/> <return-property name="employmentId" column="EMPID"/> <return-property name="salary"> <return-column name="VALUE"/> <return-column name="CURRENCY"/> </return-property> </return> { ? = call allEmployments() } </sql-query> </hibernate-mapping> --- NEW FILE: OracleDataDirectDriverStoredProcedures.hbm.xml --- <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- This version is for DataDirect drivers jdbc standard handling of stored procedures/functions. --> <hibernate-mapping package="org.hibernate.test.sql" default-access="field"> <sql-query name="simpleScalar" callable="true"> <return-scalar column="name" type="string"/> <return-scalar column="value" type="long"/> { call simpleScalar(:number) } </sql-query> <sql-query name="paramhandling" callable="true"> <return-scalar column="value" type="long" /> <return-scalar column="value2" type="long" /> { call testParamHandling(?,?) } </sql-query> <sql-query name="paramhandling_mixed" callable="true"> <return-scalar column="value" type="long" /> <return-scalar column="value2" type="long" /> { call testParamHandling(?,:second) } </sql-query> <sql-query name="selectAllEmployments" callable="true"> <return alias="emp" class="Employment"> <return-property name="employee" column="EMPLOYEE"/> <return-property name="employer" column="EMPLOYER"/> <return-property name="startDate" column="STARTDATE"/> <return-property name="endDate" column="ENDDATE"/> <return-property name="regionCode" column="REGIONCODE"/> <return-property name="employmentId" column="EMPID"/> <return-property name="salary"> <return-column name="VALUE"/> <return-column name="CURRENCY"/> </return-property> </return> { call allEmployments() } </sql-query> </hibernate-mapping> --- NEW FILE: DataDirectOracleSQLTest.java --- //$Id$ package org.hibernate.test.sql; import junit.framework.Test; import junit.framework.TestSuite; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Oracle9Dialect; /** * @author Gavin King */ public class DataDirectOracleSQLTest extends HandSQLTest { public DataDirectOracleSQLTest(String str) { super(str); } protected String[] getMappings() { return new String[] { "sql/OracleEmployment.hbm.xml", "sql/OracleDataDirectDriverStoredProcedures.hbm.xml" }; } public static Test suite() { return new TestSuite(DataDirectOracleSQLTest.class); } public boolean appliesTo(Dialect dialect) { return ( dialect instanceof Oracle9Dialect ); } } Index: OracleSQLTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/sql/OracleSQLTest.java,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -d -r1.9.2.1 -r1.9.2.2 --- OracleSQLTest.java 9 Feb 2006 17:30:48 -0000 1.9.2.1 +++ OracleSQLTest.java 21 Feb 2006 09:09:37 -0000 1.9.2.2 @@ -17,7 +17,7 @@ } protected String[] getMappings() { - return new String[] { "sql/OracleEmployment.hbm.xml" }; + return new String[] { "sql/OracleEmployment.hbm.xml", "sql/OracleDriverStoredProcedures.hbm.xml" }; } public static Test suite() { Index: OracleEmployment.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/sql/OracleEmployment.hbm.xml,v retrieving revision 1.18.2.1 retrieving revision 1.18.2.2 diff -u -d -r1.18.2.1 -r1.18.2.2 --- OracleEmployment.hbm.xml 9 Feb 2006 17:30:48 -0000 1.18.2.1 +++ OracleEmployment.hbm.xml 21 Feb 2006 09:09:37 -0000 1.18.2.2 @@ -154,41 +154,7 @@ ORDER BY STARTDATE ASC </sql-query> - <sql-query name="simpleScalar" callable="true"> - <return-scalar column="name" type="string"/> - <return-scalar column="value" type="long"/> - { ? = call simpleScalar(:number) } - </sql-query> - <sql-query name="paramhandling" callable="true"> - <return-scalar column="value" type="long" /> - <return-scalar column="value2" type="long" /> - { ? = call testParamHandling(?,?) } - </sql-query> - - <sql-query name="paramhandling_mixed" callable="true"> - <return-scalar column="value" type="long" /> - <return-scalar column="value2" type="long" /> - { ? = call testParamHandling(?,:second) } - </sql-query> - - <sql-query name="selectAllEmployments" callable="true"> - <return alias="emp" class="Employment"> - <return-property name="employee" column="EMPLOYEE"/> - <return-property name="employer" column="EMPLOYER"/> - <return-property name="startDate" column="STARTDATE"/> - <return-property name="endDate" column="ENDDATE"/> - <return-property name="regionCode" column="REGIONCODE"/> - <return-property name="employmentId" column="EMPID"/> - <return-property name="salary"> - <return-column name="VALUE"/> - <return-column name="CURRENCY"/> - </return-property> - </return> - { ? = call allEmployments() } - </sql-query> - - - <database-object> + <database-object> <create> CREATE OR REPLACE FUNCTION testParamHandling (j number, i number) RETURN SYS_REFCURSOR AS st_cursor SYS_REFCURSOR; @@ -235,5 +201,4 @@ </drop> </database-object> - </hibernate-mapping> |
From: <max...@us...> - 2006-02-21 09:09:40
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26144/src/org/hibernate/dialect Added Files: Tag: Branch_3_1 DataDirectOracle9Dialect.java Log Message: HHH-1516 support DataDirect standard jdbc stored procedures --- NEW FILE: DataDirectOracle9Dialect.java --- package org.hibernate.dialect; import java.sql.CallableStatement; import java.sql.ResultSet; import java.sql.SQLException; public class DataDirectOracle9Dialect extends Oracle9Dialect { public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException { return col; // sql server just returns automatically } public ResultSet getResultSet(CallableStatement ps) throws SQLException { boolean isResultSet = ps.execute(); // This assumes you will want to ignore any update counts while (!isResultSet && ps.getUpdateCount() != -1) { isResultSet = ps.getMoreResults(); } ResultSet rs = ps.getResultSet(); // You may still have other ResultSets or update counts left to process here // but you can't do it now or the ResultSet you just got will be closed return rs; } } |
From: <epb...@us...> - 2006-02-18 18:11:12
|
Update of /cvsroot/hibernate/Hibernate3/doc/reference/fr/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3116/doc/reference/fr/modules Modified Files: example_parentchild.xml Log Message: typo Index: example_parentchild.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/doc/reference/fr/modules/example_parentchild.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- example_parentchild.xml 27 Nov 2005 16:15:32 -0000 1.1 +++ example_parentchild.xml 18 Feb 2006 18:10:34 -0000 1.2 @@ -46,7 +46,7 @@ est complètement logique - une modification de l'un des états internes d'une entité ne doit pas causer la disparition de l'entité associée ! De même, l'ajout d'une entité dans une collection n'engendre pas, - par défaut, la persistence de cette entité. + par défaut, la persistance de cette entité. </para> </listitem> </itemizedlist> |
From: <epb...@us...> - 2006-02-18 18:10:45
|
Update of /cvsroot/hibernate/Hibernate3/doc/reference/fr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3116/doc/reference/fr Modified Files: master.xml Log Message: typo Index: master.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/doc/reference/fr/master.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- master.xml 9 Dec 2005 15:27:41 -0000 1.2 +++ master.xml 18 Feb 2006 18:10:39 -0000 1.3 @@ -63,7 +63,7 @@ <para> Le but d'Hibernate est de libérer le développeur de 95 pourcent des tâches de - programmation liées à la persistence des données communes. Hibernate n'est + programmation liées à la persistance des données communes. Hibernate n'est probablement pas la meilleure solution pour les applications centrées sur les données qui n'utilisent que les procédures stockées pour implémenter la logique métier dans la base de données, il est le plus utile dans les modèles métier orientés |
From: <epb...@us...> - 2006-02-17 18:47:22
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/various In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15783/metadata/src/test/org/hibernate/test/annotations/various Modified Files: Vehicule.java Log Message: ANN-241 Index: Vehicule.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/various/Vehicule.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Vehicule.java 4 Jan 2006 00:43:48 -0000 1.5 +++ Vehicule.java 17 Feb 2006 18:47:18 -0000 1.6 @@ -29,8 +29,13 @@ private String registrationNumber; @ManyToOne(optional = false) @JoinColumn(name="Conductor_fk") - @Index( name="thirdone", columnNames={"Conductor_fk"} ) + @Index( name="thirdone" ) private Conductor currentConductor; + @Index(name="year_idx") + private Integer year; + @ManyToOne(optional = true) + @Index( name="forthone" ) + private Conductor previousConductor; public String getId() { return id; @@ -55,4 +60,20 @@ public void setCurrentConductor(Conductor currentConductor) { this.currentConductor = currentConductor; } + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } + + public Conductor getPreviousConductor() { + return previousConductor; + } + + public void setPreviousConductor(Conductor previousConductor) { + this.previousConductor = previousConductor; + } } |
From: <epb...@us...> - 2006-02-17 18:47:21
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15783/metadata/src/java/org/hibernate/cfg Modified Files: AnnotationBinder.java Ejb3Column.java IndexSecondPass.java Log Message: ANN-241 Index: AnnotationBinder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java,v retrieving revision 1.176 retrieving revision 1.177 diff -u -d -r1.176 -r1.177 --- AnnotationBinder.java 14 Feb 2006 18:40:31 -0000 1.176 +++ AnnotationBinder.java 17 Feb 2006 18:47:18 -0000 1.177 @@ -1000,8 +1000,15 @@ //init index Index index = property.getAnnotation( Index.class ); if ( index != null ) { - for ( Ejb3Column column : columns ) { - column.addIndex( index ); + if (joinColumns != null) { + for ( Ejb3Column column : joinColumns ) { + column.addIndex( index ); + } + } + else { + for ( Ejb3Column column : columns ) { + column.addIndex( index ); + } } } Index: Ejb3Column.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/Ejb3Column.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- Ejb3Column.java 13 Feb 2006 19:14:35 -0000 1.37 +++ Ejb3Column.java 17 Feb 2006 18:47:18 -0000 1.38 @@ -9,7 +9,6 @@ import org.hibernate.AssertionFailure; import org.hibernate.annotations.Index; import org.hibernate.cfg.annotations.Nullability; -import org.hibernate.cfg.annotations.TableBinder; import org.hibernate.mapping.Column; import org.hibernate.mapping.Formula; import org.hibernate.mapping.Join; @@ -429,20 +428,8 @@ public void addIndex(Index index) { if ( index == null ) return; - if ( mappingColumn == null ) { - throw new AnnotationException( "Index on formula not allowed: " + propertyHolder.getEntityName() ); - } - Table table; - if ( StringHelper.isEmpty( secondaryTableName ) ) { - table = propertyHolder.getPersistentClass() - .getRootTable(); - // .getOrCreateIndex( index.name() ) - // .addColumn( mappingColumn ); - } - else { - table = getJoin().getTable(); - //.getOrCreateIndex( index.name() ).addColumn( mappingColumn ); - } - TableBinder.addIndexes( table, new Index[] { index }, mappings ); + mappings.addSecondPass( + new IndexSecondPass( index.name(), this, mappings ) + ); } } \ No newline at end of file Index: IndexSecondPass.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/IndexSecondPass.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- IndexSecondPass.java 11 Nov 2005 00:03:10 -0000 1.2 +++ IndexSecondPass.java 17 Feb 2006 18:47:18 -0000 1.3 @@ -3,37 +3,57 @@ import java.util.Map; -import org.hibernate.MappingException; import org.hibernate.AnnotationException; -import org.hibernate.mapping.Table; +import org.hibernate.MappingException; import org.hibernate.mapping.Column; +import org.hibernate.mapping.Table; /** * @author Emmanuel Bernard */ public class IndexSecondPass implements SecondPass { - private final Table table; + private Table table; private final String indexName; private final String[] columns; - private ExtendedMappings mappings; + private final ExtendedMappings mappings; + private final Ejb3Column column; public IndexSecondPass(Table table, String indexName, String[] columns, ExtendedMappings mappings) { this.table = table; this.indexName = indexName; this.columns = columns; this.mappings = mappings; + this.column = null; } + + public IndexSecondPass(String indexName, Ejb3Column column, ExtendedMappings mappings) { + this.indexName = indexName; + this.column = column; + this.columns = null; + this.mappings = mappings; + } + public void doSecondPass(Map persistentClasses, Map inheritedMetas) throws MappingException { - for ( String columnName : columns) { - Column column = table.getColumn( new Column( - mappings.getPhysicalColumnName( columnName, table ) - ) ); - if ( column == null ) { - throw new AnnotationException( - "@Index references a unknown column: " + columnName - ); + if (columns != null) { + for ( String columnName : columns) { + addIndexToColumn( columnName ); } - table.getOrCreateIndex( indexName ).addColumn( column ); } + if (column != null) { + this.table = column.getTable(); + addIndexToColumn( column.getName() ); + } + } + + private void addIndexToColumn(String columnName) { + Column column = table.getColumn( new Column( + mappings.getPhysicalColumnName( columnName, table ) + ) ); + if ( column == null ) { + throw new AnnotationException( + "@Index references a unknown column: " + columnName + ); + } + table.getOrCreateIndex( indexName ).addColumn( column ); } } |
From: <max...@us...> - 2006-02-17 16:32:03
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5019/src/java/org/hibernate/tool/ant Modified Files: HibernateToolTask.java Log Message: HBX-602 Better error reporting from <hibernatetool> in ant Index: HibernateToolTask.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- HibernateToolTask.java 6 Feb 2006 09:08:09 -0000 1.17 +++ HibernateToolTask.java 17 Feb 2006 16:31:57 -0000 1.18 @@ -12,11 +12,13 @@ import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Environment; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.PropertySet; import org.hibernate.cfg.Configuration; +import org.hibernate.util.StringHelper; /** * @author max @@ -142,6 +144,8 @@ log(count++ + ". task: " + generatorTask.getName() ); generatorTask.execute(); } + } catch (RuntimeException re) { + reportException(re); } finally { if (loader != null) { @@ -151,6 +155,30 @@ } } + private void reportException(Throwable re) { + log("An exception occurred. To get the full stack trace run ant with -verbose", Project.MSG_ERR); + log(re.toString(), Project.MSG_ERR); + String ex = new String(); + Throwable cause = re.getCause(); + while(cause!=null) { + ex += cause.toString() + "\n"; + if(cause==cause.getCause()) { + break; // we reached the top. + } else { + cause=cause.getCause(); + } + } + if(StringHelper.isNotEmpty(ex)) { + log(ex, Project.MSG_ERR); + } + + if(re instanceof BuildException) { + throw (BuildException)re; + } else { + throw new BuildException(re, getLocation()); + } + } + private void validateParameters() { if(generators.isEmpty()) { throw new BuildException("No exporters specified in <hibernatetool>. There has to be at least one specified. An exporter is e.g. <hbm2java> or <hbmtemplate>. See documentation for details.", getLocation()); |
From: <max...@us...> - 2006-02-17 16:32:03
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/testsupport In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5019/src/testsupport Modified Files: anttest-build.xml Log Message: HBX-602 Better error reporting from <hibernatetool> in ant Index: anttest-build.xml =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/testsupport/anttest-build.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- anttest-build.xml 6 Feb 2006 09:08:09 -0000 1.27 +++ anttest-build.xml 17 Feb 2006 16:31:57 -0000 1.28 @@ -5,7 +5,22 @@ <property name="build.dir" location="../../build/anttest"/> <property file="../../etc/hibernate.properties"/> - <delete dir="${build.dir}"/> + <delete dir="${build.dir}"/> + + + <path id="tasks.classpath"> + <pathelement path="../../build/eclipse"/> + <pathelement path="../../build/classes"/> + + <fileset dir="${hibernate-core.lib.dir}"> + <include name="**/*.jar"/> + </fileset> + + <pathelement location="${hibernate-core.jar}"/> + <pathelement path="../../lib/freemarker.jar"/> + <pathelement path="${hibernate-core.home}\jdbc\hsqldb.jar"/> + </path> + <target name="testantcfg"> @@ -26,14 +41,16 @@ <hbm2ddl drop="false" create="true" export="false" outputfilename="onlycreate.sql" format="true"/> <hbm2ddl drop="true" create="false" export="false" outputfilename="onlydrop.sql" format="true"/> <hbm2ddl drop="true" create="true" export="false" outputfilename="dropandcreate.sql" format="true"/> + <hbm2ddl update="true" outputfilename="updateonly.sql" format="true"/> <hbm2doc/> </hibernatetool> </target> <target name="testantjdbccfg"> - <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${hibernate-core.jar};../build/classes;lib/velocity-1.4.jar;lib/velocity-tools-generic-1.1.jar;../../metadata/build/classes;${hibernate-core.home}\jdbc\hsqldb.jar"/> + <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/> <property file="../etc/hibernate.properties" prefix="tools"/> -<!-- <sql onerror="continue" driver="${tools.hibernate.connection.driver_class}" password="${tools.hibernate.connection.password}" url="${tools.hibernate.connection.url}" userid="${tools.hibernate.connection.username}" classpath="C:\work\products\hsqldb-1.7.2.6\lib\hsqldb.jar"> +<!-- +<sql onerror="continue" driver="${tools.hibernate.connection.driver_class}" password="${tools.hibernate.connection.password}" url="${tools.hibernate.connection.url}" userid="${tools.hibernate.connection.username}" classpath="C:\work\products\hsqldb-1.7.2.6\lib\hsqldb.jar"> create table BottomUp ( id bigint not null, name varchar(255), @@ -49,19 +66,8 @@ </hibernatetool> </target> - <path id="tasks.classpath"> - <fileset dir="${hibernate-core.lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="lib"> - <include name="**/*.jar"/> - </fileset> - <pathelement location="${hibernate-core.jar}"/> - <pathelement path="build/classes"/> - </path> - <target name="testantjdbccfgoverrides"> - <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpath="${hibernate-core.jar};../build/classes;lib/velocity-1.4.jar;lib/velocity-tools-generic-1.1.jar;../../metadata/build/classes;${hibernate-core.home}\jdbc\hsqldb.jar"/> + <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/> <property file="../etc/hibernate.properties" prefix="tools"/> <!-- <sql onerror="continue" driver="${tools.hibernate.connection.driver_class}" password="${tools.hibernate.connection.password}" url="${tools.hibernate.connection.url}" userid="${tools.hibernate.connection.username}" classpath="C:\work\products\hsqldb-1.7.2.6\lib\hsqldb.jar"> create table BottomUp ( @@ -136,6 +142,19 @@ <hbmtemplate exporterclass="org.hibernate.tool.hbm2x.POJOExporter" filepattern="{package-name}/{class-name}.quote"/> </hibernatetool> </target> + + <target name="testexceptions"> + <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/> + <hibernatetool destdir="${build.dir}/generic" templatepath="generictemplates"> + <configuration propertyfile="../../etc/hibernate.properties"> + <fileset dir="../test" id="id"> + <include name="**/*TopDown.hbm.xml"/> + </fileset> + </configuration> + + <hbmtemplate template="generic-exception.ftl" filepattern="{package-name}/{class-name}.error"/> + </hibernatetool> + </target> <target name="testantannotationcfg"> <path id="annlib"> @@ -156,17 +175,6 @@ </hibernatetoolx> </target> -<path id="tasks.classpath"> - <fileset dir="${hibernate-core.lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="../../lib"> - <include name="**/*.jar"/> - </fileset> - <pathelement location="${hibernate-core.jar}"/> - <pathelement path="build/classes"/> -</path> - <target name="testantejb3hbm2java"> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/> |
From: <max...@us...> - 2006-02-17 16:32:03
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/test/org/hibernate/tool/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5019/src/test/org/hibernate/tool/ant Modified Files: HibernateToolTest.java Log Message: HBX-602 Better error reporting from <hibernatetool> in ant Index: HibernateToolTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- HibernateToolTest.java 6 Feb 2006 09:08:07 -0000 1.18 +++ HibernateToolTest.java 17 Feb 2006 16:31:57 -0000 1.19 @@ -31,7 +31,7 @@ configureProject("src/testsupport/anttest-build.xml"); } - public void testConfiguration() { + public void testHbm2DDLLogic() { executeTarget("testantcfg"); File baseDir = new File(project.getProperty("build.dir"), "topdown"); File onlyCreate = new File(baseDir, "onlycreate.sql"); @@ -132,6 +132,17 @@ } } + + public void testException() { + try { + executeTarget("testexceptions"); + fail("should have failed with an exception!"); + } catch(BuildException be) { + // should happen! + assertTrue(be.getMessage().indexOf("No exporters specified")>=0); + } + + } public static Test suite() { return new TestSuite(HibernateToolTest.class); |
From: <max...@us...> - 2006-02-17 16:32:02
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/testsupport/generictemplates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5019/src/testsupport/generictemplates Added Files: generic-exception.ftl Log Message: HBX-602 Better error reporting from <hibernatetool> in ant --- NEW FILE: generic-exception.ftl --- ${pojo.getShortName()} ${pojo.shortName} <#foreach cl in [1,2,3]> <@greet person=cl/> </#foreach> <#macro greet person> <font size="+2">Hello ${person} ${propertythatdoesnotexist}!</font> </#macro> |
From: <epb...@us...> - 2006-02-17 10:58:09
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/validator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1995/metadata/src/java/org/hibernate/validator Modified Files: ClassValidator.java Log Message: ANN-256 and warning suppression Index: ClassValidator.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- ClassValidator.java 11 Feb 2006 01:04:02 -0000 1.19 +++ ClassValidator.java 17 Feb 2006 10:57:59 -0000 1.20 @@ -25,6 +25,7 @@ import java.util.ResourceBundle; import java.util.Set; import java.util.StringTokenizer; +import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -86,12 +87,32 @@ private ResourceBundle getDefaultResourceBundle() { ResourceBundle rb; try { - rb = ResourceBundle.getBundle( "ValidatorMessages" ); + //use context class loader as a first citizen + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader == null) { + throw new MissingResourceException("No context classloader", null, "ValidatorMessage"); + } + rb = ResourceBundle.getBundle( + "ValidatorMessages", + Locale.getDefault(), + contextClassLoader + ); } catch( MissingResourceException e) { - //the user did not override the default ValidatorMessages - log.debug( "ResourceBundle ValidatorMessages not found. Delegate to " + DEFAULT_VALIDATOR_MESSAGE); - rb = ResourceBundle.getBundle( DEFAULT_VALIDATOR_MESSAGE ); + log.trace( "ResourceBundle ValidatorMessages not found in thread context classloader"); + //then use the Validator Framework classloader + try { + rb = ResourceBundle.getBundle( + "ValidatorMessages", + Locale.getDefault(), + this.getClass().getClassLoader() + ); + } + catch( MissingResourceException ee) { + log.debug( "ResourceBundle ValidatorMessages not found in Validator classloader. Delegate to " + DEFAULT_VALIDATOR_MESSAGE); + //the user did not override the default ValidatorMessages + rb = ResourceBundle.getBundle( DEFAULT_VALIDATOR_MESSAGE ); + } } defaultResourceBundle = true; return rb; @@ -148,6 +169,7 @@ } } + @SuppressWarnings("unchecked") private void createChildValidator(ResourceBundle resourceBundle, Member member, Class clazz) { if ( ( (AnnotatedElement) member ).isAnnotationPresent( Valid.class ) ) { setAccessible( member ); @@ -177,14 +199,7 @@ } } -// private static final Set<String> methodNames = new HashSet<String>(); -// static { -// methodNames.add("toString"); -// methodNames.add("hashCode"); -// methodNames.add("equals"); -// methodNames.add("annotationType"); -// } - + @SuppressWarnings("unchecked") private Validator createValidator(Annotation annotation) { try { ValidatorClass validatorClass = annotation.annotationType().getAnnotation( ValidatorClass.class ); @@ -221,6 +236,7 @@ * apply constraints on a bean instance and return all the failures. * if <code>bean</code> is null, an empty array is returned */ + @SuppressWarnings("unchecked") protected InvalidValue[] getInvalidValues(T bean, Set<Object> circularityState) { if ( bean == null || circularityState.contains( bean ) ) { return EMPTY_INVALID_VALUE_ARRAY; //Avoid circularity @@ -273,6 +289,7 @@ return results.toArray( new InvalidValue[results.size()] ); } + @SuppressWarnings("unchecked") private ClassValidator getClassValidator(Object value) { Class clazz = value.getClass(); ClassValidator validator = childClassValidators.get( clazz ); @@ -418,15 +435,13 @@ */ public void apply(PersistentClass persistentClass) { - Iterator<Validator> validators = beanValidators.iterator(); - while ( validators.hasNext() ) { - Validator validator = validators.next(); + for ( Validator validator : beanValidators ) { if ( validator instanceof PersistentClassConstraint ) { ( (PersistentClassConstraint) validator ).apply( persistentClass ); } } - validators = memberValidators.iterator(); + Iterator<Validator> validators = memberValidators.iterator(); Iterator<Member> getters = memberGetters.iterator(); while ( validators.hasNext() ) { Validator validator = validators.next(); |
From: <ste...@us...> - 2006-02-17 03:14:19
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/ejb3/lock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19702/test/org/hibernate/test/ejb3/lock Modified Files: EJB3LockTest.java Log Message: read-committed isolation protections Index: EJB3LockTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/ejb3/lock/EJB3LockTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- EJB3LockTest.java 14 Feb 2006 03:24:18 -0000 1.1 +++ EJB3LockTest.java 17 Feb 2006 03:14:14 -0000 1.2 @@ -36,8 +36,6 @@ protected void configure(Configuration cfg) { super.configure( cfg ); -// error on Oracle 10g -// cfg.setProperty( Environment.ISOLATION, "" + java.sql.Connection.TRANSACTION_READ_UNCOMMITTED ); cfg.setProperty( Environment.USE_SECOND_LEVEL_CACHE, "false" ); } @@ -70,7 +68,9 @@ * Odd as it may sound, EJB3 LockModeType.READ actually maps to the Hibernate LockMode.UPGRADE */ public void testLockModeTypeRead() { - // todo : add some protections here for databases which have issues with concurrent access... + if ( ! readCommittedIsolationMaintained( "ejb3 lock tests" ) ) { + return; + } final String initialName = "lock test"; // set up some test data @@ -135,8 +135,6 @@ * a new Hibernate LockMode was added to support this behavior: {@link LockMode#FORCE}. */ public void testLockModeTypeWrite() { - // todo : add some protections here for databases which have issues with concurrent access... - final String initialName = "lock test"; // set up some test data Session s1 = getSessions().openSession(); |
From: <ste...@us...> - 2006-02-17 03:13:30
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19281/test/org/hibernate/test Modified Files: TestCase.java Log Message: read-committed isolation protections Index: TestCase.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/TestCase.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- TestCase.java 12 Feb 2006 14:29:21 -0000 1.27 +++ TestCase.java 17 Feb 2006 03:13:25 -0000 1.28 @@ -11,6 +11,7 @@ import org.hibernate.HibernateException; import org.hibernate.Interceptor; import org.hibernate.SessionFactory; +import org.hibernate.Session; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.dialect.DB2Dialect; @@ -258,6 +259,33 @@ protected static final Log SKIP_LOG = LogFactory.getLog("org.hibernate.test.SKIPPED"); + protected boolean readCommittedIsolationMaintained(String scenario) { + int isolation = java.sql.Connection.TRANSACTION_READ_UNCOMMITTED; + Session testSession = null; + try { + testSession = openSession(); + isolation = testSession.connection().getTransactionIsolation(); + } + catch( Throwable ignore ) { + } + finally { + if ( session != null ) { + try { + session.close(); + } + catch( Throwable ignore ) { + } + } + } + if ( isolation < java.sql.Connection.TRANSACTION_READ_COMMITTED ) { + reportSkip( "environment does not support at least read committed isolation", scenario ); + return false; + } + else { + return true; + } + } + protected boolean dialectSupportsEmptyInList(String testdescription) { return reportSkip( "Dialect does not support SQL: \'x in ()\'.", testdescription, dialectIsNot(new Class[] { Oracle9Dialect.class, |
From: <ste...@us...> - 2006-02-16 23:21:21
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31266/test/org/hibernate/test/hql Modified Files: ASTParserLoadingTest.java Log Message: HHH-1411 & HHH-1412 : in-memory application of DISTINCT and firstRow/maxRows in conjunction with collection fetches Index: ASTParserLoadingTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- ASTParserLoadingTest.java 16 Feb 2006 19:24:13 -0000 1.53 +++ ASTParserLoadingTest.java 16 Feb 2006 23:21:18 -0000 1.54 @@ -11,6 +11,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.HashSet; import junit.framework.Test; import junit.framework.TestSuite; @@ -67,6 +68,53 @@ }; } + public void testCollectionFetchWithDistinctionAndLimit() { + // create some test data... + Session s = openSession(); + Transaction t = s.beginTransaction(); + int parentCount = 30; + for ( int i = 0; i < parentCount; i++ ) { + Animal child1 = new Animal(); + child1.setDescription( "collection fetch distinction (child1 - parent" + i + ")" ); + s.persist( child1 ); + Animal child2 = new Animal(); + child2.setDescription( "collection fetch distinction (child2 - parent " + i + ")" ); + s.persist( child2 ); + Animal parent = new Animal(); + parent.setDescription( "collection fetch distinction (parent" + i + ")" ); + parent.setSerialNumber( "123-" + i ); + parent.addOffspring( child1 ); + parent.addOffspring( child2 ); + s.persist( parent ); + } + t.commit(); + s.close(); + + s = openSession(); + t = s.beginTransaction(); + // Test simple distinction + List results; + results = s.createQuery( "select distinct p from Animal p inner join fetch p.offspring" ).list(); + assertEquals( "duplicate list() returns", 30, results.size() ); + // Test first/max + results = s.createQuery( "select p from Animal p inner join fetch p.offspring order by p.id" ) + .setFirstResult( 5 ) + .setMaxResults( 20 ) + .list(); + assertEquals( "duplicate returns", 20, results.size() ); + Animal firstReturn = ( Animal ) results.get( 0 ); + assertEquals( "firstResult not applied correctly", "123-5", firstReturn.getSerialNumber() ); + t.commit(); + s.close(); + + s = openSession(); + t = s.beginTransaction(); + s.createQuery( "delete Animal where mother is not null" ).executeUpdate(); + s.createQuery( "delete Animal" ).executeUpdate(); + t.commit(); + s.close(); + } + public void testFetchInSubqueryFails() { Session s = openSession(); try { |
From: <ste...@us...> - 2006-02-16 23:21:09
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31045/src/org/hibernate/hql/ast Modified Files: QueryTranslatorImpl.java Log Message: HHH-1411 & HHH-1412 : in-memory application of DISTINCT and firstRow/maxRows in conjunction with collection fetches Index: QueryTranslatorImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast/QueryTranslatorImpl.java,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- QueryTranslatorImpl.java 16 Feb 2006 22:51:00 -0000 1.70 +++ QueryTranslatorImpl.java 16 Feb 2006 23:21:05 -0000 1.71 @@ -315,12 +315,11 @@ // Delegate to the QueryLoader... errorIfDML(); QueryNode query = ( QueryNode ) sqlAst; - boolean hasLimit = queryParameters.getRowSelection().definesLimits(); - boolean needsDistincting = query.getSelectClause().isDistinct() || hasLimit; - boolean limitInMemory = hasLimit && containsCollectionFetches(); + boolean hasLimit = queryParameters.getRowSelection() != null && queryParameters.getRowSelection().definesLimits(); + boolean needsDistincting = ( query.getSelectClause().isDistinct() || hasLimit ) && containsCollectionFetches(); QueryParameters queryParametersToUse; - if ( limitInMemory ) { + if ( hasLimit && containsCollectionFetches() ) { log.warn( "firstResult/maxResults specified with collection fetch; applying in memory!" ); RowSelection selection = new RowSelection(); selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() ); @@ -336,10 +335,10 @@ if ( needsDistincting ) { int includedCount = -1; // NOTE : firstRow is zero-based - int first = queryParameters.getRowSelection().getFirstRow() == null + int first = !hasLimit || queryParameters.getRowSelection().getFirstRow() == null ? 0 : queryParameters.getRowSelection().getFirstRow().intValue(); - int max = queryParameters.getRowSelection().getMaxRows() == null + int max = !hasLimit || queryParameters.getRowSelection().getMaxRows() == null ? -1 : queryParameters.getRowSelection().getMaxRows().intValue(); int size = results.size(); |
From: <ste...@us...> - 2006-02-16 23:20:50
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/engine/query In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30877/src/org/hibernate/engine/query Modified Files: HQLQueryPlan.java Log Message: HHH-1411 & HHH-1412 : in-memory application of DISTINCT and firstRow/maxRows in conjunction with collection fetches Index: HQLQueryPlan.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/engine/query/HQLQueryPlan.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- HQLQueryPlan.java 16 Feb 2006 22:50:59 -0000 1.8 +++ HQLQueryPlan.java 16 Feb 2006 23:20:46 -0000 1.9 @@ -7,6 +7,7 @@ import org.hibernate.util.ArrayHelper; import org.hibernate.util.EmptyIterator; import org.hibernate.util.JoinedIterator; +import org.hibernate.util.IdentitySet; import org.hibernate.HibernateException; import org.hibernate.ScrollableResults; import org.hibernate.QueryException; @@ -149,7 +150,9 @@ log.trace( "find: " + getSourceQuery() ); queryParameters.traceParameters( session.getFactory() ); } - boolean needsLimit = translators.length > 1 && queryParameters.getRowSelection().definesLimits(); + boolean hasLimit = queryParameters.getRowSelection() != null && + queryParameters.getRowSelection().definesLimits(); + boolean needsLimit = hasLimit && translators.length > 1; QueryParameters queryParametersToUse; if ( needsLimit ) { log.warn( "firstResult/maxResults specified on polymorphic query; applying in memory!" ); @@ -163,6 +166,7 @@ } List combinedResults = new ArrayList(); + IdentitySet distinction = new IdentitySet(); int includedCount = -1; translator_loop: for ( int i = 0; i < translators.length; i++ ) { List tmp = translators[i].list( session, queryParametersToUse ); @@ -177,7 +181,7 @@ final int size = tmp.size(); for ( int x = 0; x < size; x++ ) { final Object result = tmp.get( x ); - if ( combinedResults.contains( result ) ) { + if ( distinction.add( result ) ) { continue; } includedCount++; |
From: <ste...@us...> - 2006-02-16 22:51:08
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13121/src/org/hibernate/engine Modified Files: QueryParameters.java RowSelection.java Log Message: HHH-1411 & HHH-1412 : in-memory application of DISTINCT and firstRow/maxRows in conjunction with collection fetches Index: QueryParameters.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/engine/QueryParameters.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- QueryParameters.java 12 Dec 2005 08:57:27 -0000 1.20 +++ QueryParameters.java 16 Feb 2006 22:51:00 -0000 1.21 @@ -439,5 +439,26 @@ public void setAutoDiscoverScalarTypes(boolean autodiscovertypes) { this.autodiscovertypes = autodiscovertypes; } - + + public QueryParameters createCopyUsing(RowSelection selection) { + QueryParameters copy = new QueryParameters( + this.positionalParameterTypes, + this.positionalParameterValues, + this.namedParameters, + this.lockModes, + selection, + this.readOnly, + this.cacheable, + this.cacheRegion, + this.comment, + this.collectionKeys, + this.optionalObject, + this.optionalEntityName, + this.optionalId + ); + copy.processedSQL = this.processedSQL; + copy.processedPositionalParameterTypes = this.processedPositionalParameterTypes; + copy.processedPositionalParameterValues = this.processedPositionalParameterValues; + return copy; + } } Index: RowSelection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/engine/RowSelection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- RowSelection.java 3 Jun 2004 16:30:07 -0000 1.1 +++ RowSelection.java 16 Feb 2006 22:51:00 -0000 1.2 @@ -43,9 +43,8 @@ this.fetchSize = fetchSize; } + public boolean definesLimits() { + return maxRows != null || + ( firstRow != null && firstRow.intValue() <= 0 ); + } } - - - - - |
From: <ste...@us...> - 2006-02-16 22:51:07
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13121/src/org/hibernate/hql/ast Modified Files: QueryTranslatorImpl.java Log Message: HHH-1411 & HHH-1412 : in-memory application of DISTINCT and firstRow/maxRows in conjunction with collection fetches Index: QueryTranslatorImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast/QueryTranslatorImpl.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- QueryTranslatorImpl.java 9 Feb 2006 12:37:19 -0000 1.69 +++ QueryTranslatorImpl.java 16 Feb 2006 22:51:00 -0000 1.70 @@ -15,6 +15,7 @@ import org.hibernate.engine.QueryParameters; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.RowSelection; import org.hibernate.event.EventSource; import org.hibernate.hql.FilterTranslator; import org.hibernate.hql.antlr.HqlSqlTokenTypes; @@ -33,7 +34,7 @@ import org.hibernate.persister.entity.Queryable; import org.hibernate.type.Type; import org.hibernate.util.StringHelper; -import org.hibernate.util.ArrayHelper; +import org.hibernate.util.IdentitySet; import java.util.HashMap; import java.util.Iterator; @@ -313,7 +314,56 @@ throws HibernateException { // Delegate to the QueryLoader... errorIfDML(); - return queryLoader.list( session, queryParameters ); + QueryNode query = ( QueryNode ) sqlAst; + boolean hasLimit = queryParameters.getRowSelection().definesLimits(); + boolean needsDistincting = query.getSelectClause().isDistinct() || hasLimit; + boolean limitInMemory = hasLimit && containsCollectionFetches(); + + QueryParameters queryParametersToUse; + if ( limitInMemory ) { + log.warn( "firstResult/maxResults specified with collection fetch; applying in memory!" ); + RowSelection selection = new RowSelection(); + selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() ); + selection.setTimeout( queryParameters.getRowSelection().getTimeout() ); + queryParametersToUse = queryParameters.createCopyUsing( selection ); + } + else { + queryParametersToUse = queryParameters; + } + + List results = queryLoader.list( session, queryParametersToUse ); + + if ( needsDistincting ) { + int includedCount = -1; + // NOTE : firstRow is zero-based + int first = queryParameters.getRowSelection().getFirstRow() == null + ? 0 + : queryParameters.getRowSelection().getFirstRow().intValue(); + int max = queryParameters.getRowSelection().getMaxRows() == null + ? -1 + : queryParameters.getRowSelection().getMaxRows().intValue(); + int size = results.size(); + List tmp = new ArrayList(); + IdentitySet distinction = new IdentitySet(); + for ( int i = 0; i < size; i++ ) { + final Object result = results.get( i ); + if ( !distinction.add( result ) ) { + continue; + } + includedCount++; + if ( includedCount < first ) { + continue; + } + tmp.add( result ); + // NOTE : ( max - 1 ) because first is zero-based while max is not... + if ( max >= 0 && ( includedCount - first ) >= ( max - 1 ) ) { + break; + } + } + results = tmp; + } + + return results; } /** |
From: <ste...@us...> - 2006-02-16 22:51:05
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/engine/query In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13121/src/org/hibernate/engine/query Modified Files: HQLQueryPlan.java Log Message: HHH-1411 & HHH-1412 : in-memory application of DISTINCT and firstRow/maxRows in conjunction with collection fetches Index: HQLQueryPlan.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/engine/query/HQLQueryPlan.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- HQLQueryPlan.java 27 Jan 2006 23:38:07 -0000 1.7 +++ HQLQueryPlan.java 16 Feb 2006 22:50:59 -0000 1.8 @@ -14,6 +14,7 @@ import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.QueryParameters; import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.RowSelection; import org.hibernate.event.EventSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -148,9 +149,51 @@ log.trace( "find: " + getSourceQuery() ); queryParameters.traceParameters( session.getFactory() ); } + boolean needsLimit = translators.length > 1 && queryParameters.getRowSelection().definesLimits(); + QueryParameters queryParametersToUse; + if ( needsLimit ) { + log.warn( "firstResult/maxResults specified on polymorphic query; applying in memory!" ); + RowSelection selection = new RowSelection(); + selection.setFetchSize( queryParameters.getRowSelection().getFetchSize() ); + selection.setTimeout( queryParameters.getRowSelection().getTimeout() ); + queryParametersToUse = queryParameters.createCopyUsing( selection ); + } + else { + queryParametersToUse = queryParameters; + } + List combinedResults = new ArrayList(); - for ( int i = 0; i < translators.length; i++ ) { - combinedResults.addAll( translators[i].list( session, queryParameters ) ); + int includedCount = -1; + translator_loop: for ( int i = 0; i < translators.length; i++ ) { + List tmp = translators[i].list( session, queryParametersToUse ); + if ( needsLimit ) { + // NOTE : firstRow is zero-based + int first = queryParameters.getRowSelection().getFirstRow() == null + ? 0 + : queryParameters.getRowSelection().getFirstRow().intValue(); + int max = queryParameters.getRowSelection().getMaxRows() == null + ? -1 + : queryParameters.getRowSelection().getMaxRows().intValue(); + final int size = tmp.size(); + for ( int x = 0; x < size; x++ ) { + final Object result = tmp.get( x ); + if ( combinedResults.contains( result ) ) { + continue; + } + includedCount++; + if ( includedCount < first ) { + continue; + } + combinedResults.add( result ); + if ( max >= 0 && includedCount > max ) { + // break the outer loop !!! + break translator_loop; + } + } + } + else { + combinedResults.addAll( tmp ); + } } return combinedResults; } @@ -191,6 +234,9 @@ if ( translators.length != 1 ) { throw new QueryException( "implicit polymorphism not supported for scroll() queries" ); } + if ( queryParameters.getRowSelection().definesLimits() && translators[0].containsCollectionFetches() ) { + throw new QueryException( "firstResult/maxResults not supported in conjunction with scroll() of a query containing collection fetches" ); + } return translators[0].scroll( queryParameters, session ); } |
From: <ste...@us...> - 2006-02-16 22:51:04
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast/tree In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13121/src/org/hibernate/hql/ast/tree Modified Files: SelectClause.java Log Message: HHH-1411 & HHH-1412 : in-memory application of DISTINCT and firstRow/maxRows in conjunction with collection fetches Index: SelectClause.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast/tree/SelectClause.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SelectClause.java 23 Jan 2006 16:40:51 -0000 1.3 +++ SelectClause.java 16 Feb 2006 22:51:00 -0000 1.4 @@ -43,6 +43,10 @@ return scalarSelect; } + public boolean isDistinct() { + return getFirstChild() != null && getFirstChild().getType() == SqlTokenTypes.DISTINCT; + } + /** * FromElements which need to be accounted for in the load phase (either for return or for fetch). * |