Hibernate SVN: r20015 - core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-22 16:39:15 -0400 (Thu, 22 Jul 2010)
New Revision: 20015
Modified:
core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java
Log:
HHH-5097 - Bug in ParameterizedFunctionExpression with two or more parameters: IllegalArgumentException
Modified: core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java
===================================================================
--- core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java 2010-07-22 20:23:08 UTC (rev 20014)
+++ core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java 2010-07-22 20:39:15 UTC (rev 20015)
@@ -98,8 +98,10 @@
}
protected void renderArguments(StringBuilder buffer, CriteriaQueryCompiler.RenderingContext renderingContext) {
+ String sep = "";
for ( Expression argument : argumentExpressions ) {
- buffer.append( ( (Renderable) argument ).render( renderingContext ) );
+ buffer.append( sep ).append( ( (Renderable) argument ).render( renderingContext ) );
+ sep = ", ";
}
}
}
13 years, 9 months
Hibernate SVN: r20014 - in core/trunk: core/src/main/java/org/hibernate/cfg and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-22 16:23:08 -0400 (Thu, 22 Jul 2010)
New Revision: 20014
Added:
core/trunk/core/src/main/java/org/hibernate/SQLQueryResultMappingBuilder.java
Modified:
core/trunk/core/src/main/java/org/hibernate/SQLQuery.java
core/trunk/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java
core/trunk/core/src/main/java/org/hibernate/classic/Session.java
core/trunk/core/src/main/java/org/hibernate/engine/NamedSQLQueryDefinition.java
core/trunk/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryReturn.java
core/trunk/core/src/main/java/org/hibernate/impl/SQLQueryImpl.java
core/trunk/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
Log:
HHH-3908 - Expose way to fully control fetching and result mapping on SQLQuery
Modified: core/trunk/core/src/main/java/org/hibernate/SQLQuery.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/SQLQuery.java 2010-07-22 19:52:43 UTC (rev 20013)
+++ core/trunk/core/src/main/java/org/hibernate/SQLQuery.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. 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.
+ * distributed under license by Red Hat Inc.
*
* 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
@@ -20,97 +20,323 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
import org.hibernate.type.Type;
/**
- * Allows the user to declare the types and select list injection
- * points of all entities returned by the query. Also allows
- * declaration of the type and column alias of any scalar results
- * of the query.
+ * Represents a "native sql" query and allows the user to define certain aspects about its execution, such as:<ul>
+ * <li>result-set value mapping (see below)</li>
+ * <li>
+ * Tables used via {@link #addSynchronizedQuerySpace}, {@link #addSynchronizedEntityName} and
+ * {@link #addSynchronizedEntityClass}. This allows Hibernate to properly know how to deal with auto-flush checking
+ * as well as cached query results if the results of the query are being cached.
+ * </li>
+ * </ul>
+ * <p/>
+ * In terms of result-set mapping, there are 3 approaches to defining:<ul>
+ * <li>If this represents a named sql query, the mapping could be associated with the query as part of its metadata</li>
+ * <li>A pre-defined (defined in metadata and named) mapping can be associated with {@link #setResultSetMapping}</li>
+ * <li>Defined locally per the various {@link #addEntity}, {@link #addRoot}, {@link #addJoin}, {@link #addFetch} and {@link #addScalar} methods</li>
+ *
+ * </ul>
*
* @author Gavin King
+ * @author Steve Ebersole
*/
public interface SQLQuery extends Query {
+
/**
- * Declare a "root" entity, without specifying an alias
+ * Adds a query space (table name) for (a) auto-flush checking and (b) query result cache invalidation checking
+ *
+ * @param querySpace The query space to be auto-flushed for this query.
+ *
+ * @return this, for method chaining
*/
- public SQLQuery addEntity(String entityName);
+ public SQLQuery addSynchronizedQuerySpace(String querySpace);
+
/**
- * Declare a "root" entity
+ * Adds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking. Same as
+ * {@link #addSynchronizedQuerySpace} for all tables associated with the given entity.
+ *
+ * @param entityName The name of the entity upon whose defined query spaces we should additionally synchronize.
+ *
+ * @return this, for method chaining
+ *
+ * @throws MappingException Indicates the given name could not be resolved as an entity
*/
- public SQLQuery addEntity(String alias, String entityName);
+ public SQLQuery addSynchronizedEntityName(String entityName) throws MappingException;
+
/**
- * Declare a "root" entity, specifying a lock mode
+ * Adds an entity for (a) auto-flush checking and (b) query result cache invalidation checking. Same as
+ * {@link #addSynchronizedQuerySpace} for all tables associated with the given entity.
+ *
+ * @param entityClass The class of the entity upon whose defined query spaces we should additionally synchronize.
+ *
+ * @return this, for method chaining
+ *
+ * @throws MappingException Indicates the given class could not be resolved as an entity
*/
- public SQLQuery addEntity(String alias, String entityName, LockMode lockMode);
+ public SQLQuery addSynchronizedEntityClass(Class entityClass) throws MappingException;
+
/**
- * Declare a "root" entity, without specifying an alias
+ * Use a predefined named result-set mapping. This might be defined by a {@code <result-set/>} element in a
+ * Hibernate <tt>hbm.xml</tt> file or through a {@link javax.persistence.SqlResultSetMapping} annotation.
+ *
+ * @param name The name of the mapping to use.
+ *
+ * @return this, for method chaining
*/
- public SQLQuery addEntity(Class entityClass);
+ public SQLQuery setResultSetMapping(String name);
+
/**
+ * Declare a scalar query result. Hibernate will attempt to automatically detect the underlying type.
+ * <p/>
+ * Functions like {@code <return-scalar/>} in {@code hbm.xml} or {@link javax.persistence.ColumnResult}
+ *
+ * @param columnAlias The column alias in the result-set to be processed as a scalar result
+ *
+ * @return {@code this}, for method chaining
+ */
+ public SQLQuery addScalar(String columnAlias);
+
+ /**
+ * Declare a scalar query result.
+ * <p/>
+ * Functions like {@code <return-scalar/>} in {@code hbm.xml} or {@link javax.persistence.ColumnResult}
+ *
+ * @param columnAlias The column alias in the result-set to be processed as a scalar result
+ * @param type The Hibernate type as which to treat the value.
+ *
+ * @return {@code this}, for method chaining
+ */
+ public SQLQuery addScalar(String columnAlias, Type type);
+
+ /**
+ * Add a new root return mapping, returning a {@link RootReturn} to allow further definition
+ *
+ * @param tableAlias The SQL table alias to map to this entity
+ * @param entityName The name of the entity.
+ *
+ * @return The return config object for further control.
+ *
+ * @since 3.6
+ */
+ public RootReturn addRoot(String tableAlias, String entityName);
+
+ /**
+ * Add a new root return mapping, returning a {@link RootReturn} to allow further definition
+ *
+ * @param tableAlias The SQL table alias to map to this entity
+ * @param entityType The java type of the entity.
+ *
+ * @return The return config object for further control.
+ *
+ * @since 3.6
+ */
+ public RootReturn addRoot(String tableAlias, Class entityType);
+
+ /**
+ * Declare a "root" entity, without specifying an alias. The expectation here is that the table alias is the
+ * same as the unqualified entity name
+ * <p/>
+ * Use {@link #addRoot} if you need further control of the mapping
+ *
+ * @param entityName The entity name that is the root return of the query.
+ *
+ * @return {@code this}, for method chaining
+ */
+ public SQLQuery addEntity(String entityName);
+
+ /**
* Declare a "root" entity
+ *
+ * @param tableAlias The SQL table alias
+ * @param entityName The entity name
+ *
+ * @return {@code this}, for method chaining
*/
- public SQLQuery addEntity(String alias, Class entityClass);
+ public SQLQuery addEntity(String tableAlias, String entityName);
+
/**
* Declare a "root" entity, specifying a lock mode
+ *
+ * @param tableAlias The SQL table alias
+ * @param entityName The entity name
+ * @param lockMode The lock mode for this return.
+ *
+ * @return {@code this}, for method chaining
*/
- public SQLQuery addEntity(String alias, Class entityClass, LockMode lockMode);
+ public SQLQuery addEntity(String tableAlias, String entityName, LockMode lockMode);
/**
- * Declare a "joined" entity
+ * Declare a "root" entity, without specifying an alias. The expectation here is that the table alias is the
+ * same as the unqualified entity name
+ *
+ * @param entityType The java type of the entity to add as a root
+ *
+ * @return {@code this}, for method chaining
*/
- public SQLQuery addJoin(String alias, String path);
+ public SQLQuery addEntity(Class entityType);
+
/**
- * Declare a "joined" entity, specifying a lock mode
+ * Declare a "root" entity
+ *
+ * @param tableAlias The SQL table alias
+ * @param entityType The java type of the entity to add as a root
+ *
+ * @return {@code this}, for method chaining
*/
- public SQLQuery addJoin(String alias, String path, LockMode lockMode);
-
+ public SQLQuery addEntity(String tableAlias, Class entityType);
+
/**
- * Declare a scalar query result
+ * Declare a "root" entity, specifying a lock mode
+ *
+ * @param tableAlias The SQL table alias
+ * @param entityName The entity name
+ * @param lockMode The lock mode for this return.
+ *
+ * @return {@code this}, for method chaining
*/
- public SQLQuery addScalar(String columnAlias, Type type);
+ public SQLQuery addEntity(String tableAlias, Class entityName, LockMode lockMode);
/**
- * Declare a scalar query. Hibernate will attempt to automatically detect the underlying type.
+ * Declare a join fetch result.
+ *
+ * @param tableAlias The SQL table alias for the data to be mapped to this fetch
+ * @param ownerTableAlias Identify the table alias of the owner of this association. Should match the alias of a
+ * previously added root or fetch
+ * @param joinPropertyName The name of the property being join fetched.
+ *
+ * @return The return config object for further control.
+ *
+ * @since 3.6
*/
- public SQLQuery addScalar(String columnAlias);
+ public FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName);
/**
- * Use a predefined named ResultSetMapping
+ * Declare a join fetch result.
+ *
+ * @param tableAlias The SQL table alias for the data to be mapped to this fetch
+ * @param path The association path ([owner-alias].[property-name]).
+ *
+ * @return {@code this}, for method chaining
*/
- public SQLQuery setResultSetMapping(String name);
+ public SQLQuery addJoin(String tableAlias, String path);
/**
- * Adds a query space for auto-flush synchronization.
+ * Declare a join fetch result.
*
- * @param querySpace The query space to be auto-flushed for this query.
- * @return this, for method chaning
+ * @param tableAlias The SQL table alias for the data to be mapped to this fetch
+ * @param ownerTableAlias Identify the table alias of the owner of this association. Should match the alias of a
+ * previously added root or fetch
+ * @param joinPropertyName The name of the property being join fetched.
+ *
+ * @return {@code this}, for method chaining
+ *
+ * @since 3.6
*/
- public SQLQuery addSynchronizedQuerySpace(String querySpace);
+ public SQLQuery addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName);
/**
- * Adds an entity name or auto-flush synchronization.
+ * Declare a join fetch result, specifying a lock mode
*
- * @param entityName The name of the entity upon whose defined
- * query spaces we should additionally synchronize.
- * @return this, for method chaning
- * @throws MappingException Indicates the given entity name could not be
- * resolved.
+ * @param tableAlias The SQL table alias for the data to be mapped to this fetch
+ * @param path The association path ([owner-alias].[property-name]).
+ * @param lockMode The lock mode for this return.
+ *
+ * @return {@code this}, for method chaining
*/
- public SQLQuery addSynchronizedEntityName(String entityName) throws MappingException;
+ public SQLQuery addJoin(String tableAlias, String path, LockMode lockMode);
/**
- * Adds an entity name or auto-flush synchronization.
- *
- * @param entityClass The class of the entity upon whose defined
- * query spaces we should additionally synchronize.
- * @return this, for method chaning
- * @throws MappingException Indicates the given entity class could not be
- * resolved.
+ * Allows access to further control how properties within a root or join fetch are mapped back from the result set.
+ * Generally used in composite value scenarios.
*/
- public SQLQuery addSynchronizedEntityClass(Class entityClass) throws MappingException;
+ public static interface ReturnProperty {
+ /**
+ * Add a column alias to this property mapping.
+ *
+ * @param columnAlias The column alias.
+ *
+ * @return {@code this}, for method chaining
+ */
+ public ReturnProperty addColumnAlias(String columnAlias);
+ }
+
+ /**
+ * Allows access to further control how root returns are mapped back from result sets
+ */
+ public static interface RootReturn {
+ /**
+ * Set the lock mode for this return
+ *
+ * @param lockMode The new lock mode.
+ *
+ * @return {@code this}, for method chaining
+ */
+ public RootReturn setLockMode(LockMode lockMode);
+
+ /**
+ * Name the column alias that identifies the entity's discriminator
+ *
+ * @param columnAlias The discriminator column alias
+ *
+ * @return {@code this}, for method chaining
+ */
+ public RootReturn setDiscriminatorAlias(String columnAlias);
+
+ /**
+ * Add a simple property-to-one-column mapping
+ *
+ * @param propertyName The name of the property.
+ * @param columnAlias The name of the column
+ *
+ * @return {@code this}, for method chaining
+ */
+ public RootReturn addProperty(String propertyName, String columnAlias);
+
+ /**
+ * Add a property, presumably with more than one column.
+ *
+ * @param propertyName The name of the property.
+ *
+ * @return The config object for further control.
+ */
+ public ReturnProperty addProperty(String propertyName);
+ }
+
+ /**
+ * Allows access to further control how join fetch returns are mapped back from result sets
+ */
+ public static interface FetchReturn {
+ /**
+ * Set the lock mode for this return
+ *
+ * @param lockMode The new lock mode.
+ *
+ * @return {@code this}, for method chaining
+ */
+ public FetchReturn setLockMode(LockMode lockMode);
+
+ /**
+ * Add a simple property-to-one-column mapping
+ *
+ * @param propertyName The name of the property.
+ * @param columnAlias The name of the column
+ *
+ * @return {@code this}, for method chaining
+ */
+ public FetchReturn addProperty(String propertyName, String columnAlias);
+
+ /**
+ * Add a property, presumably with more than one column.
+ *
+ * @param propertyName The name of the property.
+ *
+ * @return The config object for further control.
+ */
+ public ReturnProperty addProperty(String propertyName);
+ }
}
Added: core/trunk/core/src/main/java/org/hibernate/SQLQueryResultMappingBuilder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/SQLQueryResultMappingBuilder.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/SQLQueryResultMappingBuilder.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -0,0 +1,53 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. 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 Inc.
+ *
+ * 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;
+
+import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
+import org.hibernate.type.Type;
+
+/**
+ * Allows programmatic access from {@link SQLQuery} to define how to map SQL {@link java.sql.ResultSet results}
+ * back to in-memory objects, both entities as well as scalars. Essentially it defines an API akin to the
+ * {@code <return/>}, {@code <return-scalar/>} and {@code <return-join/>} elements under {@code <sql-query/>}
+ * definition in a Hibernate <tt>hbm.xml</tt> file.
+ *
+ * @author Steve Ebersole
+ */
+public interface SQLQueryResultMappingBuilder {
+
+ public static interface ReturnsHolder {
+ public void add(NativeSQLQueryReturn queryReturn);
+ }
+
+ public static class ScalarReturn {
+ private final ReturnsHolder returnsHolder;
+ private String name;
+ private Type type;
+
+ public ScalarReturn(ReturnsHolder returnsHolder) {
+ this.returnsHolder = returnsHolder;
+ }
+ }
+
+}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java 2010-07-22 19:52:43 UTC (rev 20013)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/NamedSQLQuerySecondPass.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -68,7 +68,7 @@
Attribute cmAtt = queryElem.attribute( "comment" );
String comment = cmAtt == null ? null : cmAtt.getValue();
- java.util.List synchronizedTables = new ArrayList();
+ java.util.List<String> synchronizedTables = new ArrayList<String>();
Iterator tables = queryElem.elementIterator( "synchronize" );
while ( tables.hasNext() ) {
synchronizedTables.add( ( (Element) tables.next() ).attributeValue( "table" ) );
Modified: core/trunk/core/src/main/java/org/hibernate/classic/Session.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/classic/Session.java 2010-07-22 19:52:43 UTC (rev 20013)
+++ core/trunk/core/src/main/java/org/hibernate/classic/Session.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -31,6 +31,7 @@
import org.hibernate.HibernateException;
import org.hibernate.Query;
+import org.hibernate.SQLQuery;
import org.hibernate.type.Type;
/**
@@ -297,24 +298,34 @@
/**
* Create a new instance of <tt>Query</tt> for the given SQL string.
+ * <p/>
+ * Returned instances should all be {@link org.hibernate.SQLQuery}.
*
- * @deprecated will be replaced with a more Query like interface in later release
- *
* @param sql a query expressed in SQL
* @param returnAlias a table alias that appears inside <tt>{}</tt> in the SQL string
* @param returnClass the returned persistent class
+ *
+ * @deprecated use {@link org.hibernate.SQLQuery#addRoot} or {@link org.hibernate.SQLQuery#addEntity} variants
+ * instead to define the alias/class
*/
+ @Deprecated
+ @SuppressWarnings({ "JavaDoc" })
public Query createSQLQuery(String sql, String returnAlias, Class returnClass);
/**
* Create a new instance of <tt>Query</tt> for the given SQL string.
+ * <p/>
+ * Returned instances should all be {@link org.hibernate.SQLQuery}.
*
- * @deprecated will be replaced with a more Query like interface in later release
- *
* @param sql a query expressed in SQL
* @param returnAliases an array of table aliases that appear inside <tt>{}</tt> in the SQL string
* @param returnClasses the returned persistent classes
+ *
+ * @deprecated use {@link org.hibernate.SQLQuery#addRoot} or {@link org.hibernate.SQLQuery#addEntity} variants
+ * instead to define the aliases/classes
*/
+ @Deprecated
+ @SuppressWarnings({ "JavaDoc" })
public Query createSQLQuery(String sql, String[] returnAliases, Class[] returnClasses);
Modified: core/trunk/core/src/main/java/org/hibernate/engine/NamedSQLQueryDefinition.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/NamedSQLQueryDefinition.java 2010-07-22 19:52:43 UTC (rev 20013)
+++ core/trunk/core/src/main/java/org/hibernate/engine/NamedSQLQueryDefinition.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. 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.
+ * distributed under license by Red Hat Inc.
*
* 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
@@ -20,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.engine;
@@ -32,15 +31,14 @@
import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
/**
- * Definition of a named native SQL query, defined
- * in the mapping metadata.
+ * Definition of a named native SQL query, defined in the mapping metadata.
*
* @author Max Andersen
*/
public class NamedSQLQueryDefinition extends NamedQueryDefinition {
private NativeSQLQueryReturn[] queryReturns;
- private final List querySpaces;
+ private final List<String> querySpaces;
private final boolean callable;
private String resultSetRef;
@@ -66,7 +64,7 @@
public NamedSQLQueryDefinition(
String query,
NativeSQLQueryReturn[] queryReturns,
- List querySpaces,
+ List<String> querySpaces,
boolean cacheable,
String cacheRegion,
Integer timeout,
@@ -115,7 +113,7 @@
public NamedSQLQueryDefinition(
String query,
String resultSetRef,
- List querySpaces,
+ List<String> querySpaces,
boolean cacheable,
String cacheRegion,
Integer timeout,
@@ -165,7 +163,7 @@
public NamedSQLQueryDefinition(
String query,
String resultSetRef,
- List querySpaces,
+ List<String> querySpaces,
boolean cacheable,
String cacheRegion,
Integer timeout,
@@ -194,7 +192,7 @@
return queryReturns;
}
- public List getQuerySpaces() {
+ public List<String> getQuerySpaces() {
return querySpaces;
}
Modified: core/trunk/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryReturn.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryReturn.java 2010-07-22 19:52:43 UTC (rev 20013)
+++ core/trunk/core/src/main/java/org/hibernate/engine/query/sql/NativeSQLQueryReturn.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -26,6 +26,8 @@
/**
* Describes a return in a native SQL query.
+ * <p/>
+ * IMPL NOTE : implementations should be immutable as they are used as part of cache keys for result caching.
*
* @author Steve Ebersole
*/
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SQLQueryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SQLQueryImpl.java 2010-07-22 19:52:43 UTC (rev 20013)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SQLQueryImpl.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. 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.
+ * distributed under license by Red Hat Inc.
*
* 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
@@ -20,13 +20,13 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -53,28 +53,23 @@
import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn;
import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
import org.hibernate.type.Type;
-import org.hibernate.util.CollectionHelper;
import org.hibernate.util.StringHelper;
/**
- * Implements SQL query passthrough.
+ * Implementation of the {@link SQLQuery} contract.
*
- * <pre>
- * <sql-query name="mySqlQuery">
- * <return alias="person" class="eg.Person"/>
- * SELECT {person}.NAME AS {person.name}, {person}.AGE AS {person.age}, {person}.SEX AS {person.sex}
- * FROM PERSON {person} WHERE {person}.NAME LIKE 'Hiber%'
- * </sql-query>
- * </pre>
- *
* @author Max Andersen
+ * @author Steve Ebersole
*/
public class SQLQueryImpl extends AbstractQueryImpl implements SQLQuery {
- private final List queryReturns;
- private Collection querySpaces;
+ private List<NativeSQLQueryReturn> queryReturns;
+ private List<ReturnBuilder> queryReturnBuilders;
+ private boolean autoDiscoverTypes;
+
+ private Collection<String> querySpaces;
+
private final boolean callable;
- private boolean autodiscovertypes;
/**
* Constructs a SQLQueryImpl given a sql query defined in the mappings.
@@ -100,7 +95,7 @@
this.queryReturns = Arrays.asList( queryDef.getQueryReturns() );
}
else {
- this.queryReturns = new ArrayList();
+ this.queryReturns = new ArrayList<NativeSQLQueryReturn>();
}
this.querySpaces = queryDef.getQuerySpaces();
@@ -109,31 +104,16 @@
SQLQueryImpl(
final String sql,
- final List queryReturns,
- final Collection querySpaces,
- final FlushMode flushMode,
- boolean callable,
- final SessionImplementor session,
- ParameterMetadata parameterMetadata) {
- // TODO : absolutely no usages of this constructor form; can it go away?
- super( sql, flushMode, session, parameterMetadata );
- this.queryReturns = queryReturns;
- this.querySpaces = querySpaces;
- this.callable = callable;
- }
-
- SQLQueryImpl(
- final String sql,
final String returnAliases[],
final Class returnClasses[],
final LockMode[] lockModes,
final SessionImplementor session,
- final Collection querySpaces,
+ final Collection<String> querySpaces,
final FlushMode flushMode,
ParameterMetadata parameterMetadata) {
// TODO : this constructor form is *only* used from constructor directly below us; can it go away?
super( sql, flushMode, session, parameterMetadata );
- queryReturns = new ArrayList(returnAliases.length);
+ queryReturns = new ArrayList<NativeSQLQueryReturn>( returnAliases.length );
for ( int i=0; i<returnAliases.length; i++ ) {
NativeSQLQueryRootReturn ret = new NativeSQLQueryRootReturn(
returnAliases[i],
@@ -157,15 +137,13 @@
SQLQueryImpl(String sql, SessionImplementor session, ParameterMetadata parameterMetadata) {
super( sql, null, session, parameterMetadata );
- queryReturns = new ArrayList();
+ queryReturns = new ArrayList<NativeSQLQueryReturn>();
querySpaces = null;
callable = false;
}
- private static final NativeSQLQueryReturn[] NO_SQL_RETURNS = new NativeSQLQueryReturn[0];
-
private NativeSQLQueryReturn[] getQueryReturns() {
- return ( NativeSQLQueryReturn[] ) queryReturns.toArray( NO_SQL_RETURNS );
+ return queryReturns.toArray( new NativeSQLQueryReturn[queryReturns.size()] );
}
public List list() throws HibernateException {
@@ -220,24 +198,25 @@
public QueryParameters getQueryParameters(Map namedParams) {
QueryParameters qp = super.getQueryParameters(namedParams);
qp.setCallable(callable);
- qp.setAutoDiscoverScalarTypes(autodiscovertypes);
+ qp.setAutoDiscoverScalarTypes( autoDiscoverTypes );
return qp;
}
protected void verifyParameters() {
+ // verifyParameters is called at the start of all execution type methods, so we use that here to perform
+ // some preparation work.
+ prepare();
verifyParameters( callable );
boolean noReturns = queryReturns==null || queryReturns.isEmpty();
if ( noReturns ) {
- this.autodiscovertypes = noReturns;
+ this.autoDiscoverTypes = noReturns;
}
else {
- Iterator itr = queryReturns.iterator();
- while ( itr.hasNext() ) {
- NativeSQLQueryReturn rtn = ( NativeSQLQueryReturn ) itr.next();
- if ( rtn instanceof NativeSQLQueryScalarReturn ) {
- NativeSQLQueryScalarReturn scalar = ( NativeSQLQueryScalarReturn ) rtn;
+ for ( NativeSQLQueryReturn queryReturn : queryReturns ) {
+ if ( queryReturn instanceof NativeSQLQueryScalarReturn ) {
+ NativeSQLQueryScalarReturn scalar = (NativeSQLQueryScalarReturn) queryReturn;
if ( scalar.getType() == null ) {
- autodiscovertypes = true;
+ autoDiscoverTypes = true;
break;
}
}
@@ -245,6 +224,23 @@
}
}
+ private void prepare() {
+ if ( queryReturnBuilders != null ) {
+ if ( ! queryReturnBuilders.isEmpty() ) {
+ if ( queryReturns != null ) {
+ queryReturns.clear();
+ queryReturns = null;
+ }
+ queryReturns = new ArrayList<NativeSQLQueryReturn>();
+ for ( ReturnBuilder builder : queryReturnBuilders ) {
+ queryReturns.add( builder.buildReturn() );
+ }
+ queryReturnBuilders.clear();
+ }
+ queryReturnBuilders = null;
+ }
+ }
+
public String[] getReturnAliases() throws HibernateException {
throw new UnsupportedOperationException("SQL queries do not currently support returning aliases");
}
@@ -266,23 +262,35 @@
return null;
}
- public SQLQuery addScalar(String columnAlias, Type type) {
- queryReturns.add( new NativeSQLQueryScalarReturn( columnAlias, type ) );
+ public SQLQuery addScalar(final String columnAlias, final Type type) {
+ if ( queryReturnBuilders == null ) {
+ queryReturnBuilders = new ArrayList<ReturnBuilder>();
+ }
+ queryReturnBuilders.add(
+ new ReturnBuilder() {
+ public NativeSQLQueryReturn buildReturn() {
+ return new NativeSQLQueryScalarReturn( columnAlias, type );
+ }
+ }
+ );
return this;
}
public SQLQuery addScalar(String columnAlias) {
- autodiscovertypes = true;
- queryReturns.add( new NativeSQLQueryScalarReturn( columnAlias, null ) );
- return this;
+ return addScalar( columnAlias, null );
}
- public SQLQuery addJoin(String alias, String path) {
- return addJoin(alias, path, LockMode.READ);
+ public RootReturn addRoot(String tableAlias, String entityName) {
+ RootReturnBuilder builder = new RootReturnBuilder( tableAlias, entityName );
+ if ( queryReturnBuilders == null ) {
+ queryReturnBuilders = new ArrayList<ReturnBuilder>();
+ }
+ queryReturnBuilders.add( builder );
+ return builder;
}
- public SQLQuery addEntity(Class entityClass) {
- return addEntity( StringHelper.unqualify( entityClass.getName() ), entityClass );
+ public RootReturn addRoot(String tableAlias, Class entityType) {
+ return addRoot( tableAlias, entityType.getName() );
}
public SQLQuery addEntity(String entityName) {
@@ -290,49 +298,74 @@
}
public SQLQuery addEntity(String alias, String entityName) {
- return addEntity(alias, entityName, LockMode.READ);
+ addRoot( alias, entityName );
+ return this;
}
+ public SQLQuery addEntity(String alias, String entityName, LockMode lockMode) {
+ addRoot( alias, entityName ).setLockMode( lockMode );
+ return this;
+ }
+
+ public SQLQuery addEntity(Class entityType) {
+ return addEntity( entityType.getName() );
+ }
+
public SQLQuery addEntity(String alias, Class entityClass) {
return addEntity( alias, entityClass.getName() );
}
- public SQLQuery addJoin(String alias, String path, LockMode lockMode) {
+ public SQLQuery addEntity(String alias, Class entityClass, LockMode lockMode) {
+ return addEntity( alias, entityClass.getName(), lockMode );
+ }
+
+ public FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName) {
+ FetchReturnBuilder builder = new FetchReturnBuilder( tableAlias, ownerTableAlias, joinPropertyName );
+ if ( queryReturnBuilders == null ) {
+ queryReturnBuilders = new ArrayList<ReturnBuilder>();
+ }
+ queryReturnBuilders.add( builder );
+ return builder;
+ }
+
+ public SQLQuery addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName) {
+ addFetch( tableAlias, ownerTableAlias, joinPropertyName );
+ return this;
+ }
+
+ public SQLQuery addJoin(String alias, String path) {
+ createFetchJoin( alias, path );
+ return this;
+ }
+
+ private FetchReturn createFetchJoin(String tableAlias, String path) {
int loc = path.indexOf('.');
if ( loc < 0 ) {
throw new QueryException( "not a property path: " + path );
}
- String ownerAlias = path.substring(0, loc);
- String role = path.substring(loc+1);
- queryReturns.add( new NativeSQLQueryJoinReturn(alias, ownerAlias, role, CollectionHelper.EMPTY_MAP, lockMode) );
- return this;
+ final String ownerTableAlias = path.substring( 0, loc );
+ final String joinedPropertyName = path.substring( loc+1 );
+ return addFetch( tableAlias, ownerTableAlias, joinedPropertyName );
}
- public SQLQuery addEntity(String alias, String entityName, LockMode lockMode) {
- queryReturns.add( new NativeSQLQueryRootReturn(alias, entityName, lockMode) );
+ public SQLQuery addJoin(String alias, String path, LockMode lockMode) {
+ createFetchJoin( alias, path ).setLockMode( lockMode );
return this;
}
- public SQLQuery addEntity(String alias, Class entityClass, LockMode lockMode) {
- return addEntity( alias, entityClass.getName(), lockMode );
- }
-
public SQLQuery setResultSetMapping(String name) {
ResultSetMappingDefinition mapping = session.getFactory().getResultSetMapping( name );
if ( mapping == null ) {
throw new MappingException( "Unknown SqlResultSetMapping [" + name + "]" );
}
NativeSQLQueryReturn[] returns = mapping.getQueryReturns();
- int length = returns.length;
- for ( int index = 0 ; index < length ; index++ ) {
- queryReturns.add( returns[index] );
- }
+ queryReturns.addAll( Arrays.asList( returns ) );
return this;
}
public SQLQuery addSynchronizedQuerySpace(String querySpace) {
if ( querySpaces == null ) {
- querySpaces = new ArrayList();
+ querySpaces = new ArrayList<String>();
}
querySpaces.add( querySpace );
return this;
@@ -349,11 +382,9 @@
private SQLQuery addQuerySpaces(Serializable[] spaces) {
if ( spaces != null ) {
if ( querySpaces == null ) {
- querySpaces = new ArrayList();
+ querySpaces = new ArrayList<String>();
}
- for ( int i = 0; i < spaces.length; i++ ) {
- querySpaces.add( spaces[i] );
- }
+ querySpaces.addAll( Arrays.asList( (String[]) spaces ) );
}
return this;
}
@@ -372,4 +403,97 @@
}
}
+ private class RootReturnBuilder implements RootReturn, ReturnBuilder {
+ private final String alias;
+ private final String entityName;
+ private LockMode lockMode = LockMode.READ;
+ private Map<String,List<String>> propertyMappings;
+
+ private RootReturnBuilder(String alias, String entityName) {
+ this.alias = alias;
+ this.entityName = entityName;
+ }
+
+ public RootReturn setLockMode(LockMode lockMode) {
+ this.lockMode = lockMode;
+ return this;
+ }
+
+ public RootReturn setDiscriminatorAlias(String alias) {
+ addProperty( "class", alias );
+ return this;
+ }
+
+ public RootReturn addProperty(String propertyName, String columnAlias) {
+ addProperty( propertyName ).addColumnAlias( columnAlias );
+ return this;
+ }
+
+ public ReturnProperty addProperty(final String propertyName) {
+ if ( propertyMappings == null ) {
+ propertyMappings = new HashMap<String,List<String>>();
+ }
+ return new ReturnProperty() {
+ public ReturnProperty addColumnAlias(String columnAlias) {
+ List<String> columnAliases = propertyMappings.get( propertyName );
+ if ( columnAliases == null ) {
+ columnAliases = new ArrayList<String>();
+ }
+ columnAliases.add( columnAlias );
+ return this;
+ }
+ };
+ }
+
+ public NativeSQLQueryReturn buildReturn() {
+ return new NativeSQLQueryRootReturn( alias, entityName, propertyMappings, lockMode );
+ }
+ }
+ private class FetchReturnBuilder implements FetchReturn, ReturnBuilder {
+ private final String alias;
+ private String ownerTableAlias;
+ private final String joinedPropertyName;
+ private LockMode lockMode = LockMode.READ;
+ private Map<String,List<String>> propertyMappings;
+
+ private FetchReturnBuilder(String alias, String ownerTableAlias, String joinedPropertyName) {
+ this.alias = alias;
+ this.ownerTableAlias = ownerTableAlias;
+ this.joinedPropertyName = joinedPropertyName;
+ }
+
+ public FetchReturn setLockMode(LockMode lockMode) {
+ this.lockMode = lockMode;
+ return this;
+ }
+
+ public FetchReturn addProperty(String propertyName, String columnAlias) {
+ addProperty( propertyName ).addColumnAlias( columnAlias );
+ return this;
+ }
+
+ public ReturnProperty addProperty(final String propertyName) {
+ if ( propertyMappings == null ) {
+ propertyMappings = new HashMap<String,List<String>>();
+ }
+ return new ReturnProperty() {
+ public ReturnProperty addColumnAlias(String columnAlias) {
+ List<String> columnAliases = propertyMappings.get( propertyName );
+ if ( columnAliases == null ) {
+ columnAliases = new ArrayList<String>();
+ }
+ columnAliases.add( columnAlias );
+ return this;
+ }
+ };
+ }
+
+ public NativeSQLQueryReturn buildReturn() {
+ return new NativeSQLQueryJoinReturn( alias, ownerTableAlias, joinedPropertyName, propertyMappings, lockMode );
+ }
+ }
+
+ private interface ReturnBuilder {
+ NativeSQLQueryReturn buildReturn();
+ }
}
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 2010-07-22 19:52:43 UTC (rev 20013)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2010-07-22 20:23:08 UTC (rev 20014)
@@ -13,9 +13,14 @@
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.Query;
+import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.dialect.H2Dialect;
+import org.hibernate.type.FloatType;
+import org.hibernate.type.LongType;
+import org.hibernate.type.StringType;
+import org.hibernate.type.TimestampType;
import org.hibernate.util.ArrayHelper;
import org.hibernate.test.sql.hand.Organization;
import org.hibernate.test.sql.hand.Person;
@@ -41,6 +46,7 @@
*
* @author Steve Ebersole
*/
+@SuppressWarnings({ "UnnecessaryBoxing", "UnnecessaryUnboxing" })
public class NativeSQLQueriesTest extends FunctionalTestCase {
public NativeSQLQueriesTest(String x) {
@@ -606,6 +612,87 @@
}
+ public void testExplicitReturnAPI() {
+ Session s = openSession();
+ s.beginTransaction();
+ Organization jboss = new Organization( "JBoss" );
+ Person me = new Person( "Steve" );
+ Employment emp = new Employment( me, jboss, "US" );
+ Serializable jbossId = s.save( jboss );
+ s.save( me );
+ s.save( emp );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+
+ String sql =
+ "SELECT org.ORGID as orgid," +
+ " org.NAME as name," +
+ " emp.EMPLOYER as employer," +
+ " emp.EMPID as empid," +
+ " emp.EMPLOYEE as employee," +
+ " emp.EMPLOYER as employer," +
+ " emp.STARTDATE as startDate," +
+ " emp.ENDDATE as endDate," +
+ " emp.REGIONCODE as regionCode," +
+ " emp.VALUE as VALUE," +
+ " emp.CURRENCY as CURRENCY" +
+ " FROM ORGANIZATION org" +
+ " LEFT OUTER JOIN EMPLOYMENT emp ON org.ORGID = emp.EMPLOYER";
+
+ // as a control, lets apply an existing rs mapping
+ SQLQuery sqlQuery = s.createSQLQuery( sql );
+ sqlQuery.setResultSetMapping( "org-description" );
+ sqlQuery.list();
+
+ // next try a partial mapping def
+ sqlQuery.addRoot( "org", Organization.class );
+ sqlQuery.addFetch( "emp", "org", "employments" );
+ sqlQuery.list();
+
+ // now try full explicit mappings
+ sqlQuery.addRoot( "org", Organization.class )
+ .addProperty( "id", "orgid" )
+ .addProperty( "name" ).addColumnAlias( "name" );
+ sqlQuery.addFetch( "emp", "org", "employments" )
+ .addProperty( "key", "employer" )
+ .addProperty( "element", "empid" )
+ .addProperty( "element.employee", "employee" )
+ .addProperty( "element.employer", "employer" )
+ .addProperty( "element.startDate", "startDate" )
+ .addProperty( "element.endDate", "endDate" )
+ .addProperty( "element.regionCode", "regionCode" )
+ .addProperty( "element.employmentId", "empId" )
+ .addProperty( "element.salary" ).addColumnAlias( "VALUE" ).addColumnAlias( "CURRENCY" );
+ sqlQuery.list();
+
+ // lets try a totally different approach now and pull back scalars, first with explicit types
+ sqlQuery.addScalar( "orgid", LongType.INSTANCE )
+ .addScalar( "name", StringType.INSTANCE )
+ .addScalar( "empid", LongType.INSTANCE )
+ .addScalar( "employee", LongType.INSTANCE )
+ .addScalar( "startDate", TimestampType.INSTANCE )
+ .addScalar( "endDate", TimestampType.INSTANCE )
+ .addScalar( "regionCode", StringType.INSTANCE )
+ .addScalar( "empId", LongType.INSTANCE )
+ .addScalar( "VALUE", FloatType.INSTANCE )
+ .addScalar( "CURRENCY", StringType.INSTANCE );
+
+
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ s.delete( emp );
+ s.delete( jboss );
+ s.delete( me );
+ s.getTransaction().commit();
+ s.close();
+ }
+
public void testMixAndMatchEntityScalar() {
Session s = openSession();
Transaction t = s.beginTransaction();
13 years, 9 months
Hibernate SVN: r20013 - in core/trunk: testsuite/src/test/java/org/hibernate/test/onetomany and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2010-07-22 15:52:43 -0400 (Thu, 22 Jul 2010)
New Revision: 20013
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml
Modified:
core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java
core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java
Log:
HHH-2350 : second-level cache broken for non-inverse bidirectional one-to-many relation
Modified: core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java 2010-07-22 19:03:09 UTC (rev 20012)
+++ core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java 2010-07-22 19:52:43 UTC (rev 20013)
@@ -88,10 +88,11 @@
}
public boolean isAlwaysDirtyChecked() {
- // If we have <tt>not-found="ignore"</tt> association mapped to a
- // formula, we always need to dirty check it, so we can update the
- // second-level cache
- return ignoreNotFound;
+ // always need to dirty-check, even when non-updateable;
+ // this ensures that when the association is updated,
+ // the entity containing this association will be updated
+ // in the cache
+ return true;
}
public boolean isOneToOne() {
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java 2010-07-22 19:03:09 UTC (rev 20012)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java 2010-07-22 19:52:43 UTC (rev 20013)
@@ -27,6 +27,7 @@
import java.util.ArrayList;
import org.hibernate.CacheMode;
+import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.junit.functional.FunctionalTestCase;
@@ -65,36 +66,43 @@
return new String[] { "onetomany/Node.hbm.xml" };
}
- public void testOneToManyMoveElement() {
- init();
- transformMove();
- check();
+ public void testOneToManyMoveElement() {
+ init();
+ transformMove();
+ check( false );
delete();
- }
+ }
+ public void testOneToManyMoveElementWithDirtySimpleProperty() {
+ init();
+ transformMoveWithDirtySimpleProperty();
+ check( true );
+ delete();
+ }
+
public void testOneToManyReplaceList() {
init();
transformReplace();
- check();
+ check( false );
delete();
}
- void init() {
+ void init() {
Session s = openSession();
Transaction tx = s.beginTransaction();
- Node node1 = new Node( 1 );
- Node node2 = new Node( 2 );
- Node node3 = new Node( 3 );
+ Node node1 = new Node( 1, "node1" );
+ Node node2 = new Node( 2, "node2" );
+ Node node3 = new Node( 3, "node3" );
- node1.addSubNode( node2 );
- node2.addSubNode( node3 );
+ node1.addSubNode( node2 );
+ node2.addSubNode( node3 );
- s.save(node1);
+ s.save(node1);
tx.commit();
- s.close();
+ s.close();
}
void transformMove() {
@@ -113,6 +121,23 @@
s.close();
}
+ void transformMoveWithDirtySimpleProperty() {
+
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+
+ Node node3 = (Node) s.load(Node.class, new Integer(3));
+ Node node2 = node3.getParentNode();
+ Node node1 = node2.getParentNode();
+
+ node2.removeSubNode( node3 );
+ node1.addSubNode( node3 );
+ node3.setDescription( "node3-updated" );
+
+ tx.commit();
+ s.close();
+ }
+
void transformReplace() {
Session s = openSession();
@@ -131,21 +156,32 @@
s.close();
}
- void check() {
-
+ void check(boolean simplePropertyUpdated) {
Session s = openSession();
Transaction tx = s.beginTransaction();
- Node node3 = (Node) s.get(Node.class, new Integer(3));
+ Node node3 = (Node) s.get( Node.class, new Integer(3) );
// fails with 2nd level cache enabled
- assertEquals(1, node3.getParentNode().getId().intValue());
+ assertEquals( 1, node3.getParentNode().getId().intValue() );
+ assertEquals( ( simplePropertyUpdated ? "node3-updated" : "node3" ), node3.getDescription() );
+ assertTrue( node3.getSubNodes().isEmpty() );
+ Node node1 = node3.getParentNode();
+ assertNull( node1.getParentNode() );
+ assertEquals( 2, node1.getSubNodes().size() );
+ assertEquals( 2, ( ( Node ) node1.getSubNodes().get( 0 ) ).getId().intValue() );
+ assertEquals( "node1", node1.getDescription() );
+
+ Node node2 = ( Node ) node1.getSubNodes().get( 0 );
+ assertSame( node1, node2.getParentNode() );
+ assertTrue( node2.getSubNodes().isEmpty() );
+ assertEquals( "node2", node2.getDescription() );
+
tx.commit();
s.close();
}
void delete() {
-
Session s = openSession();
Transaction tx = s.beginTransaction();
Node node1 = ( Node ) s.get( Node.class, new Integer( 1 ) );
@@ -153,4 +189,4 @@
tx.commit();
s.close();
}
-}
\ No newline at end of file
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java 2010-07-22 19:52:43 UTC (rev 20013)
@@ -0,0 +1,75 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, 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.test.onetomany;
+
+import java.util.ArrayList;
+
+import org.hibernate.CacheMode;
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.testing.junit.functional.FunctionalTestCase;
+import org.hibernate.test.readonly.VersionedNode;
+
+/**
+ * @author Burkhard Graves, Gail Badner
+ */
+
+public abstract class AbstractVersionedRecursiveBidirectionalOneToManyTest extends AbstractRecursiveBidirectionalOneToManyTest {
+
+ /*
+ * What is done:
+ * ___ ___
+ * | | | |
+ * -> 1 -> 1
+ * | -transform-> / \
+ * 2 2 3
+ * |
+ * 3
+ *
+ */
+
+ public AbstractVersionedRecursiveBidirectionalOneToManyTest(String str) {
+ super(str);
+ }
+
+ public String[] getMappings() {
+ return new String[] { "onetomany/VersionedNode.hbm.xml" };
+ }
+
+ void check(boolean simplePropertyUpdated) {
+ super.check( simplePropertyUpdated );
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ Node node1 = ( Node ) s.get( Node.class, new Integer( 1 ) );
+ Node node2 = ( Node ) s.get( Node.class, new Integer( 2 ) );
+ Node node3 = ( Node ) s.get( Node.class, new Integer( 3 ) );
+ assertEquals( 1, node1.getVersion() );
+ assertEquals( 1, node2.getVersion() );
+ assertEquals( 1, node3.getVersion() );
+ tx.commit();
+ s.close();
+ }
+}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml 2010-07-22 19:03:09 UTC (rev 20012)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml 2010-07-22 19:52:43 UTC (rev 20013)
@@ -8,6 +8,7 @@
<id name="id" column="id" type="java.lang.Integer">
<!--<generator class="native"/> -->
</id>
+ <property name="description"/>
<many-to-one name="parentNode"
class="Node"
column="node_id"
@@ -15,7 +16,6 @@
not-null="false"
insert="false"
update="false"
-
/>
<list name="subNodes" cascade="all">
<key column="node_id"/>
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java 2010-07-22 19:03:09 UTC (rev 20012)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java 2010-07-22 19:52:43 UTC (rev 20013)
@@ -31,15 +31,17 @@
public class Node implements Serializable {
private Integer id;
-
+ private long version;
private Node parentNode;
+ private String description;
private List subNodes = new ArrayList();
public Node() {
}
- public Node(int id) {
+ public Node(int id, String description) {
setId( id );
+ setDescription( description );
}
public Integer getId() {
@@ -50,6 +52,22 @@
this.id = id;
}
+ public long getVersion() {
+ return version;
+ }
+
+ public void setVersion(long version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
public Node getParentNode() {
return parentNode;
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java 2010-07-22 19:03:09 UTC (rev 20012)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java 2010-07-22 19:52:43 UTC (rev 20013)
@@ -61,24 +61,4 @@
public static Test suite() {
return new FunctionalTestClassTestSuite( RecursiveBidirectionalOneToManyCacheTest.class );
}
-
- public void testOneToManyMoveElement() {
- reportSkip( "non-inverse one-to-many known to fail with 2nd-level cache", "cache support");
- }
-
- // HHH-2350
- public void testOneToManyMoveElementFailureExpected() {
- super.testOneToManyMoveElement();
- }
-
- public void testOneToManyReplaceList() {
- reportSkip( "non-inverse one-to-many known to fail with 2nd-level cache", "cache support");
- }
-
- // HHH-2350
- public void testOneToManyReplaceListFailureExpected() {
- super.testOneToManyReplaceList();
- }
-
-
}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java 2010-07-22 19:52:43 UTC (rev 20013)
@@ -0,0 +1,64 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, 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.test.onetomany;
+
+import junit.framework.Test;
+
+import org.hibernate.CacheMode;
+import org.hibernate.testing.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * @author Burkhard Graves, Gail Badner
+ */
+
+public class RecursiveVersionedBidirectionalOneToManyCacheTest extends AbstractVersionedRecursiveBidirectionalOneToManyTest {
+
+ /*
+ * What is done:
+ * ___ ___
+ * | | | |
+ * -> 1 -> 1
+ * | -transform-> / \
+ * 2 2 3
+ * |
+ * 3
+ *
+ * Commenting out
+ * @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
+ * in Node.java makes the assertion true (in check() below).
+ */
+
+ public RecursiveVersionedBidirectionalOneToManyCacheTest(String str) {
+ super(str);
+ }
+
+ protected CacheMode getSessionCacheMode() {
+ return CacheMode.NORMAL;
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( RecursiveVersionedBidirectionalOneToManyCacheTest.class );
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java 2010-07-22 19:52:43 UTC (rev 20013)
@@ -0,0 +1,68 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, 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.test.onetomany;
+
+import junit.framework.Test;
+
+import org.hibernate.CacheMode;
+import org.hibernate.testing.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * @author Burkhard Graves, Gail Badner
+ */
+
+public class RecursiveVersionedBidirectionalOneToManyNoCacheTest extends AbstractVersionedRecursiveBidirectionalOneToManyTest {
+
+ /*
+ * What is done:
+ * ___ ___
+ * | | | |
+ * -> 1 -> 1
+ * | -transform-> / \
+ * 2 2 3
+ * |
+ * 3
+ *
+ * Commenting out
+ * @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
+ * in Node.java makes the assertion true (in check() below).
+ */
+
+ public RecursiveVersionedBidirectionalOneToManyNoCacheTest(String str) {
+ super(str);
+ }
+
+ public String getCacheConcurrencyStrategy() {
+ return null;
+ }
+
+ protected CacheMode getSessionCacheMode() {
+ return CacheMode.IGNORE;
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( RecursiveVersionedBidirectionalOneToManyNoCacheTest.class );
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml 2010-07-22 19:52:43 UTC (rev 20013)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.test.onetomany">
+ <class name="Node"
+ table="Node">
+ <cache usage="read-write" region="Node.entities"/>
+ <id name="id" column="id" type="java.lang.Integer">
+ <!--<generator class="native"/> -->
+ </id>
+ <version name="version" column="vers" type="long" />
+ <property name="description"/>
+ <many-to-one name="parentNode"
+ class="Node"
+ column="node_id"
+ lazy="proxy"
+ not-null="false"
+ insert="false"
+ update="false"
+ />
+ <list name="subNodes" cascade="all">
+ <key column="node_id"/>
+ <list-index column="idx"/>
+ <one-to-many class="Node"/>
+ </list>
+ </class>
+</hibernate-mapping>
13 years, 9 months
Hibernate SVN: r20012 - in core/branches/Branch_3_5: testsuite/src/test/java/org/hibernate/test/onetomany and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2010-07-22 15:03:09 -0400 (Thu, 22 Jul 2010)
New Revision: 20012
Added:
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ManyToOneType.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java
Log:
HHH-2350 : second-level cache broken for non-inverse bidirectional one-to-many relation
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ManyToOneType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ManyToOneType.java 2010-07-22 18:37:51 UTC (rev 20011)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ManyToOneType.java 2010-07-22 19:03:09 UTC (rev 20012)
@@ -100,10 +100,11 @@
}
public boolean isAlwaysDirtyChecked() {
- // If we have <tt>not-found="ignore"</tt> association mapped to a
- // formula, we always need to dirty check it, so we can update the
- // second-level cache
- return ignoreNotFound;
+ // always need to dirty-check, even when non-updateable;
+ // this ensures that when the association is updated,
+ // the entity containing this association will be updated
+ // in the cache
+ return true;
}
public boolean isOneToOne() {
Modified: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java 2010-07-22 18:37:51 UTC (rev 20011)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractRecursiveBidirectionalOneToManyTest.java 2010-07-22 19:03:09 UTC (rev 20012)
@@ -29,6 +29,7 @@
import junit.framework.Test;
import org.hibernate.CacheMode;
+import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.junit.functional.FunctionalTestCase;
@@ -68,36 +69,43 @@
return new String[] { "onetomany/Node.hbm.xml" };
}
- public void testOneToManyMoveElement() {
- init();
- transformMove();
- check();
+ public void testOneToManyMoveElement() {
+ init();
+ transformMove();
+ check( false );
delete();
- }
+ }
+ public void testOneToManyMoveElementWithDirtySimpleProperty() {
+ init();
+ transformMoveWithDirtySimpleProperty();
+ check( true );
+ delete();
+ }
+
public void testOneToManyReplaceList() {
init();
transformReplace();
- check();
+ check( false );
delete();
}
- void init() {
+ void init() {
Session s = openSession();
Transaction tx = s.beginTransaction();
- Node node1 = new Node( 1 );
- Node node2 = new Node( 2 );
- Node node3 = new Node( 3 );
+ Node node1 = new Node( 1, "node1" );
+ Node node2 = new Node( 2, "node2" );
+ Node node3 = new Node( 3, "node3" );
- node1.addSubNode( node2 );
- node2.addSubNode( node3 );
+ node1.addSubNode( node2 );
+ node2.addSubNode( node3 );
- s.save(node1);
+ s.save(node1);
tx.commit();
- s.close();
+ s.close();
}
void transformMove() {
@@ -116,6 +124,23 @@
s.close();
}
+ void transformMoveWithDirtySimpleProperty() {
+
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+
+ Node node3 = (Node) s.load(Node.class, new Integer(3));
+ Node node2 = node3.getParentNode();
+ Node node1 = node2.getParentNode();
+
+ node2.removeSubNode( node3 );
+ node1.addSubNode( node3 );
+ node3.setDescription( "node3-updated" );
+
+ tx.commit();
+ s.close();
+ }
+
void transformReplace() {
Session s = openSession();
@@ -134,21 +159,32 @@
s.close();
}
- void check() {
-
+ void check(boolean simplePropertyUpdated) {
Session s = openSession();
Transaction tx = s.beginTransaction();
- Node node3 = (Node) s.get(Node.class, new Integer(3));
+ Node node3 = (Node) s.get( Node.class, new Integer(3) );
// fails with 2nd level cache enabled
- assertEquals(1, node3.getParentNode().getId().intValue());
+ assertEquals( 1, node3.getParentNode().getId().intValue() );
+ assertEquals( ( simplePropertyUpdated ? "node3-updated" : "node3" ), node3.getDescription() );
+ assertTrue( node3.getSubNodes().isEmpty() );
+ Node node1 = node3.getParentNode();
+ assertNull( node1.getParentNode() );
+ assertEquals( 2, node1.getSubNodes().size() );
+ assertEquals( 2, ( ( Node ) node1.getSubNodes().get( 0 ) ).getId().intValue() );
+ assertEquals( "node1", node1.getDescription() );
+
+ Node node2 = ( Node ) node1.getSubNodes().get( 0 );
+ assertSame( node1, node2.getParentNode() );
+ assertTrue( node2.getSubNodes().isEmpty() );
+ assertEquals( "node2", node2.getDescription() );
+
tx.commit();
s.close();
}
void delete() {
-
Session s = openSession();
Transaction tx = s.beginTransaction();
Node node1 = ( Node ) s.get( Node.class, new Integer( 1 ) );
@@ -156,4 +192,4 @@
tx.commit();
s.close();
}
-}
\ No newline at end of file
+}
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/AbstractVersionedRecursiveBidirectionalOneToManyTest.java 2010-07-22 19:03:09 UTC (rev 20012)
@@ -0,0 +1,75 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, 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.test.onetomany;
+
+import java.util.ArrayList;
+
+import org.hibernate.CacheMode;
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.test.readonly.VersionedNode;
+
+/**
+ * @author Burkhard Graves, Gail Badner
+ */
+
+public abstract class AbstractVersionedRecursiveBidirectionalOneToManyTest extends AbstractRecursiveBidirectionalOneToManyTest {
+
+ /*
+ * What is done:
+ * ___ ___
+ * | | | |
+ * -> 1 -> 1
+ * | -transform-> / \
+ * 2 2 3
+ * |
+ * 3
+ *
+ */
+
+ public AbstractVersionedRecursiveBidirectionalOneToManyTest(String str) {
+ super(str);
+ }
+
+ public String[] getMappings() {
+ return new String[] { "onetomany/VersionedNode.hbm.xml" };
+ }
+
+ void check(boolean simplePropertyUpdated) {
+ super.check( simplePropertyUpdated );
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ Node node1 = ( Node ) s.get( Node.class, new Integer( 1 ) );
+ Node node2 = ( Node ) s.get( Node.class, new Integer( 2 ) );
+ Node node3 = ( Node ) s.get( Node.class, new Integer( 3 ) );
+ assertEquals( 1, node1.getVersion() );
+ assertEquals( 1, node2.getVersion() );
+ assertEquals( 1, node3.getVersion() );
+ tx.commit();
+ s.close();
+ }
+}
Modified: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml 2010-07-22 18:37:51 UTC (rev 20011)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.hbm.xml 2010-07-22 19:03:09 UTC (rev 20012)
@@ -8,6 +8,7 @@
<id name="id" column="id" type="java.lang.Integer">
<!--<generator class="native"/> -->
</id>
+ <property name="description"/>
<many-to-one name="parentNode"
class="Node"
column="node_id"
@@ -15,7 +16,6 @@
not-null="false"
insert="false"
update="false"
-
/>
<list name="subNodes" cascade="all">
<key column="node_id"/>
Modified: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java 2010-07-22 18:37:51 UTC (rev 20011)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/Node.java 2010-07-22 19:03:09 UTC (rev 20012)
@@ -31,15 +31,17 @@
public class Node implements Serializable {
private Integer id;
-
+ private long version;
private Node parentNode;
+ private String description;
private List subNodes = new ArrayList();
public Node() {
}
- public Node(int id) {
+ public Node(int id, String description) {
setId( id );
+ setDescription( description );
}
public Integer getId() {
@@ -50,6 +52,22 @@
this.id = id;
}
+ public long getVersion() {
+ return version;
+ }
+
+ public void setVersion(long version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
public Node getParentNode() {
return parentNode;
}
Modified: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java 2010-07-22 18:37:51 UTC (rev 20011)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveBidirectionalOneToManyCacheTest.java 2010-07-22 19:03:09 UTC (rev 20012)
@@ -61,24 +61,4 @@
public static Test suite() {
return new FunctionalTestClassTestSuite( RecursiveBidirectionalOneToManyCacheTest.class );
}
-
- public void testOneToManyMoveElement() {
- reportSkip( "non-inverse one-to-many known to fail with 2nd-level cache", "cache support");
- }
-
- // HHH-2350
- public void testOneToManyMoveElementFailureExpected() {
- super.testOneToManyMoveElement();
- }
-
- public void testOneToManyReplaceList() {
- reportSkip( "non-inverse one-to-many known to fail with 2nd-level cache", "cache support");
- }
-
- // HHH-2350
- public void testOneToManyReplaceListFailureExpected() {
- super.testOneToManyReplaceList();
- }
-
-
}
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyCacheTest.java 2010-07-22 19:03:09 UTC (rev 20012)
@@ -0,0 +1,64 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, 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.test.onetomany;
+
+import junit.framework.Test;
+
+import org.hibernate.CacheMode;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * @author Burkhard Graves, Gail Badner
+ */
+
+public class RecursiveVersionedBidirectionalOneToManyCacheTest extends AbstractVersionedRecursiveBidirectionalOneToManyTest {
+
+ /*
+ * What is done:
+ * ___ ___
+ * | | | |
+ * -> 1 -> 1
+ * | -transform-> / \
+ * 2 2 3
+ * |
+ * 3
+ *
+ * Commenting out
+ * @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
+ * in Node.java makes the assertion true (in check() below).
+ */
+
+ public RecursiveVersionedBidirectionalOneToManyCacheTest(String str) {
+ super(str);
+ }
+
+ protected CacheMode getSessionCacheMode() {
+ return CacheMode.NORMAL;
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( RecursiveVersionedBidirectionalOneToManyCacheTest.class );
+ }
+}
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/RecursiveVersionedBidirectionalOneToManyNoCacheTest.java 2010-07-22 19:03:09 UTC (rev 20012)
@@ -0,0 +1,68 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, 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.test.onetomany;
+
+import junit.framework.Test;
+
+import org.hibernate.CacheMode;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * @author Burkhard Graves, Gail Badner
+ */
+
+public class RecursiveVersionedBidirectionalOneToManyNoCacheTest extends AbstractVersionedRecursiveBidirectionalOneToManyTest {
+
+ /*
+ * What is done:
+ * ___ ___
+ * | | | |
+ * -> 1 -> 1
+ * | -transform-> / \
+ * 2 2 3
+ * |
+ * 3
+ *
+ * Commenting out
+ * @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
+ * in Node.java makes the assertion true (in check() below).
+ */
+
+ public RecursiveVersionedBidirectionalOneToManyNoCacheTest(String str) {
+ super(str);
+ }
+
+ public String getCacheConcurrencyStrategy() {
+ return null;
+ }
+
+ protected CacheMode getSessionCacheMode() {
+ return CacheMode.IGNORE;
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( RecursiveVersionedBidirectionalOneToManyNoCacheTest.class );
+ }
+}
\ No newline at end of file
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/onetomany/VersionedNode.hbm.xml 2010-07-22 19:03:09 UTC (rev 20012)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.test.onetomany">
+ <class name="Node"
+ table="Node">
+ <cache usage="read-write" region="Node.entities"/>
+ <id name="id" column="id" type="java.lang.Integer">
+ <!--<generator class="native"/> -->
+ </id>
+ <version name="version" column="vers" type="long" />
+ <property name="description"/>
+ <many-to-one name="parentNode"
+ class="Node"
+ column="node_id"
+ lazy="proxy"
+ not-null="false"
+ insert="false"
+ update="false"
+ />
+ <list name="subNodes" cascade="all">
+ <key column="node_id"/>
+ <list-index column="idx"/>
+ <one-to-many class="Node"/>
+ </list>
+ </class>
+</hibernate-mapping>
13 years, 9 months
Hibernate SVN: r20011 - search/branches/Branch_3_2.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-07-22 14:37:51 -0400 (Thu, 22 Jul 2010)
New Revision: 20011
Modified:
search/branches/Branch_3_2/pom.xml
Log:
HSEARCH-565 update dependencies of branch 3.2
Modified: search/branches/Branch_3_2/pom.xml
===================================================================
--- search/branches/Branch_3_2/pom.xml 2010-07-22 18:31:51 UTC (rev 20010)
+++ search/branches/Branch_3_2/pom.xml 2010-07-22 18:37:51 UTC (rev 20011)
@@ -126,8 +126,8 @@
<properties>
<slf4jVersion>1.5.8</slf4jVersion>
- <luceneVersion>2.9.2</luceneVersion>
- <hibernateVersion>3.5.1-Final</hibernateVersion>
+ <luceneVersion>2.9.3</luceneVersion>
+ <hibernateVersion>3.5.4-Final</hibernateVersion>
<hibernateCommonsAnnotationVersion>3.2.0.Final</hibernateCommonsAnnotationVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
13 years, 9 months
Hibernate SVN: r20010 - search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-07-22 14:31:51 -0400 (Thu, 22 Jul 2010)
New Revision: 20010
Modified:
search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/SearchIndexerTest.java
Log:
HSEARCH-534 circular graphs of IndexedEmbedded might break MassIndexer (backport to branch 3.2 - fix for test depending on mixed non-backported issues)
Modified: search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/SearchIndexerTest.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/SearchIndexerTest.java 2010-07-22 18:13:51 UTC (rev 20009)
+++ search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/SearchIndexerTest.java 2010-07-22 18:31:51 UTC (rev 20010)
@@ -108,6 +108,7 @@
.setProperty( org.hibernate.search.Environment.ANALYZER_CLASS, StandardAnalyzer.class.getName() )
.addAnnotatedClass( Dvd.class )
.addAnnotatedClass( Nation.class )
+ .addAnnotatedClass( Book.class )
.setProperty( Environment.INDEXING_STRATEGY, "manual" )
.build();
{
13 years, 9 months
Hibernate SVN: r20009 - in search/branches/Branch_3_2/hibernate-search/src: main/java/org/hibernate/search/util and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-07-22 14:13:51 -0400 (Thu, 22 Jul 2010)
New Revision: 20009
Added:
search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/util/PassThroughAnalyzer.java
Modified:
search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/AnalyzerTest.java
search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/MyEntity.java
Log:
HSEARCH-530 Return a pass through analyzer on fields not TOKENIZED(backport to branch 3.2)
Modified: search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2010-07-22 14:35:17 UTC (rev 20008)
+++ search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2010-07-22 18:13:51 UTC (rev 20009)
@@ -69,6 +69,7 @@
import org.hibernate.search.bridge.LuceneOptions;
import org.hibernate.search.impl.InitContext;
import org.hibernate.search.util.LoggerFactory;
+import org.hibernate.search.util.PassThroughAnalyzer;
import org.hibernate.search.util.ReflectionHelper;
import org.hibernate.search.util.ScopedAnalyzer;
import org.hibernate.util.StringHelper;
@@ -96,6 +97,7 @@
protected Similarity similarity; //there is only 1 similarity per class hierarchy, and only 1 per index
protected boolean isRoot;
protected EntityState entityState;
+ private Analyzer passThroughAnalyzer = new PassThroughAnalyzer();
/**
* Constructor used on contained entities not annotated with <code>@Indexed</code> themselves.
@@ -468,7 +470,7 @@
if ( analyzer == null ) {
throw new AssertionFailure( "Analyzer should not be undefined" );
}
- this.analyzer.addScopedAnalyzer( fieldName, analyzer );
+ addToScopedAnalyzer( fieldName, analyzer, ann.index() );
}
private void bindFieldAnnotation(XProperty member, PropertiesMetadata propertiesMetadata, String prefix, org.hibernate.search.annotations.Field fieldAnn, InitContext context) {
@@ -488,9 +490,19 @@
if ( analyzer == null ) {
analyzer = getAnalyzer( member, context );
}
- if ( analyzer != null ) {
- this.analyzer.addScopedAnalyzer( fieldName, analyzer );
+ addToScopedAnalyzer( fieldName, analyzer, fieldAnn.index() );
+ }
+
+ protected void addToScopedAnalyzer(String fieldName, Analyzer analyzer, Index index) {
+ if ( index == Index.TOKENIZED) {
+ if ( analyzer != null ) {
+ this.analyzer.addScopedAnalyzer( fieldName, analyzer );
+ }
}
+ else {
+ //no analyzer is used, add a fake one for queries
+ this.analyzer.addScopedAnalyzer( fieldName, passThroughAnalyzer );
+ }
}
protected Float getBoost(XProperty member, org.hibernate.search.annotations.Field fieldAnn) {
Modified: search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2010-07-22 14:35:17 UTC (rev 20008)
+++ search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2010-07-22 18:13:51 UTC (rev 20009)
@@ -221,7 +221,7 @@
if ( analyzer == null ) {
throw new AssertionFailure( "Analizer should not be undefined" );
}
- this.analyzer.addScopedAnalyzer( fieldName, analyzer );
+ addToScopedAnalyzer( fieldName, analyzer, Index.UN_TOKENIZED );
}
}
}
Copied: search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/util/PassThroughAnalyzer.java (from rev 19569, search/trunk/hibernate-search/src/main/java/org/hibernate/search/util/PassThroughAnalyzer.java)
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/util/PassThroughAnalyzer.java (rev 0)
+++ search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/util/PassThroughAnalyzer.java 2010-07-22 18:13:51 UTC (rev 20009)
@@ -0,0 +1,39 @@
+package org.hibernate.search.util;
+
+import java.io.Reader;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.CharTokenizer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.util.AttributeSource;
+
+/**
+ * Analyzer that applies no operation whatsoever to the flux
+ * This is useful for queries operating on non tokenized fields.
+ *
+ * TODO there is probably a way to make that much more efficient by
+ * reimplementing TokenStream to take the Reader and pass through the flux as a single token
+ *
+ * @author Emmanuel Bernard
+ */
+public class PassThroughAnalyzer extends Analyzer {
+
+
+
+ @Override
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ return new PassThroughTokenizer(reader);
+ }
+
+ private static class PassThroughTokenizer extends CharTokenizer {
+ public PassThroughTokenizer(Reader input) {
+ super( input );
+ }
+
+ @Override
+ protected boolean isTokenChar(char c) {
+ return true;
+ }
+ }
+}
Modified: search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/AnalyzerTest.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/AnalyzerTest.java 2010-07-22 14:35:17 UTC (rev 20008)
+++ search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/AnalyzerTest.java 2010-07-22 18:13:51 UTC (rev 20009)
@@ -179,6 +179,20 @@
session.close();
}
+ public void testNotAnalyzedFieldAndScopedAnalyzer() throws Exception {
+ FullTextSession session = Search.getFullTextSession( openSession() );
+ SearchFactory searchFactory = session.getSearchFactory();
+ Analyzer analyzer = searchFactory.getAnalyzer( MyEntity.class );
+
+ // you can pass what so ever into the analysis since the used analyzers are
+ // returning the same tokens all the time. We just want to make sure that
+ // the right analyzers are used.
+ Token[] tokens = AnalyzerUtils.tokensFromAnalysis( analyzer, "notAnalyzed", "pass through" );
+ AnalyzerUtils.assertTokensEqual( tokens, new String[] { "pass through" } );
+
+ session.close();
+ }
+
protected Class<?>[] getMappings() {
return new Class[] { MyEntity.class, Article.class };
}
Modified: search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/MyEntity.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/MyEntity.java 2010-07-22 14:35:17 UTC (rev 20008)
+++ search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/analyzer/MyEntity.java 2010-07-22 18:13:51 UTC (rev 20009)
@@ -59,6 +59,17 @@
@Analyzer(impl = Test2Analyzer.class)
private String field;
+ @Field(index = Index.UN_TOKENIZED)
+ private String notAnalyzed;
+
+ public String getNotAnalyzed() {
+ return notAnalyzed;
+ }
+
+ public void setNotAnalyzed(String notAnalyzed) {
+ this.notAnalyzed = notAnalyzed;
+ }
+
@IndexedEmbedded
@Embedded
private MyComponent component;
13 years, 9 months
Hibernate SVN: r20008 - in search/branches/Branch_3_2/hibernate-search/src: test/java/org/hibernate/search/test/batchindexing and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-07-22 10:35:17 -0400 (Thu, 22 Jul 2010)
New Revision: 20008
Modified:
search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/batchindexing/EntityConsumerLuceneworkProducer.java
search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Book.java
search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/IndexingGeneratedCorpusTest.java
search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Nation.java
Log:
HSEARCH-534 circular graphs of IndexedEmbedded might break MassIndexer (backport to branch 3.2)
Modified: search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/batchindexing/EntityConsumerLuceneworkProducer.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/batchindexing/EntityConsumerLuceneworkProducer.java 2010-07-22 12:59:24 UTC (rev 20007)
+++ search/branches/Branch_3_2/hibernate-search/src/main/java/org/hibernate/search/batchindexing/EntityConsumerLuceneworkProducer.java 2010-07-22 14:35:17 UTC (rev 20008)
@@ -60,7 +60,6 @@
private final Map<Class<?>, DocumentBuilderIndexedEntity<?>> documentBuilders;
private final MassIndexerProgressMonitor monitor;
- private static final int CLEAR_PERIOD = 50;
private final CacheMode cacheMode;
private final CountDownLatch producerEndSignal;
@@ -104,7 +103,7 @@
private void indexAllQueue(Session session) {
try {
- for ( int cycle=0; true; cycle++ ) {
+ while ( true ) {
List<?> takeList = source.take();
if ( takeList == null ) {
break;
@@ -116,11 +115,7 @@
session.buildLockRequest( LockOptions.NONE ).lock( take );
index( take, session );
monitor.documentsBuilt( 1 );
- session.evict( take );
- if ( cycle == CLEAR_PERIOD ) {
- cycle = 0;
- session.clear();
- }
+ session.clear();
}
}
}
Modified: search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Book.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Book.java 2010-07-22 12:59:24 UTC (rev 20007)
+++ search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Book.java 2010-07-22 14:35:17 UTC (rev 20008)
@@ -66,7 +66,7 @@
@ManyToOne(fetch=FetchType.LAZY,optional=false)
@Fetch(FetchMode.SELECT)
- @IndexedEmbedded
+ @IndexedEmbedded(depth=3)
public Nation getFirstPublishedIn() {
return firstPublishedIn;
}
Modified: search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/IndexingGeneratedCorpusTest.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/IndexingGeneratedCorpusTest.java 2010-07-22 12:59:24 UTC (rev 20007)
+++ search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/IndexingGeneratedCorpusTest.java 2010-07-22 14:35:17 UTC (rev 20008)
@@ -24,6 +24,8 @@
*/
package org.hibernate.search.test.batchindexing;
+import java.util.List;
+
import junit.framework.TestCase;
import org.apache.lucene.search.MatchAllDocsQuery;
@@ -66,6 +68,7 @@
createMany( Book.class, BOOK_NUM );
createMany( Dvd.class, DVD_NUM );
createMany( AncientBook.class, ANCIENTBOOK_NUM );
+ storeAllBooksInNation();
}
@Override
@@ -102,6 +105,24 @@
}
}
+ /**
+ * Adds all stored books to the Nation.
+ * Needed to test for HSEARCH-534 and makes the dataset to index quite bigger.
+ */
+ private void storeAllBooksInNation() {
+ FullTextSession fullTextSession = builder.openFullTextSession();
+ try {
+ Transaction tx = fullTextSession.beginTransaction();
+ List<Book> allBooks = fullTextSession.createCriteria( Book.class ).list();
+ Nation italy = (Nation) fullTextSession.load( Nation.class, 1 );
+ italy.getLibrariesHave().addAll( allBooks );
+ tx.commit();
+ }
+ finally {
+ fullTextSession.close();
+ }
+ }
+
public void testBatchIndexing() throws InterruptedException {
verifyResultNumbers(); //initial count of entities should match expectations
purgeAll(); // empty indexes
Modified: search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Nation.java
===================================================================
--- search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Nation.java 2010-07-22 12:59:24 UTC (rev 20007)
+++ search/branches/Branch_3_2/hibernate-search/src/test/java/org/hibernate/search/test/batchindexing/Nation.java 2010-07-22 14:35:17 UTC (rev 20008)
@@ -24,12 +24,20 @@
*/
package org.hibernate.search.test.batchindexing;
+import java.util.HashSet;
+import java.util.Set;
+
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchMode;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.IndexedEmbedded;
@Entity
public class Nation {
@@ -37,6 +45,7 @@
private Integer id;
private String name;
private String code;
+ private Set<Book> librariesHave = new HashSet<Book>();
public Nation() {}
@@ -71,6 +80,17 @@
public void setCode(String code) {
this.code = code;
}
+
+ @IndexedEmbedded
+ @OneToMany(fetch=FetchType.LAZY)
+ @Fetch(FetchMode.SELECT)
+ public Set<Book> getLibrariesHave() {
+ return librariesHave;
+ }
+ public void setLibrariesHave(Set<Book> librariesHave) {
+ this.librariesHave = librariesHave;
+ }
+
}
13 years, 9 months
Hibernate SVN: r20007 - in tools/trunk/src: test/org/hibernate/tool/ide/completion and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-07-22 08:59:24 -0400 (Thu, 22 Jul 2010)
New Revision: 20007
Added:
tools/trunk/src/test/org/hibernate/tool/ide/completion/City.hbm.xml
tools/trunk/src/test/org/hibernate/tool/ide/completion/City.java
Modified:
tools/trunk/src/java/org/hibernate/tool/ide/completion/ConfigurationCompletion.java
tools/trunk/src/test/org/hibernate/tool/ide/completion/Model.java
tools/trunk/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java
tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.hbm.xml
tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.java
Log:
https://jira.jboss.org/browse/JBIDE-6120
Show superclass properties in code completion
Modified: tools/trunk/src/java/org/hibernate/tool/ide/completion/ConfigurationCompletion.java
===================================================================
--- tools/trunk/src/java/org/hibernate/tool/ide/completion/ConfigurationCompletion.java 2010-07-21 22:06:39 UTC (rev 20006)
+++ tools/trunk/src/java/org/hibernate/tool/ide/completion/ConfigurationCompletion.java 2010-07-22 12:59:24 UTC (rev 20007)
@@ -171,20 +171,25 @@
prefix = "";
}
- EntityPOJOClass pc = new EntityPOJOClass(cmd, new Cfg2JavaTool()); // TODO: we should extract the needed functionallity from this hbm2java class.
-
- Iterator allPropertiesIterator = pc.getAllPropertiesIterator();
- while ( allPropertiesIterator.hasNext() ) {
- Property property = (Property) allPropertiesIterator.next();
- String candidate = property.getName();
- if (prefix.length() == 0 || candidate.toLowerCase().startsWith(prefix.toLowerCase())) {
- HQLCompletionProposal proposal = createStartWithCompletionProposal( prefix, cursorPosition, HQLCompletionProposal.PROPERTY, candidate );
- proposal.setEntityName( cmd.getEntityName() );
- proposal.setProperty( property );
- proposal.setPropertyName( candidate );
- hcc.accept( proposal);
+ // Add superclass's properties too
+ while (cmd != null){
+ EntityPOJOClass pc = new EntityPOJOClass(cmd, new Cfg2JavaTool()); // TODO: we should extract the needed functionallity from this hbm2java class.
+
+ Iterator allPropertiesIterator = pc.getAllPropertiesIterator();
+ while ( allPropertiesIterator.hasNext() ) {
+ Property property = (Property) allPropertiesIterator.next();
+ String candidate = property.getName();
+ if (prefix.length() == 0 || candidate.toLowerCase().startsWith(prefix.toLowerCase())) {
+ HQLCompletionProposal proposal = createStartWithCompletionProposal( prefix, cursorPosition, HQLCompletionProposal.PROPERTY, candidate );
+ proposal.setEntityName( cmd.getEntityName() );
+ proposal.setProperty( property );
+ proposal.setPropertyName( candidate );
+ hcc.accept( proposal);
+ }
}
- }
+ cmd = cmd.getSuperclass();
+ }
+
}
private HQLCompletionProposal createStartWithCompletionProposal(String prefix, int cursorPosition, int kind, String candidate) {
Added: tools/trunk/src/test/org/hibernate/tool/ide/completion/City.hbm.xml
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/ide/completion/City.hbm.xml (rev 0)
+++ tools/trunk/src/test/org/hibernate/tool/ide/completion/City.hbm.xml 2010-07-22 12:59:24 UTC (rev 20007)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping package="org.hibernate.tool.ide.completion">
+
+ <class name="City" table="hc_city" abstract="true">
+ <id name="id">
+ <generator class="native"/>
+ </id>
+ <discriminator column="hc_city_type" type="string"/>
+ <property name="name"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: tools/trunk/src/test/org/hibernate/tool/ide/completion/City.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/ide/completion/City.java (rev 0)
+++ tools/trunk/src/test/org/hibernate/tool/ide/completion/City.java 2010-07-22 12:59:24 UTC (rev 20007)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.tool.ide.completion;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public abstract class City {
+
+ private Long id;
+
+ private String name;
+
+ public City() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Modified: tools/trunk/src/test/org/hibernate/tool/ide/completion/Model.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/ide/completion/Model.java 2010-07-21 22:06:39 UTC (rev 20006)
+++ tools/trunk/src/test/org/hibernate/tool/ide/completion/Model.java 2010-07-22 12:59:24 UTC (rev 20007)
@@ -37,7 +37,8 @@
Model.class.getResourceAsStream("Product.hbm.xml")).
addInputStream(Model.class.getResourceAsStream("Store.hbm.xml")).
addInputStream(Model.class.getResourceAsStream("ProductOwnerAddress.hbm.xml")).
- addInputStream(Model.class.getResourceAsStream("StoreCity.hbm.xml"));
+ addInputStream(Model.class.getResourceAsStream("City.hbm.xml")).
+ addInputStream(Model.class.getResourceAsStream("StoreCity.hbm.xml"));
cfg.buildMappings();
return cfg;
}
Modified: tools/trunk/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java 2010-07-21 22:06:39 UTC (rev 20006)
+++ tools/trunk/src/test/org/hibernate/tool/ide/completion/ModelCompletionTest.java 2010-07-22 12:59:24 UTC (rev 20007)
@@ -66,7 +66,7 @@
public void testGetMappedClasses() {
Collector hcc = new Collector();
cc.getMatchingImports("", hcc);
- assertEquals("Invalid entity names count", 9, hcc.getCompletionProposals().length);
+ assertEquals("Invalid entity names count", 11, hcc.getCompletionProposals().length);
hcc.clear();
cc.getMatchingImports( " ", hcc );
@@ -209,7 +209,7 @@
String canonicalPath = cc.getCanonicalPath(visible, "store.city");
cc.getMatchingProperties( canonicalPath, "", hcc );
- doTestFields(hcc.getCompletionProposals(), new String[] {"id", "name"});
+ doTestFields(hcc.getCompletionProposals(), new String[] {"id", "name", "number"});
}
public void testUnaliasedProductQuery() {
@@ -256,7 +256,7 @@
HQLCompletionProposal[] completionProposals = c.getCompletionProposals();
- assertEquals(9, completionProposals.length);
+ assertEquals(11, completionProposals.length);
for (int i = 0; i < completionProposals.length; i++) {
HQLCompletionProposal proposal = completionProposals[i];
assertEquals(HQLCompletionProposal.ENTITY_NAME, proposal.getCompletionKind());
@@ -275,7 +275,7 @@
completionProposals = c.getCompletionProposals();
- assertEquals(9, completionProposals.length);
+ assertEquals(11, completionProposals.length);
}
@@ -293,7 +293,7 @@
caretPosition = getCaretPosition(query);
hqlEval.codeComplete(query, caretPosition, c);
completionProposals = c.getCompletionProposals();
- assertEquals("should get results after a nonwhitespace separator", 9, completionProposals.length);
+ assertEquals("should get results after a nonwhitespace separator", 11, completionProposals.length);
c.clear();
query = "from Store s where ";
@@ -371,7 +371,7 @@
HQLCompletionProposal[] completionProposals = c.getCompletionProposals();
- assertEquals(4, completionProposals.length);
+ assertEquals(5, completionProposals.length);
for (int i = 0; i < completionProposals.length; i++) {
HQLCompletionProposal proposal = completionProposals[i];
assertEquals(HQLCompletionProposal.ENTITY_NAME, proposal.getCompletionKind());
@@ -408,7 +408,7 @@
HQLCompletionProposal[] completionProposals = c.getCompletionProposals();
- assertEquals(4, completionProposals.length);
+ assertEquals(5, completionProposals.length);
}
@@ -514,7 +514,7 @@
HQLCompletionProposal[] completionProposals = c.getCompletionProposals();
- assertEquals(9, completionProposals.length);
+ assertEquals(11, completionProposals.length);
HQLCompletionProposal proposal = completionProposals[0];
assertEquals(HQLCompletionProposal.ENTITY_NAME, proposal.getCompletionKind());
Modified: tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.hbm.xml
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.hbm.xml 2010-07-21 22:06:39 UTC (rev 20006)
+++ tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.hbm.xml 2010-07-22 12:59:24 UTC (rev 20007)
@@ -3,11 +3,8 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.hibernate.tool.ide.completion">
- <class name="StoreCity" table="hc_store_city">
- <id name="id">
- <generator class="native"/>
- </id>
- <property name="name"/>
- </class>
+ <subclass name="StoreCity" extends="City" discriminator-value="sc">
+ <property name="number"/>
+ </subclass>
</hibernate-mapping>
\ No newline at end of file
Modified: tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.java
===================================================================
--- tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.java 2010-07-21 22:06:39 UTC (rev 20006)
+++ tools/trunk/src/test/org/hibernate/tool/ide/completion/StoreCity.java 2010-07-22 12:59:24 UTC (rev 20007)
@@ -22,27 +22,14 @@
*/
public class StoreCity {
- private Long id;
-
- private String name;
-
- public StoreCity() {
- }
+ private int number;
- public Long getId() {
- return id;
- }
+ public int getNumber() {
+ return number;
+ }
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
+ public void setNumber(int number) {
+ this.number = number;
+ }
}
13 years, 9 months
Hibernate SVN: r20006 - in core/branches/Branch_3_5: annotations and 31 other directories.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2010-07-21 18:06:39 -0400 (Wed, 21 Jul 2010)
New Revision: 20006
Modified:
core/branches/Branch_3_5/annotations/pom.xml
core/branches/Branch_3_5/cache-ehcache/pom.xml
core/branches/Branch_3_5/cache-infinispan/pom.xml
core/branches/Branch_3_5/cache-jbosscache/pom.xml
core/branches/Branch_3_5/cache-oscache/pom.xml
core/branches/Branch_3_5/cache-swarmcache/pom.xml
core/branches/Branch_3_5/connection-c3p0/pom.xml
core/branches/Branch_3_5/connection-proxool/pom.xml
core/branches/Branch_3_5/core/pom.xml
core/branches/Branch_3_5/distribution/pom.xml
core/branches/Branch_3_5/documentation/envers/pom.xml
core/branches/Branch_3_5/documentation/jbosscache2/pom.xml
core/branches/Branch_3_5/documentation/manual/old/es-ES/pom.xml
core/branches/Branch_3_5/documentation/manual/old/fr-FR/pom.xml
core/branches/Branch_3_5/documentation/manual/old/ja-JP/pom.xml
core/branches/Branch_3_5/documentation/manual/old/ko-KR/pom.xml
core/branches/Branch_3_5/documentation/manual/old/pt-BR/pom.xml
core/branches/Branch_3_5/documentation/manual/old/zh-CN/pom.xml
core/branches/Branch_3_5/documentation/manual/pom.xml
core/branches/Branch_3_5/documentation/pom.xml
core/branches/Branch_3_5/entitymanager/pom.xml
core/branches/Branch_3_5/envers/pom.xml
core/branches/Branch_3_5/hibernate-maven-plugin/pom.xml
core/branches/Branch_3_5/jdbc3-testing/pom.xml
core/branches/Branch_3_5/jdbc4-testing/pom.xml
core/branches/Branch_3_5/jmx/pom.xml
core/branches/Branch_3_5/parent/pom.xml
core/branches/Branch_3_5/pom.xml
core/branches/Branch_3_5/testing/pom.xml
core/branches/Branch_3_5/testsuite/pom.xml
core/branches/Branch_3_5/tutorials/eg/pom.xml
core/branches/Branch_3_5/tutorials/pom.xml
core/branches/Branch_3_5/tutorials/web/pom.xml
Log:
Changed 3.5.4-Final to 3.5.5-SNAPSHOT
Modified: core/branches/Branch_3_5/annotations/pom.xml
===================================================================
--- core/branches/Branch_3_5/annotations/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/annotations/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -29,7 +29,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/cache-ehcache/pom.xml
===================================================================
--- core/branches/Branch_3_5/cache-ehcache/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/cache-ehcache/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/cache-infinispan/pom.xml
===================================================================
--- core/branches/Branch_3_5/cache-infinispan/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/cache-infinispan/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/cache-jbosscache/pom.xml
===================================================================
--- core/branches/Branch_3_5/cache-jbosscache/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/cache-jbosscache/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -27,7 +27,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/cache-oscache/pom.xml
===================================================================
--- core/branches/Branch_3_5/cache-oscache/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/cache-oscache/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/cache-swarmcache/pom.xml
===================================================================
--- core/branches/Branch_3_5/cache-swarmcache/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/cache-swarmcache/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/connection-c3p0/pom.xml
===================================================================
--- core/branches/Branch_3_5/connection-c3p0/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/connection-c3p0/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/connection-proxool/pom.xml
===================================================================
--- core/branches/Branch_3_5/connection-proxool/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/connection-proxool/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/core/pom.xml
===================================================================
--- core/branches/Branch_3_5/core/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/core/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/distribution/pom.xml
===================================================================
--- core/branches/Branch_3_5/distribution/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/distribution/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/documentation/envers/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/envers/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/envers/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/documentation/jbosscache2/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/jbosscache2/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/jbosscache2/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/documentation/manual/old/es-ES/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/manual/old/es-ES/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/manual/old/es-ES/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
Modified: core/branches/Branch_3_5/documentation/manual/old/fr-FR/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/manual/old/fr-FR/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/manual/old/fr-FR/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
Modified: core/branches/Branch_3_5/documentation/manual/old/ja-JP/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/manual/old/ja-JP/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/manual/old/ja-JP/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
Modified: core/branches/Branch_3_5/documentation/manual/old/ko-KR/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/manual/old/ko-KR/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/manual/old/ko-KR/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
Modified: core/branches/Branch_3_5/documentation/manual/old/pt-BR/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/manual/old/pt-BR/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/manual/old/pt-BR/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
Modified: core/branches/Branch_3_5/documentation/manual/old/zh-CN/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/manual/old/zh-CN/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/manual/old/zh-CN/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,12 +6,12 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
</parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-manual-${translation}</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<packaging>jdocbook</packaging>
<name>Hibernate Manual (${translation})</name>
Modified: core/branches/Branch_3_5/documentation/manual/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/manual/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/manual/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/documentation/pom.xml
===================================================================
--- core/branches/Branch_3_5/documentation/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/documentation/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/entitymanager/pom.xml
===================================================================
--- core/branches/Branch_3_5/entitymanager/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/entitymanager/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/envers/pom.xml
===================================================================
--- core/branches/Branch_3_5/envers/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/envers/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/hibernate-maven-plugin/pom.xml
===================================================================
--- core/branches/Branch_3_5/hibernate-maven-plugin/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/hibernate-maven-plugin/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -27,7 +27,7 @@
<parent>
<artifactId>hibernate-parent</artifactId>
<groupId>org.hibernate</groupId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/jdbc3-testing/pom.xml
===================================================================
--- core/branches/Branch_3_5/jdbc3-testing/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/jdbc3-testing/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -28,7 +28,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/jdbc4-testing/pom.xml
===================================================================
--- core/branches/Branch_3_5/jdbc4-testing/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/jdbc4-testing/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -28,7 +28,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/jmx/pom.xml
===================================================================
--- core/branches/Branch_3_5/jmx/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/jmx/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -29,7 +29,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/parent/pom.xml
===================================================================
--- core/branches/Branch_3_5/parent/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/parent/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -29,7 +29,7 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
<packaging>pom</packaging>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<name>Hibernate Core Parent POM</name>
<description>The base POM for all Hibernate Core modules.</description>
Modified: core/branches/Branch_3_5/pom.xml
===================================================================
--- core/branches/Branch_3_5/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/testing/pom.xml
===================================================================
--- core/branches/Branch_3_5/testing/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/testing/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/testsuite/pom.xml
===================================================================
--- core/branches/Branch_3_5/testsuite/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/testsuite/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/tutorials/eg/pom.xml
===================================================================
--- core/branches/Branch_3_5/tutorials/eg/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/tutorials/eg/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tutorials</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/tutorials/pom.xml
===================================================================
--- core/branches/Branch_3_5/tutorials/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/tutorials/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -29,7 +29,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-parent</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: core/branches/Branch_3_5/tutorials/web/pom.xml
===================================================================
--- core/branches/Branch_3_5/tutorials/web/pom.xml 2010-07-21 22:02:33 UTC (rev 20005)
+++ core/branches/Branch_3_5/tutorials/web/pom.xml 2010-07-21 22:06:39 UTC (rev 20006)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tutorials</artifactId>
- <version>3.5.4-Final</version>
+ <version>3.5.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
13 years, 9 months