Hibernate SVN: r15176 - core/branches/Branch_3_3.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-10 13:07:39 -0400 (Wed, 10 Sep 2008)
New Revision: 15176
Modified:
core/branches/Branch_3_3/changelog.txt
Log:
prep 3.3.1 release
Modified: core/branches/Branch_3_3/changelog.txt
===================================================================
--- core/branches/Branch_3_3/changelog.txt 2008-09-10 17:03:42 UTC (rev 15175)
+++ core/branches/Branch_3_3/changelog.txt 2008-09-10 17:07:39 UTC (rev 15176)
@@ -12,6 +12,7 @@
** Bug
* [HHH-2694] - create-drop with c3p0 causes SQLException
* [HHH-3231] - org.hibernate.id.enhanced.TableGenerator throws "IllegalArgumentException: alias not found: tbl" under Oracle
+ * [HHH-3392] - Query Cache entries are not distributable
* [HHH-3472] - JTASessionContext broken for WebSphere
** Improvement
@@ -20,8 +21,6 @@
* [HHH-3424] - concat() with param binding fails function on derby
* [HHH-3454] - Allow enhanced.TableGenerator to segment itself per entity as default
* [HHH-3456] - Make o.h.id.enhanced.SequenceStyleGenerator more extension-friendly
-
-** New Feature
* [HHH-3471] - Provide true-false type that maps to int values
** Task
16 years, 3 months
Hibernate SVN: r15175 - in core/branches/Branch_3_3: core/src/main/java/org/hibernate/criterion and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-10 13:03:42 -0400 (Wed, 10 Sep 2008)
New Revision: 15175
Added:
core/branches/Branch_3_3/core/src/test/java/org/hibernate/cache/
core/branches/Branch_3_3/core/src/test/java/org/hibernate/cache/QueryKeyTest.java
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/cache/QueryKey.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/BasicTransformerAdapter.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
core/branches/Branch_3_3/testsuite/src/test/resources/log4j.properties
Log:
HHH-3392 : query cache cluster replication with ResultTransformers
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/cache/QueryKey.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/cache/QueryKey.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/cache/QueryKey.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -25,6 +25,7 @@
package org.hibernate.cache;
import java.io.Serializable;
+import java.io.IOException;
import java.util.Map;
import java.util.Set;
@@ -48,10 +49,15 @@
private final Map namedParameters;
private final EntityMode entityMode;
private final Set filters;
- private final int hashCode;
// the user provided resulttransformer, not the one used with "select new". Here to avoid mangling transformed/non-transformed results.
private final ResultTransformer customTransformer;
+
+ /**
+ * For performance reasons, the hashCode is cached; however, it is marked transient so that it can be
+ * recalculated as part of the serialization process which allows distributed query caches to work properly.
+ */
+ private transient int hashCode;
public QueryKey(String queryString, QueryParameters queryParameters, Set filters, EntityMode entityMode) {
this.sqlQueryString = queryString;
@@ -70,8 +76,31 @@
this.entityMode = entityMode;
this.filters = filters;
this.customTransformer = queryParameters.getResultTransformer();
- this.hashCode = getHashCode();
+ this.hashCode = generateHashCode();
}
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ this.hashCode = generateHashCode();
+ }
+
+ private int generateHashCode() {
+ int result = 13;
+ result = 37 * result + ( firstRow==null ? 0 : firstRow.hashCode() );
+ result = 37 * result + ( maxRows==null ? 0 : maxRows.hashCode() );
+ for ( int i=0; i<values.length; i++ ) {
+ result = 37 * result + ( values[i]==null ? 0 : types[i].getHashCode( values[i], entityMode ) );
+ }
+ result = 37 * result + ( namedParameters==null ? 0 : namedParameters.hashCode() );
+ result = 37 * result + ( filters==null ? 0 : filters.hashCode() );
+ result = 37 * result + ( customTransformer==null ? 0 : customTransformer.hashCode() );
+ result = 37 * result + sqlQueryString.hashCode();
+ return result;
+ }
+
+ public int hashCode() {
+ return hashCode;
+ }
public boolean equals(Object other) {
if (!(other instanceof QueryKey)) return false;
@@ -94,24 +123,6 @@
if ( !EqualsHelper.equals(namedParameters, that.namedParameters) ) return false;
return true;
}
-
- public int hashCode() {
- return hashCode;
- }
-
- private int getHashCode() {
- int result = 13;
- result = 37 * result + ( firstRow==null ? 0 : firstRow.hashCode() );
- result = 37 * result + ( maxRows==null ? 0 : maxRows.hashCode() );
- for ( int i=0; i<values.length; i++ ) {
- result = 37 * result + ( values[i]==null ? 0 : types[i].getHashCode( values[i], entityMode ) );
- }
- result = 37 * result + ( namedParameters==null ? 0 : namedParameters.hashCode() );
- result = 37 * result + ( filters==null ? 0 : filters.hashCode() );
- result = 37 * result + ( customTransformer==null ? 0 : customTransformer.hashCode() );
- result = 37 * result + sqlQueryString.hashCode();
- return result;
- }
public String toString() {
StringBuffer buf = new StringBuffer()
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -43,22 +43,22 @@
/**
* Each row of results is a <tt>Map</tt> from alias to entity instance
*/
- public static final ResultTransformer ALIAS_TO_ENTITY_MAP = new AliasToEntityMapResultTransformer();
+ public static final ResultTransformer ALIAS_TO_ENTITY_MAP = AliasToEntityMapResultTransformer.INSTANCE;
/**
* Each row of results is an instance of the root entity
*/
- public static final ResultTransformer ROOT_ENTITY = new RootEntityResultTransformer();
+ public static final ResultTransformer ROOT_ENTITY = RootEntityResultTransformer.INSTANCE;
/**
* Each row of results is a distinct instance of the root entity
*/
- public static final ResultTransformer DISTINCT_ROOT_ENTITY = new DistinctRootEntityResultTransformer();
+ public static final ResultTransformer DISTINCT_ROOT_ENTITY = DistinctRootEntityResultTransformer.INSTANCE;
/**
* This result transformer is selected implicitly by calling <tt>setProjection()</tt>
*/
- public static final ResultTransformer PROJECTION = new PassThroughResultTransformer();
+ public static final ResultTransformer PROJECTION = PassThroughResultTransformer.INSTANCE;
/**
* Specifies joining to an entity based on an inner join.
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -29,11 +29,12 @@
import java.io.Serializable;
/**
- * {@link ResultTransformer} implementation which builds a map for each "row",
- * made up of each aliased value where the alias is the map key.
+ * {@link ResultTransformer} implementation which builds a map for each "row", made up of each aliased value
+ * where the alias is the map key.
* <p/>
- * Since this transformer is stateless, all instances would be considered equal.
- * So for optimization purposes we limit it to a single, singleton {@link #INSTANCE instance}.
+ * Since this transformer is stateless, all instances would be considered equal. So for optimization purposes
+ * we limit it to a single, singleton {@link #INSTANCE instance} (this is not quite true yet, see deprecation notice
+ * on {@link #AliasToEntityMapResultTransformer() constructor}).
*
* @author Gavin King
* @author Steve Ebersole
@@ -44,13 +45,17 @@
/**
* Instantiate AliasToEntityMapResultTransformer.
+ * <p/>
+ * todo : make private, see deprecation...
*
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4).
*/
public AliasToEntityMapResultTransformer() {
- // todo : make private
}
+ /**
+ * {@inheritDoc}
+ */
public Object transformTuple(Object[] tuple, String[] aliases) {
Map result = new HashMap(tuple.length);
for ( int i=0; i<tuple.length; i++ ) {
@@ -78,8 +83,7 @@
* All AliasToEntityMapResultTransformer are considered equal
*
* @param other The other instance to check for equality
- * @return True if (non-null) other is a instance of
- * AliasToEntityMapResultTransformer.
+ * @return True if (non-null) other is a instance of AliasToEntityMapResultTransformer.
*/
public boolean equals(Object other) {
// todo : we can remove this once the deprecated ctor can be made private...
@@ -89,8 +93,7 @@
/**
* All AliasToEntityMapResultTransformer are considered equal
*
- * @return We simply return the hashCode of the
- * AliasToEntityMapResultTransformer class name string.
+ * @return We simply return the hashCode of the AliasToEntityMapResultTransformer class name string.
*/
public int hashCode() {
// todo : we can remove this once the deprecated ctor can be made private...
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/BasicTransformerAdapter.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/BasicTransformerAdapter.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/BasicTransformerAdapter.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -32,10 +32,16 @@
* @author Steve Ebersole
*/
public abstract class BasicTransformerAdapter implements ResultTransformer {
+ /**
+ * {@inheritDoc}
+ */
public Object transformTuple(Object[] tuple, String[] aliases) {
return tuple;
}
+ /**
+ * {@inheritDoc}
+ */
public List transformList(List list) {
return list;
}
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -28,11 +28,11 @@
import java.io.Serializable;
/**
- * Much like {@link RootEntityResultTransformer}, but we also distinct
- * the entity in the final result.
+ * Much like {@link RootEntityResultTransformer}, but we also distinct the entity in the final result.
* <p/>
- * Since this transformer is stateless, all instances would be considered equal.
- * So for optimization purposes we limit it to a single, singleton {@link #INSTANCE instance}.
+ * Since this transformer is stateless, all instances would be considered equal. So for optimization purposes
+ * we limit it to a single, singleton {@link #INSTANCE instance} (this is not quite true yet: see deprecation notice
+ * on {@link #DistinctRootEntityResultTransformer() constructor}).
*
* @author Gavin King
* @author Steve Ebersole
@@ -43,8 +43,10 @@
/**
* Instantiate a DistinctRootEntityResultTransformer.
+ * <p/>
+ * todo : make private, see deprecation notice
*
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4).
*/
public DistinctRootEntityResultTransformer() {
}
@@ -79,8 +81,16 @@
return INSTANCE;
}
- public boolean equals(Object obj) {
+
+ // all DistinctRootEntityResultTransformer are considered equal ~~~~~~~~~~~
+
+ public int hashCode() {
// todo : we can remove this once the deprecated ctor can be made private...
- return DistinctRootEntityResultTransformer.class.isInstance( obj );
+ return DistinctRootEntityResultTransformer.class.getName().hashCode();
}
+
+ public boolean equals(Object other) {
+ // todo : we can remove this once the deprecated ctor can be made private...
+ return other != null && DistinctRootEntityResultTransformer.class.isInstance( other );
+ }
}
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -38,7 +38,7 @@
/**
* Instamtiate a PassThroughResultTransformer.
*
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4).
*/
public PassThroughResultTransformer() {
}
@@ -56,9 +56,14 @@
return INSTANCE;
}
- public boolean equals(Object obj) {
+ public int hashCode() {
// todo : we can remove this once the deprecated ctor can be made private...
- return PassThroughResultTransformer.class.isInstance( obj );
+ return PassThroughResultTransformer.class.getName().hashCode();
}
+ public boolean equals(Object other) {
+ // todo : we can remove this once the deprecated ctor can be made private...
+ return other != null && PassThroughResultTransformer.class.isInstance( other );
+ }
+
}
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -44,7 +44,7 @@
/**
* Instantiate RootEntityResultTransformer.
*
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4).
*/
public RootEntityResultTransformer() {
}
@@ -65,8 +65,13 @@
return INSTANCE;
}
- public boolean equals(Object obj) {
+ public int hashCode() {
// todo : we can remove this once the deprecated ctor can be made private...
- return RootEntityResultTransformer.class.isInstance( obj );
+ return RootEntityResultTransformer.class.getName().hashCode();
}
+
+ public boolean equals(Object other) {
+ // todo : we can remove this once the deprecated ctor can be made private...
+ return other != null && RootEntityResultTransformer.class.isInstance( other );
+ }
}
Added: core/branches/Branch_3_3/core/src/test/java/org/hibernate/cache/QueryKeyTest.java
===================================================================
--- core/branches/Branch_3_3/core/src/test/java/org/hibernate/cache/QueryKeyTest.java (rev 0)
+++ core/branches/Branch_3_3/core/src/test/java/org/hibernate/cache/QueryKeyTest.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -0,0 +1,96 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.cache;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+
+import org.hibernate.engine.QueryParameters;
+import org.hibernate.EntityMode;
+import org.hibernate.transform.RootEntityResultTransformer;
+import org.hibernate.transform.ResultTransformer;
+import org.hibernate.transform.DistinctRootEntityResultTransformer;
+import org.hibernate.transform.AliasToEntityMapResultTransformer;
+import org.hibernate.transform.PassThroughResultTransformer;
+import org.hibernate.transform.DistinctResultTransformer;
+import org.hibernate.util.SerializationHelper;
+import org.hibernate.util.ArrayHelper;
+
+/**
+ * Tests relating to {@link QueryKey} instances.
+ *
+ * @author Steve Ebersole
+ */
+public class QueryKeyTest extends TestCase {
+ private static final String QUERY_STRING = "the query string";
+
+ public void testSerializedEquality() {
+ doTest( buildBasicKey( new QueryParameters() ) );
+ }
+
+ public void testSerializedEqualityWithResultTransformer() {
+ doTest( buildBasicKey( buildQueryParameters( RootEntityResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( DistinctRootEntityResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( DistinctResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( AliasToEntityMapResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( PassThroughResultTransformer.INSTANCE ) ) );
+ }
+
+ private QueryParameters buildQueryParameters(ResultTransformer resultTransformer) {
+ return new QueryParameters(
+ ArrayHelper.EMPTY_TYPE_ARRAY, // param types
+ ArrayHelper.EMPTY_OBJECT_ARRAY, // param values
+ Collections.EMPTY_MAP, // lock modes
+ null, // row selection
+ false, // cacheable?
+ "", // cache region
+ "", // SQL comment
+ false, // is natural key lookup?
+ resultTransformer // the result transformer, duh! ;)
+ );
+ }
+
+ private QueryKey buildBasicKey(QueryParameters queryParameters) {
+ return new QueryKey( QUERY_STRING, queryParameters, Collections.EMPTY_SET, EntityMode.POJO );
+ }
+
+ private void doTest(QueryKey key) {
+ HashMap map = new HashMap();
+
+ map.put( key, "" );
+ assert map.size() == 1 : "really messed up";
+
+ Object old = map.put( key, "value" );
+ assert old != null && map.size() == 1 : "apparent QueryKey equals/hashCode issue";
+
+ // finally, lets serialize it and see what happens
+ QueryKey key2 = ( QueryKey ) SerializationHelper.clone( key );
+ assert key != key2 : "deep copy issue";
+ old = map.put( key2, "new value" );
+ assert old != null && map.size() == 1 : "deserialization did not set hashCode or equals properly";
+ }
+}
Modified: core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
===================================================================
--- core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2008-09-10 17:03:42 UTC (rev 15175)
@@ -6,6 +6,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.HashMap;
import junit.framework.Test;
@@ -28,7 +29,7 @@
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.transform.DistinctRootEntityResultTransformer;
import org.hibernate.transform.Transformers;
-import org.hibernate.transform.AliasToEntityMapResultTransformer;
+import org.hibernate.transform.BasicTransformerAdapter;
/**
* Tests of various features of native SQL queries.
@@ -177,7 +178,7 @@
" left outer join EMPLOYMENT emp on org.ORGID = emp.EMPLOYER, ORGANIZATION org2" )
.addEntity("org", Organization.class)
.addJoin("emp", "org.employments")
- .setResultTransformer(new DistinctRootEntityResultTransformer())
+ .setResultTransformer( DistinctRootEntityResultTransformer.INSTANCE )
.list();
assertEquals( l.size(), 2 );
@@ -608,13 +609,16 @@
}
}
- private static class UpperCasedAliasToEntityMapResultTransformer extends AliasToEntityMapResultTransformer {
+ private static class UpperCasedAliasToEntityMapResultTransformer extends BasicTransformerAdapter implements Serializable {
public Object transformTuple(Object[] tuple, String[] aliases) {
- String[] ucAliases = new String[aliases.length];
- for ( int i = 0; i < aliases.length; i++ ) {
- ucAliases[i] = aliases[i].toUpperCase();
+ Map result = new HashMap( tuple.length );
+ for ( int i = 0; i < tuple.length; i++ ) {
+ String alias = aliases[i];
+ if ( alias != null ) {
+ result.put( alias.toUpperCase(), tuple[i] );
+ }
}
- return super.transformTuple( tuple, ucAliases );
+ return result;
}
}
}
Modified: core/branches/Branch_3_3/testsuite/src/test/resources/log4j.properties
===================================================================
--- core/branches/Branch_3_3/testsuite/src/test/resources/log4j.properties 2008-09-10 17:02:45 UTC (rev 15174)
+++ core/branches/Branch_3_3/testsuite/src/test/resources/log4j.properties 2008-09-10 17:03:42 UTC (rev 15175)
@@ -6,4 +6,5 @@
log4j.rootLogger=info, stdout
-log4j.logger.org.hibernate.test=info
\ No newline at end of file
+log4j.logger.org.hibernate.test=info
+log4j.logger.org.hibernate.tool.hbm2ddl=debug
\ No newline at end of file
16 years, 3 months
Hibernate SVN: r15174 - in core/trunk: core/src/main/java/org/hibernate/criterion and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-10 13:02:45 -0400 (Wed, 10 Sep 2008)
New Revision: 15174
Added:
core/trunk/core/src/test/java/org/hibernate/cache/
core/trunk/core/src/test/java/org/hibernate/cache/QueryKeyTest.java
Modified:
core/trunk/core/src/main/java/org/hibernate/cache/QueryKey.java
core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java
core/trunk/core/src/main/java/org/hibernate/transform/AliasToBeanResultTransformer.java
core/trunk/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java
core/trunk/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java
core/trunk/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java
core/trunk/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java
core/trunk/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
Log:
HHH-3392 : query cache cluster replication with ResultTransformers
Modified: core/trunk/core/src/main/java/org/hibernate/cache/QueryKey.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cache/QueryKey.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/core/src/main/java/org/hibernate/cache/QueryKey.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -25,6 +25,7 @@
package org.hibernate.cache;
import java.io.Serializable;
+import java.io.IOException;
import java.util.Map;
import java.util.Set;
@@ -48,11 +49,16 @@
private final Map namedParameters;
private final EntityMode entityMode;
private final Set filters;
- private final int hashCode;
// the user provided resulttransformer, not the one used with "select new". Here to avoid mangling transformed/non-transformed results.
private final ResultTransformer customTransformer;
-
+
+ /**
+ * For performance reasons, the hashCode is cached; however, it is marked transient so that it can be
+ * recalculated as part of the serialization process which allows distributed query caches to work properly.
+ */
+ private transient int hashCode;
+
public QueryKey(String queryString, QueryParameters queryParameters, Set filters, EntityMode entityMode) {
this.sqlQueryString = queryString;
this.types = queryParameters.getPositionalParameterTypes();
@@ -70,8 +76,27 @@
this.entityMode = entityMode;
this.filters = filters;
this.customTransformer = queryParameters.getResultTransformer();
- this.hashCode = getHashCode();
+ this.hashCode = generateHashCode();
}
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ this.hashCode = generateHashCode();
+ }
+
+ private int generateHashCode() {
+ int result = 13;
+ result = 37 * result + ( firstRow==null ? 0 : firstRow.hashCode() );
+ result = 37 * result + ( maxRows==null ? 0 : maxRows.hashCode() );
+ for ( int i=0; i<values.length; i++ ) {
+ result = 37 * result + ( values[i]==null ? 0 : types[i].getHashCode( values[i], entityMode ) );
+ }
+ result = 37 * result + ( namedParameters==null ? 0 : namedParameters.hashCode() );
+ result = 37 * result + ( filters==null ? 0 : filters.hashCode() );
+ result = 37 * result + ( customTransformer==null ? 0 : customTransformer.hashCode() );
+ result = 37 * result + sqlQueryString.hashCode();
+ return result;
+ }
public boolean equals(Object other) {
if (!(other instanceof QueryKey)) return false;
@@ -98,20 +123,6 @@
public int hashCode() {
return hashCode;
}
-
- private int getHashCode() {
- int result = 13;
- result = 37 * result + ( firstRow==null ? 0 : firstRow.hashCode() );
- result = 37 * result + ( maxRows==null ? 0 : maxRows.hashCode() );
- for ( int i=0; i<values.length; i++ ) {
- result = 37 * result + ( values[i]==null ? 0 : types[i].getHashCode( values[i], entityMode ) );
- }
- result = 37 * result + ( namedParameters==null ? 0 : namedParameters.hashCode() );
- result = 37 * result + ( filters==null ? 0 : filters.hashCode() );
- result = 37 * result + ( customTransformer==null ? 0 : customTransformer.hashCode() );
- result = 37 * result + sqlQueryString.hashCode();
- return result;
- }
public String toString() {
StringBuffer buf = new StringBuffer()
Modified: core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/core/src/main/java/org/hibernate/criterion/CriteriaSpecification.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -43,22 +43,22 @@
/**
* Each row of results is a <tt>Map</tt> from alias to entity instance
*/
- public static final ResultTransformer ALIAS_TO_ENTITY_MAP = new AliasToEntityMapResultTransformer();
+ public static final ResultTransformer ALIAS_TO_ENTITY_MAP = AliasToEntityMapResultTransformer.INSTANCE;
/**
* Each row of results is an instance of the root entity
*/
- public static final ResultTransformer ROOT_ENTITY = new RootEntityResultTransformer();
+ public static final ResultTransformer ROOT_ENTITY = RootEntityResultTransformer.INSTANCE;
/**
* Each row of results is a distinct instance of the root entity
*/
- public static final ResultTransformer DISTINCT_ROOT_ENTITY = new DistinctRootEntityResultTransformer();
+ public static final ResultTransformer DISTINCT_ROOT_ENTITY = DistinctRootEntityResultTransformer.INSTANCE;
/**
* This result transformer is selected implicitly by calling <tt>setProjection()</tt>
*/
- public static final ResultTransformer PROJECTION = new PassThroughResultTransformer();
+ public static final ResultTransformer PROJECTION = PassThroughResultTransformer.INSTANCE;
/**
* Specifies joining to an entity based on an inner join.
Modified: core/trunk/core/src/main/java/org/hibernate/transform/AliasToBeanResultTransformer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transform/AliasToBeanResultTransformer.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/core/src/main/java/org/hibernate/transform/AliasToBeanResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -55,7 +55,7 @@
public class AliasToBeanResultTransformer implements ResultTransformer {
// IMPL NOTE : due to the delayed population of setters (setters cached
- // for performance), we really cannot pro0perly define equality for
+ // for performance), we really cannot properly define equality for
// this transformer
private final Class resultClass;
Modified: core/trunk/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/core/src/main/java/org/hibernate/transform/AliasToEntityMapResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -43,14 +43,14 @@
public static final AliasToEntityMapResultTransformer INSTANCE = new AliasToEntityMapResultTransformer();
/**
- * Instantiate AliasToEntityMapResultTransformer.
- *
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * Disallow instantiation of AliasToEntityMapResultTransformer.
*/
- public AliasToEntityMapResultTransformer() {
- // todo : make private
+ private AliasToEntityMapResultTransformer() {
}
+ /**
+ * {@inheritDoc}
+ */
public Object transformTuple(Object[] tuple, String[] aliases) {
Map result = new HashMap(tuple.length);
for ( int i=0; i<tuple.length; i++ ) {
@@ -70,30 +70,4 @@
private Object readResolve() {
return INSTANCE;
}
-
-
- // all AliasToEntityMapResultTransformer are considered equal ~~~~~~~~~~~~~
-
- /**
- * All AliasToEntityMapResultTransformer are considered equal
- *
- * @param other The other instance to check for equality
- * @return True if (non-null) other is a instance of
- * AliasToEntityMapResultTransformer.
- */
- public boolean equals(Object other) {
- // todo : we can remove this once the deprecated ctor can be made private...
- return other != null && AliasToEntityMapResultTransformer.class.isInstance( other );
- }
-
- /**
- * All AliasToEntityMapResultTransformer are considered equal
- *
- * @return We simply return the hashCode of the
- * AliasToEntityMapResultTransformer class name string.
- */
- public int hashCode() {
- // todo : we can remove this once the deprecated ctor can be made private...
- return getClass().getName().hashCode();
- }
}
Modified: core/trunk/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/core/src/main/java/org/hibernate/transform/DistinctRootEntityResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -42,11 +42,9 @@
public static final DistinctRootEntityResultTransformer INSTANCE = new DistinctRootEntityResultTransformer();
/**
- * Instantiate a DistinctRootEntityResultTransformer.
- *
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * Disallow instantiation of DistinctRootEntityResultTransformer.
*/
- public DistinctRootEntityResultTransformer() {
+ private DistinctRootEntityResultTransformer() {
}
/**
@@ -79,8 +77,4 @@
return INSTANCE;
}
- public boolean equals(Object obj) {
- // todo : we can remove this once the deprecated ctor can be made private...
- return DistinctRootEntityResultTransformer.class.isInstance( obj );
- }
}
Modified: core/trunk/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/core/src/main/java/org/hibernate/transform/PassThroughResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -36,13 +36,14 @@
public static final PassThroughResultTransformer INSTANCE = new PassThroughResultTransformer();
/**
- * Instamtiate a PassThroughResultTransformer.
- *
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * Disallow instantiation of PassThroughResultTransformer.
*/
- public PassThroughResultTransformer() {
+ private PassThroughResultTransformer() {
}
+ /**
+ * {@inheritDoc}
+ */
public Object transformTuple(Object[] tuple, String[] aliases) {
return tuple.length==1 ? tuple[0] : tuple;
}
@@ -56,9 +57,4 @@
return INSTANCE;
}
- public boolean equals(Object obj) {
- // todo : we can remove this once the deprecated ctor can be made private...
- return PassThroughResultTransformer.class.isInstance( obj );
- }
-
}
Modified: core/trunk/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/core/src/main/java/org/hibernate/transform/RootEntityResultTransformer.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -24,7 +24,6 @@
*/
package org.hibernate.transform;
-import java.util.List;
import java.io.Serializable;
/**
@@ -42,11 +41,9 @@
public static final RootEntityResultTransformer INSTANCE = new RootEntityResultTransformer();
/**
- * Instantiate RootEntityResultTransformer.
- *
- * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one.
+ * Disallow instantiation of RootEntityResultTransformer.
*/
- public RootEntityResultTransformer() {
+ private RootEntityResultTransformer() {
}
/**
@@ -64,9 +61,4 @@
private Object readResolve() {
return INSTANCE;
}
-
- public boolean equals(Object obj) {
- // todo : we can remove this once the deprecated ctor can be made private...
- return RootEntityResultTransformer.class.isInstance( obj );
- }
}
Added: core/trunk/core/src/test/java/org/hibernate/cache/QueryKeyTest.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/cache/QueryKeyTest.java (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/cache/QueryKeyTest.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -0,0 +1,96 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.cache;
+
+import java.util.Collections;
+import java.util.HashMap;
+
+import junit.framework.TestCase;
+
+import org.hibernate.engine.QueryParameters;
+import org.hibernate.EntityMode;
+import org.hibernate.transform.RootEntityResultTransformer;
+import org.hibernate.transform.ResultTransformer;
+import org.hibernate.transform.DistinctRootEntityResultTransformer;
+import org.hibernate.transform.AliasToEntityMapResultTransformer;
+import org.hibernate.transform.PassThroughResultTransformer;
+import org.hibernate.transform.DistinctResultTransformer;
+import org.hibernate.util.SerializationHelper;
+import org.hibernate.util.ArrayHelper;
+
+/**
+ * Tests relating to {@link QueryKey} instances.
+ *
+ * @author Steve Ebersole
+ */
+public class QueryKeyTest extends TestCase {
+ private static final String QUERY_STRING = "the query string";
+
+ public void testSerializedEquality() {
+ doTest( buildBasicKey( new QueryParameters() ) );
+ }
+
+ public void testSerializedEqualityWithResultTransformer() {
+ doTest( buildBasicKey( buildQueryParameters( RootEntityResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( DistinctRootEntityResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( DistinctResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( AliasToEntityMapResultTransformer.INSTANCE ) ) );
+ doTest( buildBasicKey( buildQueryParameters( PassThroughResultTransformer.INSTANCE ) ) );
+ }
+
+ private QueryParameters buildQueryParameters(ResultTransformer resultTransformer) {
+ return new QueryParameters(
+ ArrayHelper.EMPTY_TYPE_ARRAY, // param types
+ ArrayHelper.EMPTY_OBJECT_ARRAY, // param values
+ Collections.EMPTY_MAP, // lock modes
+ null, // row selection
+ false, // cacheable?
+ "", // cache region
+ "", // SQL comment
+ false, // is natural key lookup?
+ resultTransformer // the result transformer, duh! ;)
+ );
+ }
+
+ private QueryKey buildBasicKey(QueryParameters queryParameters) {
+ return new QueryKey( QUERY_STRING, queryParameters, Collections.EMPTY_SET, EntityMode.POJO );
+ }
+
+ private void doTest(QueryKey key) {
+ HashMap map = new HashMap();
+
+ map.put( key, "" );
+ assert map.size() == 1 : "really messed up";
+
+ Object old = map.put( key, "value" );
+ assert old != null && map.size() == 1 : "apparent QueryKey equals/hashCode issue";
+
+ // finally, lets serialize it and see what happens
+ QueryKey key2 = ( QueryKey ) SerializationHelper.clone( key );
+ assert key != key2 : "deep copy issue";
+ old = map.put( key2, "new value" );
+ assert old != null && map.size() == 1 : "deserialization did not set hashCode or equals properly";
+ }
+}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2008-09-10 16:33:44 UTC (rev 15173)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2008-09-10 17:02:45 UTC (rev 15174)
@@ -6,6 +6,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.HashMap;
import junit.framework.Test;
@@ -29,6 +30,7 @@
import org.hibernate.transform.DistinctRootEntityResultTransformer;
import org.hibernate.transform.Transformers;
import org.hibernate.transform.AliasToEntityMapResultTransformer;
+import org.hibernate.transform.BasicTransformerAdapter;
/**
* Tests of various features of native SQL queries.
@@ -177,7 +179,7 @@
" left outer join EMPLOYMENT emp on org.ORGID = emp.EMPLOYER, ORGANIZATION org2" )
.addEntity("org", Organization.class)
.addJoin("emp", "org.employments")
- .setResultTransformer(new DistinctRootEntityResultTransformer())
+ .setResultTransformer( DistinctRootEntityResultTransformer.INSTANCE )
.list();
assertEquals( l.size(), 2 );
@@ -608,13 +610,16 @@
}
}
- private static class UpperCasedAliasToEntityMapResultTransformer extends AliasToEntityMapResultTransformer {
+ private static class UpperCasedAliasToEntityMapResultTransformer extends BasicTransformerAdapter implements Serializable {
public Object transformTuple(Object[] tuple, String[] aliases) {
- String[] ucAliases = new String[aliases.length];
- for ( int i = 0; i < aliases.length; i++ ) {
- ucAliases[i] = aliases[i].toUpperCase();
+ Map result = new HashMap( tuple.length );
+ for ( int i = 0; i < tuple.length; i++ ) {
+ String alias = aliases[i];
+ if ( alias != null ) {
+ result.put( alias.toUpperCase(), tuple[i] );
+ }
}
- return super.transformTuple( tuple, ucAliases );
+ return result;
}
}
}
16 years, 3 months
Hibernate SVN: r15173 - core/branches/Branch_3_3.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-10 12:33:44 -0400 (Wed, 10 Sep 2008)
New Revision: 15173
Modified:
core/branches/Branch_3_3/changelog.txt
Log:
prep 3.3.1 release
Modified: core/branches/Branch_3_3/changelog.txt
===================================================================
--- core/branches/Branch_3_3/changelog.txt 2008-09-10 16:24:39 UTC (rev 15172)
+++ core/branches/Branch_3_3/changelog.txt 2008-09-10 16:33:44 UTC (rev 15173)
@@ -6,6 +6,28 @@
more about each case.
+Changes in version 3.3.1.GA (2008.09.10)
+-------------------------------------------
+
+** Bug
+ * [HHH-2694] - create-drop with c3p0 causes SQLException
+ * [HHH-3231] - org.hibernate.id.enhanced.TableGenerator throws "IllegalArgumentException: alias not found: tbl" under Oracle
+ * [HHH-3472] - JTASessionContext broken for WebSphere
+
+** Improvement
+ * [HHH-2686] - Include a primary key in the sequence table used by id.enhanced.TableGenerator
+ * [HHH-3249] - Make o.h.id.enhanced.TableGenerator more extension-friendly
+ * [HHH-3424] - concat() with param binding fails function on derby
+ * [HHH-3454] - Allow enhanced.TableGenerator to segment itself per entity as default
+ * [HHH-3456] - Make o.h.id.enhanced.SequenceStyleGenerator more extension-friendly
+
+** New Feature
+ * [HHH-3471] - Provide true-false type that maps to int values
+
+** Task
+ * [HHH-3474] - Upgrade to use slf4j 1.5 (1.5.2)
+
+
Changes in version 3.3.0.SP1 (2008.08.19)
-------------------------------------------
16 years, 3 months
Hibernate SVN: r15172 - in core/branches/Branch_3_3: testsuite and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-10 12:24:39 -0400 (Wed, 10 Sep 2008)
New Revision: 15172
Modified:
core/branches/Branch_3_3/parent/pom.xml
core/branches/Branch_3_3/testsuite/pom.xml
Log:
HHH-3474 : slf4j -> 1.5.2
Modified: core/branches/Branch_3_3/parent/pom.xml
===================================================================
--- core/branches/Branch_3_3/parent/pom.xml 2008-09-10 16:24:21 UTC (rev 15171)
+++ core/branches/Branch_3_3/parent/pom.xml 2008-09-10 16:24:39 UTC (rev 15172)
@@ -278,11 +278,44 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+ <!-- test-scoped dependencies for common testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <version>3.8.1</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl104-over-slf4j</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>99.0-does-not-exist</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ <version>99.0-does-not-exist</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- / test-scoped dependencies for common testing dependencies -->
</dependencies>
<dependencyManagement>
@@ -290,7 +323,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>1.5.2</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
@@ -303,11 +336,6 @@
<version>3.1</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- </dependency>
- <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
@@ -330,4 +358,4 @@
</snapshotRepository>
</distributionManagement>
-</project>
\ No newline at end of file
+</project>
Modified: core/branches/Branch_3_3/testsuite/pom.xml
===================================================================
--- core/branches/Branch_3_3/testsuite/pom.xml 2008-09-10 16:24:21 UTC (rev 15171)
+++ core/branches/Branch_3_3/testsuite/pom.xml 2008-09-10 16:24:39 UTC (rev 15172)
@@ -44,32 +44,6 @@
<artifactId>jaxen</artifactId>
<version>1.1</version>
</dependency>
- <!-- logging setup for the test suite -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>99.0-does-not-exist</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging-api</artifactId>
- <version>99.0-does-not-exist</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl104-over-slf4j</artifactId>
- <version>1.4.2</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.4.2</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
<build>
@@ -350,4 +324,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
16 years, 3 months
Hibernate SVN: r15171 - in core/trunk: testsuite and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-10 12:24:21 -0400 (Wed, 10 Sep 2008)
New Revision: 15171
Modified:
core/trunk/parent/pom.xml
core/trunk/testsuite/pom.xml
Log:
HHH-3474 : slf4j -> 1.5.2
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2008-09-10 10:56:37 UTC (rev 15170)
+++ core/trunk/parent/pom.xml 2008-09-10 16:24:21 UTC (rev 15171)
@@ -278,11 +278,44 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+ <!-- test-scoped dependencies for common testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <version>3.8.1</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl104-over-slf4j</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>99.0-does-not-exist</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ <version>99.0-does-not-exist</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- / test-scoped dependencies for common testing dependencies -->
</dependencies>
<dependencyManagement>
@@ -290,7 +323,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>1.5.2</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
@@ -303,11 +336,6 @@
<version>3.1</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- </dependency>
- <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
Modified: core/trunk/testsuite/pom.xml
===================================================================
--- core/trunk/testsuite/pom.xml 2008-09-10 10:56:37 UTC (rev 15170)
+++ core/trunk/testsuite/pom.xml 2008-09-10 16:24:21 UTC (rev 15171)
@@ -44,32 +44,6 @@
<artifactId>jaxen</artifactId>
<version>1.1</version>
</dependency>
- <!-- logging setup for the test suite -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>99.0-does-not-exist</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging-api</artifactId>
- <version>99.0-does-not-exist</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl104-over-slf4j</artifactId>
- <version>1.4.2</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.4.2</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
</dependencies>
<build>
16 years, 3 months
Hibernate SVN: r15170 - validator/tags.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-09-10 06:56:37 -0400 (Wed, 10 Sep 2008)
New Revision: 15170
Added:
validator/tags/3.1.0.GA/
Log:
Tagging release 3.1.0.GA
Copied: validator/tags/3.1.0.GA (from rev 15169, validator/trunk)
16 years, 3 months
Hibernate SVN: r15169 - in validator/trunk: doc/reference/en and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-09-10 06:53:41 -0400 (Wed, 10 Sep 2008)
New Revision: 15169
Added:
validator/trunk/lib/test/
Modified:
validator/trunk/build.xml
validator/trunk/changelog.txt
validator/trunk/doc/reference/en/master.xml
validator/trunk/pom.xml
validator/trunk/readme.txt
validator/trunk/src/java/org/hibernate/validator/Version.java
Log:
Preperation for 3.1.0.GA
Modified: validator/trunk/build.xml
===================================================================
--- validator/trunk/build.xml 2008-09-09 21:27:28 UTC (rev 15168)
+++ validator/trunk/build.xml 2008-09-10 10:53:41 UTC (rev 15169)
@@ -25,7 +25,7 @@
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="Hibernate Validator"/>
<property name="name" value="hibernate-validator"/>
- <property name="version" value="3.1.0.CR2"/>
+ <property name="version" value="3.1.0.GA"/>
<property name="javadoc.packagenames" value="org.hibernate.validator.*"/>
<property name="copy.test" value="true"/>
<property name="javac.source" value="1.5"/>
Modified: validator/trunk/changelog.txt
===================================================================
--- validator/trunk/changelog.txt 2008-09-09 21:27:28 UTC (rev 15168)
+++ validator/trunk/changelog.txt 2008-09-10 10:53:41 UTC (rev 15169)
@@ -1,6 +1,10 @@
Hibernate Validator Changelog
=============================
+3.1.0.GA (10-09-2008)
+----------------------
+
+
3.1.0.CR2 (20-08-2008)
----------------------
Modified: validator/trunk/doc/reference/en/master.xml
===================================================================
--- validator/trunk/doc/reference/en/master.xml 2008-09-09 21:27:28 UTC (rev 15168)
+++ validator/trunk/doc/reference/en/master.xml 2008-09-10 10:53:41 UTC (rev 15169)
@@ -10,7 +10,7 @@
<subtitle>Reference Guide</subtitle>
- <releaseinfo>3.1.0.CR2</releaseinfo>
+ <releaseinfo>3.1.0.GA</releaseinfo>
<mediaobject>
<imageobject>
Modified: validator/trunk/pom.xml
===================================================================
--- validator/trunk/pom.xml 2008-09-09 21:27:28 UTC (rev 15168)
+++ validator/trunk/pom.xml 2008-09-10 10:53:41 UTC (rev 15169)
@@ -6,7 +6,7 @@
<artifactId>hibernate-validator</artifactId>
<packaging>jar</packaging>
<name>Hibernate Validator</name>
- <version>3.1.0.CR2</version>
+ <version>3.1.0.GA</version>
<url>http://validator.hibernate.org</url>
<licenses>
<license>
@@ -34,7 +34,6 @@
<artifactId>slf4j-api</artifactId>
<version>1.4.2</version>
</dependency>
-
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
Modified: validator/trunk/readme.txt
===================================================================
--- validator/trunk/readme.txt 2008-09-09 21:27:28 UTC (rev 15168)
+++ validator/trunk/readme.txt 2008-09-10 10:53:41 UTC (rev 15169)
@@ -1,6 +1,6 @@
Hibernate Validator
==================================================
-Version: 3.1.0.CR2, 20.08.2008
+Version: 3.1.0.GA, 10.09.2008
Description
-----------
Modified: validator/trunk/src/java/org/hibernate/validator/Version.java
===================================================================
--- validator/trunk/src/java/org/hibernate/validator/Version.java 2008-09-09 21:27:28 UTC (rev 15168)
+++ validator/trunk/src/java/org/hibernate/validator/Version.java 2008-09-10 10:53:41 UTC (rev 15169)
@@ -10,7 +10,7 @@
* @author Emmanuel Bernard
*/
public class Version {
- public static final String VERSION = "3.1.0.CR2";
+ public static final String VERSION = "3.1.0.GA";
private static Logger log = LoggerFactory.getLogger( Version.class );
static {
16 years, 3 months
Hibernate SVN: r15168 - core/trunk/core/src/main/java/org/hibernate/context.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-09 17:27:28 -0400 (Tue, 09 Sep 2008)
New Revision: 15168
Modified:
core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
Log:
HHH-3472 : WebSphere + JTASessionContext
Modified: core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-09-09 21:27:11 UTC (rev 15167)
+++ core/trunk/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-09-09 21:27:28 UTC (rev 15168)
@@ -101,13 +101,17 @@
throw new HibernateException( "Problem locating/validating JTA transaction", t );
}
- Session currentSession = ( Session ) currentSessionMap.get( txn );
+ final Object txnIdentifier = factory.getSettings().getTransactionManagerLookup() == null
+ ? txn
+ : factory.getSettings().getTransactionManagerLookup().getTransactionIdentifier( txn );
+ Session currentSession = ( Session ) currentSessionMap.get( txnIdentifier );
+
if ( currentSession == null ) {
currentSession = buildOrObtainSession();
try {
- txn.registerSynchronization( buildCleanupSynch( txn ) );
+ txn.registerSynchronization( buildCleanupSynch( txnIdentifier ) );
}
catch ( Throwable t ) {
try {
@@ -119,17 +123,21 @@
throw new HibernateException( "Unable to register cleanup Synchronization with TransactionManager" );
}
- Object txnIdentifier = factory.getSettings().getTransactionManagerLookup() == null
- ? txn
- : factory.getSettings().getTransactionManagerLookup().getTransactionIdentifier( txn );
currentSessionMap.put( txnIdentifier, currentSession );
}
return currentSession;
}
- private CleanupSynch buildCleanupSynch(Transaction txn) {
- return new CleanupSynch( txn, this );
+ /**
+ * Builds a {@link CleanupSynch} capable of cleaning up the the current session map as an after transaction
+ * callback.
+ *
+ * @param transactionIdentifier The transaction identifier under which the current session is registered.
+ * @return The cleanup synch.
+ */
+ private CleanupSynch buildCleanupSynch(Object transactionIdentifier) {
+ return new CleanupSynch( transactionIdentifier, this );
}
/**
@@ -180,11 +188,11 @@
* JTA transaction synch used for cleanup of the internal session map.
*/
protected static class CleanupSynch implements Synchronization {
- private Transaction txn;
+ private Object transactionIdentifier;
private JTASessionContext context;
- public CleanupSynch(Transaction txn, JTASessionContext context) {
- this.txn = txn;
+ public CleanupSynch(Object transactionIdentifier, JTASessionContext context) {
+ this.transactionIdentifier = transactionIdentifier;
this.context = context;
}
@@ -198,7 +206,7 @@
* {@inheritDoc}
*/
public void afterCompletion(int i) {
- context.currentSessionMap.remove( txn );
+ context.currentSessionMap.remove( transactionIdentifier );
}
}
}
16 years, 3 months
Hibernate SVN: r15167 - core/branches/Branch_3_3/core/src/main/java/org/hibernate/context.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-09-09 17:27:11 -0400 (Tue, 09 Sep 2008)
New Revision: 15167
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/context/JTASessionContext.java
Log:
HHH-3472 : WebSphere + JTASessionContext
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/context/JTASessionContext.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-09-09 19:22:59 UTC (rev 15166)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/context/JTASessionContext.java 2008-09-09 21:27:11 UTC (rev 15167)
@@ -101,13 +101,17 @@
throw new HibernateException( "Problem locating/validating JTA transaction", t );
}
- Session currentSession = ( Session ) currentSessionMap.get( txn );
+ final Object txnIdentifier = factory.getSettings().getTransactionManagerLookup() == null
+ ? txn
+ : factory.getSettings().getTransactionManagerLookup().getTransactionIdentifier( txn );
+ Session currentSession = ( Session ) currentSessionMap.get( txnIdentifier );
+
if ( currentSession == null ) {
currentSession = buildOrObtainSession();
try {
- txn.registerSynchronization( buildCleanupSynch( txn ) );
+ txn.registerSynchronization( buildCleanupSynch( txnIdentifier ) );
}
catch ( Throwable t ) {
try {
@@ -119,17 +123,21 @@
throw new HibernateException( "Unable to register cleanup Synchronization with TransactionManager" );
}
- Object txnIdentifier = factory.getSettings().getTransactionManagerLookup() == null
- ? txn
- : factory.getSettings().getTransactionManagerLookup().getTransactionIdentifier( txn );
currentSessionMap.put( txnIdentifier, currentSession );
}
return currentSession;
}
- private CleanupSynch buildCleanupSynch(Transaction txn) {
- return new CleanupSynch( txn, this );
+ /**
+ * Builds a {@link CleanupSynch} capable of cleaning up the the current session map as an after transaction
+ * callback.
+ *
+ * @param transactionIdentifier The transaction identifier under which the current session is registered.
+ * @return The cleanup synch.
+ */
+ private CleanupSynch buildCleanupSynch(Object transactionIdentifier) {
+ return new CleanupSynch( transactionIdentifier, this );
}
/**
@@ -180,11 +188,11 @@
* JTA transaction synch used for cleanup of the internal session map.
*/
protected static class CleanupSynch implements Synchronization {
- private Transaction txn;
+ private Object transactionIdentifier;
private JTASessionContext context;
- public CleanupSynch(Transaction txn, JTASessionContext context) {
- this.txn = txn;
+ public CleanupSynch(Object transactionIdentifier, JTASessionContext context) {
+ this.transactionIdentifier = transactionIdentifier;
this.context = context;
}
@@ -198,7 +206,7 @@
* {@inheritDoc}
*/
public void afterCompletion(int i) {
- context.currentSessionMap.remove( txn );
+ context.currentSessionMap.remove( transactionIdentifier );
}
}
}
16 years, 3 months