Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/Cache.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/CacheMode.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/CacheMode.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/CacheMode.java 17 Aug 2012 14:36:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/CacheMode.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2011, 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,82 +20,90 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - /** - * Controls how the session interacts with the second-level - * cache and query cache. + * Controls how the session interacts with the second-level cache and query cache. * - * @see Session#setCacheMode(CacheMode) * @author Gavin King + * @author Strong Liu + * @see Session#setCacheMode(CacheMode) */ -public final class CacheMode implements Serializable { - private final String name; - private final boolean isPutEnabled; - private final boolean isGetEnabled; - private static final Map INSTANCES = new HashMap(); - - private CacheMode(String name, boolean isPutEnabled, boolean isGetEnabled) { - this.name=name; - this.isPutEnabled = isPutEnabled; - this.isGetEnabled = isGetEnabled; - } - public String toString() { - return name; - } - public boolean isPutEnabled() { - return isPutEnabled; - } - public boolean isGetEnabled() { - return isGetEnabled; - } +public enum CacheMode { /** - * The session may read items from the cache, and add items to the cache + * The session may read items from the cache, and add items to the cache. */ - public static final CacheMode NORMAL = new CacheMode("NORMAL", true, true); + NORMAL( true, true ), /** * The session will never interact with the cache, except to invalidate - * cache items when updates occur + * cache items when updates occur. */ - public static final CacheMode IGNORE = new CacheMode("IGNORE", false, false); + IGNORE( false, false ), /** - * The session may read items from the cache, but will not add items, - * except to invalidate items when updates occur + * The session may read items from the cache, but will not add items, + * except to invalidate items when updates occur. */ - public static final CacheMode GET = new CacheMode("GET", false, true); + GET( false, true ), /** * The session will never read items from the cache, but will add items * to the cache as it reads them from the database. */ - public static final CacheMode PUT = new CacheMode("PUT", true, false); - + PUT( true, false ), /** * The session will never read items from the cache, but will add items - * to the cache as it reads them from the database. In this mode, the + * to the cache as it reads them from the database. In this mode, the * effect of hibernate.cache.use_minimal_puts is bypassed, in - * order to force a cache refresh + * order to force a cache refresh. */ - public static final CacheMode REFRESH = new CacheMode("REFRESH", true, false); - - static { - INSTANCES.put( NORMAL.name, NORMAL ); - INSTANCES.put( IGNORE.name, IGNORE ); - INSTANCES.put( GET.name, GET ); - INSTANCES.put( PUT.name, PUT ); - INSTANCES.put( REFRESH.name, REFRESH ); + REFRESH( true, false ); + + + private final boolean isPutEnabled; + private final boolean isGetEnabled; + + private CacheMode( boolean isPutEnabled, boolean isGetEnabled) { + this.isPutEnabled = isPutEnabled; + this.isGetEnabled = isGetEnabled; } - private Object readResolve() { - return INSTANCES.get( name ); + /** + * Does this cache mode indicate that reads are allowed? + * + * @return {@code true} if cache reads are allowed; {@code false} otherwise. + */ + public boolean isGetEnabled() { + return isGetEnabled; } - public static CacheMode parse(String name) { - return ( CacheMode ) INSTANCES.get( name ); + /** + * Does this cache mode indicate that writes are allowed? + * + * @return {@code true} if cache writes are allowed; {@code false} otherwise. + */ + public boolean isPutEnabled() { + return isPutEnabled; } + + /** + * Used to interpret externalized forms of this enum. + * + * @param setting The externalized form. + * + * @return The matching enum value. + * + * @throws MappingException Indicates the external form was not recognized as a valid enum value. + */ + public static CacheMode interpretExternalSetting(String setting) { + if (setting == null) { + return null; + } + + try { + return CacheMode.valueOf( setting.toUpperCase() ); + } + catch ( IllegalArgumentException e ) { + throw new MappingException( "Unknown Cache Mode: " + setting ); + } + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/ConnectionReleaseMode.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/ConnectionReleaseMode.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/ConnectionReleaseMode.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/ConnectionReleaseMode.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,27 +20,23 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; -import java.io.Serializable; - /** * Defines the various policies by which Hibernate might release its underlying * JDBC connection. * * @author Steve Ebersole */ -public class ConnectionReleaseMode implements Serializable { - +public enum ConnectionReleaseMode{ /** * Indicates that JDBC connection should be aggressively released after each * SQL statement is executed. In this mode, the application must * explicitly close all iterators and scrollable results. This mode may * only be used with a JTA datasource. */ - public static final ConnectionReleaseMode AFTER_STATEMENT = new ConnectionReleaseMode( "after_statement" ); + AFTER_STATEMENT, /** * Indicates that JDBC connections should be released after each transaction @@ -49,52 +45,22 @@ *

* This is the default mode starting in 3.1; was previously {@link #ON_CLOSE}. */ - public static final ConnectionReleaseMode AFTER_TRANSACTION = new ConnectionReleaseMode( "after_transaction" ); + AFTER_TRANSACTION, /** * Indicates that connections should only be released when the Session is explicitly closed * or disconnected; this is the legacy (Hibernate2 and pre-3.1) behavior. */ - public static final ConnectionReleaseMode ON_CLOSE = new ConnectionReleaseMode( "on_close" ); + ON_CLOSE; - - private String name; - - private ConnectionReleaseMode(String name) { - this.name = name; - } - /** - * Override of Object.toString(). Returns the release mode name. + * Alias for {@link ConnectionReleaseMode#valueOf(String)} using upper-case version of the incoming name. * - * @return The release mode name. - */ - public String toString() { - return name; - } - - /** - * Determine the correct ConnectionReleaseMode instance based on the given - * name. + * @param name The name to parse * - * @param modeName The release mode name. - * @return The appropriate ConnectionReleaseMode instance - * @throws HibernateException Indicates the modeName param did not match any known modes. + * @return The matched enum value. */ - public static ConnectionReleaseMode parse(String modeName) throws HibernateException { - if ( AFTER_STATEMENT.name.equals( modeName ) ) { - return AFTER_STATEMENT; - } - else if ( AFTER_TRANSACTION.name.equals( modeName ) ) { - return AFTER_TRANSACTION; - } - else if ( ON_CLOSE.name.equals( modeName ) ) { - return ON_CLOSE; - } - throw new HibernateException( "could not determine appropriate connection release mode [" + modeName + "]" ); + public static ConnectionReleaseMode parse(final String name) { + return ConnectionReleaseMode.valueOf( name.toUpperCase() ); } - - private Object readResolve() { - return parse( name ); - } } Index: 3rdParty_sources/hibernate-core/org/hibernate/Criteria.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/Criteria.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/Criteria.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/Criteria.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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; @@ -30,8 +29,10 @@ import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Order; import org.hibernate.criterion.Projection; +import org.hibernate.sql.JoinType; import org.hibernate.transform.ResultTransformer; + /** * Criteria is a simplified API for retrieving entities * by composing Criterion objects. This is a very @@ -119,7 +120,7 @@ * @return this (for method chaining) */ public Criteria add(Criterion criterion); - + /** * Add an {@link Order ordering} to the result set. * @@ -135,62 +136,133 @@ * * @param associationPath a dot seperated property path * @param mode The fetch mode for the referenced association + * * @return this (for method chaining) + * + * @throws HibernateException Indicates a problem applying the given fetch mode */ public Criteria setFetchMode(String associationPath, FetchMode mode) throws HibernateException; /** - * Set the lock mode of the current entity + * Set the lock mode of the current entity. * * @param lockMode The lock mode to be applied + * * @return this (for method chaining) */ public Criteria setLockMode(LockMode lockMode); /** - * Set the lock mode of the aliased entity + * Set the lock mode of the aliased entity. * * @param alias The previously assigned alias representing the entity to - * which the given lock mode should apply. + * which the given lock mode should apply. * @param lockMode The lock mode to be applied + * * @return this (for method chaining) */ public Criteria setLockMode(String alias, LockMode lockMode); /** * Join an association, assigning an alias to the joined association. *

- * Functionally equivalent to {@link #createAlias(String, String, int)} using - * {@link #INNER_JOIN} for the joinType. + * Functionally equivalent to {@link #createAlias(String, String, JoinType )} using + * {@link JoinType#INNER_JOIN} for the joinType. * * @param associationPath A dot-seperated property path * @param alias The alias to assign to the joined association (for later reference). + * * @return this (for method chaining) + * + * @throws HibernateException Indicates a problem creating the sub criteria */ public Criteria createAlias(String associationPath, String alias) throws HibernateException; /** * Join an association using the specified join-type, assigning an alias * to the joined association. *

+ * The joinType is expected to be one of {@link JoinType#INNER_JOIN} (the default), + * {@link JoinType#FULL_JOIN}, or {@link JoinType#LEFT_OUTER_JOIN}. + * + * @param associationPath A dot-seperated property path + * @param alias The alias to assign to the joined association (for later reference). + * @param joinType The type of join to use. + * + * @return this (for method chaining) + * + * @throws HibernateException Indicates a problem creating the sub criteria + */ + public Criteria createAlias(String associationPath, String alias, JoinType joinType) throws HibernateException; + + /** + * Join an association using the specified join-type, assigning an alias + * to the joined association. + *

* The joinType is expected to be one of {@link #INNER_JOIN} (the default), * {@link #FULL_JOIN}, or {@link #LEFT_JOIN}. * * @param associationPath A dot-seperated property path * @param alias The alias to assign to the joined association (for later reference). * @param joinType The type of join to use. + * * @return this (for method chaining) + * + * @throws HibernateException Indicates a problem creating the sub criteria + * @deprecated use {@link #createAlias(String, String, org.hibernate.sql.JoinType)} */ + @Deprecated public Criteria createAlias(String associationPath, String alias, int joinType) throws HibernateException; /** + * Join an association using the specified join-type, assigning an alias + * to the joined association. + *

+ * The joinType is expected to be one of {@link JoinType#INNER_JOIN} (the default), + * {@link JoinType#FULL_JOIN}, or {@link JoinType#LEFT_OUTER_JOIN}. + * + * @param associationPath A dot-seperated property path + * @param alias The alias to assign to the joined association (for later reference). + * @param joinType The type of join to use. + * @param withClause The criteria to be added to the join condition (ON clause) + * + * @return this (for method chaining) + * + * @throws HibernateException Indicates a problem creating the sub criteria + */ + public Criteria createAlias(String associationPath, String alias, JoinType joinType, Criterion withClause) throws HibernateException; + + /** + * Join an association using the specified join-type, assigning an alias + * to the joined association. + *

+ * The joinType is expected to be one of {@link #INNER_JOIN} (the default), + * {@link #FULL_JOIN}, or {@link #LEFT_JOIN}. + * + * @param associationPath A dot-seperated property path + * @param alias The alias to assign to the joined association (for later reference). + * @param joinType The type of join to use. + * @param withClause The criteria to be added to the join condition (ON clause) + * + * @return this (for method chaining) + * + * @throws HibernateException Indicates a problem creating the sub criteria + * @deprecated use {@link #createAlias(String, String, JoinType, Criterion)} + */ + @Deprecated + public Criteria createAlias(String associationPath, String alias, int joinType, Criterion withClause) throws HibernateException; + + /** * Create a new Criteria, "rooted" at the associated entity. *

- * Functionally equivalent to {@link #createCriteria(String, int)} using - * {@link #INNER_JOIN} for the joinType. + * Functionally equivalent to {@link #createCriteria(String, org.hibernate.sql.JoinType)} using + * {@link JoinType#INNER_JOIN} for the joinType. * * @param associationPath A dot-seperated property path + * * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria */ public Criteria createCriteria(String associationPath) throws HibernateException; @@ -200,20 +272,41 @@ * * @param associationPath A dot-seperated property path * @param joinType The type of join to use. + * * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria */ + public Criteria createCriteria(String associationPath, JoinType joinType) throws HibernateException; + + /** + * Create a new Criteria, "rooted" at the associated entity, using the + * specified join type. + * + * @param associationPath A dot-seperated property path + * @param joinType The type of join to use. + * + * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria + * @deprecated use {@link #createAlias(String, String, org.hibernate.sql.JoinType)} + */ + @Deprecated public Criteria createCriteria(String associationPath, int joinType) throws HibernateException; /** * Create a new Criteria, "rooted" at the associated entity, * assigning the given alias. *

- * Functionally equivalent to {@link #createCriteria(String, String, int)} using - * {@link #INNER_JOIN} for the joinType. + * Functionally equivalent to {@link #createCriteria(String, String, org.hibernate.sql.JoinType)} using + * {@link JoinType#INNER_JOIN} for the joinType. * * @param associationPath A dot-seperated property path * @param alias The alias to assign to the joined association (for later reference). + * * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria */ public Criteria createCriteria(String associationPath, String alias) throws HibernateException; @@ -224,11 +317,63 @@ * @param associationPath A dot-seperated property path * @param alias The alias to assign to the joined association (for later reference). * @param joinType The type of join to use. + * * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria */ + public Criteria createCriteria(String associationPath, String alias, JoinType joinType) throws HibernateException; + + /** + * Create a new Criteria, "rooted" at the associated entity, + * assigning the given alias and using the specified join type. + * + * @param associationPath A dot-seperated property path + * @param alias The alias to assign to the joined association (for later reference). + * @param joinType The type of join to use. + * + * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria + * @deprecated use {@link #createCriteria(String, org.hibernate.sql.JoinType)} + */ + @Deprecated public Criteria createCriteria(String associationPath, String alias, int joinType) throws HibernateException; + /** + * Create a new Criteria, "rooted" at the associated entity, + * assigning the given alias and using the specified join type. + * + * @param associationPath A dot-seperated property path + * @param alias The alias to assign to the joined association (for later reference). + * @param joinType The type of join to use. + * @param withClause The criteria to be added to the join condition (ON clause) + * + * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria + */ + public Criteria createCriteria(String associationPath, String alias, JoinType joinType, Criterion withClause) throws HibernateException; + + /** + * Create a new Criteria, "rooted" at the associated entity, + * assigning the given alias and using the specified join type. + * + * @param associationPath A dot-seperated property path + * @param alias The alias to assign to the joined association (for later reference). + * @param joinType The type of join to use. + * @param withClause The criteria to be added to the join condition (ON clause) + * + * @return the created "sub criteria" + * + * @throws HibernateException Indicates a problem creating the sub criteria + * @deprecated use {@link #createCriteria(String, String, org.hibernate.sql.JoinType, org.hibernate.criterion.Criterion)} + */ + @Deprecated + public Criteria createCriteria(String associationPath, String alias, int joinType, Criterion withClause) throws HibernateException; + + /** * Set a strategy for handling the query results. This determines the * "shape" of the query result. * @@ -249,16 +394,71 @@ * @return this (for method chaining) */ public Criteria setMaxResults(int maxResults); - + /** * Set the first result to be retrieved. * * @param firstResult the first result to retrieve, numbered from 0 * @return this (for method chaining) */ public Criteria setFirstResult(int firstResult); - + /** + * Was the read-only/modifiable mode explicitly initialized? + * + * @return true, the read-only/modifiable mode was explicitly initialized; false, otherwise. + * + * @see Criteria#setReadOnly(boolean) + */ + public boolean isReadOnlyInitialized(); + + /** + * Should entities and proxies loaded by this Criteria be put in read-only mode? If the + * read-only/modifiable setting was not initialized, then the default + * read-only/modifiable setting for the persistence context is returned instead. + * @see Criteria#setReadOnly(boolean) + * @see org.hibernate.engine.spi.PersistenceContext#isDefaultReadOnly() + * + * The read-only/modifiable setting has no impact on entities/proxies returned by the + * Criteria that existed in the session before the Criteria was executed. + * + * @return true, entities and proxies loaded by the criteria will be put in read-only mode + * false, entities and proxies loaded by the criteria will be put in modifiable mode + * @throws IllegalStateException if isReadOnlyInitialized() returns false + * and this Criteria is not associated with a session. + * @see Criteria#isReadOnlyInitialized() + */ + public boolean isReadOnly(); + + /** + * Set the read-only/modifiable mode for entities and proxies + * loaded by this Criteria. This setting overrides the default setting + * for the persistence context. + * @see org.hibernate.engine.spi.PersistenceContext#isDefaultReadOnly() + * + * To set the default read-only/modifiable setting used for + * entities and proxies that are loaded into the session: + * @see org.hibernate.engine.spi.PersistenceContext#setDefaultReadOnly(boolean) + * @see org.hibernate.Session#setDefaultReadOnly(boolean) + * + * Read-only entities are not dirty-checked and snapshots of persistent + * state are not maintained. Read-only entities can be modified, but + * changes are not persisted. + * + * When a proxy is initialized, the loaded entity will have the same + * read-only/modifiable setting as the uninitialized + * proxy has, regardless of the session's current setting. + * + * The read-only/modifiable setting has no impact on entities/proxies + * returned by the criteria that existed in the session before the criteria was executed. + * + * @param readOnly true, entities and proxies loaded by the criteria will be put in read-only mode + * false, entities and proxies loaded by the criteria will be put in modifiable mode + * @return {@code this}, for method chaining + */ + public Criteria setReadOnly(boolean readOnly); + + /** * Set a fetch size for the underlying JDBC query. * * @param fetchSize the fetch size @@ -306,6 +506,18 @@ * @return this (for method chaining) */ public Criteria setComment(String comment); + + + /** + * Add a DB query hint to the SQL. These differ from JPA's {@link javax.persistence.QueryHint}, which is specific + * to the JPA implementation and ignores DB vendor-specific hints. Instead, these are intended solely for the + * vendor-specific hints, such as Oracle's optimizers. Multiple query hints are supported; the Dialect will + * determine concatenation and placement. + * + * @param hint The database specific query hint to add. + * @return this (for method chaining) + */ + public Criteria addQueryHint(String hint); /** * Override the flush mode for this particular query. @@ -327,14 +539,20 @@ * Get the results. * * @return The list of matched query results. + * + * @throws HibernateException Indicates a problem either translating the criteria to SQL, + * exeucting the SQL or processing the SQL results. */ public List list() throws HibernateException; - + /** - * Get the results as an instance of {@link ScrollableResults} + * Get the results as an instance of {@link ScrollableResults}. * * @return The {@link ScrollableResults} representing the matched * query results. + * + * @throws HibernateException Indicates a problem either translating the criteria to SQL, + * exeucting the SQL or processing the SQL results. */ public ScrollableResults scroll() throws HibernateException; @@ -344,8 +562,12 @@ * * @param scrollMode Indicates the type of underlying database cursor to * request. + * * @return The {@link ScrollableResults} representing the matched * query results. + * + * @throws HibernateException Indicates a problem either translating the criteria to SQL, + * exeucting the SQL or processing the SQL results. */ public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException; @@ -358,4 +580,4 @@ */ public Object uniqueResult() throws HibernateException; -} \ No newline at end of file +} Index: 3rdParty_sources/hibernate-core/org/hibernate/DuplicateMappingException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/DuplicateMappingException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/DuplicateMappingException.java 17 Aug 2012 14:36:39 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/DuplicateMappingException.java 30 Jul 2014 15:50:59 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2011, 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,31 +20,90 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; /** - * Raised whenever a duplicate for a certain type occurs. - * Duplicate class, table, property name etc. + * Raised whenever a duplicate for a certain type occurs. Duplicate class, table, property name etc. * * @author Max Rydahl Andersen - * + * @author Steve Ebersole */ public class DuplicateMappingException extends MappingException { + /** + * Enumeration of the types of things that can be duplicated. + */ + public static enum Type { + /** + * A duplicate entity definition was encountered. + */ + ENTITY, + /** + * A duplicate table definition was encountered. + */ + TABLE, + /** + * A duplicate property/attribute definition was encountered. + */ + PROPERTY, + /** + * A duplicate column definition was encountered. + */ + COLUMN + } private final String name; private final String type; + /** + * Creates a DuplicateMappingException using the given type and name. + * + * @param type The type of the duplicated thing. + * @param name The name of the duplicated thing. + */ + public DuplicateMappingException(Type type, String name) { + this( type.name(), name ); + } + + /** + * Creates a DuplicateMappingException using the given type and name. + * + * @param type The type of the duplicated thing. + * @param name The name of the duplicated thing. + * + * @deprecated Use the for taking {@link Type} instead. + */ + @Deprecated + public DuplicateMappingException(String type, String name) { + this( "Duplicate " + type + " mapping " + name, type, name ); + } + + /** + * Creates a DuplicateMappingException using the given customMessage, type and name. + * + * @param customMessage A custom exception message explaining the exception condition + * @param type The type of the duplicated thing. + * @param name The name of the duplicated thing. + */ + public DuplicateMappingException(String customMessage, Type type, String name) { + this( customMessage, type.name(), name ); + } + + /** + * Creates a DuplicateMappingException using the given customMessage, type and name. + * + * @param customMessage A custom exception message explaining the exception condition + * @param type The type of the duplicated thing. + * @param name The name of the duplicated thing. + * + * @deprecated Use the for taking {@link Type} instead. + */ + @Deprecated public DuplicateMappingException(String customMessage, String type, String name) { - super(customMessage); + super( customMessage ); this.type=type; this.name=name; } - - public DuplicateMappingException(String type, String name) { - this("Duplicate " + type + " mapping " + name, type, name); - } public String getType() { return type; Index: 3rdParty_sources/hibernate-core/org/hibernate/EntityMode.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/EntityMode.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/EntityMode.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/EntityMode.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2011, 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,53 +20,56 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; -import java.util.Map; -import java.util.HashMap; -import java.io.Serializable; - /** * Defines the representation modes available for entities. * * @author Steve Ebersole */ -public class EntityMode implements Serializable { +public enum EntityMode { + /** + * The {@code pojo} entity mode describes an entity model made up of entity classes (loosely) following + * the java bean convention. + */ + POJO( "pojo" ), - private static final Map INSTANCES = new HashMap(); + /** + * The {@code dynamic-map} entity mode describes an entity model defined using {@link java.util.Map} references. + */ + MAP( "dynamic-map" ); - public static final EntityMode POJO = new EntityMode( "pojo" ); - public static final EntityMode DOM4J = new EntityMode( "dom4j" ); - public static final EntityMode MAP = new EntityMode( "dynamic-map" ); - - static { - INSTANCES.put( POJO.name, POJO ); - INSTANCES.put( DOM4J.name, DOM4J ); - INSTANCES.put( MAP.name, MAP ); - } - private final String name; - public EntityMode(String name) { + private EntityMode(String name) { this.name = name; } + @Override public String toString() { return name; } - private Object readResolve() { - return INSTANCES.get( name ); - } + private static final String DYNAMIC_MAP_NAME = MAP.name.toUpperCase(); - public static EntityMode parse(String name) { - EntityMode rtn = ( EntityMode ) INSTANCES.get( name ); - if ( rtn == null ) { - // default is POJO - rtn = POJO; + /** + * Legacy-style entity-mode name parsing. Case insensitive + * + * @param entityMode The entity mode name to evaluate + * + * @return The appropriate entity mode; {@code null} for incoming {@code entityMode} param is treated by returning + * {@link #POJO}. + */ + public static EntityMode parse(String entityMode) { + if ( entityMode == null ) { + return POJO; } - return rtn; + entityMode = entityMode.toUpperCase(); + if ( DYNAMIC_MAP_NAME.equals( entityMode ) ) { + return MAP; + } + return valueOf( entityMode ); } + } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/EntityNameResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/Filter.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/Filter.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/Filter.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/Filter.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -23,11 +23,10 @@ * */ package org.hibernate; - -import org.hibernate.engine.FilterDefinition; - import java.util.Collection; +import org.hibernate.engine.spi.FilterDefinition; + /** * Type definition of Filter. Filter defines the user's view into enabled dynamic filters, * allowing them to set filter parameter values. Index: 3rdParty_sources/hibernate-core/org/hibernate/Hibernate.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/Hibernate.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/Hibernate.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/Hibernate.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -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,66 +20,19 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.Serializable; -import java.sql.Blob; -import java.sql.Clob; import java.util.Iterator; -import java.util.Properties; -import org.hibernate.collection.PersistentCollection; +import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper; +import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor; +import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.HibernateIterator; -import org.hibernate.intercept.FieldInterceptionHelper; -import org.hibernate.intercept.FieldInterceptor; -import org.hibernate.lob.BlobImpl; -import org.hibernate.lob.ClobImpl; -import org.hibernate.lob.SerializableBlob; -import org.hibernate.lob.SerializableClob; +import org.hibernate.engine.jdbc.LobCreator; +import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.proxy.HibernateProxy; import org.hibernate.proxy.LazyInitializer; -import org.hibernate.type.AnyType; -import org.hibernate.type.BigDecimalType; -import org.hibernate.type.BigIntegerType; -import org.hibernate.type.BinaryType; -import org.hibernate.type.BlobType; -import org.hibernate.type.BooleanType; -import org.hibernate.type.ByteType; -import org.hibernate.type.CalendarDateType; -import org.hibernate.type.CalendarType; -import org.hibernate.type.CharacterType; -import org.hibernate.type.ClassType; -import org.hibernate.type.ClobType; -import org.hibernate.type.CompositeCustomType; -import org.hibernate.type.CurrencyType; -import org.hibernate.type.CustomType; -import org.hibernate.type.DateType; -import org.hibernate.type.DoubleType; -import org.hibernate.type.FloatType; -import org.hibernate.type.IntegerType; -import org.hibernate.type.LocaleType; -import org.hibernate.type.LongType; -import org.hibernate.type.ManyToOneType; -import org.hibernate.type.NullableType; -import org.hibernate.type.SerializableType; -import org.hibernate.type.ShortType; -import org.hibernate.type.StringType; -import org.hibernate.type.TextType; -import org.hibernate.type.TimeType; -import org.hibernate.type.TimeZoneType; -import org.hibernate.type.TimestampType; -import org.hibernate.type.TrueFalseType; -import org.hibernate.type.Type; -import org.hibernate.type.YesNoType; -import org.hibernate.type.CharArrayType; -import org.hibernate.type.WrapperBinaryType; -import org.hibernate.type.CharacterArrayType; -import org.hibernate.usertype.CompositeUserType; /** *

* * @param object a persistent or detached instance - * @throws HibernateException */ - public void refresh(Object object) throws HibernateException; + public void refresh(Object object); /** + * Re-read the state of the given instance from the underlying database. It is + * inadvisable to use this to implement long-running sessions that span many + * business tasks. This method is, however, useful in certain special circumstances. + * For example + * + * + * @param entityName a persistent class + * @param object a persistent or detached instance + */ + public void refresh(String entityName, Object object); + + /** * Re-read the state of the given instance from the underlying database, with * the given LockMode. It is inadvisable to use this to implement * long-running sessions that span many business tasks. This method is, however, * useful in certain special circumstances. * * @param object a persistent or detached instance * @param lockMode the lock mode to use - * @throws HibernateException - */ - public void refresh(Object object, LockMode lockMode) throws HibernateException; - - /** - * Determine the current lock mode of the given object. * - * @param object a persistent instance - * @return the current lock mode - * @throws HibernateException + * @deprecated LockMode parameter should be replaced with LockOptions */ - public LockMode getCurrentLockMode(Object object) throws HibernateException; + @Deprecated + public void refresh(Object object, LockMode lockMode); /** - * Begin a unit of work and return the associated Transaction object. - * If a new underlying transaction is required, begin the transaction. Otherwise - * continue the new work in the context of the existing underlying transaction. - * The class of the returned Transaction object is determined by the - * property hibernate.transaction_factory. + * Re-read the state of the given instance from the underlying database, with + * the given LockMode. It is inadvisable to use this to implement + * long-running sessions that span many business tasks. This method is, however, + * useful in certain special circumstances. * - * @return a Transaction instance - * @throws HibernateException - * @see Transaction + * @param object a persistent or detached instance + * @param lockOptions contains the lock mode to use */ - public Transaction beginTransaction() throws HibernateException; + public void refresh(Object object, LockOptions lockOptions); /** - * Get the Transaction instance associated with this session. - * The class of the returned Transaction object is determined by the - * property hibernate.transaction_factory. + * Re-read the state of the given instance from the underlying database, with + * the given LockMode. It is inadvisable to use this to implement + * long-running sessions that span many business tasks. This method is, however, + * useful in certain special circumstances. * - * @return a Transaction instance - * @throws HibernateException - * @see Transaction + * @param entityName a persistent class + * @param object a persistent or detached instance + * @param lockOptions contains the lock mode to use */ - public Transaction getTransaction(); + public void refresh(String entityName, Object object, LockOptions lockOptions); /** - * Create a new Criteria instance, for the given entity class, - * or a superclass of an entity class. + * Determine the current lock mode of the given object. * - * @param persistentClass a class, which is persistent, or has persistent subclasses - * @return Criteria - */ - public Criteria createCriteria(Class persistentClass); - - /** - * Create a new Criteria instance, for the given entity class, - * or a superclass of an entity class, with the given alias. + * @param object a persistent instance * - * @param persistentClass a class, which is persistent, or has persistent subclasses - * @return Criteria + * @return the current lock mode */ - public Criteria createCriteria(Class persistentClass, String alias); + public LockMode getCurrentLockMode(Object object); /** - * Create a new Criteria instance, for the given entity name. + * Create a {@link Query} instance for the given collection and filter string. Contains an implicit {@code FROM} + * element named {@code this} which refers to the defined table for the collection elements, as well as an implicit + * {@code WHERE} restriction for this particular collection instance's key value. * - * @param entityName - * @return Criteria - */ - public Criteria createCriteria(String entityName); - - /** - * Create a new Criteria instance, for the given entity name, - * with the given alias. - * - * @param entityName - * @return Criteria - */ - public Criteria createCriteria(String entityName, String alias); - - /** - * Create a new instance of Query for the given HQL query string. - * - * @param queryString a HQL query - * @return Query - * @throws HibernateException - */ - public Query createQuery(String queryString) throws HibernateException; - - /** - * Create a new instance of SQLQuery for the given SQL query string. - * - * @param queryString a SQL query - * @return SQLQuery - * @throws HibernateException - */ - public SQLQuery createSQLQuery(String queryString) throws HibernateException; - - /** - * Create a new instance of Query for the given collection and filter string. - * * @param collection a persistent collection - * @param queryString a Hibernate query - * @return Query - * @throws HibernateException - */ - public Query createFilter(Object collection, String queryString) throws HibernateException; - - /** - * Obtain an instance of Query for a named query string defined in the - * mapping file. + * @param queryString a Hibernate query fragment. * - * @param queryName the name of a query defined externally - * @return Query - * @throws HibernateException + * @return The query instance for manipulation and execution */ - public Query getNamedQuery(String queryName) throws HibernateException; + public Query createFilter(Object collection, String queryString); /** * Completely clear the session. Evict all loaded instances and cancel all pending @@ -668,14 +689,13 @@ * Return the persistent instance of the given entity class with the given identifier, * or null if there is no such persistent instance. (If the instance is already associated * with the session, return that instance. This method never returns an uninitialized instance.) - * Obtain the specified lock mode if the instance exists. * * @param clazz a persistent class * @param id an identifier + * * @return a persistent instance or null - * @throws HibernateException */ - public Object get(Class clazz, Serializable id) throws HibernateException; + public Object get(Class clazz, Serializable id); /** * Return the persistent instance of the given entity class with the given identifier, @@ -686,22 +706,39 @@ * @param clazz a persistent class * @param id an identifier * @param lockMode the lock mode + * * @return a persistent instance or null - * @throws HibernateException + * + * @deprecated LockMode parameter should be replaced with LockOptions */ - public Object get(Class clazz, Serializable id, LockMode lockMode) throws HibernateException; + @Deprecated + public Object get(Class clazz, Serializable id, LockMode lockMode); /** + * Return the persistent instance of the given entity class with the given identifier, + * or null if there is no such persistent instance. (If the instance is already associated + * with the session, return that instance. This method never returns an uninitialized instance.) + * Obtain the specified lock mode if the instance exists. + * + * @param clazz a persistent class + * @param id an identifier + * @param lockOptions the lock mode + * + * @return a persistent instance or null + */ + public Object get(Class clazz, Serializable id, LockOptions lockOptions); + + /** * Return the persistent instance of the given named entity with the given identifier, * or null if there is no such persistent instance. (If the instance is already associated * with the session, return that instance. This method never returns an uninitialized instance.) * * @param entityName the entity name * @param id an identifier + * * @return a persistent instance or null - * @throws HibernateException */ - public Object get(String entityName, Serializable id) throws HibernateException; + public Object get(String entityName, Serializable id); /** * Return the persistent instance of the given entity class with the given identifier, @@ -712,34 +749,126 @@ * @param entityName the entity name * @param id an identifier * @param lockMode the lock mode + * * @return a persistent instance or null - * @throws HibernateException + * + * @deprecated LockMode parameter should be replaced with LockOptions */ - public Object get(String entityName, Serializable id, LockMode lockMode) throws HibernateException; + @Deprecated + public Object get(String entityName, Serializable id, LockMode lockMode); - /** - * Return the entity name for a persistent entity + * Return the persistent instance of the given entity class with the given identifier, + * or null if there is no such persistent instance. (If the instance is already associated + * with the session, return that instance. This method never returns an uninitialized instance.) + * Obtain the specified lock mode if the instance exists. + * + * @param entityName the entity name + * @param id an identifier + * @param lockOptions contains the lock mode + * + * @return a persistent instance or null + */ + public Object get(String entityName, Serializable id, LockOptions lockOptions); + + /** + * Return the entity name for a persistent entity. * * @param object a persistent entity + * * @return the entity name - * @throws HibernateException */ - public String getEntityName(Object object) throws HibernateException; + public String getEntityName(Object object); + + /** + * Create an {@link IdentifierLoadAccess} instance to retrieve the specified entity type by + * primary key. + * + * @param entityName The entity name of the entity type to be retrieved + * + * @return load delegate for loading the specified entity type by primary key + * + * @throws HibernateException If the specified entity name cannot be resolved as an entity name + */ + public IdentifierLoadAccess byId(String entityName); /** + * Create an {@link IdentifierLoadAccess} instance to retrieve the specified entity by + * primary key. + * + * @param entityClass The entity type to be retrieved + * + * @return load delegate for loading the specified entity type by primary key + * + * @throws HibernateException If the specified Class cannot be resolved as a mapped entity + */ + public IdentifierLoadAccess byId(Class entityClass); + + /** + * Create an {@link NaturalIdLoadAccess} instance to retrieve the specified entity by + * its natural id. + * + * @param entityName The entity name of the entity type to be retrieved + * + * @return load delegate for loading the specified entity type by natural id + * + * @throws HibernateException If the specified entity name cannot be resolved as an entity name + */ + public NaturalIdLoadAccess byNaturalId(String entityName); + + /** + * Create an {@link NaturalIdLoadAccess} instance to retrieve the specified entity by + * its natural id. + * + * @param entityClass The entity type to be retrieved + * + * @return load delegate for loading the specified entity type by natural id + * + * @throws HibernateException If the specified Class cannot be resolved as a mapped entity + */ + public NaturalIdLoadAccess byNaturalId(Class entityClass); + + /** + * Create an {@link SimpleNaturalIdLoadAccess} instance to retrieve the specified entity by + * its natural id. + * + * @param entityName The entity name of the entity type to be retrieved + * + * @return load delegate for loading the specified entity type by natural id + * + * @throws HibernateException If the specified entityClass cannot be resolved as a mapped entity, or if the + * entity does not define a natural-id or if its natural-id is made up of multiple attributes. + */ + public SimpleNaturalIdLoadAccess bySimpleNaturalId(String entityName); + + /** + * Create an {@link SimpleNaturalIdLoadAccess} instance to retrieve the specified entity by + * its simple (single attribute) natural id. + * + * @param entityClass The entity type to be retrieved + * + * @return load delegate for loading the specified entity type by natural id + * + * @throws HibernateException If the specified entityClass cannot be resolved as a mapped entity, or if the + * entity does not define a natural-id or if its natural-id is made up of multiple attributes. + */ + public SimpleNaturalIdLoadAccess bySimpleNaturalId(Class entityClass); + + /** * Enable the named filter for this current session. * * @param filterName The name of the filter to be enabled. - * @return The Filter instance representing the enabled fiter. + * + * @return The Filter instance representing the enabled filter. */ public Filter enableFilter(String filterName); /** * Retrieve a currently enabled filter by name. * * @param filterName The name of the filter to be retrieved. - * @return The Filter instance representing the enabled fiter. + * + * @return The Filter instance representing the enabled filter. */ public Filter getEnabledFilter(String filterName); @@ -752,65 +881,228 @@ /** * Get the statistics for this session. + * + * @return The session statistics being collected for this session */ public SessionStatistics getStatistics(); - + /** - * Set an unmodified persistent object to read only mode, or a read only - * object to modifiable mode. In read only mode, no snapshot is maintained - * and the instance is never dirty checked. + * Is the specified entity or proxy read-only? + * + * To get the default read-only/modifiable setting used for + * entities and proxies that are loaded into the session: + * @see org.hibernate.Session#isDefaultReadOnly() + * + * @param entityOrProxy an entity or HibernateProxy + * @return {@code true} if the entity or proxy is read-only, {@code false} if the entity or proxy is modifiable. + */ + public boolean isReadOnly(Object entityOrProxy); + + /** + * Set an unmodified persistent object to read-only mode, or a read-only + * object to modifiable mode. In read-only mode, no snapshot is maintained, + * the instance is never dirty checked, and changes are not persisted. + * + * If the entity or proxy already has the specified read-only/modifiable + * setting, then this method does nothing. * + * To set the default read-only/modifiable setting used for + * entities and proxies that are loaded into the session: + * @see org.hibernate.Session#setDefaultReadOnly(boolean) + * + * To override this session's read-only/modifiable setting for entities + * and proxies loaded by a Query: * @see Query#setReadOnly(boolean) + * + * @param entityOrProxy an entity or HibernateProxy + * @param readOnly {@code true} if the entity or proxy should be made read-only; {@code false} if the entity or + * proxy should be made modifiable */ - public void setReadOnly(Object entity, boolean readOnly); + public void setReadOnly(Object entityOrProxy, boolean readOnly); /** - * Controller for allowing users to perform JDBC related work using the Connection - * managed by this Session. + * Controller for allowing users to perform JDBC related work using the Connection managed by this Session. * * @param work The work to be performed. * @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException} */ public void doWork(Work work) throws HibernateException; + /** + * Controller for allowing users to perform JDBC related work using the Connection managed by this Session. After + * execution returns the result of the {@link ReturningWork#execute} call. + * + * @param work The work to be performed. + * @param The type of the result returned from the work + * + * @return the result from calling {@link ReturningWork#execute}. + * + * @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException} + */ + public T doReturningWork(ReturningWork work) throws HibernateException; /** - * Disconnect the Session from the current JDBC connection. If - * the connection was obtained by Hibernate close it and return it to - * the connection pool; otherwise, return it to the application. + * Disconnect the session from its underlying JDBC connection. This is intended for use in cases where the + * application has supplied the JDBC connection to the session and which require long-sessions (aka, conversations). *

- * This is used by applications which supply JDBC connections to Hibernate - * and which require long-sessions (or long-conversations) + * It is considered an error to call this method on a session which was not opened by supplying the JDBC connection + * and an exception will be thrown. *

- * Note that disconnect() called on a session where the connection was - * retrieved by Hibernate through its configured - * {@link org.hibernate.connection.ConnectionProvider} has no effect, - * provided {@link ConnectionReleaseMode#ON_CLOSE} is not in effect. + * For non-user-supplied scenarios, normal transaction management already handles disconnection and reconnection + * automatically. * - * @return the application-supplied connection or null + * @return the application-supplied connection or {@code null} + * * @see #reconnect(Connection) - * @see #reconnect() */ - Connection disconnect() throws HibernateException; + Connection disconnect(); /** - * Obtain a new JDBC connection. This is used by applications which - * require long transactions and do not supply connections to the - * session. + * Reconnect to the given JDBC connection. * + * @param connection a JDBC connection + * * @see #disconnect() - * @deprecated Manual reconnection is only needed in the case of - * application-supplied connections, in which case the - * {@link #reconnect(java.sql.Connection)} for should be used. */ - void reconnect() throws HibernateException; + void reconnect(Connection connection); /** - * Reconnect to the given JDBC connection. This is used by applications - * which require long transactions and use application-supplied connections. + * Is a particular fetch profile enabled on this session? * - * @param connection a JDBC connection - * @see #disconnect() + * @param name The name of the profile to be checked. + * @return True if fetch profile is enabled; false if not. + * @throws UnknownProfileException Indicates that the given name does not + * match any known profile names + * + * @see org.hibernate.engine.profile.FetchProfile for discussion of this feature */ - void reconnect(Connection connection) throws HibernateException; + public boolean isFetchProfileEnabled(String name) throws UnknownProfileException; + + /** + * Enable a particular fetch profile on this session. No-op if requested + * profile is already enabled. + * + * @param name The name of the fetch profile to be enabled. + * @throws UnknownProfileException Indicates that the given name does not + * match any known profile names + * + * @see org.hibernate.engine.profile.FetchProfile for discussion of this feature + */ + public void enableFetchProfile(String name) throws UnknownProfileException; + + /** + * Disable a particular fetch profile on this session. No-op if requested + * profile is already disabled. + * + * @param name The name of the fetch profile to be disabled. + * @throws UnknownProfileException Indicates that the given name does not + * match any known profile names + * + * @see org.hibernate.engine.profile.FetchProfile for discussion of this feature + */ + public void disableFetchProfile(String name) throws UnknownProfileException; + + /** + * Convenience access to the {@link TypeHelper} associated with this session's {@link SessionFactory}. + *

+ * Equivalent to calling {@link #getSessionFactory()}.{@link SessionFactory#getTypeHelper getTypeHelper()} + * + * @return The {@link TypeHelper} associated with this session's {@link SessionFactory} + */ + public TypeHelper getTypeHelper(); + + /** + * Retrieve this session's helper/delegate for creating LOB instances. + * + * @return This session's LOB helper + */ + public LobHelper getLobHelper(); + + /** + * Contains locking details (LockMode, Timeout and Scope). + */ + public interface LockRequest { + /** + * Constant usable as a time out value that indicates no wait semantics should be used in + * attempting to acquire locks. + */ + static final int PESSIMISTIC_NO_WAIT = 0; + /** + * Constant usable as a time out value that indicates that attempting to acquire locks should be allowed to + * wait forever (apply no timeout). + */ + static final int PESSIMISTIC_WAIT_FOREVER = -1; + + /** + * Get the lock mode. + * + * @return the lock mode. + */ + LockMode getLockMode(); + + /** + * Specify the LockMode to be used. The default is LockMode.none. + * + * @param lockMode The lock mode to use for this request + * + * @return this LockRequest instance for operation chaining. + */ + LockRequest setLockMode(LockMode lockMode); + + /** + * Get the timeout setting. + * + * @return timeout in milliseconds, -1 for indefinite wait and 0 for no wait. + */ + int getTimeOut(); + + /** + * Specify the pessimistic lock timeout (check if your dialect supports this option). + * The default pessimistic lock behavior is to wait forever for the lock. + * + * @param timeout is time in milliseconds to wait for lock. -1 means wait forever and 0 means no wait. + * + * @return this LockRequest instance for operation chaining. + */ + LockRequest setTimeOut(int timeout); + + /** + * Check if locking is cascaded to owned collections and relationships. + * + * @return true if locking will be extended to owned collections and relationships. + */ + boolean getScope(); + + /** + * Specify if LockMode should be cascaded to owned collections and relationships. + * The association must be mapped with {@code cascade="lock"} for scope=true to work. + * + * @param scope {@code true} to cascade locks; {@code false} to not. + * + * @return {@code this}, for method chaining + */ + LockRequest setScope(boolean scope); + + /** + * Perform the requested locking. + * + * @param entityName The name of the entity to lock + * @param object The instance of the entity to lock + */ + void lock(String entityName, Object object); + + /** + * Perform the requested locking. + * + * @param object The instance of the entity to lock + */ + void lock(Object object); + } + + /** + * Add one or more listeners to the Session + * + * @param listeners The listener(s) to add + */ + public void addEventListeners(SessionEventListener... listeners); } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/SessionBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/SessionEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/SessionFactoryObserver.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/SessionFactoryObserver.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/SessionFactoryObserver.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/SessionFactoryObserver.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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; Index: 3rdParty_sources/hibernate-core/org/hibernate/StaleStateException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/StaleStateException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/StaleStateException.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/StaleStateException.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,25 +20,26 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; /** - * Thrown when a version number or timestamp check failed, indicating that the - * Session contained stale data (when using long transactions - * with versioning). Also occurs if we try delete or update a row that does - * not exist.
- *
- * Note that this exception often indicates that the user failed to specify the - * correct unsaved-value strategy for a class! + * Thrown when a version number or timestamp check failed, indicating that the Session contained + * stale data (when using long transactions with versioning). Also occurs if we try delete or update + * a row that does not exist. * - * @see StaleObjectStateException + * Note that this exception often indicates that the user failed to specify the correct + * {@code unsaved-value} strategy for an entity + * * @author Gavin King */ public class StaleStateException extends HibernateException { - - public StaleStateException(String s) { - super(s); + /** + * Constructs a StaleStateException using the supplied message. + * + * @param message The message explaining the exception condition + */ + public StaleStateException(String message) { + super( message ); } } Index: 3rdParty_sources/hibernate-core/org/hibernate/StatelessSession.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/StatelessSession.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/StatelessSession.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/StatelessSession.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2011, 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,32 +20,29 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; import java.io.Serializable; import java.sql.Connection; /** - * A command-oriented API for performing bulk operations - * against a database.
- *
- * A stateless session does not implement a first-level cache nor - * interact with any second-level cache, nor does it implement - * transactional write-behind or automatic dirty checking, nor do - * operations cascade to associated instances. Collections are - * ignored by a stateless session. Operations performed via a - * stateless session bypass Hibernate's event model and - * interceptors. Stateless sessions are vulnerable to data - * aliasing effects, due to the lack of a first-level cache.
- *
- * For certain kinds of transactions, a stateless session may - * perform slightly faster than a stateful session. + * A command-oriented API for performing bulk operations against a database. + *

+ * A stateless session does not implement a first-level cache nor interact + * with any second-level cache, nor does it implement transactional + * write-behind or automatic dirty checking, nor do operations cascade to + * associated instances. Collections are ignored by a stateless session. + * Operations performed via a stateless session bypass Hibernate's event model + * and interceptors. Stateless sessions are vulnerable to data aliasing + * effects, due to the lack of a first-level cache. + *

+ * For certain kinds of transactions, a stateless session may perform slightly + * faster than a stateful session. * * @author Gavin King */ -public interface StatelessSession extends Serializable { +public interface StatelessSession extends SharedSessionContract { /** * Close the stateless session and release the JDBC connection. */ @@ -55,6 +52,8 @@ * Insert a row. * * @param entity a new transient instance + * + * @return The identifier of the inserted entity */ public Serializable insert(Object entity); @@ -63,6 +62,7 @@ * * @param entityName The entityName for the entity to be inserted * @param entity a new transient instance + * * @return the identifier of the instance */ public Serializable insert(String entityName, Object entity); @@ -100,27 +100,41 @@ /** * Retrieve a row. * + * @param entityName The name of the entity to retrieve + * @param id The id of the entity to retrieve + * * @return a detached entity instance */ public Object get(String entityName, Serializable id); /** * Retrieve a row. * + * @param entityClass The class of the entity to retrieve + * @param id The id of the entity to retrieve + * * @return a detached entity instance */ public Object get(Class entityClass, Serializable id); /** * Retrieve a row, obtaining the specified lock mode. * + * @param entityName The name of the entity to retrieve + * @param id The id of the entity to retrieve + * @param lockMode The lock mode to apply to the entity + * * @return a detached entity instance */ public Object get(String entityName, Serializable id, LockMode lockMode); /** * Retrieve a row, obtaining the specified lock mode. * + * @param entityClass The class of the entity to retrieve + * @param id The id of the entity to retrieve + * @param lockMode The lock mode to apply to the entity + * * @return a detached entity instance */ public Object get(Class entityClass, Serializable id, LockMode lockMode); @@ -158,83 +172,18 @@ public void refresh(String entityName, Object entity, LockMode lockMode); /** - * Create a new instance of Query for the given HQL query string. - * Entities returned by the query are detached. - */ - public Query createQuery(String queryString); - - /** - * Obtain an instance of Query for a named query string defined in - * the mapping file. Entities returned by the query are detached. - */ - public Query getNamedQuery(String queryName); - - /** - * Create a new Criteria instance, for the given entity class, - * or a superclass of an entity class. Entities returned by the query are - * detached. - * - * @param persistentClass a class, which is persistent, or has persistent subclasses - * @return Criteria - */ - public Criteria createCriteria(Class persistentClass); - - /** - * Create a new Criteria instance, for the given entity class, - * or a superclass of an entity class, with the given alias. - * Entities returned by the query are detached. - * - * @param persistentClass a class, which is persistent, or has persistent subclasses - * @return Criteria - */ - public Criteria createCriteria(Class persistentClass, String alias); - - /** - * Create a new Criteria instance, for the given entity name. - * Entities returned by the query are detached. - * - * @param entityName - * @return Criteria - */ - public Criteria createCriteria(String entityName); - - /** - * Create a new Criteria instance, for the given entity name, - * with the given alias. Entities returned by the query are detached. - * - * @param entityName - * @return Criteria - */ - public Criteria createCriteria(String entityName, String alias); - - /** - * Create a new instance of SQLQuery for the given SQL query string. - * Entities returned by the query are detached. - * - * @param queryString a SQL query - * @return SQLQuery - * @throws HibernateException - */ - public SQLQuery createSQLQuery(String queryString) throws HibernateException; - - /** - * Begin a Hibernate transaction. - */ - public Transaction beginTransaction(); - - /** - * Get the current Hibernate transaction. - */ - public Transaction getTransaction(); - - /** * Returns the current JDBC connection associated with this * instance.
*
* If the session is using aggressive connection release (as in a * CMT environment), it is the application's responsibility to * close the connection returned by this call. Otherwise, the * application should not close the connection. + * + * @deprecated just missed when deprecating same method from {@link Session} + * + * @return The connection associated with this stateless session */ + @Deprecated public Connection connection(); } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/SynchronizeableQuery.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/Transaction.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/Transaction.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/Transaction.java 17 Aug 2012 14:36:39 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/Transaction.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2007-2011, 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,109 +20,152 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; import javax.transaction.Synchronization; +import org.hibernate.engine.transaction.spi.LocalStatus; + /** - * Allows the application to define units of work, while - * maintaining abstraction from the underlying transaction - * implementation (eg. JTA, JDBC).
- *
- * A transaction is associated with a Session and is - * usually instantiated by a call to Session.beginTransaction(). - * A single session might span multiple transactions since - * the notion of a session (a conversation between the application - * and the datastore) is of coarser granularity than the notion of - * a transaction. However, it is intended that there be at most one - * uncommitted Transaction associated with a particular - * Session at any time.
- *
- * Implementors are not intended to be threadsafe. + * Defines the contract for abstracting applications from the configured underlying means of transaction management. + * Allows the application to define units of work, while maintaining abstraction from the underlying transaction + * implementation (eg. JTA, JDBC). + *

+ * A transaction is associated with a {@link Session} and is usually initiated by a call to + * {@link org.hibernate.Session#beginTransaction()}. A single session might span multiple transactions since + * the notion of a session (a conversation between the application and the datastore) is of coarser granularity than + * the notion of a transaction. However, it is intended that there be at most one uncommitted transaction associated + * with a particular {@link Session} at any time. + *

+ * Implementers are not intended to be thread-safe. * - * @see Session#beginTransaction() - * @see org.hibernate.transaction.TransactionFactory * @author Anton van Straaten + * @author Steve Ebersole */ public interface Transaction { - /** - * Begin a new transaction. + * Is this transaction the initiator of any underlying transaction? + * + * @return {@code true} if this transaction initiated the underlying transaction; {@code false} otherwise. */ - public void begin() throws HibernateException; + public boolean isInitiator(); /** - * Flush the associated Session and end the unit of work (unless - * we are in {@link FlushMode#MANUAL}. - *

- * This method will commit the underlying transaction if and only - * if the underlying transaction was initiated by this object. + * Begin this transaction. No-op if the transaction has already been begun. Note that this is not necessarily + * symmetrical since usually multiple calls to {@link #commit} or {@link #rollback} will error. * - * @throws HibernateException + * @throws HibernateException Indicates a problem beginning the transaction. */ - public void commit() throws HibernateException; + public void begin(); /** - * Force the underlying transaction to roll back. + * Commit this transaction. This might entail a number of things depending on the context:
    + *
  • + * If this transaction is the {@link #isInitiator initiator}, {@link Session#flush} the {@link Session} + * with which it is associated (unless {@link Session} is in {@link FlushMode#MANUAL}). + *
  • + *
  • + * If this transaction is the {@link #isInitiator initiator}, commit the underlying transaction. + *
  • + *
  • + * Coordinate various callbacks + *
  • + *
* - * @throws HibernateException + * @throws HibernateException Indicates a problem committing the transaction. */ - public void rollback() throws HibernateException; + public void commit(); /** - * Was this transaction rolled back or set to rollback only? - *

- * This only accounts for actions initiated from this local transaction. - * If, for example, the underlying transaction is forced to rollback via - * some other means, this method still reports false because the rollback - * was not initiated from here. + * Rollback this transaction. Either rolls back the underlying transaction or ensures it cannot later commit + * (depending on the actual underlying strategy). * - * @return boolean True if the transaction was rolled back via this - * local transaction; false otherwise. - * @throws HibernateException + * @throws HibernateException Indicates a problem rolling back the transaction. */ - public boolean wasRolledBack() throws HibernateException; + public void rollback(); /** - * Check if this transaction was successfully committed. + * Get the current local status of this transaction. *

- * This method could return false even after successful invocation - * of {@link #commit}. As an example, JTA based strategies no-op on - * {@link #commit} calls if they did not start the transaction; in that case, - * they also report {@link #wasCommitted} as false. + * This only accounts for the local view of the transaction status. In other words it does not check the status + * of the actual underlying transaction. * - * @return boolean True if the transaction was (unequivocally) committed - * via this local transaction; false otherwise. - * @throws HibernateException + * @return The current local status. */ - public boolean wasCommitted() throws HibernateException; - + public LocalStatus getLocalStatus(); + /** * Is this transaction still active? *

- * Again, this only returns information in relation to the - * local transaction, not the actual underlying transaction. + * Answers on a best effort basis. For example, in the case of JDBC based transactions we cannot know that a + * transaction is active when it is initiated directly through the JDBC {@link java.sql.Connection}, only when + * it is initiated from here. * - * @return boolean Treu if this local transaction is still active. + * @return {@code true} if the transaction is still active; {@code false} otherwise. + * + * @throws HibernateException Indicates a problem checking the transaction status. */ - public boolean isActive() throws HibernateException; + public boolean isActive(); /** + * Is Hibernate participating in the underlying transaction? + *

+ * Generally speaking this will be the same as {@link #isActive()}. + * + * @return {@code true} if Hibernate is known to be participating in the underlying transaction; {@code false} + * otherwise. + */ + public boolean isParticipating(); + + /** + * Was this transaction committed? + *

+ * Answers on a best effort basis. For example, in the case of JDBC based transactions we cannot know that a + * transaction was committed when the commit was performed directly through the JDBC {@link java.sql.Connection}, + * only when the commit was done from this. + * + * @return {@code true} if the transaction is rolled back; {@code false} otherwise. + * + * @throws HibernateException Indicates a problem checking the transaction status. + */ + @SuppressWarnings( {"UnusedDeclaration"}) + public boolean wasCommitted(); + + /** + * Was this transaction rolled back or set to rollback only? + *

+ * Answers on a best effort basis. For example, in the case of JDBC based transactions we cannot know that a + * transaction was rolled back when rollback was performed directly through the JDBC {@link java.sql.Connection}, + * only when it was rolled back from here. + * + * @return {@literal true} if the transaction is rolled back; {@literal false} otherwise. + * + * @throws HibernateException Indicates a problem checking the transaction status. + */ + @SuppressWarnings( {"UnusedDeclaration"}) + public boolean wasRolledBack(); + + /** * Register a user synchronization callback for this transaction. * * @param synchronization The Synchronization callback to register. - * @throws HibernateException + * + * @throws HibernateException Indicates a problem registering the synchronization. */ - public void registerSynchronization(Synchronization synchronization) - throws HibernateException; + public void registerSynchronization(Synchronization synchronization) throws HibernateException; /** - * Set the transaction timeout for any transaction started by - * a subsequent call to begin() on this instance. + * Set the transaction timeout for any transaction started by a subsequent call to {@link #begin} on this instance. * * @param seconds The number of seconds before a timeout. */ public void setTimeout(int seconds); + + /** + * Retrieve the transaction timeout set for this transaction. A negative indicates no timeout has been set. + * + * @return The timeout, in seconds. + */ + public int getTimeout(); } Index: 3rdParty_sources/hibernate-core/org/hibernate/TransactionException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/TransactionException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/TransactionException.java 17 Aug 2012 14:36:39 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/TransactionException.java 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,26 +20,33 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; /** * Indicates that a transaction could not be begun, committed * or rolled back. * - * @see Transaction * @author Anton van Straaten */ - public class TransactionException extends HibernateException { - - public TransactionException(String message, Throwable root) { - super(message,root); + /** + * Constructs a TransactionException using the specified information. + * + * @param message The message explaining the exception condition + * @param cause The underlying cause + */ + public TransactionException(String message, Throwable cause) { + super( message, cause ); } + /** + * Constructs a TransactionException using the specified information. + * + * @param message The message explaining the exception condition + */ public TransactionException(String message) { - super(message); + super( message ); } } Index: 3rdParty_sources/hibernate-core/org/hibernate/TransientObjectException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/TransientObjectException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/TransientObjectException.java 17 Aug 2012 14:36:39 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/TransientObjectException.java 30 Jul 2014 15:50:59 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,21 +20,22 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate; /** - * Thrown when the user passes a transient instance to a Session - * method that expects a persistent instance. + * Thrown when the user passes a transient instance to a Session method that expects a persistent instance. * * @author Gavin King */ - public class TransientObjectException extends HibernateException { - - public TransientObjectException(String s) { - super(s); + /** + * Constructs a TransientObjectException using the supplied message. + * + * @param message The message explaining the exception condition + */ + public TransientObjectException(String message) { + super( message ); } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/TransientPropertyValueException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/TypeHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/UnknownProfileException.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/UnresolvableObjectException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/UnresolvableObjectException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/UnresolvableObjectException.java 17 Aug 2012 14:36:39 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/UnresolvableObjectException.java 30 Jul 2014 15:50:59 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2013, 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; @@ -35,34 +34,52 @@ * @author Gavin King */ public class UnresolvableObjectException extends HibernateException { - private final Serializable identifier; private final String entityName; - public UnresolvableObjectException(Serializable identifier, String clazz) { - this("No row with the given identifier exists", identifier, clazz); + /** + * Constructs an UnresolvableObjectException using the specified information. + * + * @param identifier The identifier of the entity which could not be resolved + * @param entityName The name of the entity which could not be resolved + */ + public UnresolvableObjectException(Serializable identifier, String entityName) { + this( "No row with the given identifier exists", identifier, entityName ); } - UnresolvableObjectException(String message, Serializable identifier, String clazz) { - super(message); + + protected UnresolvableObjectException(String message, Serializable identifier, String clazz) { + super( message ); this.identifier = identifier; this.entityName = clazz; } + + /** + * Factory method for building and throwing an UnresolvableObjectException if the entity is null. + * + * @param entity The entity to check for nullness + * @param identifier The identifier of the entity + * @param entityName The name of the entity + * + * @throws UnresolvableObjectException Thrown if entity is null + */ + public static void throwIfNull(Object entity, Serializable identifier, String entityName) + throws UnresolvableObjectException { + if ( entity == null ) { + throw new UnresolvableObjectException( identifier, entityName ); + } + } + public Serializable getIdentifier() { return identifier; } - public String getMessage() { - return super.getMessage() + ": " + - MessageHelper.infoString(entityName, identifier); - } - public String getEntityName() { return entityName; } - public static void throwIfNull(Object o, Serializable id, String clazz) - throws UnresolvableObjectException { - if (o==null) throw new UnresolvableObjectException(id, clazz); + @Override + public String getMessage() { + return super.getMessage() + ": " + MessageHelper.infoString( entityName, identifier ); } } Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/checkstyle_checks.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/package.html =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/package.html,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/package.html 17 Aug 2012 14:36:39 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/package.html 30 Jul 2014 15:51:00 -0000 1.1.2.1 @@ -1,10 +1,10 @@ Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/BulkOperationCleanupAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/CollectionAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/CollectionRecreateAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/CollectionRemoveAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/CollectionUpdateAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/DelayedPostInsertIdentifier.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/EntityAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/EntityDeleteAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/EntityIdentityInsertAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/EntityInsertAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/EntityUpdateAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/Executable.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/action/package.html =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/action/package.html,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/action/package.html 17 Aug 2012 14:34:02 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/action/package.html 30 Jul 2014 15:52:31 -0000 1.1.2.1 @@ -1,10 +1,10 @@

- This package defines "actions" that are scheduled for - asycnchronous execution by the event listeners. + This package defines "actions" that are scheduled for asynchronous execution by the event listeners. + The {@link org.hibernate.engine.ActionQueue} is responsible for execution of these actions.

Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/AbstractEntityInsertAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/BulkOperationCleanupAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/CollectionAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/CollectionRecreateAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/CollectionRemoveAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/CollectionUpdateAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/DelayedPostInsertIdentifier.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/EntityAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/EntityDeleteAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/EntityIdentityInsertAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/EntityIncrementVersionProcess.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/EntityInsertAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/EntityUpdateAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/EntityVerifyVersionProcess.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/OrphanRemovalAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/QueuedOperationCollectionAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/UnresolvedEntityInsertActions.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/spi/AfterTransactionCompletionProcess.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/spi/BeforeTransactionCompletionProcess.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/spi/Executable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/action/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/BootstrapServiceRegistry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/BootstrapServiceRegistryBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/StandardServiceInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/StandardServiceRegistry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/classloading/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/classloading/spi/ClassLoaderService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/classloading/spi/ClassLoadingException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/classloading/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/internal/BootstrapServiceRegistryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/internal/StandardServiceRegistryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/SimpleStrategyRegistrationImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/StrategyRegistration.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/StrategyRegistrationProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/internal/StrategySelectorBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/internal/StrategySelectorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/spi/StrategySelectionException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/spi/StrategySelector.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/boot/registry/selector/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/AbstractJndiBoundCacheProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/Cache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/CacheConcurrencyStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/CacheDataDescription.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cache/CacheException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cache/CacheException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cache/CacheException.java 17 Aug 2012 14:33:59 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cache/CacheException.java 30 Jul 2014 15:51:50 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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.cache; @@ -30,17 +29,32 @@ * Something went wrong in the cache */ public class CacheException extends HibernateException { - - public CacheException(String s) { - super(s); + /** + * Constructs a CacheException. + * + * @param message Message explaining the exception condition + */ + public CacheException(String message) { + super( message ); } - public CacheException(String s, Throwable e) { - super(s, e); + /** + * Constructs a CacheException. + * + * @param message Message explaining the exception condition + * @param cause The underlying cause + */ + public CacheException(String message, Throwable cause) { + super( message, cause ); } - - public CacheException(Throwable e) { - super(e); + + /** + * Constructs a CacheException. + * + * @param cause The underlying cause + */ + public CacheException(Throwable cause) { + super( cause ); } } Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/CacheKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/CacheProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/CollectionRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/EntityRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/FilterKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/GeneralDataRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/HashtableCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/HashtableCacheProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/NoCacheProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/NoCacheRegionFactoryAvailableException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/NoCachingEnabledException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/NonstrictReadWriteCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/OptimisticCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/OptimisticCacheSource.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/QueryCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/QueryCacheFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/QueryKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/QueryResultsRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/ReadOnlyCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/ReadWriteCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/Region.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cache/RegionFactory.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cache/RegionFactory.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cache/RegionFactory.java 17 Aug 2012 14:33:57 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cache/RegionFactory.java 30 Jul 2014 15:51:49 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2011, 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,111 +20,16 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cache; -import java.util.Properties; - -import org.hibernate.cfg.Settings; - /** - * Contract for building second level cache regions. - *

- * Implementors should define a constructor in one of two forms:

    - *
  • MyRegionFactoryImpl({@link java.util.Properties})
  • - *
  • MyRegionFactoryImpl()
  • - *
- * Use the first when we need to read config properties prior to - * {@link #start} being called. For an example, have a look at - * {@link org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge} - * where we need the properties in order to determine which legacy - * {@link CacheProvider} to use so that we can answer the - * {@link #isMinimalPutsEnabledByDefault()} question for the - * {@link org.hibernate.cfg.SettingsFactory}. + * Legacy (deprecated) namespace for the RegionFactory contract. * * @author Steve Ebersole + * + * @deprecated Moved, but still need this definition for ehcache */ -public interface RegionFactory { - - /** - * Lifecycle callback to perform any necessary initialization of the - * underlying cache implementation(s). Called exactly once during the - * construction of a {@link org.hibernate.impl.SessionFactoryImpl}. - * - * @param settings The settings in effect. - * @param properties The defined cfg properties - * @throws CacheException Indicates problems starting the L2 cache impl; - * considered as a sign to stop {@link org.hibernate.SessionFactory} - * building. - */ - public void start(Settings settings, Properties properties) throws CacheException; - - /** - * Lifecycle callback to perform any necessary cleanup of the underlying - * cache implementation(s). Called exactly once during - * {@link org.hibernate.SessionFactory#close}. - */ - public void stop(); - - /** - * By default should we perform "minimal puts" when using this second - * level cache implementation? - * - * @return True if "minimal puts" should be performed by default; false - * otherwise. - */ - public boolean isMinimalPutsEnabledByDefault(); - - /** - * Generate a timestamp. - *

- * This is generally used for cache content locking/unlocking purposes - * depending upon the access-strategy being used. - * - * @return The generated timestamp. - */ - public long nextTimestamp(); - - /** - * Build a cache region specialized for storing entity data. - * - * @param regionName The name of the region. - * @param properties Configuration properties. - * @param metadata Information regarding the type of data to be cached - * @return The built region - * @throws CacheException Indicates problems building the region. - */ - public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException; - - /** - * Build a cache region specialized for storing collection data. - * - * @param regionName The name of the region. - * @param properties Configuration properties. - * @param metadata Information regarding the type of data to be cached - * @return The built region - * @throws CacheException Indicates problems building the region. - */ - public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException; - - /** - * Build a cache region specialized for storing query results - * - * @param regionName The name of the region. - * @param properties Configuration properties. - * @return The built region - * @throws CacheException Indicates problems building the region. - */ - public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException; - - /** - * Build a cache region specialized for storing update-timestamps data. - * - * @param regionName The name of the region. - * @param properties Configuration properties. - * @return The built region - * @throws CacheException Indicates problems building the region. - */ - public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException; +@Deprecated +public interface RegionFactory extends org.hibernate.cache.spi.RegionFactory { } Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/StandardQueryCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/StandardQueryCacheFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/Timestamper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/TimestampsRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/TransactionAwareCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/TransactionalCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/TransactionalDataRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/UpdateTimestampsCache.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cache/package.html =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cache/package.html,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cache/package.html 17 Aug 2012 14:33:57 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cache/package.html 30 Jul 2014 15:51:50 -0000 1.1.2.1 @@ -1,10 +1,10 @@ - - - -

- This package defines APIs/SPIs and implementations for the Hibernate second-level cache. + This package defines API of the Hibernate second level cache service. The + org.hibernate.cache.spi package defines the SPI used to + integrate with Hibernate internals.

-

- The legacy (and now deprecated) approach to caching is defined by the {@link org.hibernate.cache.CacheProvider} and - {@link org.hibernate.cache.Cache} interfaces as well as the {@link org.hibernate.cache.CacheConcurrencyStrategy} - interface along with the various implementations of all these interfaces. In that scheme, a - {@link org.hibernate.cache.CacheProvider} defined how to configure and perform lifecycle operations - in regards to a particular underlying caching library; it also defined how to build {@link org.hibernate.cache.Cache} - instances which in turn defined how to access the "regions" of the underlying cache instance. - For entity and collection data cache regions, {@link org.hibernate.cache.CacheConcurrencyStrategy} wrapped - access to those cache regions to apply transactional/concurrent access semantics. -

-

- The improved approach is based on {@link org.hibernate.cache.RegionFactory}, the various - {@link org.hibernate.cache.Region} specializations and the two access strategies contracts - ({@link org.hibernate.cache.access.EntityRegionAccessStrategy} and - {@link org.hibernate.cache.access.CollectionRegionAccessStrategy}). The general approach here is that - {@link org.hibernate.cache.RegionFactory} defined how to configure and perform lifecycle operations - in regards to a particular underlying caching library (or libraries). - {@link org.hibernate.cache.RegionFactory} also defines how to build specialized - {@link org.hibernate.cache.Region} instances based on the type of data we will be storing in that given - region. The fact that {@link org.hibernate.cache.RegionFactory} is asked to build specialized - regions (as opposed to just general access) is the first improvement over the legacy scheme. The - second improvement is the fact that the regions (well the ones like entity and collection regions - that are responsible for storing {@link org.hibernate.cache.TransactionalDataRegion transactional} data) are - asked to build their own access strategies (see {@link org.hibernate.cache.EntityRegion#buildAccessStrategy} - and {@link org.hibernate.cache.CollectionRegion#buildAccessStrategy}). -

Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/access/AccessType.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/access/CollectionRegionAccessStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/access/EntityRegionAccessStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/access/SoftLock.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/access/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/CacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/CacheEntryStructure.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/CollectionCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/StructuredCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/StructuredCollectionCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/StructuredMapCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/UnstructuredCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/entry/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/CacheDataDescriptionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/NoCachingRegionFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/BaseGeneralDataRegionAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/BaseRegionAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/BaseTransactionalDataRegionAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/CollectionAccessStrategyAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/CollectionRegionAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/EntityAccessStrategyAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/EntityRegionAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/OptimisticCacheSourceAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/QueryResultsRegionAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/RegionFactoryCacheProviderBridge.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/impl/bridge/TimestampsRegionAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/internal/CacheDataDescriptionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/internal/CollectionCacheInvalidator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/internal/NoCachingRegionFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/internal/RegionFactoryInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/internal/StandardQueryCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/internal/StandardQueryCacheFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/CacheDataDescription.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/CacheKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/CollectionRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/EntityRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/FilterKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/GeneralDataRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/NaturalIdCacheKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/NaturalIdRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/OptimisticCacheSource.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/QueryCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/QueryCacheFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/QueryKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/QueryResultsRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/Region.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/RegionFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/TimestampsRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/TransactionAwareCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/TransactionalDataRegion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/UpdateTimestampsCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/AccessType.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/CollectionRegionAccessStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/EntityRegionAccessStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/NaturalIdRegionAccessStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/RegionAccessStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/SoftLock.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/UnknownAccessTypeException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/access/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/CacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/CacheEntryStructure.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/CollectionCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/ReferenceCacheEntryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/StandardCacheEntryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/StructuredCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/StructuredCollectionCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/StructuredMapCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/UnstructuredCacheEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cache/spi/entry/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AbstractPropertyHolder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AccessType.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AnnotatedClassType.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AnnotationBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AnnotationConfiguration.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AttributeConversionInfo.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AttributeConverterDefinition.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/AvailableSettings.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/BaselineSessionEventsListenerBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/BinderHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ClassPropertyHolder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/CollectionPropertyHolder.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/CollectionSecondPass.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/CollectionSecondPass.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/CollectionSecondPass.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/CollectionSecondPass.java 30 Jul 2014 15:51:05 -0000 1.1.2.1 @@ -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,30 +20,32 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.util.Collections; import java.util.Iterator; import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.hibernate.MappingException; +import org.hibernate.internal.CoreMessageLogger; import org.hibernate.mapping.Collection; import org.hibernate.mapping.IndexedCollection; import org.hibernate.mapping.OneToMany; import org.hibernate.mapping.Selectable; import org.hibernate.mapping.Value; +import org.jboss.logging.Logger; + /** * Collection second pass * * @author Emmanuel Bernard */ public abstract class CollectionSecondPass implements SecondPass { - private static Logger log = LoggerFactory.getLogger( CollectionSecondPass.class ); + + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CollectionSecondPass.class.getName()); + Mappings mappings; Collection collection; private Map localInheritedMetas; @@ -60,13 +62,15 @@ public void doSecondPass(java.util.Map persistentClasses) throws MappingException { - if ( log.isDebugEnabled() ) - log.debug( "Second pass for collection: " + collection.getRole() ); + final boolean debugEnabled = LOG.isDebugEnabled(); + if ( debugEnabled ) { + LOG.debugf( "Second pass for collection: %s", collection.getRole() ); + } secondPass( persistentClasses, localInheritedMetas ); // using local since the inheritedMetas at this point is not the correct map since it is always the empty map collection.createAllKeys(); - if ( log.isDebugEnabled() ) { + if ( debugEnabled ) { String msg = "Mapped collection key: " + columns( collection.getKey() ); if ( collection.isIndexed() ) msg += ", index: " + columns( ( (IndexedCollection) collection ).getIndex() ); @@ -77,15 +81,15 @@ else { msg += ", element: " + columns( collection.getElement() ); } - log.debug( msg ); + LOG.debug( msg ); } } abstract public void secondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas) throws MappingException; private static String columns(Value val) { - StringBuffer columns = new StringBuffer(); + StringBuilder columns = new StringBuilder(); Iterator iter = val.getColumnIterator(); while ( iter.hasNext() ) { columns.append( ( (Selectable) iter.next() ).getText() ); Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ColumnsBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ComponentPropertyHolder.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/Configuration.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/Configuration.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/Configuration.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/Configuration.java 30 Jul 2014 15:51:06 -0000 1.1.2.1 @@ -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.cfg; @@ -33,31 +32,34 @@ import java.io.ObjectInputStream; import java.io.Serializable; import java.io.StringReader; -import java.lang.reflect.Array; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.StringTokenizer; import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.jar.JarFile; import java.util.zip.ZipEntry; +import javax.persistence.AttributeConverter; +import javax.persistence.Converter; +import javax.persistence.Embeddable; +import javax.persistence.Entity; +import javax.persistence.MapsId; -import org.dom4j.Attribute; -import org.dom4j.DocumentException; -import org.dom4j.Element; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; - +import org.hibernate.AnnotationException; +import org.hibernate.AssertionFailure; +import org.hibernate.DuplicateMappingException; import org.hibernate.EmptyInterceptor; import org.hibernate.HibernateException; import org.hibernate.Interceptor; @@ -66,69 +68,100 @@ import org.hibernate.MappingNotFoundException; import org.hibernate.SessionFactory; import org.hibernate.SessionFactoryObserver; +import org.hibernate.annotations.AnyMetaDef; +import org.hibernate.annotations.common.reflection.MetadataProvider; +import org.hibernate.annotations.common.reflection.MetadataProviderInjector; +import org.hibernate.annotations.common.reflection.ReflectionManager; +import org.hibernate.annotations.common.reflection.XClass; +import org.hibernate.annotations.common.reflection.java.JavaReflectionManager; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; +import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; +import org.hibernate.cfg.annotations.NamedEntityGraphDefinition; +import org.hibernate.cfg.annotations.NamedProcedureCallDefinition; +import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider; +import org.hibernate.context.spi.CurrentTenantIdentifierResolver; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.function.SQLFunction; -import org.hibernate.engine.FilterDefinition; -import org.hibernate.engine.Mapping; -import org.hibernate.event.AutoFlushEventListener; -import org.hibernate.event.DeleteEventListener; -import org.hibernate.event.DirtyCheckEventListener; -import org.hibernate.event.EventListeners; -import org.hibernate.event.EvictEventListener; -import org.hibernate.event.FlushEntityEventListener; -import org.hibernate.event.FlushEventListener; -import org.hibernate.event.InitializeCollectionEventListener; -import org.hibernate.event.LoadEventListener; -import org.hibernate.event.LockEventListener; -import org.hibernate.event.MergeEventListener; -import org.hibernate.event.PersistEventListener; -import org.hibernate.event.PostCollectionRecreateEventListener; -import org.hibernate.event.PostCollectionRemoveEventListener; -import org.hibernate.event.PostCollectionUpdateEventListener; -import org.hibernate.event.PostDeleteEventListener; -import org.hibernate.event.PostInsertEventListener; -import org.hibernate.event.PostLoadEventListener; -import org.hibernate.event.PostUpdateEventListener; -import org.hibernate.event.PreCollectionRecreateEventListener; -import org.hibernate.event.PreCollectionRemoveEventListener; -import org.hibernate.event.PreCollectionUpdateEventListener; -import org.hibernate.event.PreDeleteEventListener; -import org.hibernate.event.PreInsertEventListener; -import org.hibernate.event.PreLoadEventListener; -import org.hibernate.event.PreUpdateEventListener; -import org.hibernate.event.RefreshEventListener; -import org.hibernate.event.ReplicateEventListener; -import org.hibernate.event.SaveOrUpdateEventListener; +import org.hibernate.engine.ResultSetMappingDefinition; +import org.hibernate.engine.jdbc.spi.JdbcServices; +import org.hibernate.engine.spi.FilterDefinition; +import org.hibernate.engine.spi.Mapping; +import org.hibernate.engine.spi.NamedQueryDefinition; +import org.hibernate.engine.spi.NamedSQLQueryDefinition; import org.hibernate.id.IdentifierGenerator; +import org.hibernate.id.IdentifierGeneratorAggregator; import org.hibernate.id.PersistentIdentifierGenerator; -import org.hibernate.impl.SessionFactoryImpl; +import org.hibernate.id.factory.IdentifierGeneratorFactory; +import org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory; +import org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.SessionFactoryImpl; +import org.hibernate.internal.util.ClassLoaderHelper; +import org.hibernate.internal.util.ConfigHelper; +import org.hibernate.internal.util.ReflectHelper; +import org.hibernate.internal.util.SerializationHelper; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.collections.ArrayHelper; +import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.internal.util.collections.JoinedIterator; +import org.hibernate.internal.util.config.ConfigurationHelper; +import org.hibernate.internal.util.xml.ErrorLogger; +import org.hibernate.internal.util.xml.MappingReader; +import org.hibernate.internal.util.xml.Origin; +import org.hibernate.internal.util.xml.OriginImpl; +import org.hibernate.internal.util.xml.XMLHelper; +import org.hibernate.internal.util.xml.XmlDocument; +import org.hibernate.internal.util.xml.XmlDocumentImpl; import org.hibernate.mapping.AuxiliaryDatabaseObject; import org.hibernate.mapping.Collection; +import org.hibernate.mapping.Column; +import org.hibernate.mapping.Constraint; +import org.hibernate.mapping.DenormalizedTable; +import org.hibernate.mapping.FetchProfile; import org.hibernate.mapping.ForeignKey; +import org.hibernate.mapping.IdGenerator; import org.hibernate.mapping.IdentifierCollection; import org.hibernate.mapping.Index; +import org.hibernate.mapping.Join; +import org.hibernate.mapping.MappedSuperclass; +import org.hibernate.mapping.MetadataSource; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.RootClass; import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.Table; +import org.hibernate.mapping.TypeDef; import org.hibernate.mapping.UniqueKey; +import org.hibernate.metamodel.spi.TypeContributions; +import org.hibernate.metamodel.spi.TypeContributor; import org.hibernate.proxy.EntityNotFoundDelegate; -import org.hibernate.secure.JACCConfiguration; +import org.hibernate.secure.spi.GrantedPermission; +import org.hibernate.secure.spi.JaccPermissionDeclarations; +import org.hibernate.service.ServiceRegistry; import org.hibernate.tool.hbm2ddl.DatabaseMetadata; +import org.hibernate.tool.hbm2ddl.IndexMetadata; +import org.hibernate.tool.hbm2ddl.SchemaUpdateScript; import org.hibernate.tool.hbm2ddl.TableMetadata; +import org.hibernate.tool.hbm2ddl.UniqueConstraintSchemaUpdateStrategy; +import org.hibernate.tuple.entity.EntityTuplizerFactory; +import org.hibernate.type.BasicType; import org.hibernate.type.SerializationException; import org.hibernate.type.Type; -import org.hibernate.util.ArrayHelper; -import org.hibernate.util.CollectionHelper; -import org.hibernate.util.ConfigHelper; -import org.hibernate.util.PropertiesHelper; -import org.hibernate.util.ReflectHelper; -import org.hibernate.util.SerializationHelper; -import org.hibernate.util.StringHelper; -import org.hibernate.util.XMLHelper; +import org.hibernate.type.TypeResolver; +import org.hibernate.usertype.CompositeUserType; +import org.hibernate.usertype.UserType; +import org.jboss.logging.Logger; + +import org.dom4j.Attribute; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; + /** * An instance of Configuration allows the application * to specify properties and mapping documents to be used when @@ -142,79 +175,115 @@ *
* A new Configuration will use the properties specified in * hibernate.properties by default. + *

+ * NOTE : This will be replaced by use of {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder} and + * {@link org.hibernate.metamodel.MetadataSources} instead after the 4.0 release at which point this class will become + * deprecated and scheduled for removal in 5.0. See + * HHH-6183, + * HHH-2578 and + * HHH-6586 for details * * @author Gavin King * @see org.hibernate.SessionFactory */ +@SuppressWarnings( {"UnusedDeclaration"}) public class Configuration implements Serializable { - private static Logger log = LoggerFactory.getLogger( Configuration.class ); + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Configuration.class.getName()); - protected Map classes; - protected Map imports; - protected Map collections; - protected Map tables; - protected List auxiliaryDatabaseObjects; - protected Map sqlFunctions; - protected Map namedQueries; - protected Map namedSqlQueries; + public static final String DEFAULT_CACHE_CONCURRENCY_STRATEGY = AvailableSettings.DEFAULT_CACHE_CONCURRENCY_STRATEGY; + + public static final String USE_NEW_ID_GENERATOR_MAPPINGS = AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS; + + public static final String ARTEFACT_PROCESSING_ORDER = "hibernate.mapping.precedence"; + /** - * Map result set name, result set description + * Class name of the class needed to enable Search. */ - protected Map sqlResultSetMappings; - protected Map filterDefinitions; - protected List secondPasses; - protected List propertyReferences; -// protected List extendsQueue; - protected Map extendsQueue; + private static final String SEARCH_STARTUP_CLASS = "org.hibernate.search.event.EventListenerRegister"; + + /** + * Method to call to enable Search. + */ + private static final String SEARCH_STARTUP_METHOD = "enableHibernateSearch"; + + protected MetadataSourceQueue metadataSourceQueue; + private transient ReflectionManager reflectionManager; + + protected Map classes; + protected Map imports; + protected Map collections; + protected Map tables; + protected List auxiliaryDatabaseObjects; + + protected Map namedQueries; + protected Map namedSqlQueries; + protected Map namedProcedureCallMap; + protected Map sqlResultSetMappings; + protected Map namedEntityGraphMap; + + protected Map typeDefs; + protected Map filterDefinitions; + protected Map fetchProfiles; + protected Map tableNameBinding; protected Map columnNameBindingPerTable; + + protected List secondPasses; + protected List propertyReferences; + protected Map extendsQueue; + + protected Map sqlFunctions; + + private TypeResolver typeResolver = new TypeResolver(); + private List typeContributorRegistrations = new ArrayList(); + + private EntityTuplizerFactory entityTuplizerFactory; +// private ComponentTuplizerFactory componentTuplizerFactory; todo : HHH-3517 and HHH-1907 + private Interceptor interceptor; private Properties properties; private EntityResolver entityResolver; private EntityNotFoundDelegate entityNotFoundDelegate; protected transient XMLHelper xmlHelper; - protected transient Map typeDefs; - protected NamingStrategy namingStrategy; + private SessionFactoryObserver sessionFactoryObserver; - private EventListeners eventListeners; - protected final SettingsFactory settingsFactory; - private SessionFactoryObserver sessionFactoryObserver; + private transient Mapping mapping = buildMapping(); - protected void reset() { - classes = new HashMap(); - imports = new HashMap(); - collections = new HashMap(); - tables = new TreeMap(); - namedQueries = new HashMap(); - namedSqlQueries = new HashMap(); - sqlResultSetMappings = new HashMap(); - xmlHelper = new XMLHelper(); - typeDefs = new HashMap(); - propertyReferences = new ArrayList(); - secondPasses = new ArrayList(); - interceptor = EmptyInterceptor.INSTANCE; - properties = Environment.getProperties(); - entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER; - eventListeners = new EventListeners(); - filterDefinitions = new HashMap(); -// extendsQueue = new ArrayList(); - extendsQueue = new HashMap(); - auxiliaryDatabaseObjects = new ArrayList(); - tableNameBinding = new HashMap(); - columnNameBindingPerTable = new HashMap(); - namingStrategy = DefaultNamingStrategy.INSTANCE; - sqlFunctions = new HashMap(); - } + private MutableIdentifierGeneratorFactory identifierGeneratorFactory; - private transient Mapping mapping = buildMapping(); + private Map, org.hibernate.mapping.MappedSuperclass> mappedSuperClasses; + private Map namedGenerators; + private Map> joins; + private Map classTypes; + private Set defaultNamedQueryNames; + private Set defaultNamedNativeQueryNames; + private Set defaultSqlResultSetMappingNames; + private Set defaultNamedProcedure; + private Set defaultNamedGenerators; + private Map generatorTables; + private Map> uniqueConstraintHoldersByTable; + private Map> jpaIndexHoldersByTable; + private Map mappedByResolver; + private Map propertyRefResolver; + private Map anyMetaDefs; + private List caches; + private boolean inSecondPass = false; + private boolean isDefaultProcessed = false; + private boolean isValidatorNotPresentLogged; + private Map> propertiesAnnotatedWithMapsId; + private Map> propertiesAnnotatedWithIdAndToOne; + private CurrentTenantIdentifierResolver currentTenantIdentifierResolver; + private boolean specjProprietarySyntaxEnabled; + private ConcurrentHashMap attributeConverterDefinitionsByClass; + protected Configuration(SettingsFactory settingsFactory) { this.settingsFactory = settingsFactory; reset(); @@ -224,12 +293,88 @@ this( new SettingsFactory() ); } + protected void reset() { + metadataSourceQueue = new MetadataSourceQueue(); + createReflectionManager(); + + classes = new HashMap(); + imports = new HashMap(); + collections = new HashMap(); + tables = new TreeMap(); + + namedQueries = new HashMap(); + namedSqlQueries = new HashMap(); + sqlResultSetMappings = new HashMap(); + namedEntityGraphMap = new HashMap(); + namedProcedureCallMap = new HashMap( ); + typeDefs = new HashMap(); + filterDefinitions = new HashMap(); + fetchProfiles = new HashMap(); + auxiliaryDatabaseObjects = new ArrayList(); + + tableNameBinding = new HashMap(); + columnNameBindingPerTable = new HashMap(); + + secondPasses = new ArrayList(); + propertyReferences = new ArrayList(); + extendsQueue = new HashMap(); + + xmlHelper = new XMLHelper(); + interceptor = EmptyInterceptor.INSTANCE; + properties = Environment.getProperties(); + entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER; + + sqlFunctions = new HashMap(); + + entityTuplizerFactory = new EntityTuplizerFactory(); +// componentTuplizerFactory = new ComponentTuplizerFactory(); + + identifierGeneratorFactory = new DefaultIdentifierGeneratorFactory(); + + mappedSuperClasses = new HashMap, MappedSuperclass>(); + + metadataSourcePrecedence = Collections.emptyList(); + + namedGenerators = new HashMap(); + joins = new HashMap>(); + classTypes = new HashMap(); + generatorTables = new HashMap(); + defaultNamedQueryNames = new HashSet(); + defaultNamedNativeQueryNames = new HashSet(); + defaultSqlResultSetMappingNames = new HashSet(); + defaultNamedProcedure = new HashSet( ); + defaultNamedGenerators = new HashSet(); + uniqueConstraintHoldersByTable = new HashMap>(); + jpaIndexHoldersByTable = new HashMap>( ); + mappedByResolver = new HashMap(); + propertyRefResolver = new HashMap(); + caches = new ArrayList(); + namingStrategy = EJB3NamingStrategy.INSTANCE; + setEntityResolver( new EJB3DTDEntityResolver() ); + anyMetaDefs = new HashMap(); + propertiesAnnotatedWithMapsId = new HashMap>(); + propertiesAnnotatedWithIdAndToOne = new HashMap>(); + specjProprietarySyntaxEnabled = System.getProperty( "hibernate.enable_specj_proprietary_syntax" ) != null; + } + + public EntityTuplizerFactory getEntityTuplizerFactory() { + return entityTuplizerFactory; + } + + public ReflectionManager getReflectionManager() { + return reflectionManager; + } + +// public ComponentTuplizerFactory getComponentTuplizerFactory() { +// return componentTuplizerFactory; +// } + /** * Iterate the entity mappings * * @return Iterator of the entity mappings currently contained in the configuration. */ - public Iterator getClassMappings() { + public Iterator getClassMappings() { return classes.values().iterator(); } @@ -247,18 +392,39 @@ * * @return Iterator of the table mappings currently contained in the configuration. */ - public Iterator getTableMappings() { + public Iterator getTableMappings() { return tables.values().iterator(); } /** + * Iterate the mapped super class mappings + * EXPERIMENTAL Consider this API as PRIVATE + * + * @return iterator over the MappedSuperclass mapping currently contained in the configuration. + */ + public Iterator getMappedSuperclassMappings() { + return mappedSuperClasses.values().iterator(); + } + + /** + * Get a copy of all known MappedSuperclasses + *

+ * EXPERIMENTAL Consider this API as PRIVATE + * + * @return Set of all known MappedSuperclasses + */ + public java.util.Set getMappedSuperclassMappingsCopy() { + return new HashSet( mappedSuperClasses.values() ); + } + + /** * Get the mapping for a particular entity * * @param entityName An entity name. * @return the entity mapping information */ public PersistentClass getClassMapping(String entityName) { - return (PersistentClass) classes.get( entityName ); + return classes.get( entityName ); } /** @@ -268,13 +434,13 @@ * @return The collection mapping information */ public Collection getCollectionMapping(String role) { - return (Collection) collections.get( role ); + return collections.get( role ); } /** * Set a custom entity resolver. This entity resolver must be * set before addXXX(misc) call. - * Default value is {@link org.hibernate.util.DTDEntityResolver} + * Default value is {@link org.hibernate.internal.util.xml.DTDEntityResolver} * * @param entityResolver entity resolver to use */ @@ -325,34 +491,57 @@ * * @param xmlFile a path to a file * @return this (for method chaining purposes) - * @throws org.hibernate.MappingException Indicates inability to locate or parse - * the specified mapping file. + * @throws MappingException Indicates inability to locate the specified mapping file. Historically this could + * have indicated a problem parsing the XML document, but that is now delayed until after {@link #buildMappings} */ - public Configuration addFile(File xmlFile) throws MappingException { - log.info( "Reading mappings from file: " + xmlFile.getPath() ); - if ( !xmlFile.exists() ) { - throw new MappingNotFoundException( "file", xmlFile.toString() ); - } + public Configuration addFile(final File xmlFile) throws MappingException { + LOG.readingMappingsFromFile( xmlFile.getPath() ); + final String name = xmlFile.getAbsolutePath(); + final InputSource inputSource; try { - List errors = new ArrayList(); - org.dom4j.Document doc = xmlHelper.createSAXReader( xmlFile.toString(), errors, entityResolver ).read( xmlFile ); - if ( errors.size() != 0 ) { - throw new InvalidMappingException( "file", xmlFile.toString(), ( Throwable ) errors.get( 0 ) ); - } - add( doc ); - return this; + inputSource = new InputSource( new FileInputStream( xmlFile ) ); } - catch ( InvalidMappingException e ) { - throw e; + catch ( FileNotFoundException e ) { + throw new MappingNotFoundException( "file", xmlFile.toString() ); } - catch ( MappingNotFoundException e ) { - throw e; + add( inputSource, "file", name ); + return this; + } + + private XmlDocument add(InputSource inputSource, String originType, String originName) { + return add( inputSource, new OriginImpl( originType, originName ) ); + } + + private XmlDocument add(InputSource inputSource, Origin origin) { + XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument( entityResolver, inputSource, origin ); + add( metadataXml ); + return metadataXml; + } + + public void add(XmlDocument metadataXml) { + if ( inSecondPass || !isOrmXml( metadataXml ) ) { + metadataSourceQueue.add( metadataXml ); } - catch ( Exception e ) { - throw new InvalidMappingException( "file", xmlFile.toString(), e ); + else { + final MetadataProvider metadataProvider = ( (MetadataProviderInjector) reflectionManager ).getMetadataProvider(); + JPAMetadataProvider jpaMetadataProvider = ( JPAMetadataProvider ) metadataProvider; + List classNames = jpaMetadataProvider.getXMLContext().addDocument( metadataXml.getDocumentTree() ); + for ( String className : classNames ) { + try { + metadataSourceQueue.add( reflectionManager.classForName( className, this.getClass() ) ); + } + catch ( ClassNotFoundException e ) { + throw new AnnotationException( "Unable to load class defined in XML: " + className, e ); + } + } + jpaMetadataProvider.getXMLContext().applyDiscoveredAttributeConverters( this ); } } + private static boolean isOrmXml(XmlDocument xmlDocument) { + return "entity-mappings".equals( xmlDocument.getDocumentTree().getRootElement().getName() ); + } + /** * Add a cached mapping file. A cached file is a serialized representation * of the DOM structure of a particular mapping. It is saved from a previous @@ -370,70 +559,73 @@ * the non-cached file. */ public Configuration addCacheableFile(File xmlFile) throws MappingException { + File cachedFile = determineCachedDomFile( xmlFile ); + try { - File cachedFile = new File( xmlFile.getAbsolutePath() + ".bin" ); - org.dom4j.Document doc = null; + return addCacheableFileStrictly( xmlFile ); + } + catch ( SerializationException e ) { + LOG.unableToDeserializeCache( cachedFile.getPath(), e ); + } + catch ( FileNotFoundException e ) { + LOG.cachedFileNotFound( cachedFile.getPath(), e ); + } - final boolean useCachedFile = xmlFile.exists() && - cachedFile.exists() && - xmlFile.lastModified() < cachedFile.lastModified(); + final String name = xmlFile.getAbsolutePath(); + final InputSource inputSource; + try { + inputSource = new InputSource( new FileInputStream( xmlFile ) ); + } + catch ( FileNotFoundException e ) { + throw new MappingNotFoundException( "file", xmlFile.toString() ); + } - if ( useCachedFile ) { - try { - log.info( "Reading mappings from cache file: " + cachedFile ); - doc = ( org.dom4j.Document ) SerializationHelper.deserialize( new FileInputStream( cachedFile ) ); - } - catch ( SerializationException e ) { - log.warn( "Could not deserialize cache file: " + cachedFile.getPath(), e ); - } - catch ( FileNotFoundException e ) { - log.warn( "I/O reported cached file could not be found : " + cachedFile.getPath(), e ); - } - } + LOG.readingMappingsFromFile( xmlFile.getPath() ); + XmlDocument metadataXml = add( inputSource, "file", name ); - // if doc is null, then for whatever reason, the cached file cannot be used... - if ( doc == null ) { - if ( !xmlFile.exists() ) { - throw new MappingNotFoundException( "file", xmlFile.toString() ); - } + try { + LOG.debugf( "Writing cache file for: %s to: %s", xmlFile, cachedFile ); + SerializationHelper.serialize( ( Serializable ) metadataXml.getDocumentTree(), new FileOutputStream( cachedFile ) ); + } + catch ( Exception e ) { + LOG.unableToWriteCachedFile( cachedFile.getPath(), e.getMessage() ); + } - log.info( "Reading mappings from file: " + xmlFile ); - List errors = new ArrayList(); - try { - doc = xmlHelper.createSAXReader( xmlFile.getAbsolutePath(), errors, entityResolver ).read( xmlFile ); - if ( errors.size() != 0 ) { - throw new MappingException( "invalid mapping", ( Throwable ) errors.get( 0 ) ); - } - } - catch( DocumentException e){ - throw new MappingException( "invalid mapping", e ); - } + return this; + } - try { - log.debug( "Writing cache file for: " + xmlFile + " to: " + cachedFile ); - SerializationHelper.serialize( ( Serializable ) doc, new FileOutputStream( cachedFile ) ); - } - catch ( SerializationException e ) { - log.warn( "Could not write cached file: " + cachedFile, e ); - } - catch ( FileNotFoundException e ) { - log.warn( "I/O reported error writing cached file : " + cachedFile.getPath(), e ); - } - } + private File determineCachedDomFile(File xmlFile) { + return new File( xmlFile.getAbsolutePath() + ".bin" ); + } - add( doc ); - return this; + /** + * INTENDED FOR TESTSUITE USE ONLY! + *

+ * Much like {@link #addCacheableFile(File)} except that here we will fail immediately if + * the cache version cannot be found or used for whatever reason + * + * @param xmlFile The xml file, not the bin! + * + * @return The dom "deserialized" from the cached file. + * + * @throws SerializationException Indicates a problem deserializing the cached dom tree + * @throws FileNotFoundException Indicates that the cached file was not found or was not usable. + */ + public Configuration addCacheableFileStrictly(File xmlFile) throws SerializationException, FileNotFoundException { + final File cachedFile = determineCachedDomFile( xmlFile ); + final boolean useCachedFile = xmlFile.exists() + && cachedFile.exists() + && xmlFile.lastModified() < cachedFile.lastModified(); + + if ( ! useCachedFile ) { + throw new FileNotFoundException( "Cached file could not be found or could not be used" ); } - catch ( InvalidMappingException e ) { - throw e; - } - catch ( MappingNotFoundException e ) { - throw e; - } - catch ( Exception e ) { - throw new InvalidMappingException( "file", xmlFile.toString(), e ); - } + + LOG.readingCachedMappings( cachedFile ); + Document document = ( Document ) SerializationHelper.deserialize( new FileInputStream( cachedFile ) ); + add( new XmlDocumentImpl( document, "file", xmlFile.getAbsolutePath() ) ); + return this; } /** @@ -460,21 +652,9 @@ * given XML string */ public Configuration addXML(String xml) throws MappingException { - if ( log.isDebugEnabled() ) { - log.debug( "Mapping XML:\n" + xml ); - } - try { - List errors = new ArrayList(); - org.dom4j.Document doc = xmlHelper.createSAXReader( "XML String", errors, entityResolver ) - .read( new StringReader( xml ) ); - if ( errors.size() != 0 ) { - throw new MappingException( "invalid mapping", (Throwable) errors.get( 0 ) ); - } - add( doc ); - } - catch (DocumentException e) { - throw new MappingException( "Could not parse mapping document in XML string", e ); - } + LOG.debugf( "Mapping XML:\n%s", xml ); + final InputSource inputSource = new InputSource( new StringReader( xml ) ); + add( inputSource, "string", "XML String" ); return this; } @@ -487,21 +667,34 @@ * the mapping document. */ public Configuration addURL(URL url) throws MappingException { - if ( log.isDebugEnabled() ) { - log.debug( "Reading mapping document from URL:" + url.toExternalForm() ); - } + final String urlExternalForm = url.toExternalForm(); + + LOG.debugf( "Reading mapping document from URL : %s", urlExternalForm ); + try { - addInputStream( url.openStream() ); + add( url.openStream(), "URL", urlExternalForm ); } - catch ( InvalidMappingException e ) { - throw new InvalidMappingException( "URL", url.toExternalForm(), e.getCause() ); + catch ( IOException e ) { + throw new InvalidMappingException( "Unable to open url stream [" + urlExternalForm + "]", "URL", urlExternalForm, e ); } - catch (Exception e) { - throw new InvalidMappingException( "URL", url.toExternalForm(), e ); - } return this; } + private XmlDocument add(InputStream inputStream, final String type, final String name) { + final InputSource inputSource = new InputSource( inputStream ); + try { + return add( inputSource, type, name ); + } + finally { + try { + inputStream.close(); + } + catch ( IOException ignore ) { + LOG.trace( "Was unable to close input stream"); + } + } + } + /** * Read mappings from a DOM Document * @@ -510,11 +703,12 @@ * @throws MappingException Indicates problems reading the DOM or processing * the mapping document. */ - public Configuration addDocument(Document doc) throws MappingException { - if ( log.isDebugEnabled() ) { - log.debug( "Mapping document:\n" + doc ); - } - add( xmlHelper.createDOMReader().read( doc ) ); + public Configuration addDocument(org.w3c.dom.Document doc) throws MappingException { + LOG.debugf( "Mapping Document:\n%s", doc ); + + final Document document = xmlHelper.createDOMReader().read( doc ); + add( new XmlDocumentImpl( document, "unknown", null ) ); + return this; } @@ -527,27 +721,8 @@ * processing the contained mapping document. */ public Configuration addInputStream(InputStream xmlInputStream) throws MappingException { - try { - List errors = new ArrayList(); - org.dom4j.Document doc = xmlHelper.createSAXReader( "XML InputStream", errors, entityResolver ) - .read( new InputSource( xmlInputStream ) ); - if ( errors.size() != 0 ) { - throw new InvalidMappingException( "invalid mapping", null, (Throwable) errors.get( 0 ) ); - } - add( doc ); - return this; - } - catch (DocumentException e) { - throw new InvalidMappingException( "input stream", null, e ); - } - finally { - try { - xmlInputStream.close(); - } - catch (IOException ioe) { - log.warn( "Could not close input stream", ioe ); - } - } + add( xmlInputStream, "input stream", null ); + return this; } /** @@ -560,51 +735,43 @@ * processing the contained mapping document. */ public Configuration addResource(String resourceName, ClassLoader classLoader) throws MappingException { - log.info( "Reading mappings from resource: " + resourceName ); - InputStream rsrc = classLoader.getResourceAsStream( resourceName ); - if ( rsrc == null ) { + LOG.readingMappingsFromResource( resourceName ); + InputStream resourceInputStream = classLoader.getResourceAsStream( resourceName ); + if ( resourceInputStream == null ) { throw new MappingNotFoundException( "resource", resourceName ); } - try { - return addInputStream( rsrc ); - } - catch (MappingException me) { - throw new InvalidMappingException( "resource", resourceName, me ); - } + add( resourceInputStream, "resource", resourceName ); + return this; } /** * Read mappings as a application resourceName (i.e. classpath lookup) - * trying different classloaders. + * trying different class loaders. * * @param resourceName The resource name * @return this (for method chaining purposes) * @throws MappingException Indicates problems locating the resource or * processing the contained mapping document. */ public Configuration addResource(String resourceName) throws MappingException { - log.info( "Reading mappings from resource : " + resourceName ); - ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - InputStream rsrc = null; - if (contextClassLoader!=null) { - rsrc = contextClassLoader.getResourceAsStream( resourceName ); + LOG.readingMappingsFromResource( resourceName ); + ClassLoader contextClassLoader = ClassLoaderHelper.getContextClassLoader(); + InputStream resourceInputStream = null; + if ( contextClassLoader != null ) { + resourceInputStream = contextClassLoader.getResourceAsStream( resourceName ); } - if ( rsrc == null ) { - rsrc = Environment.class.getClassLoader().getResourceAsStream( resourceName ); + if ( resourceInputStream == null ) { + resourceInputStream = Environment.class.getClassLoader().getResourceAsStream( resourceName ); } - if ( rsrc == null ) { + if ( resourceInputStream == null ) { throw new MappingNotFoundException( "resource", resourceName ); } - try { - return addInputStream( rsrc ); - } - catch (MappingException me) { - throw new InvalidMappingException( "resource", resourceName, me ); - } + add( resourceInputStream, "resource", resourceName ); + return this; } /** - * Read a mapping as an application resouurce using the convention that a class + * Read a mapping as an application resource using the convention that a class * named foo.bar.Foo is mapped by a file foo/bar/Foo.hbm.xml * which can be resolved as a classpath resource. * @@ -615,11 +782,46 @@ */ public Configuration addClass(Class persistentClass) throws MappingException { String mappingResourceName = persistentClass.getName().replace( '.', '/' ) + ".hbm.xml"; - log.info( "Reading mappings from resource: " + mappingResourceName ); + LOG.readingMappingsFromResource( mappingResourceName ); return addResource( mappingResourceName, persistentClass.getClassLoader() ); } /** + * Read metadata from the annotations associated with this class. + * + * @param annotatedClass The class containing annotations + * + * @return this (for method chaining) + */ + @SuppressWarnings({ "unchecked" }) + public Configuration addAnnotatedClass(Class annotatedClass) { + XClass xClass = reflectionManager.toXClass( annotatedClass ); + metadataSourceQueue.add( xClass ); + return this; + } + + /** + * Read package-level metadata. + * + * @param packageName java package name + * + * @return this (for method chaining) + * + * @throws MappingException in case there is an error in the mapping data + */ + public Configuration addPackage(String packageName) throws MappingException { + LOG.debugf( "Mapping Package %s", packageName ); + try { + AnnotationBinder.bindPackage( packageName, createMappings() ); + return this; + } + catch ( MappingException me ) { + LOG.unableToParseMetadata( packageName ); + throw me; + } + } + + /** * Read all mappings from a jar file *

* Assumes that any file named *.hbm.xml is a mapping document. @@ -630,7 +832,7 @@ * processing the contained mapping documents. */ public Configuration addJar(File jar) throws MappingException { - log.info( "Searching for mapping documents in jar: " + jar.getName() ); + LOG.searchingForMappingDocuments( jar.getName() ); JarFile jarFile = null; try { try { @@ -646,7 +848,7 @@ while ( jarEntries.hasMoreElements() ) { ZipEntry ze = (ZipEntry) jarEntries.nextElement(); if ( ze.getName().endsWith( ".hbm.xml" ) ) { - log.info( "Found mapping document in jar: " + ze.getName() ); + LOG.foundMappingDocument( ze.getName() ); try { addInputStream( jarFile.getInputStream( ze ) ); } @@ -668,7 +870,7 @@ } } catch (IOException ioe) { - log.error("could not close jar", ioe); + LOG.unableToCloseJar( ioe.getMessage() ); } } @@ -687,92 +889,68 @@ */ public Configuration addDirectory(File dir) throws MappingException { File[] files = dir.listFiles(); - for ( int i = 0; i < files.length ; i++ ) { - if ( files[i].isDirectory() ) { - addDirectory( files[i] ); + if ( files != null ) { + for ( File file : files ) { + if ( file.isDirectory() ) { + addDirectory( file ); + } + else if ( file.getName().endsWith( ".hbm.xml" ) ) { + addFile( file ); + } } - else if ( files[i].getName().endsWith( ".hbm.xml" ) ) { - addFile( files[i] ); - } } return this; } - protected void add(org.dom4j.Document doc) throws MappingException { - HbmBinder.bindRoot( doc, createMappings(), CollectionHelper.EMPTY_MAP ); - } - /** - * Create a new Mappings to add class and collection - * mappings to. + * Create a new Mappings to add class and collection mappings to. + * + * @return The created mappings */ public Mappings createMappings() { - return new Mappings( - classes, - collections, - tables, - namedQueries, - namedSqlQueries, - sqlResultSetMappings, - imports, - secondPasses, - propertyReferences, - namingStrategy, - typeDefs, - filterDefinitions, - extendsQueue, - auxiliaryDatabaseObjects, - tableNameBinding, - columnNameBindingPerTable - ); + return new MappingsImpl(); } - private Iterator iterateGenerators(Dialect dialect) throws MappingException { + @SuppressWarnings({ "unchecked" }) + public Iterator iterateGenerators(Dialect dialect) throws MappingException { TreeMap generators = new TreeMap(); String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG ); String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA ); - Iterator iter = classes.values().iterator(); - while ( iter.hasNext() ) { - PersistentClass pc = (PersistentClass) iter.next(); - + for ( PersistentClass pc : classes.values() ) { if ( !pc.isInherited() ) { + IdentifierGenerator ig = pc.getIdentifier().createIdentifierGenerator( + getIdentifierGeneratorFactory(), + dialect, + defaultCatalog, + defaultSchema, + (RootClass) pc + ); - IdentifierGenerator ig = pc.getIdentifier() - .createIdentifierGenerator( - dialect, - defaultCatalog, - defaultSchema, - (RootClass) pc - ); - if ( ig instanceof PersistentIdentifierGenerator ) { generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig ); } - + else if ( ig instanceof IdentifierGeneratorAggregator ) { + ( (IdentifierGeneratorAggregator) ig ).registerPersistentGenerators( generators ); + } } } - iter = collections.values().iterator(); - while ( iter.hasNext() ) { - Collection collection = (Collection) iter.next(); - + for ( Collection collection : collections.values() ) { if ( collection.isIdentified() ) { + IdentifierGenerator ig = ( ( IdentifierCollection ) collection ).getIdentifier().createIdentifierGenerator( + getIdentifierGeneratorFactory(), + dialect, + defaultCatalog, + defaultSchema, + null + ); - IdentifierGenerator ig = ( (IdentifierCollection) collection ).getIdentifier() - .createIdentifierGenerator( - dialect, - defaultCatalog, - defaultSchema, - null - ); - if ( ig instanceof PersistentIdentifierGenerator ) { generators.put( ( (PersistentIdentifierGenerator) ig ).generatorKey(), ig ); } - } } @@ -782,34 +960,41 @@ /** * Generate DDL for dropping tables * + * @param dialect The dialect for which to generate the drop script + + * @return The sequence of DDL commands to drop the schema objects + + * @throws HibernateException Generally indicates a problem calling {@link #buildMappings()} + * @see org.hibernate.tool.hbm2ddl.SchemaExport */ public String[] generateDropSchemaScript(Dialect dialect) throws HibernateException { - secondPassCompile(); String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG ); String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA ); - ArrayList script = new ArrayList( 50 ); + ArrayList script = new ArrayList( 50 ); // drop them in reverse order in case db needs it done that way... - ListIterator itr = auxiliaryDatabaseObjects.listIterator( auxiliaryDatabaseObjects.size() ); - while ( itr.hasPrevious() ) { - AuxiliaryDatabaseObject object = (AuxiliaryDatabaseObject) itr.previous(); - if ( object.appliesToDialect( dialect ) ) { - script.add( object.sqlDropString( dialect, defaultCatalog, defaultSchema ) ); + { + ListIterator itr = auxiliaryDatabaseObjects.listIterator( auxiliaryDatabaseObjects.size() ); + while ( itr.hasPrevious() ) { + AuxiliaryDatabaseObject object = (AuxiliaryDatabaseObject) itr.previous(); + if ( object.appliesToDialect( dialect ) ) { + script.add( object.sqlDropString( dialect, defaultCatalog, defaultSchema ) ); + } } } if ( dialect.dropConstraints() ) { - Iterator iter = getTableMappings(); - while ( iter.hasNext() ) { - Table table = (Table) iter.next(); + Iterator itr = getTableMappings(); + while ( itr.hasNext() ) { + Table table = (Table) itr.next(); if ( table.isPhysicalTable() ) { - Iterator subIter = table.getForeignKeyIterator(); - while ( subIter.hasNext() ) { - ForeignKey fk = (ForeignKey) subIter.next(); + Iterator subItr = table.getForeignKeyIterator(); + while ( subItr.hasNext() ) { + ForeignKey fk = (ForeignKey) subItr.next(); if ( fk.isPhysicalConstraint() ) { script.add( fk.sqlDropString( @@ -825,10 +1010,10 @@ } - Iterator iter = getTableMappings(); - while ( iter.hasNext() ) { + Iterator itr = getTableMappings(); + while ( itr.hasNext() ) { - Table table = (Table) iter.next(); + Table table = (Table) itr.next(); if ( table.isPhysicalTable() ) { /*Iterator subIter = table.getIndexIterator(); @@ -851,26 +1036,29 @@ } - iter = iterateGenerators( dialect ); - while ( iter.hasNext() ) { - String[] lines = ( (PersistentIdentifierGenerator) iter.next() ).sqlDropStrings( dialect ); - for ( int i = 0; i < lines.length ; i++ ) { - script.add( lines[i] ); - } + itr = iterateGenerators( dialect ); + while ( itr.hasNext() ) { + String[] lines = ( (PersistentIdentifierGenerator) itr.next() ).sqlDropStrings( dialect ); + script.addAll( Arrays.asList( lines ) ); } return ArrayHelper.toStringArray( script ); } /** - * Generate DDL for creating tables + * @param dialect The dialect for which to generate the creation script * + * @return The sequence of DDL commands to create the schema objects + * + * @throws HibernateException Generally indicates a problem calling {@link #buildMappings()} + * * @see org.hibernate.tool.hbm2ddl.SchemaExport */ + @SuppressWarnings({ "unchecked" }) public String[] generateSchemaCreationScript(Dialect dialect) throws HibernateException { secondPassCompile(); - ArrayList script = new ArrayList( 50 ); + ArrayList script = new ArrayList( 50 ); String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG ); String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA ); @@ -886,7 +1074,7 @@ defaultSchema ) ); - Iterator comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema ); + Iterator comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema ); while ( comments.hasNext() ) { script.add( comments.next() ); } @@ -898,17 +1086,15 @@ Table table = (Table) iter.next(); if ( table.isPhysicalTable() ) { - if ( !dialect.supportsUniqueConstraintInCreateAlterTable() ) { - Iterator subIter = table.getUniqueKeyIterator(); - while ( subIter.hasNext() ) { - UniqueKey uk = (UniqueKey) subIter.next(); - String constraintString = uk.sqlCreateString( dialect, mapping, defaultCatalog, defaultSchema ); - if (constraintString != null) script.add( constraintString ); - } + Iterator subIter = table.getUniqueKeyIterator(); + while ( subIter.hasNext() ) { + UniqueKey uk = (UniqueKey) subIter.next(); + String constraintString = uk.sqlCreateString( dialect, mapping, defaultCatalog, defaultSchema ); + if (constraintString != null) script.add( constraintString ); } - Iterator subIter = table.getIndexIterator(); + subIter = table.getIndexIterator(); while ( subIter.hasNext() ) { Index index = (Index) subIter.next(); script.add( @@ -920,9 +1106,17 @@ ) ); } + } + } + // Foreign keys must be created *after* unique keys for numerous DBs. See HH-8390. + iter = getTableMappings(); + while ( iter.hasNext() ) { + Table table = (Table) iter.next(); + if ( table.isPhysicalTable() ) { + if ( dialect.hasAlterTable() ) { - subIter = table.getForeignKeyIterator(); + Iterator subIter = table.getForeignKeyIterator(); while ( subIter.hasNext() ) { ForeignKey fk = (ForeignKey) subIter.next(); if ( fk.isPhysicalConstraint() ) { @@ -943,74 +1137,85 @@ iter = iterateGenerators( dialect ); while ( iter.hasNext() ) { String[] lines = ( (PersistentIdentifierGenerator) iter.next() ).sqlCreateStrings( dialect ); - for ( int i = 0; i < lines.length ; i++ ) { - script.add( lines[i] ); - } + script.addAll( Arrays.asList( lines ) ); } - Iterator itr = auxiliaryDatabaseObjects.iterator(); - while ( itr.hasNext() ) { - AuxiliaryDatabaseObject object = (AuxiliaryDatabaseObject) itr.next(); - if ( object.appliesToDialect( dialect ) ) { - script.add( object.sqlCreateString( dialect, mapping, defaultCatalog, defaultSchema ) ); + for ( AuxiliaryDatabaseObject auxiliaryDatabaseObject : auxiliaryDatabaseObjects ) { + if ( auxiliaryDatabaseObject.appliesToDialect( dialect ) ) { + script.add( auxiliaryDatabaseObject.sqlCreateString( dialect, mapping, defaultCatalog, defaultSchema ) ); } } return ArrayHelper.toStringArray( script ); } /** - * Generate DDL for altering tables + * @param dialect The dialect for which to generate the creation script + * @param databaseMetadata The database catalog information for the database to be updated; needed to work out what + * should be created/altered * + * @return The sequence of DDL commands to apply the schema objects + * + * @throws HibernateException Generally indicates a problem calling {@link #buildMappings()} + * * @see org.hibernate.tool.hbm2ddl.SchemaUpdate + * + * @deprecated Use {@link #generateSchemaUpdateScriptList(Dialect, DatabaseMetadata)} instead */ + @SuppressWarnings({ "unchecked" }) + @Deprecated public String[] generateSchemaUpdateScript(Dialect dialect, DatabaseMetadata databaseMetadata) throws HibernateException { + List scripts = generateSchemaUpdateScriptList( dialect, databaseMetadata ); + return SchemaUpdateScript.toStringArray( scripts ); + } + + /** + * @param dialect The dialect for which to generate the creation script + * @param databaseMetadata The database catalog information for the database to be updated; needed to work out what + * should be created/altered + * + * @return The sequence of DDL commands to apply the schema objects + * + * @throws HibernateException Generally indicates a problem calling {@link #buildMappings()} + * + * @see org.hibernate.tool.hbm2ddl.SchemaUpdate + */ + public List generateSchemaUpdateScriptList(Dialect dialect, DatabaseMetadata databaseMetadata) + throws HibernateException { secondPassCompile(); String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG ); String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA ); + UniqueConstraintSchemaUpdateStrategy constraintMethod = UniqueConstraintSchemaUpdateStrategy.interpret( properties + .get( Environment.UNIQUE_CONSTRAINT_SCHEMA_UPDATE_STRATEGY ) ); - ArrayList script = new ArrayList( 50 ); + List scripts = new ArrayList(); Iterator iter = getTableMappings(); while ( iter.hasNext() ) { Table table = (Table) iter.next(); + String tableSchema = ( table.getSchema() == null ) ? defaultSchema : table.getSchema(); + String tableCatalog = ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(); if ( table.isPhysicalTable() ) { - - TableMetadata tableInfo = databaseMetadata.getTableMetadata( - table.getName(), - ( table.getSchema() == null ) ? defaultSchema : table.getSchema(), - ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(), - table.isQuoted() - ); + TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.getName(), tableSchema, + tableCatalog, table.isQuoted() ); if ( tableInfo == null ) { - script.add( - table.sqlCreateString( - dialect, - mapping, - defaultCatalog, - defaultSchema - ) - ); + scripts.add( new SchemaUpdateScript( table.sqlCreateString( dialect, mapping, tableCatalog, + tableSchema ), false ) ); } else { - Iterator subiter = table.sqlAlterStrings( - dialect, - mapping, - tableInfo, - defaultCatalog, - defaultSchema - ); + Iterator subiter = table.sqlAlterStrings( dialect, mapping, tableInfo, tableCatalog, + tableSchema ); while ( subiter.hasNext() ) { - script.add( subiter.next() ); + scripts.add( new SchemaUpdateScript( subiter.next(), false ) ); } } - Iterator comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema ); + Iterator comments = table.sqlCommentStrings( dialect, defaultCatalog, defaultSchema ); while ( comments.hasNext() ) { - script.add( comments.next() ); + scripts.add( new SchemaUpdateScript( comments.next(), false ) ); } } @@ -1019,61 +1224,79 @@ iter = getTableMappings(); while ( iter.hasNext() ) { Table table = (Table) iter.next(); + String tableSchema = ( table.getSchema() == null ) ? defaultSchema : table.getSchema(); + String tableCatalog = ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(); if ( table.isPhysicalTable() ) { - TableMetadata tableInfo = databaseMetadata.getTableMetadata( - table.getName(), - table.getSchema(), - table.getCatalog(), - table.isQuoted() - ); + TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.getName(), tableSchema, + tableCatalog, table.isQuoted() ); + if (! constraintMethod.equals( UniqueConstraintSchemaUpdateStrategy.SKIP )) { + Iterator uniqueIter = table.getUniqueKeyIterator(); + while ( uniqueIter.hasNext() ) { + final UniqueKey uniqueKey = (UniqueKey) uniqueIter.next(); + // Skip if index already exists. Most of the time, this + // won't work since most Dialects use Constraints. However, + // keep it for the few that do use Indexes. + if ( tableInfo != null && StringHelper.isNotEmpty( uniqueKey.getName() ) ) { + final IndexMetadata meta = tableInfo.getIndexMetadata( uniqueKey.getName() ); + if ( meta != null ) { + continue; + } + } + String constraintString = uniqueKey.sqlCreateString( dialect, mapping, tableCatalog, tableSchema ); + if ( constraintString != null && !constraintString.isEmpty() ) + if ( constraintMethod.equals( UniqueConstraintSchemaUpdateStrategy.DROP_RECREATE_QUIETLY ) ) { + String constraintDropString = uniqueKey.sqlDropString( dialect, tableCatalog, tableSchema ); + scripts.add( new SchemaUpdateScript( constraintDropString, true) ); + } + scripts.add( new SchemaUpdateScript( constraintString, true) ); + } + } + + Iterator subIter = table.getIndexIterator(); + while ( subIter.hasNext() ) { + final Index index = (Index) subIter.next(); + // Skip if index already exists + if ( tableInfo != null && StringHelper.isNotEmpty( index.getName() ) ) { + final IndexMetadata meta = tableInfo.getIndexMetadata( index.getName() ); + if ( meta != null ) { + continue; + } + } + scripts.add( new SchemaUpdateScript( index.sqlCreateString( dialect, mapping, tableCatalog, + tableSchema ), false ) ); + } + } + } + + // Foreign keys must be created *after* unique keys for numerous DBs. See HH-8390. + iter = getTableMappings(); + while ( iter.hasNext() ) { + Table table = (Table) iter.next(); + String tableSchema = ( table.getSchema() == null ) ? defaultSchema : table.getSchema(); + String tableCatalog = ( table.getCatalog() == null ) ? defaultCatalog : table.getCatalog(); + if ( table.isPhysicalTable() ) { + + TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.getName(), tableSchema, + tableCatalog, table.isQuoted() ); + if ( dialect.hasAlterTable() ) { Iterator subIter = table.getForeignKeyIterator(); while ( subIter.hasNext() ) { ForeignKey fk = (ForeignKey) subIter.next(); if ( fk.isPhysicalConstraint() ) { - boolean create = tableInfo == null || ( - tableInfo.getForeignKeyMetadata( fk.getName() ) == null && ( - //Icky workaround for MySQL bug: - !( dialect instanceof MySQLDialect ) || - tableInfo.getIndexMetadata( fk.getName() ) == null - ) - ); + boolean create = tableInfo == null || ( tableInfo.getForeignKeyMetadata( fk ) == null && ( + // Icky workaround for MySQL bug: + !( dialect instanceof MySQLDialect ) || tableInfo.getIndexMetadata( fk.getName() ) == null ) ); if ( create ) { - script.add( - fk.sqlCreateString( - dialect, - mapping, - defaultCatalog, - defaultSchema - ) - ); + scripts.add( new SchemaUpdateScript( fk.sqlCreateString( dialect, mapping, + tableCatalog, tableSchema ), false ) ); } } } } - } - - /*//broken, 'cos we don't generate these with names in SchemaExport - subIter = table.getIndexIterator(); - while ( subIter.hasNext() ) { - Index index = (Index) subIter.next(); - if ( !index.isForeignKey() || !dialect.hasImplicitIndexForForeignKey() ) { - if ( tableInfo==null || tableInfo.getIndexMetadata( index.getFilterName() ) == null ) { - script.add( index.sqlCreateString(dialect, mapping) ); - } - } - } - //broken, 'cos we don't generate these with names in SchemaExport - subIter = table.getUniqueKeyIterator(); - while ( subIter.hasNext() ) { - UniqueKey uk = (UniqueKey) subIter.next(); - if ( tableInfo==null || tableInfo.getIndexMetadata( uk.getFilterName() ) == null ) { - script.add( uk.sqlCreateString(dialect, mapping) ); - } - }*/ } iter = iterateGenerators( dialect ); @@ -1082,28 +1305,25 @@ Object key = generator.generatorKey(); if ( !databaseMetadata.isSequence( key ) && !databaseMetadata.isTable( key ) ) { String[] lines = generator.sqlCreateStrings( dialect ); - for ( int i = 0; i < lines.length ; i++ ) { - script.add( lines[i] ); - } + scripts.addAll( SchemaUpdateScript.fromStringArray( lines, false ) ); } } - return ArrayHelper.toStringArray( script ); + return scripts; } - public void validateSchema(Dialect dialect, DatabaseMetadata databaseMetadata) - throws HibernateException { + public void validateSchema(Dialect dialect, DatabaseMetadata databaseMetadata)throws HibernateException { secondPassCompile(); String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG ); String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA ); - + Iterator iter = getTableMappings(); while ( iter.hasNext() ) { Table table = (Table) iter.next(); if ( table.isPhysicalTable() ) { - + TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.getName(), ( table.getSchema() == null ) ? defaultSchema : table.getSchema(), @@ -1123,6 +1343,9 @@ while ( iter.hasNext() ) { PersistentIdentifierGenerator generator = (PersistentIdentifierGenerator) iter.next(); Object key = generator.generatorKey(); + if (key instanceof String) { + key = normalizer.normalizeIdentifierQuoting( (String) key ); + } if ( !databaseMetadata.isSequence( key ) && !databaseMetadata.isTable( key ) ) { throw new HibernateException( "Missing sequence or table: " + key ); } @@ -1148,37 +1371,346 @@ secondPassCompile(); } - // This method may be called many times!! protected void secondPassCompile() throws MappingException { - log.debug( "processing extends queue" ); + LOG.trace( "Starting secondPassCompile() processing" ); + + // TEMPORARY + // Ensure the correct ClassLoader is used in commons-annotations. + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader( ClassLoaderHelper.getContextClassLoader() ); - processExtendsQueue(); + //process default values first + { + if ( !isDefaultProcessed ) { + //use global delimiters if orm.xml declare it + Map defaults = reflectionManager.getDefaults(); + final Object isDelimited = defaults.get( "delimited-identifier" ); + if ( isDelimited != null && isDelimited == Boolean.TRUE ) { + getProperties().put( Environment.GLOBALLY_QUOTED_IDENTIFIERS, "true" ); + } + // Set default schema name if orm.xml declares it. + final String schema = (String) defaults.get( "schema" ); + if ( StringHelper.isNotEmpty( schema ) ) { + getProperties().put( Environment.DEFAULT_SCHEMA, schema ); + } + // Set default catalog name if orm.xml declares it. + final String catalog = (String) defaults.get( "catalog" ); + if ( StringHelper.isNotEmpty( catalog ) ) { + getProperties().put( Environment.DEFAULT_CATALOG, catalog ); + } - log.debug( "processing collection mappings" ); + AnnotationBinder.bindDefaults( createMappings() ); + isDefaultProcessed = true; + } + } + // process metadata queue + { + metadataSourceQueue.syncAnnotatedClasses(); + metadataSourceQueue.processMetadata( determineMetadataSourcePrecedence() ); + } + + + + try { + inSecondPass = true; + processSecondPassesOfType( PkDrivenByDefaultMapsIdSecondPass.class ); + processSecondPassesOfType( SetSimpleValueTypeSecondPass.class ); + processSecondPassesOfType( CopyIdentifierComponentSecondPass.class ); + processFkSecondPassInOrder(); + processSecondPassesOfType( CreateKeySecondPass.class ); + processSecondPassesOfType( SecondaryTableSecondPass.class ); + + originalSecondPassCompile(); + + inSecondPass = false; + } + catch ( RecoverableException e ) { + //the exception was not recoverable after all + throw ( RuntimeException ) e.getCause(); + } + + // process cache queue + { + for ( CacheHolder holder : caches ) { + if ( holder.isClass ) { + applyCacheConcurrencyStrategy( holder ); + } + else { + applyCollectionCacheConcurrencyStrategy( holder ); + } + } + caches.clear(); + } + + for ( Map.Entry> tableListEntry : uniqueConstraintHoldersByTable.entrySet() ) { + final Table table = tableListEntry.getKey(); + final List uniqueConstraints = tableListEntry.getValue(); + for ( UniqueConstraintHolder holder : uniqueConstraints ) { + buildUniqueKeyFromColumnNames( table, holder.getName(), holder.getColumns() ); + } + } + + for(Table table : jpaIndexHoldersByTable.keySet()){ + final List jpaIndexHolders = jpaIndexHoldersByTable.get( table ); + for ( JPAIndexHolder holder : jpaIndexHolders ) { + buildUniqueKeyFromColumnNames( table, holder.getName(), holder.getColumns(), holder.getOrdering(), holder.isUnique() ); + } + } + + Thread.currentThread().setContextClassLoader( tccl ); + } + + private void processSecondPassesOfType(Class type) { Iterator iter = secondPasses.iterator(); while ( iter.hasNext() ) { - SecondPass sp = (SecondPass) iter.next(); - if ( ! (sp instanceof QuerySecondPass) ) { + SecondPass sp = ( SecondPass ) iter.next(); + //do the second pass of simple value types first and remove them + if ( type.isInstance( sp ) ) { sp.doSecondPass( classes ); iter.remove(); } } + } - log.debug( "processing native query and ResultSetMapping mappings" ); - iter = secondPasses.iterator(); - while ( iter.hasNext() ) { - SecondPass sp = (SecondPass) iter.next(); + /** + * Processes FKSecondPass instances trying to resolve any + * graph circularity (ie PK made of a many to one linking to + * an entity having a PK made of a ManyToOne ...). + */ + private void processFkSecondPassInOrder() { + LOG.debug("Processing fk mappings (*ToOne and JoinedSubclass)"); + List fkSecondPasses = getFKSecondPassesOnly(); + + if ( fkSecondPasses.size() == 0 ) { + return; // nothing to do here + } + + // split FkSecondPass instances into primary key and non primary key FKs. + // While doing so build a map of class names to FkSecondPass instances depending on this class. + Map> isADependencyOf = new HashMap>(); + List endOfQueueFkSecondPasses = new ArrayList( fkSecondPasses.size() ); + for ( FkSecondPass sp : fkSecondPasses ) { + if ( sp.isInPrimaryKey() ) { + String referenceEntityName = sp.getReferencedEntityName(); + PersistentClass classMapping = getClassMapping( referenceEntityName ); + String dependentTable = quotedTableName(classMapping.getTable()); + if ( !isADependencyOf.containsKey( dependentTable ) ) { + isADependencyOf.put( dependentTable, new HashSet() ); + } + isADependencyOf.get( dependentTable ).add( sp ); + } + else { + endOfQueueFkSecondPasses.add( sp ); + } + } + + // using the isADependencyOf map we order the FkSecondPass recursively instances into the right order for processing + List orderedFkSecondPasses = new ArrayList( fkSecondPasses.size() ); + for ( String tableName : isADependencyOf.keySet() ) { + buildRecursiveOrderedFkSecondPasses( orderedFkSecondPasses, isADependencyOf, tableName, tableName ); + } + + // process the ordered FkSecondPasses + for ( FkSecondPass sp : orderedFkSecondPasses ) { sp.doSecondPass( classes ); - iter.remove(); } - log.debug( "processing association property references" ); + processEndOfQueue( endOfQueueFkSecondPasses ); + } - iter = propertyReferences.iterator(); + /** + * @return Returns a list of all secondPasses instances which are a instance of + * FkSecondPass. + */ + private List getFKSecondPassesOnly() { + Iterator iter = secondPasses.iterator(); + List fkSecondPasses = new ArrayList( secondPasses.size() ); while ( iter.hasNext() ) { - Mappings.PropertyReference upr = (Mappings.PropertyReference) iter.next(); + SecondPass sp = ( SecondPass ) iter.next(); + //do the second pass of fk before the others and remove them + if ( sp instanceof FkSecondPass ) { + fkSecondPasses.add( ( FkSecondPass ) sp ); + iter.remove(); + } + } + return fkSecondPasses; + } + /** + * Recursively builds a list of FkSecondPass instances ready to be processed in this order. + * Checking all dependencies recursively seems quite expensive, but the original code just relied + * on some sort of table name sorting which failed in certain circumstances. + *

+ * See ANN-722 and ANN-730 + * + * @param orderedFkSecondPasses The list containing the FkSecondPass instances ready + * for processing. + * @param isADependencyOf Our lookup data structure to determine dependencies between tables + * @param startTable Table name to start recursive algorithm. + * @param currentTable The current table name used to check for 'new' dependencies. + */ + private void buildRecursiveOrderedFkSecondPasses( + List orderedFkSecondPasses, + Map> isADependencyOf, + String startTable, + String currentTable) { + + Set dependencies = isADependencyOf.get( currentTable ); + + // bottom out + if ( dependencies == null || dependencies.size() == 0 ) { + return; + } + + for ( FkSecondPass sp : dependencies ) { + String dependentTable = quotedTableName(sp.getValue().getTable()); + if ( dependentTable.compareTo( startTable ) == 0 ) { + String sb = "Foreign key circularity dependency involving the following tables: "; + throw new AnnotationException( sb ); + } + buildRecursiveOrderedFkSecondPasses( orderedFkSecondPasses, isADependencyOf, startTable, dependentTable ); + if ( !orderedFkSecondPasses.contains( sp ) ) { + orderedFkSecondPasses.add( 0, sp ); + } + } + } + + private String quotedTableName(Table table) { + return Table.qualify( table.getCatalog(), table.getQuotedSchema(), table.getQuotedName() ); + } + + private void processEndOfQueue(List endOfQueueFkSecondPasses) { + /* + * If a second pass raises a recoverableException, queue it for next round + * stop of no pass has to be processed or if the number of pass to processes + * does not diminish between two rounds. + * If some failing pass remain, raise the original exception + */ + boolean stopProcess = false; + RuntimeException originalException = null; + while ( !stopProcess ) { + List failingSecondPasses = new ArrayList(); + for ( FkSecondPass pass : endOfQueueFkSecondPasses ) { + try { + pass.doSecondPass( classes ); + } + catch (RecoverableException e) { + failingSecondPasses.add( pass ); + if ( originalException == null ) { + originalException = (RuntimeException) e.getCause(); + } + } + } + stopProcess = failingSecondPasses.size() == 0 || failingSecondPasses.size() == endOfQueueFkSecondPasses.size(); + endOfQueueFkSecondPasses = failingSecondPasses; + } + if ( endOfQueueFkSecondPasses.size() > 0 ) { + throw originalException; + } + } + + private void buildUniqueKeyFromColumnNames(Table table, String keyName, String[] columnNames){ + buildUniqueKeyFromColumnNames( table, keyName, columnNames, null, true ); + } + + private void buildUniqueKeyFromColumnNames(Table table, String keyName, String[] columnNames, String[] orderings, boolean unique) { + int size = columnNames.length; + Column[] columns = new Column[size]; + Set unbound = new HashSet(); + Set unboundNoLogical = new HashSet(); + for ( int index = 0; index < size; index++ ) { + String column = columnNames[index]; + try { + final String columnName = createMappings().getPhysicalColumnName( column, table ); + columns[index] = new Column( columnName ); + unbound.add( columns[index] ); + //column equals and hashcode is based on column name + } + catch ( MappingException e ) { + // If at least 1 columnName does exist, 'columns' will contain a mix of Columns and nulls. In order + // to exhaustively report all of the unbound columns at once, w/o an NPE in + // Constraint#generateName's array sorting, simply create a fake Column. + columns[index] = new Column( column ); + unboundNoLogical.add( columns[index] ); + } + } + + if ( StringHelper.isEmpty( keyName ) ) { + keyName = Constraint.generateName( "UK_", table, columns ); + } + keyName = normalizer.normalizeIdentifierQuoting( keyName ); + + if ( unique ) { + UniqueKey uk = table.getOrCreateUniqueKey( keyName ); + for ( int i = 0; i < columns.length; i++ ) { + Column column = columns[i]; + String order = orderings != null ? orderings[i] : null; + if ( table.containsColumn( column ) ) { + uk.addColumn( column, order ); + unbound.remove( column ); + } + } + } + else { + Index index = table.getOrCreateIndex( keyName ); + for ( int i = 0; i < columns.length; i++ ) { + Column column = columns[i]; + String order = orderings != null ? orderings[i] : null; + if ( table.containsColumn( column ) ) { + index.addColumn( column, order ); + unbound.remove( column ); + } + } + } + + if ( unbound.size() > 0 || unboundNoLogical.size() > 0 ) { + StringBuilder sb = new StringBuilder( "Unable to create unique key constraint (" ); + for ( String columnName : columnNames ) { + sb.append( columnName ).append( ", " ); + } + sb.setLength( sb.length() - 2 ); + sb.append( ") on table " ).append( table.getName() ).append( ": database column " ); + for ( Column column : unbound ) { + sb.append("'").append( column.getName() ).append( "', " ); + } + for ( Column column : unboundNoLogical ) { + sb.append("'").append( column.getName() ).append( "', " ); + } + sb.setLength( sb.length() - 2 ); + sb.append( " not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)" ); + throw new AnnotationException( sb.toString() ); + } + } + + private void originalSecondPassCompile() throws MappingException { + LOG.debug( "Processing extends queue" ); + processExtendsQueue(); + + LOG.debug( "Processing collection mappings" ); + Iterator itr = secondPasses.iterator(); + while ( itr.hasNext() ) { + SecondPass sp = (SecondPass) itr.next(); + if ( ! (sp instanceof QuerySecondPass) ) { + sp.doSecondPass( classes ); + itr.remove(); + } + } + + LOG.debug( "Processing native query and ResultSetMapping mappings" ); + itr = secondPasses.iterator(); + while ( itr.hasNext() ) { + SecondPass sp = (SecondPass) itr.next(); + sp.doSecondPass( classes ); + itr.remove(); + } + + LOG.debug( "Processing association property references" ); + + itr = propertyReferences.iterator(); + while ( itr.hasNext() ) { + Mappings.PropertyReference upr = (Mappings.PropertyReference) itr.next(); + PersistentClass clazz = getClassMapping( upr.referencedClass ); if ( clazz == null ) { throw new MappingException( @@ -1192,37 +1724,35 @@ ( (SimpleValue) prop.getValue() ).setAlternateUniqueKey( true ); } } - + //TODO: Somehow add the newly created foreign keys to the internal collection - log.debug( "processing foreign key constraints" ); + LOG.debug( "Creating tables' unique integer identifiers" ); + LOG.debug( "Processing foreign key constraints" ); - iter = getTableMappings(); - Set done = new HashSet(); - while ( iter.hasNext() ) { - secondPassCompileForeignKeys( (Table) iter.next(), done ); + itr = getTableMappings(); + int uniqueInteger = 0; + Set done = new HashSet(); + while ( itr.hasNext() ) { + Table table = (Table) itr.next(); + table.setUniqueInteger( uniqueInteger++ ); + secondPassCompileForeignKeys( table, done ); } } - /** - * Try to empty the extends queue. - */ - private void processExtendsQueue() { - // todo : would love to have this work on a notification basis - // where the successful binding of an entity/subclass would - // emit a notification which the extendsQueue entries could - // react to... - org.dom4j.Document document = findPossibleExtends(); - while ( document != null ) { - add( document ); - document = findPossibleExtends(); + private int processExtendsQueue() { + LOG.debug( "Processing extends queue" ); + int added = 0; + ExtendsQueueEntry extendsQueueEntry = findPossibleExtends(); + while ( extendsQueueEntry != null ) { + metadataSourceQueue.processHbmXml( extendsQueueEntry.getMetadataXml(), extendsQueueEntry.getEntityNames() ); + extendsQueueEntry = findPossibleExtends(); } if ( extendsQueue.size() > 0 ) { -// Iterator iterator = extendsQueue.iterator(); Iterator iterator = extendsQueue.keySet().iterator(); - StringBuffer buf = new StringBuffer( "Following superclasses referenced in extends not found: " ); + StringBuilder buf = new StringBuilder( "Following super classes referenced in extends not found: " ); while ( iterator.hasNext() ) { final ExtendsQueueEntry entry = ( ExtendsQueueEntry ) iterator.next(); buf.append( entry.getExplicitName() ); @@ -1235,34 +1765,26 @@ } throw new MappingException( buf.toString() ); } + + return added; } - /** - * Find the first possible element in the queue of extends. - */ - protected org.dom4j.Document findPossibleExtends() { -// Iterator iter = extendsQueue.iterator(); - Iterator iter = extendsQueue.keySet().iterator(); - while ( iter.hasNext() ) { - final ExtendsQueueEntry entry = ( ExtendsQueueEntry ) iter.next(); - if ( getClassMapping( entry.getExplicitName() ) != null ) { - // found - iter.remove(); - return entry.getDocument(); + protected ExtendsQueueEntry findPossibleExtends() { + Iterator itr = extendsQueue.keySet().iterator(); + while ( itr.hasNext() ) { + final ExtendsQueueEntry entry = itr.next(); + boolean found = getClassMapping( entry.getExplicitName() ) != null + || getClassMapping( HbmBinder.getClassName( entry.getExplicitName(), entry.getMappingPackage() ) ) != null; + if ( found ) { + itr.remove(); + return entry; } - else if ( getClassMapping( HbmBinder.getClassName( entry.getExplicitName(), entry.getMappingPackage() ) ) != null ) { - // found - iter.remove(); - return entry.getDocument(); - } } return null; } - protected void secondPassCompileForeignKeys(Table table, Set done) throws MappingException { - + protected void secondPassCompileForeignKeys(Table table, Set done) throws MappingException { table.createForeignKeys(); - Iterator iter = table.getForeignKeyIterator(); while ( iter.hasNext() ) { @@ -1277,10 +1799,8 @@ " does not specify the referenced entity" ); } - if ( log.isDebugEnabled() ) { - log.debug( "resolving reference to class: " + referencedEntityName ); - } - PersistentClass referencedClass = (PersistentClass) classes.get( referencedEntityName ); + LOG.debugf( "Resolving reference to class: %s", referencedEntityName ); + PersistentClass referencedClass = classes.get( referencedEntityName ); if ( referencedClass == null ) { throw new MappingException( "An association from the table " + @@ -1298,127 +1818,221 @@ } } - /** - * Get the named queries - */ - public Map getNamedQueries() { + public Map getNamedQueries() { return namedQueries; } + public Map getNamedProcedureCallMap() { + return namedProcedureCallMap; + } + /** - * Instantiate a new SessionFactory, using the properties and - * mappings in this configuration. The SessionFactory will be - * immutable, so changes made to the Configuration after - * building the SessionFactory will not affect it. + * Create a {@link SessionFactory} using the properties and mappings in this configuration. The + * {@link SessionFactory} will be immutable, so changes made to {@code this} {@link Configuration} after + * building the {@link SessionFactory} will not affect it. * - * @return a new factory for Sessions - * @see org.hibernate.SessionFactory + * @param serviceRegistry The registry of services to be used in creating this session factory. + * + * @return The built {@link SessionFactory} + * + * @throws HibernateException usually indicates an invalid configuration or invalid mapping information */ - public SessionFactory buildSessionFactory() throws HibernateException { - log.debug( "Preparing to build session factory with filters : " + filterDefinitions ); + public SessionFactory buildSessionFactory(ServiceRegistry serviceRegistry) throws HibernateException { + LOG.debugf( "Preparing to build session factory with filters : %s", filterDefinitions ); + + buildTypeRegistrations( serviceRegistry ); secondPassCompile(); + if ( !metadataSourceQueue.isEmpty() ) { + LOG.incompleteMappingMetadataCacheProcessing(); + } + validate(); + Environment.verifyProperties( properties ); Properties copy = new Properties(); copy.putAll( properties ); - PropertiesHelper.resolvePlaceHolders( copy ); - Settings settings = buildSettings( copy ); + ConfigurationHelper.resolvePlaceHolders( copy ); + Settings settings = buildSettings( copy, serviceRegistry ); return new SessionFactoryImpl( this, mapping, + serviceRegistry, settings, - getInitializedEventListeners(), sessionFactoryObserver ); } + + private void buildTypeRegistrations(ServiceRegistry serviceRegistry) { + final TypeContributions typeContributions = new TypeContributions() { + @Override + public void contributeType(BasicType type) { + typeResolver.registerTypeOverride( type ); + } - private EventListeners getInitializedEventListeners() { - EventListeners result = (EventListeners) eventListeners.shallowCopy(); - result.initializeListeners( this ); - return result; + @Override + public void contributeType(UserType type, String[] keys) { + typeResolver.registerTypeOverride( type, keys ); + } + + @Override + public void contributeType(CompositeUserType type, String[] keys) { + typeResolver.registerTypeOverride( type, keys ); + } + }; + + // add Dialect contributed types + final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect(); + dialect.contributeTypes( typeContributions, serviceRegistry ); + + // add TypeContributor contributed types. + ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class ); + for ( TypeContributor contributor : classLoaderService.loadJavaServices( TypeContributor.class ) ) { + contributor.contribute( typeContributions, serviceRegistry ); + } + // from app registrations + for ( TypeContributor contributor : typeContributorRegistrations ) { + contributor.contribute( typeContributions, serviceRegistry ); + } } /** - * Return the configured Interceptor + * Create a {@link SessionFactory} using the properties and mappings in this configuration. The + * {@link SessionFactory} will be immutable, so changes made to {@code this} {@link Configuration} after + * building the {@link SessionFactory} will not affect it. + * + * @return The build {@link SessionFactory} + * + * @throws HibernateException usually indicates an invalid configuration or invalid mapping information + * + * @deprecated Use {@link #buildSessionFactory(ServiceRegistry)} instead */ + public SessionFactory buildSessionFactory() throws HibernateException { + Environment.verifyProperties( properties ); + ConfigurationHelper.resolvePlaceHolders( properties ); + final ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder() + .applySettings( properties ) + .build(); + setSessionFactoryObserver( + new SessionFactoryObserver() { + @Override + public void sessionFactoryCreated(SessionFactory factory) { + } + + @Override + public void sessionFactoryClosed(SessionFactory factory) { + ( (StandardServiceRegistryImpl) serviceRegistry ).destroy(); + } + } + ); + return buildSessionFactory( serviceRegistry ); + } + + /** + * Retrieve the configured {@link Interceptor}. + * + * @return The current {@link Interceptor} + */ public Interceptor getInterceptor() { return interceptor; } /** + * Set the current {@link Interceptor} + * + * @param interceptor The {@link Interceptor} to use for the {@link #buildSessionFactory built} + * {@link SessionFactory}. + * + * @return this for method chaining + */ + public Configuration setInterceptor(Interceptor interceptor) { + this.interceptor = interceptor; + return this; + } + + /** * Get all properties + * + * @return all properties */ public Properties getProperties() { return properties; } /** - * Configure an Interceptor + * Get a property value by name + * + * @param propertyName The name of the property + * + * @return The value currently associated with that property name; may be null. */ - public Configuration setInterceptor(Interceptor interceptor) { - this.interceptor = interceptor; - return this; + public String getProperty(String propertyName) { + return properties.getProperty( propertyName ); } /** * Specify a completely new set of properties + * + * @param properties The new set of properties + * + * @return this for method chaining */ public Configuration setProperties(Properties properties) { this.properties = properties; return this; } /** - * Set the given properties + * Add the given properties to ours. + * + * @param extraProperties The properties to add. + * + * @return this for method chaining + * */ public Configuration addProperties(Properties extraProperties) { this.properties.putAll( extraProperties ); return this; } /** - * Adds the incoming properties to the internap properties structure, - * as long as the internal structure does not already contain an - * entry for the given key. + * Adds the incoming properties to the internal properties structure, as long as the internal structure does not + * already contain an entry for the given key. * - * @param properties - * @return this + * @param properties The properties to merge + * + * @return this for ethod chaining */ public Configuration mergeProperties(Properties properties) { - Iterator itr = properties.entrySet().iterator(); - while ( itr.hasNext() ) { - final Map.Entry entry = ( Map.Entry ) itr.next(); + for ( Map.Entry entry : properties.entrySet() ) { if ( this.properties.containsKey( entry.getKey() ) ) { continue; } - this.properties.setProperty( ( String ) entry.getKey(), ( String ) entry.getValue() ); + this.properties.setProperty( (String) entry.getKey(), (String) entry.getValue() ); } return this; } /** - * Set a property + * Set a property value by name + * + * @param propertyName The name of the property to set + * @param value The new property value + * + * @return this for method chaining */ public Configuration setProperty(String propertyName, String value) { properties.setProperty( propertyName, value ); return this; } - /** - * Get a property - */ - public String getProperty(String propertyName) { - return properties.getProperty( propertyName ); - } - private void addProperties(Element parent) { - Iterator iter = parent.elementIterator( "property" ); - while ( iter.hasNext() ) { - Element node = (Element) iter.next(); + Iterator itr = parent.elementIterator( "property" ); + while ( itr.hasNext() ) { + Element node = (Element) itr.next(); String name = node.attributeValue( "name" ); String value = node.getText().trim(); - log.debug( name + "=" + value ); + LOG.debugf( "%s=%s", name, value ); properties.setProperty( name, value ); if ( !name.startsWith( "hibernate" ) ) { properties.setProperty( "hibernate." + name, value ); @@ -1428,51 +2042,71 @@ } /** - * Get the configuration file as an InputStream. Might be overridden - * by subclasses to allow the configuration to be located by some arbitrary - * mechanism. + * Use the mappings and properties specified in an application resource named hibernate.cfg.xml. + * + * @return this for method chaining + * + * @throws HibernateException Generally indicates we cannot find hibernate.cfg.xml + * + * @see #configure(String) */ - protected InputStream getConfigurationInputStream(String resource) throws HibernateException { - - log.info( "Configuration resource: " + resource ); - - return ConfigHelper.getResourceAsStream( resource ); - - } - - /** - * Use the mappings and properties specified in an application - * resource named hibernate.cfg.xml. - */ public Configuration configure() throws HibernateException { configure( "/hibernate.cfg.xml" ); return this; } /** - * Use the mappings and properties specified in the given application - * resource. The format of the resource is defined in - * hibernate-configuration-3.0.dtd. + * Use the mappings and properties specified in the given application resource. The format of the resource is + * defined in hibernate-configuration-3.0.dtd. *

- * The resource is found via getConfigurationInputStream(resource). + * The resource is found via {@link #getConfigurationInputStream} + * + * @param resource The resource to use + * + * @return this for method chaining + * + * @throws HibernateException Generally indicates we cannot find the named resource + * + * @see #doConfigure(java.io.InputStream, String) */ public Configuration configure(String resource) throws HibernateException { - log.info( "configuring from resource: " + resource ); + LOG.configuringFromResource( resource ); InputStream stream = getConfigurationInputStream( resource ); return doConfigure( stream, resource ); } /** - * Use the mappings and properties specified in the given document. - * The format of the document is defined in + * Get the configuration file as an InputStream. Might be overridden + * by subclasses to allow the configuration to be located by some arbitrary + * mechanism. + *

+ * By default here we use classpath resource resolution + * + * @param resource The resource to locate + * + * @return The stream + * + * @throws HibernateException Generally indicates we cannot find the named resource + */ + protected InputStream getConfigurationInputStream(String resource) throws HibernateException { + LOG.configurationResource( resource ); + return ConfigHelper.getResourceAsStream( resource ); + } + + /** + * Use the mappings and properties specified in the given document. The format of the document is defined in * hibernate-configuration-3.0.dtd. * * @param url URL from which you wish to load the configuration - * @return A configuration configured via the file - * @throws HibernateException + * + * @return this for method chaining + * + * @throws HibernateException Generally indicates a problem access the url + * + * @see #doConfigure(java.io.InputStream, String) */ public Configuration configure(URL url) throws HibernateException { - log.info( "configuring from url: " + url.toString() ); + LOG.configuringFromUrl( url ); try { return doConfigure( url.openStream(), url.toString() ); } @@ -1482,16 +2116,19 @@ } /** - * Use the mappings and properties specified in the given application - * file. The format of the file is defined in + * Use the mappings and properties specified in the given application file. The format of the file is defined in * hibernate-configuration-3.0.dtd. * - * @param configFile File from which you wish to load the configuration - * @return A configuration configured via the file - * @throws HibernateException + * @param configFile File from which you wish to load the configuration + * + * @return this for method chaining + * + * @throws HibernateException Generally indicates a problem access the file + * + * @see #doConfigure(java.io.InputStream, String) */ public Configuration configure(File configFile) throws HibernateException { - log.info( "configuring from file: " + configFile.getName() ); + LOG.configuringFromFile( configFile.getName() ); try { return doConfigure( new FileInputStream( configFile ), configFile.toString() ); } @@ -1501,46 +2138,39 @@ } /** - * Use the mappings and properties specified in the given application - * resource. The format of the resource is defined in - * hibernate-configuration-3.0.dtd. + * Configure this configuration's state from the contents of the given input stream. The expectation is that + * the stream contents represent an XML document conforming to the Hibernate Configuration DTD. See + * {@link #doConfigure(Document)} for further details. * - * @param stream Inputstream to be read from + * @param stream The input stream from which to read * @param resourceName The name to use in warning/error messages - * @return A configuration configured via the stream - * @throws HibernateException + * + * @return this for method chaining + * + * @throws HibernateException Indicates a problem reading the stream contents. */ protected Configuration doConfigure(InputStream stream, String resourceName) throws HibernateException { - - org.dom4j.Document doc; try { - List errors = new ArrayList(); - doc = xmlHelper.createSAXReader( resourceName, errors, entityResolver ) + ErrorLogger errorLogger = new ErrorLogger( resourceName ); + Document document = xmlHelper.createSAXReader( errorLogger, entityResolver ) .read( new InputSource( stream ) ); - if ( errors.size() != 0 ) { - throw new MappingException( - "invalid configuration", - (Throwable) errors.get( 0 ) - ); + if ( errorLogger.hasErrors() ) { + throw new MappingException( "invalid configuration", errorLogger.getErrors().get( 0 ) ); } + doConfigure( document ); } catch (DocumentException e) { - throw new HibernateException( - "Could not parse configuration: " + resourceName, - e - ); + throw new HibernateException( "Could not parse configuration: " + resourceName, e ); } finally { try { stream.close(); } catch (IOException ioe) { - log.warn( "could not close input stream for: " + resourceName, ioe ); + LOG.unableToCloseInputStreamForResource( resourceName, ioe ); } } - - return doConfigure( doc ); - + return this; } /** @@ -1552,13 +2182,22 @@ * @return A configuration configured via the Document * @throws HibernateException if there is problem in accessing the file. */ - public Configuration configure(Document document) throws HibernateException { - log.info( "configuring from XML document" ); + public Configuration configure(org.w3c.dom.Document document) throws HibernateException { + LOG.configuringFromXmlDocument(); return doConfigure( xmlHelper.createDOMReader().read( document ) ); } - protected Configuration doConfigure(org.dom4j.Document doc) throws HibernateException { - + /** + * Parse a dom4j document conforming to the Hibernate Configuration DTD (hibernate-configuration-3.0.dtd) + * and use its information to configure this {@link Configuration}'s state + * + * @param doc The dom4j document + * + * @return this for method chaining + * + * @throws HibernateException Indicates a problem performing the configuration task + */ + protected Configuration doConfigure(Document doc) throws HibernateException { Element sfNode = doc.getRootElement().element( "session-factory" ); String name = sfNode.attributeValue( "name" ); if ( name != null ) { @@ -1572,11 +2211,10 @@ parseSecurity( secNode ); } - log.info( "Configured SessionFactory: " + name ); - log.debug( "properties: " + properties ); + LOG.configuredSessionFactory( name ); + LOG.debugf( "Properties: %s", properties ); return this; - } @@ -1601,603 +2239,1663 @@ final String region = ( regionNode == null ) ? role : regionNode.getValue(); setCollectionCacheConcurrencyStrategy( role, subelement.attributeValue( "usage" ), region ); } - else if ( "listener".equals( subelementName ) ) { - parseListener( subelement ); - } - else if ( "event".equals( subelementName ) ) { - parseEvent( subelement ); - } } } - protected void parseMappingElement(Element subelement, String name) { - Attribute rsrc = subelement.attribute( "resource" ); - Attribute file = subelement.attribute( "file" ); - Attribute jar = subelement.attribute( "jar" ); - Attribute pkg = subelement.attribute( "package" ); - Attribute clazz = subelement.attribute( "class" ); - if ( rsrc != null ) { - log.debug( name + "<-" + rsrc ); - addResource( rsrc.getValue() ); + private void parseMappingElement(Element mappingElement, String name) { + final Attribute resourceAttribute = mappingElement.attribute( "resource" ); + final Attribute fileAttribute = mappingElement.attribute( "file" ); + final Attribute jarAttribute = mappingElement.attribute( "jar" ); + final Attribute packageAttribute = mappingElement.attribute( "package" ); + final Attribute classAttribute = mappingElement.attribute( "class" ); + + if ( resourceAttribute != null ) { + final String resourceName = resourceAttribute.getValue(); + LOG.debugf( "Session-factory config [%s] named resource [%s] for mapping", name, resourceName ); + addResource( resourceName ); } - else if ( jar != null ) { - log.debug( name + "<-" + jar ); - addJar( new File( jar.getValue() ) ); + else if ( fileAttribute != null ) { + final String fileName = fileAttribute.getValue(); + LOG.debugf( "Session-factory config [%s] named file [%s] for mapping", name, fileName ); + addFile( fileName ); } - else if ( pkg != null ) { - throw new MappingException( - "An AnnotationConfiguration instance is required to use " - ); + else if ( jarAttribute != null ) { + final String jarFileName = jarAttribute.getValue(); + LOG.debugf( "Session-factory config [%s] named jar file [%s] for mapping", name, jarFileName ); + addJar( new File( jarFileName ) ); } - else if ( clazz != null ) { - throw new MappingException( - "An AnnotationConfiguration instance is required to use " - ); + else if ( packageAttribute != null ) { + final String packageName = packageAttribute.getValue(); + LOG.debugf( "Session-factory config [%s] named package [%s] for mapping", name, packageName ); + addPackage( packageName ); } - else { - if ( file == null ) { + else if ( classAttribute != null ) { + final String className = classAttribute.getValue(); + LOG.debugf( "Session-factory config [%s] named class [%s] for mapping", name, className ); + try { + addAnnotatedClass( ReflectHelper.classForName( className ) ); + } + catch ( Exception e ) { throw new MappingException( - " element in configuration specifies no attributes" - ); + "Unable to load class [ " + className + "] declared in Hibernate configuration entry", + e + ); } - log.debug( name + "<-" + file ); - addFile( file.getValue() ); } + else { + throw new MappingException( " element in configuration specifies no known attributes" ); + } } + private JaccPermissionDeclarations jaccPermissionDeclarations; + private void parseSecurity(Element secNode) { - String contextId = secNode.attributeValue( "context" ); - setProperty(Environment.JACC_CONTEXTID, contextId); - log.info( "JACC contextID: " + contextId ); - JACCConfiguration jcfg = new JACCConfiguration( contextId ); + final String nodeContextId = secNode.attributeValue( "context" ); + + final String explicitContextId = getProperty( AvailableSettings.JACC_CONTEXT_ID ); + if ( explicitContextId == null ) { + setProperty( AvailableSettings.JACC_CONTEXT_ID, nodeContextId ); + LOG.jaccContextId( nodeContextId ); + } + else { + // if they dont match, throw an error + if ( ! nodeContextId.equals( explicitContextId ) ) { + throw new HibernateException( "Non-matching JACC context ids" ); + } + } + jaccPermissionDeclarations = new JaccPermissionDeclarations( nodeContextId ); + Iterator grantElements = secNode.elementIterator(); while ( grantElements.hasNext() ) { - Element grantElement = (Element) grantElements.next(); - String elementName = grantElement.getName(); + final Element grantElement = (Element) grantElements.next(); + final String elementName = grantElement.getName(); if ( "grant".equals( elementName ) ) { - jcfg.addPermission( - grantElement.attributeValue( "role" ), - grantElement.attributeValue( "entity-name" ), - grantElement.attributeValue( "actions" ) - ); + jaccPermissionDeclarations.addPermissionDeclaration( + new GrantedPermission( + grantElement.attributeValue( "role" ), + grantElement.attributeValue( "entity-name" ), + grantElement.attributeValue( "actions" ) + ) + ); } } } - private void parseEvent(Element element) { - String type = element.attributeValue( "type" ); - List listeners = element.elements(); - String[] listenerClasses = new String[ listeners.size() ]; - for ( int i = 0; i < listeners.size() ; i++ ) { - listenerClasses[i] = ( (Element) listeners.get( i ) ).attributeValue( "class" ); + public JaccPermissionDeclarations getJaccPermissionDeclarations() { + return jaccPermissionDeclarations; + } + + RootClass getRootClassMapping(String clazz) throws MappingException { + try { + return (RootClass) getClassMapping( clazz ); } - log.debug( "Event listeners: " + type + "=" + StringHelper.toString( listenerClasses ) ); - setListeners( type, listenerClasses ); + catch (ClassCastException cce) { + throw new MappingException( "You may only specify a cache for root mappings. Attempted on " + clazz ); + } } - private void parseListener(Element element) { - String type = element.attributeValue( "type" ); - if ( type == null ) { - throw new MappingException( "No type specified for listener" ); + /** + * Set up a cache for an entity class + * + * @param entityName The name of the entity to which we shoudl associate these cache settings + * @param concurrencyStrategy The cache strategy to use + * + * @return this for method chaining + */ + public Configuration setCacheConcurrencyStrategy(String entityName, String concurrencyStrategy) { + setCacheConcurrencyStrategy( entityName, concurrencyStrategy, entityName ); + return this; + } + + /** + * Set up a cache for an entity class, giving an explicit region name + * + * @param entityName The name of the entity to which we should associate these cache settings + * @param concurrencyStrategy The cache strategy to use + * @param region The name of the cache region to use + * + * @return this for method chaining + */ + public Configuration setCacheConcurrencyStrategy(String entityName, String concurrencyStrategy, String region) { + setCacheConcurrencyStrategy( entityName, concurrencyStrategy, region, true ); + return this; + } + + public void setCacheConcurrencyStrategy( + String entityName, + String concurrencyStrategy, + String region, + boolean cacheLazyProperty) throws MappingException { + caches.add( new CacheHolder( entityName, concurrencyStrategy, region, true, cacheLazyProperty ) ); + } + + private void applyCacheConcurrencyStrategy(CacheHolder holder) { + RootClass rootClass = getRootClassMapping( holder.role ); + if ( rootClass == null ) { + throw new MappingException( "Cannot cache an unknown entity: " + holder.role ); } - String impl = element.attributeValue( "class" ); - log.debug( "Event listener: " + type + "=" + impl ); - setListeners( type, new String[]{impl} ); + rootClass.setCacheConcurrencyStrategy( holder.usage ); + rootClass.setCacheRegionName( holder.region ); + rootClass.setLazyPropertiesCacheable( holder.cacheLazy ); } - public void setListener(String type, String listener) { - String[] listeners = null; - if ( listener != null ) { - listeners = (String[]) Array.newInstance( String.class, 1 ); - listeners[0] = listener; + /** + * Set up a cache for a collection role + * + * @param collectionRole The name of the collection to which we should associate these cache settings + * @param concurrencyStrategy The cache strategy to use + * + * @return this for method chaining + */ + public Configuration setCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy) { + setCollectionCacheConcurrencyStrategy( collectionRole, concurrencyStrategy, collectionRole ); + return this; + } + + /** + * Set up a cache for a collection role, giving an explicit region name + * + * @param collectionRole The name of the collection to which we should associate these cache settings + * @param concurrencyStrategy The cache strategy to use + * @param region The name of the cache region to use + */ + public void setCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy, String region) { + caches.add( new CacheHolder( collectionRole, concurrencyStrategy, region, false, false ) ); + } + + private void applyCollectionCacheConcurrencyStrategy(CacheHolder holder) { + Collection collection = getCollectionMapping( holder.role ); + if ( collection == null ) { + throw new MappingException( "Cannot cache an unknown collection: " + holder.role ); } - setListeners( type, listeners ); + collection.setCacheConcurrencyStrategy( holder.usage ); + collection.setCacheRegionName( holder.region ); } - public void setListeners(String type, String[] listenerClasses) { - Object[] listeners = null; - if ( listenerClasses != null ) { - listeners = (Object[]) Array.newInstance( eventListeners.getListenerClassFor(type), listenerClasses.length ); - for ( int i = 0; i < listeners.length ; i++ ) { - try { - listeners[i] = ReflectHelper.classForName( listenerClasses[i] ).newInstance(); + /** + * Get the query language imports + * + * @return a mapping from "import" names to fully qualified class names + */ + public Map getImports() { + return imports; + } + + /** + * Create an object-oriented view of the configuration properties + * + * @param serviceRegistry The registry of services to be used in building these settings. + * + * @return The build settings + */ + public Settings buildSettings(ServiceRegistry serviceRegistry) { + Properties clone = ( Properties ) properties.clone(); + ConfigurationHelper.resolvePlaceHolders( clone ); + return buildSettingsInternal( clone, serviceRegistry ); + } + + public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) throws HibernateException { + return buildSettingsInternal( props, serviceRegistry ); + } + + private Settings buildSettingsInternal(Properties props, ServiceRegistry serviceRegistry) { + final Settings settings = settingsFactory.buildSettings( props, serviceRegistry ); + settings.setEntityTuplizerFactory( this.getEntityTuplizerFactory() ); +// settings.setComponentTuplizerFactory( this.getComponentTuplizerFactory() ); + return settings; + } + + public Map getNamedSQLQueries() { + return namedSqlQueries; + } + + public Map getSqlResultSetMappings() { + return sqlResultSetMappings; + } + + public NamingStrategy getNamingStrategy() { + return namingStrategy; + } + + /** + * Set a custom naming strategy + * + * @param namingStrategy the NamingStrategy to set + * + * @return this for method chaining + */ + public Configuration setNamingStrategy(NamingStrategy namingStrategy) { + this.namingStrategy = namingStrategy; + return this; + } + + /** + * Retrieve the IdentifierGeneratorFactory in effect for this configuration. + * + * @return This configuration's IdentifierGeneratorFactory. + */ + public MutableIdentifierGeneratorFactory getIdentifierGeneratorFactory() { + return identifierGeneratorFactory; + } + + public Mapping buildMapping() { + return new Mapping() { + public IdentifierGeneratorFactory getIdentifierGeneratorFactory() { + return identifierGeneratorFactory; + } + + /** + * Returns the identifier type of a mapped class + */ + public Type getIdentifierType(String entityName) throws MappingException { + PersistentClass pc = classes.get( entityName ); + if ( pc == null ) { + throw new MappingException( "persistent class not known: " + entityName ); } - catch (Exception e) { + return pc.getIdentifier().getType(); + } + + public String getIdentifierPropertyName(String entityName) throws MappingException { + final PersistentClass pc = classes.get( entityName ); + if ( pc == null ) { + throw new MappingException( "persistent class not known: " + entityName ); + } + if ( !pc.hasIdentifierProperty() ) { + return null; + } + return pc.getIdentifierProperty().getName(); + } + + public Type getReferencedPropertyType(String entityName, String propertyName) throws MappingException { + final PersistentClass pc = classes.get( entityName ); + if ( pc == null ) { + throw new MappingException( "persistent class not known: " + entityName ); + } + Property prop = pc.getReferencedProperty( propertyName ); + if ( prop == null ) { throw new MappingException( - "Unable to instantiate specified event (" + type + ") listener class: " + listenerClasses[i], - e + "property not known: " + + entityName + '.' + propertyName ); } + return prop.getType(); } + }; + } + + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + //we need reflectionManager before reading the other components (MetadataSourceQueue in particular) + final MetadataProvider metadataProvider = (MetadataProvider) ois.readObject(); + this.mapping = buildMapping(); + xmlHelper = new XMLHelper(); + createReflectionManager(metadataProvider); + ois.defaultReadObject(); + } + + private void writeObject(java.io.ObjectOutputStream out) throws IOException { + //We write MetadataProvider first as we need reflectionManager before reading the other components + final MetadataProvider metadataProvider = ( ( MetadataProviderInjector ) reflectionManager ).getMetadataProvider(); + out.writeObject( metadataProvider ); + out.defaultWriteObject(); + } + + private void createReflectionManager() { + createReflectionManager( new JPAMetadataProvider() ); + } + + private void createReflectionManager(MetadataProvider metadataProvider) { + reflectionManager = new JavaReflectionManager(); + ( ( MetadataProviderInjector ) reflectionManager ).setMetadataProvider( metadataProvider ); + } + + public Map getFilterDefinitions() { + return filterDefinitions; + } + + public void addFilterDefinition(FilterDefinition definition) { + filterDefinitions.put( definition.getFilterName(), definition ); + } + + public Iterator iterateFetchProfiles() { + return fetchProfiles.values().iterator(); + } + + public void addFetchProfile(FetchProfile fetchProfile) { + fetchProfiles.put( fetchProfile.getName(), fetchProfile ); + } + + public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject object) { + auxiliaryDatabaseObjects.add( object ); + } + + public Map getSqlFunctions() { + return sqlFunctions; + } + + public void addSqlFunction(String functionName, SQLFunction function) { + // HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce, + // just in case a user's customer dialect uses mixed cases. + sqlFunctions.put( functionName.toLowerCase(), function ); + } + + public TypeResolver getTypeResolver() { + return typeResolver; + } + + /** + * Allows registration of a type into the type registry. The phrase 'override' in the method name simply + * reminds that registration *potentially* replaces a previously registered type . + * + * @param type The type to register. + */ + public void registerTypeOverride(BasicType type) { + getTypeResolver().registerTypeOverride( type ); + } + + + public void registerTypeOverride(UserType type, String[] keys) { + getTypeResolver().registerTypeOverride( type, keys ); + } + + public void registerTypeOverride(CompositeUserType type, String[] keys) { + getTypeResolver().registerTypeOverride( type, keys ); + } + + public void registerTypeContributor(TypeContributor typeContributor) { + typeContributorRegistrations.add( typeContributor ); + } + + public SessionFactoryObserver getSessionFactoryObserver() { + return sessionFactoryObserver; + } + + public void setSessionFactoryObserver(SessionFactoryObserver sessionFactoryObserver) { + this.sessionFactoryObserver = sessionFactoryObserver; + } + + public CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver() { + return currentTenantIdentifierResolver; + } + + public void setCurrentTenantIdentifierResolver(CurrentTenantIdentifierResolver currentTenantIdentifierResolver) { + this.currentTenantIdentifierResolver = currentTenantIdentifierResolver; + } + + /** + * Adds the AttributeConverter Class to this Configuration. + * + * @param attributeConverterClass The AttributeConverter class. + * @param autoApply Should the AttributeConverter be auto applied to property types as specified + * by its "entity attribute" parameterized type? + */ + public void addAttributeConverter(Class attributeConverterClass, boolean autoApply) { + addAttributeConverter( + instantiateAttributeConverter( attributeConverterClass ), + autoApply + ); + } + + private AttributeConverter instantiateAttributeConverter(Class attributeConverterClass) { + AttributeConverter attributeConverter; + try { + attributeConverter = attributeConverterClass.newInstance(); } - setListeners( type, listeners ); + catch (Exception e) { + throw new AnnotationException( + "Unable to instantiate AttributeConverter [" + attributeConverterClass.getName() + "]", + e + ); + } + return attributeConverter; } - public void setListener(String type, Object listener) { - Object[] listeners = null; - if ( listener != null ) { - listeners = (Object[]) Array.newInstance( eventListeners.getListenerClassFor(type), 1 ); - listeners[0] = listener; + /** + * Adds the AttributeConverter Class to this Configuration. + * + * @param attributeConverterClass The AttributeConverter class. + */ + public void addAttributeConverter(Class attributeConverterClass) { + addAttributeConverter( instantiateAttributeConverter( attributeConverterClass ) ); + } + + /** + * Adds the AttributeConverter instance to this Configuration. This form is mainly intended for developers + * to programatically add their own AttributeConverter instance. HEM, instead, uses the + * {@link #addAttributeConverter(Class, boolean)} form + * + * @param attributeConverter The AttributeConverter instance. + */ + public void addAttributeConverter(AttributeConverter attributeConverter) { + boolean autoApply = false; + Converter converterAnnotation = attributeConverter.getClass().getAnnotation( Converter.class ); + if ( converterAnnotation != null ) { + autoApply = converterAnnotation.autoApply(); } - setListeners( type, listeners ); + + addAttributeConverter( new AttributeConverterDefinition( attributeConverter, autoApply ) ); } - public void setListeners(String type, Object[] listeners) { - if ( "auto-flush".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setAutoFlushEventListeners( new AutoFlushEventListener[]{} ); + /** + * Adds the AttributeConverter instance to this Configuration. This form is mainly intended for developers + * to programatically add their own AttributeConverter instance. HEM, instead, uses the + * {@link #addAttributeConverter(Class, boolean)} form + * + * @param attributeConverter The AttributeConverter instance. + * @param autoApply Should the AttributeConverter be auto applied to property types as specified + * by its "entity attribute" parameterized type? + */ + public void addAttributeConverter(AttributeConverter attributeConverter, boolean autoApply) { + addAttributeConverter( new AttributeConverterDefinition( attributeConverter, autoApply ) ); + } + + public void addAttributeConverter(AttributeConverterDefinition definition) { + if ( attributeConverterDefinitionsByClass == null ) { + attributeConverterDefinitionsByClass = new ConcurrentHashMap(); + } + + final Object old = attributeConverterDefinitionsByClass.put( definition.getAttributeConverter().getClass(), definition ); + + if ( old != null ) { + throw new AssertionFailure( + String.format( + "AttributeConverter class [%s] registered multiple times", + definition.getAttributeConverter().getClass() + ) + ); + } + } + + public java.util.Collection getNamedEntityGraphs() { + return namedEntityGraphMap == null + ? Collections.emptyList() + : namedEntityGraphMap.values(); + } + + + // Mappings impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * Internal implementation of the Mappings interface giving access to the Configuration's internal + * metadata repository state ({@link Configuration#classes}, {@link Configuration#tables}, etc). + */ + @SuppressWarnings( {"deprecation", "unchecked"}) + protected class MappingsImpl implements ExtendedMappings, Serializable { + + private String schemaName; + + public String getSchemaName() { + return schemaName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + + + private String catalogName; + + public String getCatalogName() { + return catalogName; + } + + public void setCatalogName(String catalogName) { + this.catalogName = catalogName; + } + + + private String defaultPackage; + + public String getDefaultPackage() { + return defaultPackage; + } + + public void setDefaultPackage(String defaultPackage) { + this.defaultPackage = defaultPackage; + } + + + private boolean autoImport; + + public boolean isAutoImport() { + return autoImport; + } + + public void setAutoImport(boolean autoImport) { + this.autoImport = autoImport; + } + + + private boolean defaultLazy; + + public boolean isDefaultLazy() { + return defaultLazy; + } + + public void setDefaultLazy(boolean defaultLazy) { + this.defaultLazy = defaultLazy; + } + + + private String defaultCascade; + + public String getDefaultCascade() { + return defaultCascade; + } + + public void setDefaultCascade(String defaultCascade) { + this.defaultCascade = defaultCascade; + } + + + private String defaultAccess; + + public String getDefaultAccess() { + return defaultAccess; + } + + public void setDefaultAccess(String defaultAccess) { + this.defaultAccess = defaultAccess; + } + + + public NamingStrategy getNamingStrategy() { + return namingStrategy; + } + + public void setNamingStrategy(NamingStrategy namingStrategy) { + Configuration.this.namingStrategy = namingStrategy; + } + + public TypeResolver getTypeResolver() { + return typeResolver; + } + + public Iterator iterateClasses() { + return classes.values().iterator(); + } + + public PersistentClass getClass(String entityName) { + return classes.get( entityName ); + } + + public PersistentClass locatePersistentClassByEntityName(String entityName) { + PersistentClass persistentClass = classes.get( entityName ); + if ( persistentClass == null ) { + String actualEntityName = imports.get( entityName ); + if ( StringHelper.isNotEmpty( actualEntityName ) ) { + persistentClass = classes.get( actualEntityName ); + } } - else { - eventListeners.setAutoFlushEventListeners( (AutoFlushEventListener[]) listeners ); + return persistentClass; + } + + public void addClass(PersistentClass persistentClass) throws DuplicateMappingException { + Object old = classes.put( persistentClass.getEntityName(), persistentClass ); + if ( old != null ) { + throw new DuplicateMappingException( "class/entity", persistentClass.getEntityName() ); } } - else if ( "merge".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setMergeEventListeners( new MergeEventListener[]{} ); + + public void addImport(String entityName, String rename) throws DuplicateMappingException { + String existing = imports.put( rename, entityName ); + if ( existing != null ) { + if (existing.equals(entityName)) LOG.duplicateImport(entityName, rename); + else throw new DuplicateMappingException("duplicate import: " + rename + " refers to both " + entityName + " and " + + existing + " (try using auto-import=\"false\")", "import", rename); } - else { - eventListeners.setMergeEventListeners( (MergeEventListener[]) listeners ); + } + + public Collection getCollection(String role) { + return collections.get( role ); + } + + public Iterator iterateCollections() { + return collections.values().iterator(); + } + + public void addCollection(Collection collection) throws DuplicateMappingException { + Object old = collections.put( collection.getRole(), collection ); + if ( old != null ) { + throw new DuplicateMappingException( "collection role", collection.getRole() ); } } - else if ( "create".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPersistEventListeners( new PersistEventListener[]{} ); + + public Table getTable(String schema, String catalog, String name) { + String key = Table.qualify(catalog, schema, name); + return tables.get( key ); + } + + public Iterator

iterateTables() { + return tables.values().iterator(); + } + + public Table addTable( + String schema, + String catalog, + String name, + String subselect, + boolean isAbstract) { + name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); + schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); + catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); + + String key = subselect == null ? Table.qualify( catalog, schema, name ) : subselect; + Table table = tables.get( key ); + + if ( table == null ) { + table = new Table(); + table.setAbstract( isAbstract ); + table.setName( name ); + table.setSchema( schema ); + table.setCatalog( catalog ); + table.setSubselect( subselect ); + tables.put( key, table ); } else { - eventListeners.setPersistEventListeners( (PersistEventListener[]) listeners ); + if ( !isAbstract ) { + table.setAbstract( false ); + } } + + return table; } - else if ( "create-onflush".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPersistOnFlushEventListeners( new PersistEventListener[]{} ); + + public Table addDenormalizedTable( + String schema, + String catalog, + String name, + boolean isAbstract, + String subselect, + Table includedTable) throws DuplicateMappingException { + name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); + schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); + catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); + + String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect; + if ( tables.containsKey( key ) ) { + throw new DuplicateMappingException( "table", name ); } - else { - eventListeners.setPersistOnFlushEventListeners( (PersistEventListener[]) listeners ); + + Table table = new DenormalizedTable( includedTable ); + table.setAbstract( isAbstract ); + table.setName( name ); + table.setSchema( schema ); + table.setCatalog( catalog ); + table.setSubselect( subselect ); + + tables.put( key, table ); + return table; + } + + public NamedQueryDefinition getQuery(String name) { + return namedQueries.get( name ); + } + + public void addQuery(String name, NamedQueryDefinition query) throws DuplicateMappingException { + if ( !defaultNamedQueryNames.contains( name ) ) { + applyQuery( name, query ); } } - else if ( "delete".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setDeleteEventListeners( new DeleteEventListener[]{} ); + + private void applyQuery(String name, NamedQueryDefinition query) { + checkQueryName( name ); + namedQueries.put( name.intern(), query ); + } + + private void checkQueryName(String name) throws DuplicateMappingException { + if ( namedQueries.containsKey( name ) || namedSqlQueries.containsKey( name ) ) { + throw new DuplicateMappingException( "query", name ); } - else { - eventListeners.setDeleteEventListeners( (DeleteEventListener[]) listeners ); + } + + public void addDefaultQuery(String name, NamedQueryDefinition query) { + applyQuery( name, query ); + defaultNamedQueryNames.add( name ); + } + + public NamedSQLQueryDefinition getSQLQuery(String name) { + return namedSqlQueries.get( name ); + } + + public void addSQLQuery(String name, NamedSQLQueryDefinition query) throws DuplicateMappingException { + if ( !defaultNamedNativeQueryNames.contains( name ) ) { + applySQLQuery( name, query ); } } - else if ( "dirty-check".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setDirtyCheckEventListeners( new DirtyCheckEventListener[]{} ); + + private void applySQLQuery(String name, NamedSQLQueryDefinition query) throws DuplicateMappingException { + checkQueryName( name ); + namedSqlQueries.put( name.intern(), query ); + } + + @Override + public void addNamedProcedureCallDefinition(NamedProcedureCallDefinition definition) + throws DuplicateMappingException { + final String name = definition.getRegisteredName(); + if ( !defaultNamedProcedure.contains( name ) ) { + final NamedProcedureCallDefinition previous = namedProcedureCallMap.put( name, definition ); + if ( previous != null ) { + throw new DuplicateMappingException( "named stored procedure query", name ); + } } - else { - eventListeners.setDirtyCheckEventListeners( (DirtyCheckEventListener[]) listeners ); + } + @Override + public void addDefaultNamedProcedureCallDefinition(NamedProcedureCallDefinition definition) + throws DuplicateMappingException { + addNamedProcedureCallDefinition( definition ); + defaultNamedProcedure.add( definition.getRegisteredName() ); + } + + @Override + public void addNamedEntityGraphDefintion(NamedEntityGraphDefinition definition) + throws DuplicateMappingException { + final String name = definition.getRegisteredName(); + + final NamedEntityGraphDefinition previous = namedEntityGraphMap.put( name, definition ); + if ( previous != null ) { + throw new DuplicateMappingException( "NamedEntityGraph", name ); } } - else if ( "evict".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setEvictEventListeners( new EvictEventListener[]{} ); + + public void addDefaultSQLQuery(String name, NamedSQLQueryDefinition query) { + applySQLQuery( name, query ); + defaultNamedNativeQueryNames.add( name ); + } + + public ResultSetMappingDefinition getResultSetMapping(String name) { + return sqlResultSetMappings.get(name); + } + + public void addResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping) throws DuplicateMappingException { + if ( !defaultSqlResultSetMappingNames.contains( sqlResultSetMapping.getName() ) ) { + applyResultSetMapping( sqlResultSetMapping ); } - else { - eventListeners.setEvictEventListeners( (EvictEventListener[]) listeners ); + } + + public void applyResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping) throws DuplicateMappingException { + Object old = sqlResultSetMappings.put( sqlResultSetMapping.getName(), sqlResultSetMapping ); + if ( old != null ) { + throw new DuplicateMappingException( "resultSet", sqlResultSetMapping.getName() ); } } - else if ( "flush".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setFlushEventListeners( new FlushEventListener[]{} ); + + public void addDefaultResultSetMapping(ResultSetMappingDefinition definition) { + final String name = definition.getName(); + if ( !defaultSqlResultSetMappingNames.contains( name ) && getResultSetMapping( name ) != null ) { + removeResultSetMapping( name ); } - else { - eventListeners.setFlushEventListeners( (FlushEventListener[]) listeners ); + applyResultSetMapping( definition ); + defaultSqlResultSetMappingNames.add( name ); + } + + protected void removeResultSetMapping(String name) { + sqlResultSetMappings.remove( name ); + } + + public TypeDef getTypeDef(String typeName) { + return typeDefs.get( typeName ); + } + + public void addTypeDef(String typeName, String typeClass, Properties paramMap) { + TypeDef def = new TypeDef( typeClass, paramMap ); + typeDefs.put( typeName, def ); + LOG.debugf( "Added %s with class %s", typeName, typeClass ); + } + + public Map getFilterDefinitions() { + return filterDefinitions; + } + + public FilterDefinition getFilterDefinition(String name) { + return filterDefinitions.get( name ); + } + + public void addFilterDefinition(FilterDefinition definition) { + filterDefinitions.put( definition.getFilterName(), definition ); + } + + public FetchProfile findOrCreateFetchProfile(String name, MetadataSource source) { + FetchProfile profile = fetchProfiles.get( name ); + if ( profile == null ) { + profile = new FetchProfile( name, source ); + fetchProfiles.put( name, profile ); } + return profile; } - else if ( "flush-entity".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setFlushEntityEventListeners( new FlushEntityEventListener[]{} ); + + public Iterator iterateAuxliaryDatabaseObjects() { + return iterateAuxiliaryDatabaseObjects(); + } + + public Iterator iterateAuxiliaryDatabaseObjects() { + return auxiliaryDatabaseObjects.iterator(); + } + + public ListIterator iterateAuxliaryDatabaseObjectsInReverse() { + return iterateAuxiliaryDatabaseObjectsInReverse(); + } + + public ListIterator iterateAuxiliaryDatabaseObjectsInReverse() { + return auxiliaryDatabaseObjects.listIterator( auxiliaryDatabaseObjects.size() ); + } + + public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject) { + auxiliaryDatabaseObjects.add( auxiliaryDatabaseObject ); + } + + /** + * Internal struct used to help track physical table names to logical table names. + */ + private class TableDescription implements Serializable { + final String logicalName; + final Table denormalizedSupertable; + + TableDescription(String logicalName, Table denormalizedSupertable) { + this.logicalName = logicalName; + this.denormalizedSupertable = denormalizedSupertable; } - else { - eventListeners.setFlushEntityEventListeners( (FlushEntityEventListener[]) listeners ); + } + + public String getLogicalTableName(Table table) throws MappingException { + return getLogicalTableName( table.getQuotedSchema(), table.getQuotedCatalog(), table.getQuotedName() ); + } + + private String getLogicalTableName(String schema, String catalog, String physicalName) throws MappingException { + String key = buildTableNameKey( schema, catalog, physicalName ); + TableDescription descriptor = (TableDescription) tableNameBinding.get( key ); + if (descriptor == null) { + throw new MappingException( "Unable to find physical table: " + physicalName); } + return descriptor.logicalName; } - else if ( "load".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setLoadEventListeners( new LoadEventListener[]{} ); + + public void addTableBinding( + String schema, + String catalog, + String logicalName, + String physicalName, + Table denormalizedSuperTable) throws DuplicateMappingException { + String key = buildTableNameKey( schema, catalog, physicalName ); + TableDescription tableDescription = new TableDescription( logicalName, denormalizedSuperTable ); + TableDescription oldDescriptor = ( TableDescription ) tableNameBinding.put( key, tableDescription ); + if ( oldDescriptor != null && ! oldDescriptor.logicalName.equals( logicalName ) ) { + //TODO possibly relax that + throw new DuplicateMappingException( + "Same physical table name [" + physicalName + "] references several logical table names: [" + + oldDescriptor.logicalName + "], [" + logicalName + ']', + "table", + physicalName + ); } - else { - eventListeners.setLoadEventListeners( (LoadEventListener[]) listeners ); - } } - else if ( "load-collection".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setInitializeCollectionEventListeners( - new InitializeCollectionEventListener[]{} - ); + + private String buildTableNameKey(String schema, String catalog, String finalName) { + StringBuilder keyBuilder = new StringBuilder(); + if (schema != null) keyBuilder.append( schema ); + keyBuilder.append( "."); + if (catalog != null) keyBuilder.append( catalog ); + keyBuilder.append( "."); + keyBuilder.append( finalName ); + return keyBuilder.toString(); + } + + /** + * Internal struct used to maintain xref between physical and logical column + * names for a table. Mainly this is used to ensure that the defined + * {@link NamingStrategy} is not creating duplicate column names. + */ + private class TableColumnNameBinding implements Serializable { + private final String tableName; + private Map/**/ logicalToPhysical = new HashMap(); + private Map/**/ physicalToLogical = new HashMap(); + + private TableColumnNameBinding(String tableName) { + this.tableName = tableName; } - else { - eventListeners.setInitializeCollectionEventListeners( - (InitializeCollectionEventListener[]) listeners + + public void addBinding(String logicalName, Column physicalColumn) { + bindLogicalToPhysical( logicalName, physicalColumn ); + bindPhysicalToLogical( logicalName, physicalColumn ); + } + + private void bindLogicalToPhysical(String logicalName, Column physicalColumn) throws DuplicateMappingException { + final String logicalKey = logicalName.toLowerCase(); + final String physicalName = physicalColumn.getQuotedName(); + final String existingPhysicalName = ( String ) logicalToPhysical.put( logicalKey, physicalName ); + if ( existingPhysicalName != null ) { + boolean areSamePhysicalColumn = physicalColumn.isQuoted() + ? existingPhysicalName.equals( physicalName ) + : existingPhysicalName.equalsIgnoreCase( physicalName ); + if ( ! areSamePhysicalColumn ) { + throw new DuplicateMappingException( + " Table [" + tableName + "] contains logical column name [" + logicalName + + "] referenced by multiple physical column names: [" + existingPhysicalName + + "], [" + physicalName + "]", + "column-binding", + tableName + "." + logicalName + ); + } + } + } + + private void bindPhysicalToLogical(String logicalName, Column physicalColumn) throws DuplicateMappingException { + final String physicalName = physicalColumn.getQuotedName(); + final String existingLogicalName = ( String ) physicalToLogical.put( physicalName, logicalName ); + if ( existingLogicalName != null && ! existingLogicalName.equals( logicalName ) ) { + throw new DuplicateMappingException( + " Table [" + tableName + "] contains physical column name [" + physicalName + + "] represented by different logical column names: [" + existingLogicalName + + "], [" + logicalName + "]", + "column-binding", + tableName + "." + physicalName ); + } } } - else if ( "lock".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setLockEventListeners( new LockEventListener[]{} ); + + public void addColumnBinding(String logicalName, Column physicalColumn, Table table) throws DuplicateMappingException { + TableColumnNameBinding binding = ( TableColumnNameBinding ) columnNameBindingPerTable.get( table ); + if ( binding == null ) { + binding = new TableColumnNameBinding( table.getName() ); + columnNameBindingPerTable.put( table, binding ); } - else { - eventListeners.setLockEventListeners( (LockEventListener[]) listeners ); + binding.addBinding( logicalName, physicalColumn ); + } + + public String getPhysicalColumnName(String logicalName, Table table) throws MappingException { + logicalName = logicalName.toLowerCase(); + String finalName = null; + Table currentTable = table; + do { + TableColumnNameBinding binding = ( TableColumnNameBinding ) columnNameBindingPerTable.get( currentTable ); + if ( binding != null ) { + finalName = ( String ) binding.logicalToPhysical.get( logicalName ); + } + String key = buildTableNameKey( + currentTable.getQuotedSchema(), currentTable.getQuotedCatalog(), currentTable.getQuotedName() + ); + TableDescription description = ( TableDescription ) tableNameBinding.get( key ); + if ( description != null ) { + currentTable = description.denormalizedSupertable; + } + else { + currentTable = null; + } + } while ( finalName == null && currentTable != null ); + + if ( finalName == null ) { + throw new MappingException( + "Unable to find column with logical name " + logicalName + " in table " + table.getName() + ); } + return finalName; } - else if ( "refresh".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setRefreshEventListeners( new RefreshEventListener[]{} ); + @Override + public String getLogicalColumnName(String physicalName, Table table) throws MappingException { + String logical = null; + Table currentTable = table; + TableDescription description = null; + do { + TableColumnNameBinding binding = ( TableColumnNameBinding ) columnNameBindingPerTable.get( currentTable ); + if ( binding != null ) { + logical = ( String ) binding.physicalToLogical.get( physicalName ); + } + String key = buildTableNameKey( + currentTable.getQuotedSchema(), currentTable.getQuotedCatalog(), currentTable.getQuotedName() + ); + description = ( TableDescription ) tableNameBinding.get( key ); + if ( description != null ) { + currentTable = description.denormalizedSupertable; + } + else { + currentTable = null; + } } - else { - eventListeners.setRefreshEventListeners( (RefreshEventListener[]) listeners ); + while ( logical == null && currentTable != null ); + if ( logical == null ) { + throw new MappingException( + "Unable to find logical column name from physical name " + + physicalName + " in table " + table.getName() + ); } + return logical; } - else if ( "replicate".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setReplicateEventListeners( new ReplicateEventListener[]{} ); + + public void addSecondPass(SecondPass sp) { + addSecondPass( sp, false ); + } + + public void addSecondPass(SecondPass sp, boolean onTopOfTheQueue) { + if ( onTopOfTheQueue ) { + secondPasses.add( 0, sp ); } else { - eventListeners.setReplicateEventListeners( (ReplicateEventListener[]) listeners ); + secondPasses.add( sp ); } } - else if ( "save-update".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setSaveOrUpdateEventListeners( new SaveOrUpdateEventListener[]{} ); + + @Override + public AttributeConverterDefinition locateAttributeConverter(Class converterClass) { + if ( attributeConverterDefinitionsByClass == null ) { + return null; } - else { - eventListeners.setSaveOrUpdateEventListeners( (SaveOrUpdateEventListener[]) listeners ); + return attributeConverterDefinitionsByClass.get( converterClass ); + } + + @Override + public java.util.Collection getAttributeConverters() { + if ( attributeConverterDefinitionsByClass == null ) { + return Collections.emptyList(); } + return attributeConverterDefinitionsByClass.values(); } - else if ( "save".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setSaveEventListeners( new SaveOrUpdateEventListener[]{} ); + + public void addPropertyReference(String referencedClass, String propertyName) { + propertyReferences.add( new PropertyReference( referencedClass, propertyName, false ) ); + } + + public void addUniquePropertyReference(String referencedClass, String propertyName) { + propertyReferences.add( new PropertyReference( referencedClass, propertyName, true ) ); + } + + public void addToExtendsQueue(ExtendsQueueEntry entry) { + extendsQueue.put( entry, null ); + } + + public MutableIdentifierGeneratorFactory getIdentifierGeneratorFactory() { + return identifierGeneratorFactory; + } + + public void addMappedSuperclass(Class type, MappedSuperclass mappedSuperclass) { + mappedSuperClasses.put( type, mappedSuperclass ); + } + + public MappedSuperclass getMappedSuperclass(Class type) { + return mappedSuperClasses.get( type ); + } + + public ObjectNameNormalizer getObjectNameNormalizer() { + return normalizer; + } + + public Properties getConfigurationProperties() { + return properties; + } + + public void addDefaultGenerator(IdGenerator generator) { + this.addGenerator( generator ); + defaultNamedGenerators.add( generator.getName() ); + } + + public boolean isInSecondPass() { + return inSecondPass; + } + + public PropertyData getPropertyAnnotatedWithMapsId(XClass entityType, String propertyName) { + final Map map = propertiesAnnotatedWithMapsId.get( entityType ); + return map == null ? null : map.get( propertyName ); + } + + public void addPropertyAnnotatedWithMapsId(XClass entityType, PropertyData property) { + Map map = propertiesAnnotatedWithMapsId.get( entityType ); + if ( map == null ) { + map = new HashMap(); + propertiesAnnotatedWithMapsId.put( entityType, map ); } - else { - eventListeners.setSaveEventListeners( (SaveOrUpdateEventListener[]) listeners ); + map.put( property.getProperty().getAnnotation( MapsId.class ).value(), property ); + } + + public boolean isSpecjProprietarySyntaxEnabled() { + return specjProprietarySyntaxEnabled; + } + + public void addPropertyAnnotatedWithMapsIdSpecj(XClass entityType, PropertyData property, String mapsIdValue) { + Map map = propertiesAnnotatedWithMapsId.get( entityType ); + if ( map == null ) { + map = new HashMap(); + propertiesAnnotatedWithMapsId.put( entityType, map ); } + map.put( mapsIdValue, property ); } - else if ( "update".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setUpdateEventListeners( new SaveOrUpdateEventListener[]{} ); + + public PropertyData getPropertyAnnotatedWithIdAndToOne(XClass entityType, String propertyName) { + final Map map = propertiesAnnotatedWithIdAndToOne.get( entityType ); + return map == null ? null : map.get( propertyName ); + } + + public void addToOneAndIdProperty(XClass entityType, PropertyData property) { + Map map = propertiesAnnotatedWithIdAndToOne.get( entityType ); + if ( map == null ) { + map = new HashMap(); + propertiesAnnotatedWithIdAndToOne.put( entityType, map ); } - else { - eventListeners.setUpdateEventListeners( (SaveOrUpdateEventListener[]) listeners ); + map.put( property.getPropertyName(), property ); + } + + private Boolean useNewGeneratorMappings; + + @Override + public boolean useNewGeneratorMappings() { + if ( useNewGeneratorMappings == null ) { + final String booleanName = getConfigurationProperties() + .getProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS ); + useNewGeneratorMappings = Boolean.valueOf( booleanName ); } + return useNewGeneratorMappings; } - else if ( "pre-load".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPreLoadEventListeners( new PreLoadEventListener[]{} ); + + + private Boolean implicitDiscriminatorColumnForJoinedInheritance; + + @Override + public boolean useImplicitDiscriminatorColumnForJoinedInheritance() { + if ( implicitDiscriminatorColumnForJoinedInheritance == null ) { + final String booleanName = getConfigurationProperties() + .getProperty( AvailableSettings.IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS ); + implicitDiscriminatorColumnForJoinedInheritance = Boolean.valueOf( booleanName ); } - else { - eventListeners.setPreLoadEventListeners( (PreLoadEventListener[]) listeners ); - } + return implicitDiscriminatorColumnForJoinedInheritance; } - else if ( "pre-update".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPreUpdateEventListeners( new PreUpdateEventListener[]{} ); + + + private Boolean ignoreExplicitDiscriminatorColumnForJoinedInheritance; + + @Override + public boolean ignoreExplicitDiscriminatorColumnForJoinedInheritance() { + if ( ignoreExplicitDiscriminatorColumnForJoinedInheritance == null ) { + final String booleanName = getConfigurationProperties() + .getProperty( AvailableSettings.IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS ); + ignoreExplicitDiscriminatorColumnForJoinedInheritance = Boolean.valueOf( booleanName ); } - else { - eventListeners.setPreUpdateEventListeners( (PreUpdateEventListener[]) listeners ); - } + return ignoreExplicitDiscriminatorColumnForJoinedInheritance; } - else if ( "pre-delete".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPreDeleteEventListeners( new PreDeleteEventListener[]{} ); + + + private Boolean useNationalizedCharacterData; + + @Override + public boolean useNationalizedCharacterData() { + if ( useNationalizedCharacterData == null ) { + final String booleanName = getConfigurationProperties() + .getProperty( AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA ); + useNationalizedCharacterData = Boolean.valueOf( booleanName ); } - else { - eventListeners.setPreDeleteEventListeners( (PreDeleteEventListener[]) listeners ); - } + return useNationalizedCharacterData; } - else if ( "pre-insert".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPreInsertEventListeners( new PreInsertEventListener[]{} ); + + private Boolean forceDiscriminatorInSelectsByDefault; + + @Override + public boolean forceDiscriminatorInSelectsByDefault() { + if ( forceDiscriminatorInSelectsByDefault == null ) { + final String booleanName = getConfigurationProperties() + .getProperty( AvailableSettings.FORCE_DISCRIMINATOR_IN_SELECTS_BY_DEFAULT ); + forceDiscriminatorInSelectsByDefault = Boolean.valueOf( booleanName ); } - else { - eventListeners.setPreInsertEventListeners( (PreInsertEventListener[]) listeners ); - } + return forceDiscriminatorInSelectsByDefault; } - else if ( "pre-collection-recreate".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPreCollectionRecreateEventListeners( new PreCollectionRecreateEventListener[]{} ); + + public IdGenerator getGenerator(String name) { + return getGenerator( name, null ); + } + + public IdGenerator getGenerator(String name, Map localGenerators) { + if ( localGenerators != null ) { + IdGenerator result = localGenerators.get( name ); + if ( result != null ) { + return result; + } } - else { - eventListeners.setPreCollectionRecreateEventListeners( (PreCollectionRecreateEventListener[]) listeners ); - } + return namedGenerators.get( name ); } - else if ( "pre-collection-remove".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPreCollectionRemoveEventListeners( new PreCollectionRemoveEventListener[]{} ); + + public void addGenerator(IdGenerator generator) { + if ( !defaultNamedGenerators.contains( generator.getName() ) ) { + IdGenerator old = namedGenerators.put( generator.getName(), generator ); + if ( old != null ) { + LOG.duplicateGeneratorName( old.getName() ); + } } - else { - eventListeners.setPreCollectionRemoveEventListeners( ( PreCollectionRemoveEventListener[]) listeners ); - } } - else if ( "pre-collection-update".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPreCollectionUpdateEventListeners( new PreCollectionUpdateEventListener[]{} ); + + public void addGeneratorTable(String name, Properties params) { + Object old = generatorTables.put( name, params ); + if ( old != null ) { + LOG.duplicateGeneratorTable( name ); } - else { - eventListeners.setPreCollectionUpdateEventListeners( ( PreCollectionUpdateEventListener[]) listeners ); - } } - else if ( "post-load".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostLoadEventListeners( new PostLoadEventListener[]{} ); + + public Properties getGeneratorTableProperties(String name, Map localGeneratorTables) { + if ( localGeneratorTables != null ) { + Properties result = localGeneratorTables.get( name ); + if ( result != null ) { + return result; + } } - else { - eventListeners.setPostLoadEventListeners( (PostLoadEventListener[]) listeners ); - } + return generatorTables.get( name ); } - else if ( "post-update".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostUpdateEventListeners( new PostUpdateEventListener[]{} ); + + public Map getJoins(String entityName) { + return joins.get( entityName ); + } + + public void addJoins(PersistentClass persistentClass, Map joins) { + Object old = Configuration.this.joins.put( persistentClass.getEntityName(), joins ); + if ( old != null ) { + LOG.duplicateJoins( persistentClass.getEntityName() ); } - else { - eventListeners.setPostUpdateEventListeners( (PostUpdateEventListener[]) listeners ); - } } - else if ( "post-delete".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostDeleteEventListeners( new PostDeleteEventListener[]{} ); + + public AnnotatedClassType getClassType(XClass clazz) { + AnnotatedClassType type = classTypes.get( clazz.getName() ); + if ( type == null ) { + return addClassType( clazz ); } else { - eventListeners.setPostDeleteEventListeners( (PostDeleteEventListener[]) listeners ); + return type; } } - else if ( "post-insert".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostInsertEventListeners( new PostInsertEventListener[]{} ); + + //FIXME should be private but is part of the ExtendedMapping contract + + public AnnotatedClassType addClassType(XClass clazz) { + AnnotatedClassType type; + if ( clazz.isAnnotationPresent( Entity.class ) ) { + type = AnnotatedClassType.ENTITY; } - else { - eventListeners.setPostInsertEventListeners( (PostInsertEventListener[]) listeners ); + else if ( clazz.isAnnotationPresent( Embeddable.class ) ) { + type = AnnotatedClassType.EMBEDDABLE; } - } - else if ( "post-commit-update".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostCommitUpdateEventListeners( - new PostUpdateEventListener[]{} - ); + else if ( clazz.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) { + type = AnnotatedClassType.EMBEDDABLE_SUPERCLASS; } else { - eventListeners.setPostCommitUpdateEventListeners( (PostUpdateEventListener[]) listeners ); + type = AnnotatedClassType.NONE; } + classTypes.put( clazz.getName(), type ); + return type; } - else if ( "post-commit-delete".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostCommitDeleteEventListeners( - new PostDeleteEventListener[]{} - ); + + /** + * {@inheritDoc} + */ + public Map> getTableUniqueConstraints() { + final Map> deprecatedStructure = new HashMap>( + CollectionHelper.determineProperSizing( getUniqueConstraintHoldersByTable() ), + CollectionHelper.LOAD_FACTOR + ); + for ( Map.Entry> entry : getUniqueConstraintHoldersByTable().entrySet() ) { + List columnsPerConstraint = new ArrayList( + CollectionHelper.determineProperSizing( entry.getValue().size() ) + ); + deprecatedStructure.put( entry.getKey(), columnsPerConstraint ); + for ( UniqueConstraintHolder holder : entry.getValue() ) { + columnsPerConstraint.add( holder.getColumns() ); + } } - else { - eventListeners.setPostCommitDeleteEventListeners( (PostDeleteEventListener[]) listeners ); - } + return deprecatedStructure; } - else if ( "post-commit-insert".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostCommitInsertEventListeners( - new PostInsertEventListener[]{} + + public Map> getUniqueConstraintHoldersByTable() { + return uniqueConstraintHoldersByTable; + } + + @SuppressWarnings({ "unchecked" }) + public void addUniqueConstraints(Table table, List uniqueConstraints) { + List constraintHolders = new ArrayList( + CollectionHelper.determineProperSizing( uniqueConstraints.size() ) + ); + + int keyNameBase = determineCurrentNumberOfUniqueConstraintHolders( table ); + for ( String[] columns : ( List ) uniqueConstraints ) { + final String keyName = "key" + keyNameBase++; + constraintHolders.add( + new UniqueConstraintHolder().setName( keyName ).setColumns( columns ) ); } - else { - eventListeners.setPostCommitInsertEventListeners( (PostInsertEventListener[]) listeners ); - } + addUniqueConstraintHolders( table, constraintHolders ); } - else if ( "post-collection-recreate".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostCollectionRecreateEventListeners( new PostCollectionRecreateEventListener[]{} ); + + private int determineCurrentNumberOfUniqueConstraintHolders(Table table) { + List currentHolders = getUniqueConstraintHoldersByTable().get( table ); + return currentHolders == null + ? 0 + : currentHolders.size(); + } + + public void addUniqueConstraintHolders(Table table, List uniqueConstraintHolders) { + List holderList = getUniqueConstraintHoldersByTable().get( table ); + if ( holderList == null ) { + holderList = new ArrayList(); + getUniqueConstraintHoldersByTable().put( table, holderList ); } - else { - eventListeners.setPostCollectionRecreateEventListeners( (PostCollectionRecreateEventListener[]) listeners ); - } + holderList.addAll( uniqueConstraintHolders ); } - else if ( "post-collection-remove".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostCollectionRemoveEventListeners( new PostCollectionRemoveEventListener[]{} ); + + public void addJpaIndexHolders(Table table, List holders) { + List holderList = jpaIndexHoldersByTable.get( table ); + if ( holderList == null ) { + holderList = new ArrayList(); + jpaIndexHoldersByTable.put( table, holderList ); } - else { - eventListeners.setPostCollectionRemoveEventListeners( ( PostCollectionRemoveEventListener[]) listeners ); - } + holderList.addAll( holders ); } - else if ( "post-collection-update".equals( type ) ) { - if ( listeners == null ) { - eventListeners.setPostCollectionUpdateEventListeners( new PostCollectionUpdateEventListener[]{} ); + + public void addMappedBy(String entityName, String propertyName, String inversePropertyName) { + mappedByResolver.put( entityName + "." + propertyName, inversePropertyName ); + } + + public String getFromMappedBy(String entityName, String propertyName) { + return mappedByResolver.get( entityName + "." + propertyName ); + } + + public void addPropertyReferencedAssociation(String entityName, String propertyName, String propertyRef) { + propertyRefResolver.put( entityName + "." + propertyName, propertyRef ); + } + + public String getPropertyReferencedAssociation(String entityName, String propertyName) { + return propertyRefResolver.get( entityName + "." + propertyName ); + } + + public ReflectionManager getReflectionManager() { + return reflectionManager; + } + + public Map getClasses() { + return classes; + } + + public void addAnyMetaDef(AnyMetaDef defAnn) throws AnnotationException { + if ( anyMetaDefs.containsKey( defAnn.name() ) ) { + throw new AnnotationException( "Two @AnyMetaDef with the same name defined: " + defAnn.name() ); } - else { - eventListeners.setPostCollectionUpdateEventListeners( ( PostCollectionUpdateEventListener[]) listeners ); - } + anyMetaDefs.put( defAnn.name(), defAnn ); } - else { - throw new MappingException("Unrecognized listener type [" + type + "]"); + + public AnyMetaDef getAnyMetaDef(String name) { + return anyMetaDefs.get( name ); } } - public EventListeners getEventListeners() { - return eventListeners; - } + final ObjectNameNormalizer normalizer = new ObjectNameNormalizerImpl(); - RootClass getRootClassMapping(String clazz) throws MappingException { - try { - return (RootClass) getClassMapping( clazz ); + final class ObjectNameNormalizerImpl extends ObjectNameNormalizer implements Serializable { + public boolean isUseQuotedIdentifiersGlobally() { + //Do not cache this value as we lazily set it in Hibernate Annotation (AnnotationConfiguration) + //TODO use a dedicated protected useQuotedIdentifier flag in Configuration (overriden by AnnotationConfiguration) + String setting = (String) properties.get( Environment.GLOBALLY_QUOTED_IDENTIFIERS ); + return setting != null && Boolean.valueOf( setting ); } - catch (ClassCastException cce) { - throw new MappingException( "You may only specify a cache for root mappings" ); + + public NamingStrategy getNamingStrategy() { + return namingStrategy; } } - /** - * Set up a cache for an entity class - * - * @param clazz - * @param concurrencyStrategy - * @return Configuration - * @throws MappingException - */ - public Configuration setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy) - throws MappingException { - setCacheConcurrencyStrategy( clazz, concurrencyStrategy, clazz ); - return this; - } + protected class MetadataSourceQueue implements Serializable { + private LinkedHashMap> hbmMetadataToEntityNamesMap + = new LinkedHashMap>(); + private Map hbmMetadataByEntityNameXRef = new HashMap(); - public void setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy, String region) - throws MappingException { - setCacheConcurrencyStrategy( clazz, concurrencyStrategy, region, true ); - } + //XClass are not serializable by default + private transient List annotatedClasses = new ArrayList(); + //only used during the secondPhaseCompile pass, hence does not need to be serialized + private transient Map annotatedClassesByEntityNameMap = new HashMap(); - void setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy, String region, boolean includeLazy) - throws MappingException { - RootClass rootClass = getRootClassMapping( clazz ); - if ( rootClass == null ) { - throw new MappingException( "Cannot cache an unknown entity: " + clazz ); + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + ois.defaultReadObject(); + annotatedClassesByEntityNameMap = new HashMap(); + + //build back annotatedClasses + @SuppressWarnings( "unchecked" ) + List serializableAnnotatedClasses = (List) ois.readObject(); + annotatedClasses = new ArrayList( serializableAnnotatedClasses.size() ); + for ( Class clazz : serializableAnnotatedClasses ) { + annotatedClasses.add( reflectionManager.toXClass( clazz ) ); + } } - rootClass.setCacheConcurrencyStrategy( concurrencyStrategy ); - rootClass.setCacheRegionName( region ); - rootClass.setLazyPropertiesCacheable( includeLazy ); - } - /** - * Set up a cache for a collection role - * - * @param collectionRole - * @param concurrencyStrategy - * @return Configuration - * @throws MappingException - */ - public Configuration setCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy) - throws MappingException { - setCollectionCacheConcurrencyStrategy( collectionRole, concurrencyStrategy, collectionRole ); - return this; - } + private void writeObject(java.io.ObjectOutputStream out) throws IOException { + out.defaultWriteObject(); + List serializableAnnotatedClasses = new ArrayList( annotatedClasses.size() ); + for ( XClass xClass : annotatedClasses ) { + serializableAnnotatedClasses.add( reflectionManager.toClass( xClass ) ); + } + out.writeObject( serializableAnnotatedClasses ); + } - public void setCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy, String region) - throws MappingException { - Collection collection = getCollectionMapping( collectionRole ); - if ( collection == null ) { - throw new MappingException( "Cannot cache an unknown collection: " + collectionRole ); + public void add(XmlDocument metadataXml) { + final Document document = metadataXml.getDocumentTree(); + final Element hmNode = document.getRootElement(); + Attribute packNode = hmNode.attribute( "package" ); + String defaultPackage = packNode != null ? packNode.getValue() : ""; + Set entityNames = new HashSet(); + findClassNames( defaultPackage, hmNode, entityNames ); + for ( String entity : entityNames ) { + hbmMetadataByEntityNameXRef.put( entity, metadataXml ); + } + this.hbmMetadataToEntityNamesMap.put( metadataXml, entityNames ); } - collection.setCacheConcurrencyStrategy( concurrencyStrategy ); - collection.setCacheRegionName( region ); - } - /** - * Get the query language imports - * - * @return a mapping from "import" names to fully qualified class names - */ - public Map getImports() { - return imports; - } + private void findClassNames(String defaultPackage, Element startNode, Set names) { + // if we have some extends we need to check if those classes possibly could be inside the + // same hbm.xml file... + Iterator[] classes = new Iterator[4]; + classes[0] = startNode.elementIterator( "class" ); + classes[1] = startNode.elementIterator( "subclass" ); + classes[2] = startNode.elementIterator( "joined-subclass" ); + classes[3] = startNode.elementIterator( "union-subclass" ); - /** - * Create an object-oriented view of the configuration properties - */ - public Settings buildSettings() throws HibernateException { - Properties clone = ( Properties ) properties.clone(); - PropertiesHelper.resolvePlaceHolders( clone ); - return settingsFactory.buildSettings( clone ); - } + Iterator classIterator = new JoinedIterator( classes ); + while ( classIterator.hasNext() ) { + Element element = ( Element ) classIterator.next(); + String entityName = element.attributeValue( "entity-name" ); + if ( entityName == null ) { + entityName = getClassName( element.attribute( "name" ), defaultPackage ); + } + names.add( entityName ); + findClassNames( defaultPackage, element, names ); + } + } - public Settings buildSettings(Properties props) throws HibernateException { - return settingsFactory.buildSettings( props ); - } + private String getClassName(Attribute name, String defaultPackage) { + if ( name == null ) { + return null; + } + String unqualifiedName = name.getValue(); + if ( unqualifiedName == null ) { + return null; + } + if ( unqualifiedName.indexOf( '.' ) < 0 && defaultPackage != null ) { + return defaultPackage + '.' + unqualifiedName; + } + return unqualifiedName; + } - public Map getNamedSQLQueries() { - return namedSqlQueries; - } + public void add(XClass annotatedClass) { + annotatedClasses.add( annotatedClass ); + } - public Map getSqlResultSetMappings() { - return sqlResultSetMappings; - } + protected void syncAnnotatedClasses() { + final Iterator itr = annotatedClasses.iterator(); + while ( itr.hasNext() ) { + final XClass annotatedClass = itr.next(); + if ( annotatedClass.isAnnotationPresent( Entity.class ) ) { + annotatedClassesByEntityNameMap.put( annotatedClass.getName(), annotatedClass ); + continue; + } - /** - * @return the NamingStrategy. - */ - public NamingStrategy getNamingStrategy() { - return namingStrategy; - } + if ( !annotatedClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) { + itr.remove(); + } + } + } - /** - * Set a custom naming strategy - * - * @param namingStrategy the NamingStrategy to set - */ - public Configuration setNamingStrategy(NamingStrategy namingStrategy) { - this.namingStrategy = namingStrategy; - return this; - } + protected void processMetadata(List order) { + syncAnnotatedClasses(); - public Mapping buildMapping() { - return new Mapping() { - /** - * Returns the identifier type of a mapped class - */ - public Type getIdentifierType(String persistentClass) throws MappingException { - PersistentClass pc = ( (PersistentClass) classes.get( persistentClass ) ); - if ( pc == null ) { - throw new MappingException( "persistent class not known: " + persistentClass ); + for ( MetadataSourceType type : order ) { + if ( MetadataSourceType.HBM.equals( type ) ) { + processHbmXmlQueue(); } - return pc.getIdentifier().getType(); + else if ( MetadataSourceType.CLASS.equals( type ) ) { + processAnnotatedClassesQueue(); + } } + } - public String getIdentifierPropertyName(String persistentClass) throws MappingException { - final PersistentClass pc = (PersistentClass) classes.get( persistentClass ); - if ( pc == null ) { - throw new MappingException( "persistent class not known: " + persistentClass ); + private void processHbmXmlQueue() { + LOG.debug( "Processing hbm.xml files" ); + for ( Map.Entry> entry : hbmMetadataToEntityNamesMap.entrySet() ) { + // Unfortunately we have to create a Mappings instance for each iteration here + processHbmXml( entry.getKey(), entry.getValue() ); + } + hbmMetadataToEntityNamesMap.clear(); + hbmMetadataByEntityNameXRef.clear(); + } + + private void processHbmXml(XmlDocument metadataXml, Set entityNames) { + try { + HbmBinder.bindRoot( metadataXml, createMappings(), Collections.EMPTY_MAP, entityNames ); + } + catch ( MappingException me ) { + throw new InvalidMappingException( + metadataXml.getOrigin().getType(), + metadataXml.getOrigin().getName(), + me + ); + } + + for ( String entityName : entityNames ) { + if ( annotatedClassesByEntityNameMap.containsKey( entityName ) ) { + annotatedClasses.remove( annotatedClassesByEntityNameMap.get( entityName ) ); + annotatedClassesByEntityNameMap.remove( entityName ); } - if ( !pc.hasIdentifierProperty() ) { - return null; + } + } + + private void processAnnotatedClassesQueue() { + LOG.debug( "Process annotated classes" ); + //bind classes in the correct order calculating some inheritance state + List orderedClasses = orderAndFillHierarchy( annotatedClasses ); + Mappings mappings = createMappings(); + Map inheritanceStatePerClass = AnnotationBinder.buildInheritanceStates( + orderedClasses, mappings + ); + + + for ( XClass clazz : orderedClasses ) { + AnnotationBinder.bindClass( clazz, inheritanceStatePerClass, mappings ); + + final String entityName = clazz.getName(); + if ( hbmMetadataByEntityNameXRef.containsKey( entityName ) ) { + hbmMetadataToEntityNamesMap.remove( hbmMetadataByEntityNameXRef.get( entityName ) ); + hbmMetadataByEntityNameXRef.remove( entityName ); } - return pc.getIdentifierProperty().getName(); } + annotatedClasses.clear(); + annotatedClassesByEntityNameMap.clear(); + } - public Type getReferencedPropertyType(String persistentClass, String propertyName) throws MappingException { - final PersistentClass pc = (PersistentClass) classes.get( persistentClass ); - if ( pc == null ) { - throw new MappingException( "persistent class not known: " + persistentClass ); + private List orderAndFillHierarchy(List original) { + List copy = new ArrayList( original ); + insertMappedSuperclasses( original, copy ); + + // order the hierarchy + List workingCopy = new ArrayList( copy ); + List newList = new ArrayList( copy.size() ); + while ( workingCopy.size() > 0 ) { + XClass clazz = workingCopy.get( 0 ); + orderHierarchy( workingCopy, newList, copy, clazz ); + } + return newList; + } + + private void insertMappedSuperclasses(List original, List copy) { + for ( XClass clazz : original ) { + XClass superClass = clazz.getSuperclass(); + while ( superClass != null + && !reflectionManager.equals( superClass, Object.class ) + && !copy.contains( superClass ) ) { + if ( superClass.isAnnotationPresent( Entity.class ) + || superClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) { + copy.add( superClass ); + } + superClass = superClass.getSuperclass(); } - Property prop = pc.getReferencedProperty( propertyName ); - if ( prop == null ) { - throw new MappingException( - "property not known: " + - persistentClass + '.' + propertyName - ); + } + } + + private void orderHierarchy(List copy, List newList, List original, XClass clazz) { + if ( clazz == null || reflectionManager.equals( clazz, Object.class ) ) { + return; + } + //process superclass first + orderHierarchy( copy, newList, original, clazz.getSuperclass() ); + if ( original.contains( clazz ) ) { + if ( !newList.contains( clazz ) ) { + newList.add( clazz ); } - return prop.getType(); + copy.remove( clazz ); } - }; - } + } - private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { - ois.defaultReadObject(); - this.mapping = buildMapping(); - xmlHelper = new XMLHelper(); - } + public boolean isEmpty() { + return hbmMetadataToEntityNamesMap.isEmpty() && annotatedClasses.isEmpty(); + } - public Map getFilterDefinitions() { - return filterDefinitions; } - public void addFilterDefinition(FilterDefinition definition) { - filterDefinitions.put( definition.getFilterName(), definition ); - } - public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject object) { - auxiliaryDatabaseObjects.add( object ); - } + public static final MetadataSourceType[] DEFAULT_ARTEFACT_PROCESSING_ORDER = new MetadataSourceType[] { + MetadataSourceType.HBM, + MetadataSourceType.CLASS + }; - public Map getSqlFunctions() { - return sqlFunctions; + private List metadataSourcePrecedence; + + private List determineMetadataSourcePrecedence() { + if ( metadataSourcePrecedence.isEmpty() + && StringHelper.isNotEmpty( getProperties().getProperty( ARTEFACT_PROCESSING_ORDER ) ) ) { + metadataSourcePrecedence = parsePrecedence( getProperties().getProperty( ARTEFACT_PROCESSING_ORDER ) ); + } + if ( metadataSourcePrecedence.isEmpty() ) { + metadataSourcePrecedence = Arrays.asList( DEFAULT_ARTEFACT_PROCESSING_ORDER ); + } + metadataSourcePrecedence = Collections.unmodifiableList( metadataSourcePrecedence ); + + return metadataSourcePrecedence; } - public void addSqlFunction(String functionName, SQLFunction function) { - sqlFunctions.put( functionName, function ); + public void setPrecedence(String precedence) { + this.metadataSourcePrecedence = parsePrecedence( precedence ); } - public SessionFactoryObserver getSessionFactoryObserver() { - return sessionFactoryObserver; + private List parsePrecedence(String s) { + if ( StringHelper.isEmpty( s ) ) { + return Collections.emptyList(); + } + StringTokenizer precedences = new StringTokenizer( s, ",; ", false ); + List tmpPrecedences = new ArrayList(); + while ( precedences.hasMoreElements() ) { + tmpPrecedences.add( MetadataSourceType.parsePrecedence( ( String ) precedences.nextElement() ) ); + } + return tmpPrecedences; } - public void setSessionFactoryObserver(SessionFactoryObserver sessionFactoryObserver) { - this.sessionFactoryObserver = sessionFactoryObserver; + private static class CacheHolder { + public CacheHolder(String role, String usage, String region, boolean isClass, boolean cacheLazy) { + this.role = role; + this.usage = usage; + this.region = region; + this.isClass = isClass; + this.cacheLazy = cacheLazy; + } + + public String role; + public String usage; + public String region; + public boolean isClass; + public boolean cacheLazy; } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/CreateKeySecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/DefaultComponentSafeNamingStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/DefaultNamingStrategy.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/DefaultNamingStrategy.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/DefaultNamingStrategy.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/DefaultNamingStrategy.java 30 Jul 2014 15:51:04 -0000 1.1.2.1 @@ -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,14 +20,13 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.io.Serializable; -import org.hibernate.util.StringHelper; import org.hibernate.AssertionFailure; +import org.hibernate.internal.util.StringHelper; /** * The default NamingStrategy @@ -130,4 +129,4 @@ public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) { return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName + "_" + referencedColumn; } -} \ No newline at end of file +} Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/EJB3DTDEntityResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/EJB3NamingStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/Ejb3Column.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/Ejb3DiscriminatorColumn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/Ejb3JoinColumn.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/Environment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/Environment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/Environment.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/Environment.java 30 Jul 2014 15:51:06 -0000 1.1.2.1 @@ -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,29 +20,28 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; -import java.sql.Statement; import java.sql.Timestamp; +import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Properties; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import org.hibernate.HibernateException; -import org.hibernate.bytecode.BytecodeProvider; -import org.hibernate.util.ConfigHelper; -import org.hibernate.util.PropertiesHelper; +import org.hibernate.Version; +import org.hibernate.bytecode.spi.BytecodeProvider; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.ConfigHelper; +import org.hibernate.internal.util.config.ConfigurationHelper; +import org.jboss.logging.Logger; + /** * Provides access to configuration info passed in Properties objects. *

@@ -67,7 +66,7 @@ * Properties may be either be System properties, properties * defined in a resource named /hibernate.properties or an instance of * java.util.Properties passed to - * Configuration.buildSessionFactory()
+ * Configuration.build()
*
*
* @@ -76,13 +75,8 @@ * * * - * - * - * - * * - * * * @@ -157,14 +151,14 @@ * Session (de)serialization. * * - * - * + * * * * * + * (Defaults to JdbcTransactionFactory.) * * * @@ -174,513 +168,156 @@ * @see org.hibernate.SessionFactory * @author Gavin King */ -public final class Environment { +public final class Environment implements AvailableSettings { + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Environment.class.getName()); - public static final String VERSION = "3.3.1.GA"; - - /** - * ConnectionProvider implementor to use when obtaining connections - */ - public static final String CONNECTION_PROVIDER ="hibernate.connection.provider_class"; - /** - * JDBC driver class - */ - public static final String DRIVER ="hibernate.connection.driver_class"; - /** - * JDBC transaction isolation level - */ - public static final String ISOLATION ="hibernate.connection.isolation"; - /** - * JDBC URL - */ - public static final String URL ="hibernate.connection.url"; - /** - * JDBC user - */ - public static final String USER ="hibernate.connection.username"; - /** - * JDBC password - */ - public static final String PASS ="hibernate.connection.password"; - /** - * JDBC autocommit mode - */ - public static final String AUTOCOMMIT ="hibernate.connection.autocommit"; - /** - * Maximum number of inactive connections for Hibernate's connection pool - */ - public static final String POOL_SIZE ="hibernate.connection.pool_size"; - /** - * java.sql.Datasource JNDI name - */ - public static final String DATASOURCE ="hibernate.connection.datasource"; - /** - * prefix for arbitrary JDBC connection properties - */ - public static final String CONNECTION_PREFIX = "hibernate.connection"; - - /** - * JNDI initial context class, Context.INITIAL_CONTEXT_FACTORY - */ - public static final String JNDI_CLASS ="hibernate.jndi.class"; - /** - * JNDI provider URL, Context.PROVIDER_URL - */ - public static final String JNDI_URL ="hibernate.jndi.url"; - /** - * prefix for arbitrary JNDI InitialContext properties - */ - public static final String JNDI_PREFIX = "hibernate.jndi"; - /** - * JNDI name to bind to SessionFactory - */ - public static final String SESSION_FACTORY_NAME = "hibernate.session_factory_name"; - - /** - * Hibernate SQL Dialect class - */ - public static final String DIALECT ="hibernate.dialect"; - /** - * A default database schema (owner) name to use for unqualified tablenames - */ - public static final String DEFAULT_SCHEMA = "hibernate.default_schema"; - /** - * A default database catalog name to use for unqualified tablenames - */ - public static final String DEFAULT_CATALOG = "hibernate.default_catalog"; - - /** - * Enable logging of generated SQL to the console - */ - public static final String SHOW_SQL ="hibernate.show_sql"; - /** - * Enable formatting of SQL logged to the console - */ - public static final String FORMAT_SQL ="hibernate.format_sql"; - /** - * Add comments to the generated SQL - */ - public static final String USE_SQL_COMMENTS ="hibernate.use_sql_comments"; - /** - * Maximum depth of outer join fetching - */ - public static final String MAX_FETCH_DEPTH = "hibernate.max_fetch_depth"; - /** - * The default batch size for batch fetching - */ - public static final String DEFAULT_BATCH_FETCH_SIZE = "hibernate.default_batch_fetch_size"; - /** - * Use java.io streams to read / write binary data from / to JDBC - */ - public static final String USE_STREAMS_FOR_BINARY = "hibernate.jdbc.use_streams_for_binary"; - /** - * Use JDBC scrollable ResultSets. This property is only necessary when there is - * no ConnectionProvider, ie. the user is supplying JDBC connections. - */ - public static final String USE_SCROLLABLE_RESULTSET = "hibernate.jdbc.use_scrollable_resultset"; - /** - * Tells the JDBC driver to attempt to retrieve row Id with the JDBC 3.0 PreparedStatement.getGeneratedKeys() - * method. In general, performance will be better if this property is set to true and the underlying - * JDBC driver supports getGeneratedKeys(). - */ - public static final String USE_GET_GENERATED_KEYS = "hibernate.jdbc.use_get_generated_keys"; - /** - * Gives the JDBC driver a hint as to the number of rows that should be fetched from the database - * when more rows are needed. If 0, JDBC driver default settings will be used. - */ - public static final String STATEMENT_FETCH_SIZE = "hibernate.jdbc.fetch_size"; - /** - * Maximum JDBC batch size. A nonzero value enables batch updates. - */ - public static final String STATEMENT_BATCH_SIZE = "hibernate.jdbc.batch_size"; - /** - * Select a custom batcher. - */ - public static final String BATCH_STRATEGY = "hibernate.jdbc.factory_class"; - /** - * Should versioned data be included in batching? - */ - public static final String BATCH_VERSIONED_DATA = "hibernate.jdbc.batch_versioned_data"; - /** - * An XSLT resource used to generate "custom" XML - */ - public static final String OUTPUT_STYLESHEET ="hibernate.xml.output_stylesheet"; - - /** - * Maximum size of C3P0 connection pool - */ - public static final String C3P0_MAX_SIZE = "hibernate.c3p0.max_size"; - /** - * Minimum size of C3P0 connection pool - */ - public static final String C3P0_MIN_SIZE = "hibernate.c3p0.min_size"; - - /** - * Maximum idle time for C3P0 connection pool - */ - public static final String C3P0_TIMEOUT = "hibernate.c3p0.timeout"; - /** - * Maximum size of C3P0 statement cache - */ - public static final String C3P0_MAX_STATEMENTS = "hibernate.c3p0.max_statements"; - /** - * Number of connections acquired when pool is exhausted - */ - public static final String C3P0_ACQUIRE_INCREMENT = "hibernate.c3p0.acquire_increment"; - /** - * Idle time before a C3P0 pooled connection is validated - */ - public static final String C3P0_IDLE_TEST_PERIOD = "hibernate.c3p0.idle_test_period"; - - /** - * Proxool/Hibernate property prefix - */ - public static final String PROXOOL_PREFIX = "hibernate.proxool"; - /** - * Proxool property to configure the Proxool Provider using an XML (/path/to/file.xml) - */ - public static final String PROXOOL_XML = "hibernate.proxool.xml"; - /** - * Proxool property to configure the Proxool Provider using a properties file (/path/to/proxool.properties) - */ - public static final String PROXOOL_PROPERTIES = "hibernate.proxool.properties"; - /** - * Proxool property to configure the Proxool Provider from an already existing pool (true / false) - */ - public static final String PROXOOL_EXISTING_POOL = "hibernate.proxool.existing_pool"; - /** - * Proxool property with the Proxool pool alias to use - * (Required for PROXOOL_EXISTING_POOL, PROXOOL_PROPERTIES, or - * PROXOOL_XML) - */ - public static final String PROXOOL_POOL_ALIAS = "hibernate.proxool.pool_alias"; - - /** - * Enable automatic session close at end of transaction - */ - public static final String AUTO_CLOSE_SESSION = "hibernate.transaction.auto_close_session"; - /** - * Enable automatic flush during the JTA beforeCompletion() callback - */ - public static final String FLUSH_BEFORE_COMPLETION = "hibernate.transaction.flush_before_completion"; - /** - * Specifies how Hibernate should release JDBC connections. - */ - public static final String RELEASE_CONNECTIONS = "hibernate.connection.release_mode"; - /** - * Context scoping impl for {@link org.hibernate.SessionFactory#getCurrentSession()} processing. - */ - public static final String CURRENT_SESSION_CONTEXT_CLASS = "hibernate.current_session_context_class"; - /** - * TransactionFactory implementor to use for creating Transactions - */ - public static final String TRANSACTION_STRATEGY = "hibernate.transaction.factory_class"; - /** - * TransactionManagerLookup implementor to use for obtaining the TransactionManager - */ - public static final String TRANSACTION_MANAGER_STRATEGY = "hibernate.transaction.manager_lookup_class"; - /** - * JNDI name of JTA UserTransaction object - */ - public static final String USER_TRANSACTION = "jta.UserTransaction"; - - /** - * The CacheProvider implementation class - */ - public static final String CACHE_PROVIDER = "hibernate.cache.provider_class"; - - /** - * The {@link org.hibernate.cache.RegionFactory} implementation class - */ - public static final String CACHE_REGION_FACTORY = "hibernate.cache.region.factory_class"; - - /** - * The CacheProvider implementation class - */ - public static final String CACHE_PROVIDER_CONFIG = "hibernate.cache.provider_configuration_file_resource_path"; - /** - * The CacheProvider JNDI namespace, if pre-bound to JNDI. - */ - public static final String CACHE_NAMESPACE = "hibernate.cache.jndi"; - /** - * Enable the query cache (disabled by default) - */ - public static final String USE_QUERY_CACHE = "hibernate.cache.use_query_cache"; - /** - * The QueryCacheFactory implementation class. - */ - public static final String QUERY_CACHE_FACTORY = "hibernate.cache.query_cache_factory"; - /** - * Enable the second-level cache (enabled by default) - */ - public static final String USE_SECOND_LEVEL_CACHE = "hibernate.cache.use_second_level_cache"; - /** - * Optimize the cache for mimimal puts instead of minimal gets - */ - public static final String USE_MINIMAL_PUTS = "hibernate.cache.use_minimal_puts"; - /** - * The CacheProvider region name prefix - */ - public static final String CACHE_REGION_PREFIX = "hibernate.cache.region_prefix"; - /** - * Enable use of structured second-level cache entries - */ - public static final String USE_STRUCTURED_CACHE = "hibernate.cache.use_structured_entries"; - - /** - * Enable statistics collection - */ - public static final String GENERATE_STATISTICS = "hibernate.generate_statistics"; - - public static final String USE_IDENTIFIER_ROLLBACK = "hibernate.use_identifier_rollback"; - - /** - * Use bytecode libraries optimized property access - */ - public static final String USE_REFLECTION_OPTIMIZER = "hibernate.bytecode.use_reflection_optimizer"; - - /** - * The classname of the HQL query parser factory - */ - public static final String QUERY_TRANSLATOR = "hibernate.query.factory_class"; - - /** - * A comma-seperated list of token substitutions to use when translating a Hibernate - * query to SQL - */ - public static final String QUERY_SUBSTITUTIONS = "hibernate.query.substitutions"; - - /** - * Should named queries be checked during startup (the default is enabled). - *

- * Mainly intended for test environments. - */ - public static final String QUERY_STARTUP_CHECKING = "hibernate.query.startup_check"; - - /** - * Auto export/update schema using hbm2ddl tool. Valid values are update, - * create, create-drop and validate. - */ - public static final String HBM2DDL_AUTO = "hibernate.hbm2ddl.auto"; - - /** - * The {@link org.hibernate.exception.SQLExceptionConverter} to use for converting SQLExceptions - * to Hibernate's JDBCException hierarchy. The default is to use the configured - * {@link org.hibernate.dialect.Dialect}'s preferred SQLExceptionConverter. - */ - public static final String SQL_EXCEPTION_CONVERTER = "hibernate.jdbc.sql_exception_converter"; - - /** - * Enable wrapping of JDBC result sets in order to speed up column name lookups for - * broken JDBC drivers - */ - public static final String WRAP_RESULT_SETS = "hibernate.jdbc.wrap_result_sets"; - - /** - * Enable ordering of update statements by primary key value - */ - public static final String ORDER_UPDATES = "hibernate.order_updates"; - - /** - * Enable ordering of insert statements for the purpose of more effecient JDBC batching. - */ - public static final String ORDER_INSERTS = "hibernate.order_inserts"; - - /** - * The EntityMode in which set the Session opened from the SessionFactory. - */ - public static final String DEFAULT_ENTITY_MODE = "hibernate.default_entity_mode"; - - /** - * The jacc context id of the deployment - */ - public static final String JACC_CONTEXTID = "hibernate.jacc_context_id"; - - public static final String BYTECODE_PROVIDER = "hibernate.bytecode.provider"; - - public static final String JPAQL_STRICT_COMPLIANCE= "hibernate.query.jpaql_strict_compliance"; - private static final BytecodeProvider BYTECODE_PROVIDER_INSTANCE; private static final boolean ENABLE_BINARY_STREAMS; private static final boolean ENABLE_REFLECTION_OPTIMIZER; - private static final boolean JVM_SUPPORTS_LINKED_HASH_COLLECTIONS; private static final boolean JVM_HAS_TIMESTAMP_BUG; - private static final boolean JVM_HAS_JDK14_TIMESTAMP; - private static final boolean JVM_SUPPORTS_GET_GENERATED_KEYS; private static final Properties GLOBAL_PROPERTIES; - private static final HashMap ISOLATION_LEVELS = new HashMap(); + private static final Map ISOLATION_LEVELS; + private static final Map OBSOLETE_PROPERTIES = new HashMap(); private static final Map RENAMED_PROPERTIES = new HashMap(); - private static final Logger log = LoggerFactory.getLogger(Environment.class); - /** - * Issues warnings to the user when any obsolete property names are used. + * Issues warnings to the user when any obsolete or renamed property names are used. + * + * @param configurationValues The specified properties. */ - public static void verifyProperties(Properties props) { - Iterator iter = props.keySet().iterator(); - Map propertiesToAdd = new HashMap(); - while ( iter.hasNext() ) { - final Object propertyName = iter.next(); - Object newPropertyName = OBSOLETE_PROPERTIES.get( propertyName ); - if ( newPropertyName != null ) { - log.warn( "Usage of obsolete property: " + propertyName + " no longer supported, use: " + newPropertyName ); + public static void verifyProperties(Map configurationValues) { + final Map propertiesToAdd = new HashMap(); + for ( Map.Entry entry : configurationValues.entrySet() ) { + final Object replacementKey = OBSOLETE_PROPERTIES.get( entry.getKey() ); + if ( replacementKey != null ) { + LOG.unsupportedProperty( entry.getKey(), replacementKey ); } - newPropertyName = RENAMED_PROPERTIES.get( propertyName ); - if ( newPropertyName != null ) { - log.warn( "Property [" + propertyName + "] has been renamed to [" + newPropertyName + "]; update your properties appropriately" ); - if ( ! props.containsKey( newPropertyName ) ) { - propertiesToAdd.put( newPropertyName, props.get( propertyName ) ); - } + final Object renamedKey = RENAMED_PROPERTIES.get( entry.getKey() ); + if ( renamedKey != null ) { + LOG.renamedProperty( entry.getKey(), renamedKey ); + propertiesToAdd.put( renamedKey, entry.getValue() ); } } - props.putAll(propertiesToAdd); + configurationValues.putAll( propertiesToAdd ); } static { + Version.logVersion(); - log.info("Hibernate " + VERSION); - - RENAMED_PROPERTIES.put( "hibernate.cglib.use_reflection_optimizer", USE_REFLECTION_OPTIMIZER ); - - ISOLATION_LEVELS.put( new Integer(Connection.TRANSACTION_NONE), "NONE" ); - ISOLATION_LEVELS.put( new Integer(Connection.TRANSACTION_READ_UNCOMMITTED), "READ_UNCOMMITTED" ); - ISOLATION_LEVELS.put( new Integer(Connection.TRANSACTION_READ_COMMITTED), "READ_COMMITTED" ); - ISOLATION_LEVELS.put( new Integer(Connection.TRANSACTION_REPEATABLE_READ), "REPEATABLE_READ" ); - ISOLATION_LEVELS.put( new Integer(Connection.TRANSACTION_SERIALIZABLE), "SERIALIZABLE" ); - + Map temp = new HashMap(); + temp.put( Connection.TRANSACTION_NONE, "NONE" ); + temp.put( Connection.TRANSACTION_READ_UNCOMMITTED, "READ_UNCOMMITTED" ); + temp.put( Connection.TRANSACTION_READ_COMMITTED, "READ_COMMITTED" ); + temp.put( Connection.TRANSACTION_REPEATABLE_READ, "REPEATABLE_READ" ); + temp.put( Connection.TRANSACTION_SERIALIZABLE, "SERIALIZABLE" ); + ISOLATION_LEVELS = Collections.unmodifiableMap( temp ); GLOBAL_PROPERTIES = new Properties(); //Set USE_REFLECTION_OPTIMIZER to false to fix HHH-227 GLOBAL_PROPERTIES.setProperty( USE_REFLECTION_OPTIMIZER, Boolean.FALSE.toString() ); try { - InputStream stream = ConfigHelper.getResourceAsStream("/hibernate.properties"); + InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" ); try { GLOBAL_PROPERTIES.load(stream); - log.info( "loaded properties from resource hibernate.properties: " + PropertiesHelper.maskOut(GLOBAL_PROPERTIES, PASS) ); + LOG.propertiesLoaded( ConfigurationHelper.maskOut( GLOBAL_PROPERTIES, PASS ) ); } catch (Exception e) { - log.error("problem loading properties from hibernate.properties"); + LOG.unableToLoadProperties(); } finally { try{ stream.close(); } catch (IOException ioe){ - log.error("could not close stream on hibernate.properties", ioe); + LOG.unableToCloseStreamError( ioe ); } } } catch (HibernateException he) { - log.info("hibernate.properties not found"); + LOG.propertiesNotFound(); } try { - GLOBAL_PROPERTIES.putAll( System.getProperties() ); + Properties systemProperties = System.getProperties(); + // Must be thread-safe in case an application changes System properties during Hibernate initialization. + // See HHH-8383. + synchronized (systemProperties) { + GLOBAL_PROPERTIES.putAll(systemProperties); + } + } catch (SecurityException se) { + LOG.unableToCopySystemProperties(); } - catch (SecurityException se) { - log.warn("could not copy system properties, system properties will be ignored"); - } verifyProperties(GLOBAL_PROPERTIES); - ENABLE_BINARY_STREAMS = PropertiesHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES); - ENABLE_REFLECTION_OPTIMIZER = PropertiesHelper.getBoolean(USE_REFLECTION_OPTIMIZER, GLOBAL_PROPERTIES); - - if (ENABLE_BINARY_STREAMS) { - log.info("using java.io streams to persist binary types"); + ENABLE_BINARY_STREAMS = ConfigurationHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES); + if ( ENABLE_BINARY_STREAMS ) { + LOG.usingStreams(); } - if (ENABLE_REFLECTION_OPTIMIZER) { - log.info("using bytecode reflection optimizer"); - } - BYTECODE_PROVIDER_INSTANCE = buildBytecodeProvider( GLOBAL_PROPERTIES ); - boolean getGeneratedKeysSupport; - try { - Statement.class.getMethod("getGeneratedKeys", null); - getGeneratedKeysSupport = true; + ENABLE_REFLECTION_OPTIMIZER = ConfigurationHelper.getBoolean(USE_REFLECTION_OPTIMIZER, GLOBAL_PROPERTIES); + if ( ENABLE_REFLECTION_OPTIMIZER ) { + LOG.usingReflectionOptimizer(); } - catch (NoSuchMethodException nsme) { - getGeneratedKeysSupport = false; - } - JVM_SUPPORTS_GET_GENERATED_KEYS = getGeneratedKeysSupport; - if (!JVM_SUPPORTS_GET_GENERATED_KEYS) log.info("JVM does not support Statement.getGeneratedKeys()"); - boolean linkedHashSupport; - try { - Class.forName("java.util.LinkedHashSet"); - linkedHashSupport = true; - } - catch (ClassNotFoundException cnfe) { - linkedHashSupport = false; - } - JVM_SUPPORTS_LINKED_HASH_COLLECTIONS = linkedHashSupport; - if (!JVM_SUPPORTS_LINKED_HASH_COLLECTIONS) log.info("JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled"); + BYTECODE_PROVIDER_INSTANCE = buildBytecodeProvider( GLOBAL_PROPERTIES ); - JVM_HAS_TIMESTAMP_BUG = new Timestamp(123456789).getTime() != 123456789; - if (JVM_HAS_TIMESTAMP_BUG) log.info("using workaround for JVM bug in java.sql.Timestamp"); - Timestamp t = new Timestamp(0); - t.setNanos(5 * 1000000); - JVM_HAS_JDK14_TIMESTAMP = t.getTime() == 5; - if (JVM_HAS_JDK14_TIMESTAMP) { - log.info("using JDK 1.4 java.sql.Timestamp handling"); + long x = 123456789; + JVM_HAS_TIMESTAMP_BUG = new Timestamp(x).getTime() != x; + if ( JVM_HAS_TIMESTAMP_BUG ) { + LOG.usingTimestampWorkaround(); } - else { - log.info("using pre JDK 1.4 java.sql.Timestamp handling"); - } } public static BytecodeProvider getBytecodeProvider() { return BYTECODE_PROVIDER_INSTANCE; } /** - * Does this JVM have the IBM JDK 1.3.1. The bug is new Timestamp(x).getTime()!=x. + * Does this JVM's implementation of {@link java.sql.Timestamp} have a bug in which the following is true: + * new java.sql.Timestamp( x ).getTime() != x + * + *

+ * NOTE : IBM JDK 1.3.1 the only known JVM to exhibit this behavior. + * + * @return True if the JVM's {@link Timestamp} implementa */ public static boolean jvmHasTimestampBug() { return JVM_HAS_TIMESTAMP_BUG; } /** - * Does this JVM handle Timestamp in the JDK 1.4 compliant way? + * Should we use streams to bind binary types to JDBC IN parameters? + * + * @return True if streams should be used for binary data handling; false otherwise. + * + * @see #USE_STREAMS_FOR_BINARY */ - public static boolean jvmHasJDK14Timestamp() { - return JVM_HAS_JDK14_TIMESTAMP; - } - - /** - * Does this JVM support LinkedHashSet, LinkedHashMap. - * @see java.util.LinkedHashSet - * @see java.util.LinkedHashMap - */ - public static boolean jvmSupportsLinkedHashCollections() { - return JVM_SUPPORTS_LINKED_HASH_COLLECTIONS; - } - - public static boolean jvmSupportsGetGeneratedKeys() { - return JVM_SUPPORTS_GET_GENERATED_KEYS; - } - - /** - * Should we use streams to bind binary types to JDBC IN parameters. - * Property hibernate.jdbc.use_streams_for_binary. - * @see Environment#USE_STREAMS_FOR_BINARY - */ public static boolean useStreamsForBinary() { return ENABLE_BINARY_STREAMS; } /** - * Should we use CGLIB reflection optimizer. - * Property hibernate.jdbc.use_refection_optimizer. - * @see Environment#USE_REFLECTION_OPTIMIZER + * Should we use reflection optimization? + * + * @return True if reflection optimization should be used; false otherwise. + * + * @see #USE_REFLECTION_OPTIMIZER + * @see #getBytecodeProvider() + * @see BytecodeProvider#getReflectionOptimizer */ public static boolean useReflectionOptimizer() { return ENABLE_REFLECTION_OPTIMIZER; } - private Environment() { throw new UnsupportedOperationException(); } + /** + * Disallow instantiation + */ + private Environment() { + throw new UnsupportedOperationException(); + } /** * Return System properties, extended by any properties specified @@ -701,25 +338,21 @@ * @return a human-readable name */ public static String isolationLevelToString(int isolation) { - return (String) ISOLATION_LEVELS.get( new Integer(isolation) ); + return ISOLATION_LEVELS.get( isolation ); } public static BytecodeProvider buildBytecodeProvider(Properties properties) { - String provider = PropertiesHelper.getString( BYTECODE_PROVIDER, properties, "javassist" ); - log.info( "Bytecode provider name : " + provider ); + String provider = ConfigurationHelper.getString( BYTECODE_PROVIDER, properties, "javassist" ); + LOG.bytecodeProvider( provider ); return buildBytecodeProvider( provider ); } private static BytecodeProvider buildBytecodeProvider(String providerName) { if ( "javassist".equals( providerName ) ) { - return new org.hibernate.bytecode.javassist.BytecodeProviderImpl(); + return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl(); } - else if ( "cglib".equals( providerName ) ) { - return new org.hibernate.bytecode.cglib.BytecodeProviderImpl(); - } - log.warn( "unrecognized bytecode provider [" + providerName + "], using javassist by default" ); - return new org.hibernate.bytecode.javassist.BytecodeProviderImpl(); + LOG.unknownBytecodeProvider( providerName ); + return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl(); } - } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ExtendedMappings.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/ExtendsQueueEntry.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/ExtendsQueueEntry.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/ExtendsQueueEntry.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/ExtendsQueueEntry.java 30 Jul 2014 15:51:05 -0000 1.1.2.1 @@ -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,12 +20,13 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; -import org.dom4j.Document; +import java.util.Set; +import org.hibernate.internal.util.xml.XmlDocument; + /** * Represents a mapping queued for delayed processing to await * processing of an extends entity upon which it depends. @@ -35,12 +36,14 @@ public class ExtendsQueueEntry { private final String explicitName; private final String mappingPackage; - private final Document document; + private final XmlDocument metadataXml; + private final Set entityNames; - public ExtendsQueueEntry(String explicitName, String mappingPackage, Document document) { + public ExtendsQueueEntry(String explicitName, String mappingPackage, XmlDocument metadataXml, Set entityNames) { this.explicitName = explicitName; this.mappingPackage = mappingPackage; - this.document = document; + this.metadataXml = metadataXml; + this.entityNames = entityNames; } public String getExplicitName() { @@ -51,7 +54,11 @@ return mappingPackage; } - public Document getDocument() { - return document; + public XmlDocument getMetadataXml() { + return metadataXml; } + + public Set getEntityNames() { + return entityNames; + } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ExternalSessionFactoryConfig.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/FkSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/HbmBinder.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/HbmBinder.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/HbmBinder.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/HbmBinder.java 30 Jul 2014 15:51:05 -0000 1.1.2.1 @@ -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,33 +20,33 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Properties; import java.util.StringTokenizer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.dom4j.Attribute; -import org.dom4j.Document; -import org.dom4j.Element; import org.hibernate.CacheMode; import org.hibernate.EntityMode; import org.hibernate.FetchMode; import org.hibernate.FlushMode; import org.hibernate.MappingException; -import org.hibernate.engine.FilterDefinition; -import org.hibernate.engine.NamedQueryDefinition; -import org.hibernate.engine.Versioning; -import org.hibernate.engine.ExecuteUpdateResultCheckStyle; +import org.hibernate.engine.OptimisticLockStyle; +import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle; +import org.hibernate.engine.spi.FilterDefinition; +import org.hibernate.engine.spi.NamedQueryDefinition; +import org.hibernate.engine.spi.NamedQueryDefinitionBuilder; import org.hibernate.id.PersistentIdentifierGenerator; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.ReflectHelper; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.collections.JoinedIterator; +import org.hibernate.internal.util.xml.XmlDocument; +import org.hibernate.loader.PropertyPath; import org.hibernate.mapping.Any; import org.hibernate.mapping.Array; import org.hibernate.mapping.AuxiliaryDatabaseObject; @@ -55,7 +55,9 @@ import org.hibernate.mapping.Collection; import org.hibernate.mapping.Column; import org.hibernate.mapping.Component; +import org.hibernate.mapping.Constraint; import org.hibernate.mapping.DependantValue; +import org.hibernate.mapping.FetchProfile; import org.hibernate.mapping.Fetchable; import org.hibernate.mapping.Filterable; import org.hibernate.mapping.Formula; @@ -70,12 +72,12 @@ import org.hibernate.mapping.ManyToOne; import org.hibernate.mapping.Map; import org.hibernate.mapping.MetaAttribute; +import org.hibernate.mapping.MetadataSource; import org.hibernate.mapping.OneToMany; import org.hibernate.mapping.OneToOne; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.PrimitiveArray; import org.hibernate.mapping.Property; -import org.hibernate.mapping.PropertyGeneration; import org.hibernate.mapping.RootClass; import org.hibernate.mapping.Selectable; import org.hibernate.mapping.Set; @@ -89,17 +91,19 @@ import org.hibernate.mapping.UnionSubclass; import org.hibernate.mapping.UniqueKey; import org.hibernate.mapping.Value; -import org.hibernate.persister.entity.JoinedSubclassEntityPersister; -import org.hibernate.persister.entity.SingleTableEntityPersister; -import org.hibernate.persister.entity.UnionSubclassEntityPersister; +import org.hibernate.tuple.GeneratedValueGeneration; +import org.hibernate.tuple.GenerationTiming; +import org.hibernate.type.BasicType; import org.hibernate.type.DiscriminatorType; import org.hibernate.type.ForeignKeyDirection; import org.hibernate.type.Type; -import org.hibernate.type.TypeFactory; -import org.hibernate.util.JoinedIterator; -import org.hibernate.util.ReflectHelper; -import org.hibernate.util.StringHelper; +import org.jboss.logging.Logger; + +import org.dom4j.Attribute; +import org.dom4j.Document; +import org.dom4j.Element; + /** * Walks an XML mapping document and produces the Hibernate configuration-time metamodel (the * classes in the mapping package) @@ -108,7 +112,7 @@ */ public final class HbmBinder { - private static final Logger log = LoggerFactory.getLogger( HbmBinder.class ); + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, HbmBinder.class.getName()); /** * Private constructor to disallow instantiation. @@ -120,44 +124,51 @@ * The main contract into the hbm.xml-based binder. Performs necessary binding operations * represented by the given DOM. * - * @param doc The DOM to be parsed and bound. + * @param metadataXml The DOM to be parsed and bound. * @param mappings Current bind state. * @param inheritedMetas Any inherited meta-tag information. + * @param entityNames Any state + * * @throws MappingException */ - public static void bindRoot(Document doc, Mappings mappings, java.util.Map inheritedMetas) - throws MappingException { + public static void bindRoot( + XmlDocument metadataXml, + Mappings mappings, + java.util.Map inheritedMetas, + java.util.Set entityNames) throws MappingException { - java.util.List names = HbmBinder.getExtendsNeeded( doc, mappings ); + final Document doc = metadataXml.getDocumentTree(); + final Element hibernateMappingElement = doc.getRootElement(); + + java.util.List names = HbmBinder.getExtendsNeeded( metadataXml, mappings ); if ( !names.isEmpty() ) { // classes mentioned in extends not available - so put it in queue - Element hmNode = doc.getRootElement(); - Attribute packNode = hmNode.attribute( "package" ); - String packageName = null; - if ( packNode != null ) { - packageName = packNode.getValue(); + Attribute packageAttribute = hibernateMappingElement.attribute( "package" ); + String packageName = packageAttribute == null ? null : packageAttribute.getValue(); + for ( String name : names ) { + mappings.addToExtendsQueue( new ExtendsQueueEntry( name, packageName, metadataXml, entityNames ) ); } - Iterator itr = names.iterator(); - while ( itr.hasNext() ) { - String extendsName = (String) itr.next(); - mappings.addToExtendsQueue( new ExtendsQueueEntry( extendsName, packageName, doc ) ); - } return; } - Element hmNode = doc.getRootElement(); // get meta's from - inheritedMetas = getMetas( hmNode, inheritedMetas, true ); - extractRootAttributes( hmNode, mappings ); + inheritedMetas = getMetas( hibernateMappingElement, inheritedMetas, true ); + extractRootAttributes( hibernateMappingElement, mappings ); - Iterator rootChildren = hmNode.elementIterator(); + Iterator rootChildren = hibernateMappingElement.elementIterator(); while ( rootChildren.hasNext() ) { final Element element = (Element) rootChildren.next(); final String elementName = element.getName(); if ( "filter-def".equals( elementName ) ) { parseFilterDef( element, mappings ); } + else if ( "fetch-profile".equals( elementName ) ) { + parseFetchProfile( element, mappings, null ); + } + else if ( "identifier-generator".equals( elementName ) ) { + parseIdentifierGeneratorRegistration( element, mappings ); + } else if ( "typedef".equals( elementName ) ) { bindTypeDef( element, mappings ); } @@ -196,13 +207,33 @@ } } + private static void parseIdentifierGeneratorRegistration(Element element, Mappings mappings) { + String strategy = element.attributeValue( "name" ); + if ( StringHelper.isEmpty( strategy ) ) { + throw new MappingException( "'name' attribute expected for identifier-generator elements" ); + } + String generatorClassName = element.attributeValue( "class" ); + if ( StringHelper.isEmpty( generatorClassName ) ) { + throw new MappingException( "'class' attribute expected for identifier-generator [identifier-generator@name=" + strategy + "]" ); + } + + try { + Class generatorClass = ReflectHelper.classForName( generatorClassName ); + mappings.getIdentifierGeneratorFactory().register( strategy, generatorClass ); + } + catch ( ClassNotFoundException e ) { + throw new MappingException( "Unable to locate identifier-generator class [name=" + strategy + ", class=" + generatorClassName + "]" ); + } + + } + private static void bindImport(Element importNode, Mappings mappings) { String className = getClassName( importNode.attribute( "class" ), mappings ); Attribute renameNode = importNode.attribute( "rename" ); String rename = ( renameNode == null ) ? StringHelper.unqualify( className ) : renameNode.getValue(); - log.debug( "Import: " + rename + " -> " + className ); + LOG.debugf( "Import: %s -> %s", rename, className ); mappings.addImport( className, rename ); } @@ -280,7 +311,7 @@ } /** - * Responsible for perfoming the bind operation related to an <class/> mapping element. + * Responsible for performing the bind operation related to an <class/> mapping element. * * @param node The DOM Element for the <class/> element. * @param rootClass The mapping instance to which to bind the information. @@ -314,15 +345,14 @@ catalog, getClassTableName( entity, node, schema, catalog, null, mappings ), getSubselect( node ), - entity.isAbstract() != null && entity.isAbstract().booleanValue() + entity.isAbstract() != null && entity.isAbstract() ); entity.setTable( table ); bindComment(table, node); - log.info( - "Mapping class: " + entity.getEntityName() + - " -> " + entity.getTable().getName() - ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Mapping class: %s -> %s", entity.getEntityName(), entity.getTable().getName() ); + } // MUTABLE Attribute mutableNode = node.attribute( "mutable" ); @@ -385,7 +415,7 @@ java.util.Map inheritedMetas) throws MappingException { String propertyName = idNode.attributeValue( "name" ); - SimpleValue id = new SimpleValue( entity.getTable() ); + SimpleValue id = new SimpleValue( mappings, entity.getTable() ); entity.setIdentifier( id ); // if ( propertyName == null || entity.getPojoRepresentation() == null ) { @@ -428,6 +458,7 @@ prop.setValue( id ); bindProperty( idNode, prop, mappings, inheritedMetas ); entity.setIdentifierProperty( prop ); + entity.setDeclaredIdentifierProperty( prop ); } // TODO: @@ -441,7 +472,7 @@ private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { String propertyName = idNode.attributeValue( "name" ); - Component id = new Component( entity ); + Component id = new Component( mappings, entity ); entity.setIdentifier( id ); bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas ); if ( propertyName == null ) { @@ -461,6 +492,7 @@ prop.setValue( id ); bindProperty( idNode, prop, mappings, inheritedMetas ); entity.setIdentifierProperty( prop ); + entity.setDeclaredIdentifierProperty( prop ); } makeIdentifier( idNode, id, mappings ); @@ -471,7 +503,7 @@ String name, RootClass entity, java.util.Map inheritedMetas) { String propertyName = subnode.attributeValue( "name" ); - SimpleValue val = new SimpleValue( table ); + SimpleValue val = new SimpleValue( mappings, table ); bindSimpleValue( subnode, val, false, propertyName, mappings ); if ( !val.isTypeSpecified() ) { // this is either a tag with no type attribute, @@ -494,8 +526,10 @@ // for version properties marked as being generated, make sure they are "always" // generated; aka, "insert" is invalid; this is dis-allowed by the DTD, // but just to make sure... - if ( prop.getGeneration() == PropertyGeneration.INSERT ) { - throw new MappingException( "'generated' attribute cannot be 'insert' for versioning property" ); + if ( prop.getValueGenerationStrategy() != null ) { + if ( prop.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.INSERT ) { + throw new MappingException( "'generated' attribute cannot be 'insert' for versioning property" ); + } } makeVersion( subnode, val ); entity.setVersion( prop ); @@ -504,7 +538,7 @@ private static void bindDiscriminatorProperty(Table table, RootClass entity, Element subnode, Mappings mappings) { - SimpleValue discrim = new SimpleValue( table ); + SimpleValue discrim = new SimpleValue( mappings, table ); entity.setDiscriminator( discrim ); bindSimpleValue( subnode, @@ -518,10 +552,14 @@ // ( (Column) discrim.getColumnIterator().next() ).setType(type); } entity.setPolymorphic( true ); - if ( "true".equals( subnode.attributeValue( "force" ) ) ) - entity.setForceDiscriminator( true ); - if ( "false".equals( subnode.attributeValue( "insert" ) ) ) + final String explicitForceValue = subnode.attributeValue( "force" ); + boolean forceDiscriminatorInSelects = explicitForceValue == null + ? mappings.forceDiscriminatorInSelectsByDefault() + : "true".equals( explicitForceValue ); + entity.setForceDiscriminator( forceDiscriminatorInSelects ); + if ( "false".equals( subnode.attributeValue( "insert" ) ) ) { entity.setDiscriminatorInsertable( false ); + } } public static void bindClass(Element node, PersistentClass persistentClass, Mappings mappings, @@ -541,13 +579,19 @@ throw new MappingException( "Unable to determine entity name" ); } persistentClass.setEntityName( entityName ); + persistentClass.setJpaEntityName( StringHelper.unqualify( entityName ) ); bindPojoRepresentation( node, persistentClass, mappings, inheritedMetas ); bindDom4jRepresentation( node, persistentClass, mappings, inheritedMetas ); bindMapRepresentation( node, persistentClass, mappings, inheritedMetas ); - bindPersistentClassCommonValues( node, persistentClass, mappings, inheritedMetas ); + Iterator itr = node.elementIterator( "fetch-profile" ); + while ( itr.hasNext() ) { + final Element profileElement = ( Element ) itr.next(); + parseFetchProfile( profileElement, mappings, entityName ); + } + bindPersistentClassCommonValues( node, persistentClass, mappings, inheritedMetas ); } private static void bindPojoRepresentation(Element node, PersistentClass entity, @@ -578,10 +622,10 @@ if (nodeName==null) nodeName = StringHelper.unqualify( entity.getEntityName() ); entity.setNodeName(nodeName); - Element tuplizer = locateTuplizerDefinition( node, EntityMode.DOM4J ); - if ( tuplizer != null ) { - entity.addTuplizer( EntityMode.DOM4J, tuplizer.attributeValue( "class" ) ); - } +// Element tuplizer = locateTuplizerDefinition( node, EntityMode.DOM4J ); +// if ( tuplizer != null ) { +// entity.addTuplizer( EntityMode.DOM4J, tuplizer.attributeValue( "class" ) ); +// } } private static void bindMapRepresentation(Element node, PersistentClass entity, @@ -649,16 +693,18 @@ // OPTIMISTIC LOCK MODE Attribute olNode = node.attribute( "optimistic-lock" ); - entity.setOptimisticLockMode( getOptimisticLockMode( olNode ) ); + entity.setOptimisticLockStyle( getOptimisticLockStyle( olNode ) ); entity.setMetaAttributes( getMetas( node, inheritedMetas ) ); // PERSISTER Attribute persisterNode = node.attribute( "persister" ); if ( persisterNode != null ) { try { - entity.setEntityPersisterClass( ReflectHelper.classForName( persisterNode - .getValue() ) ); + entity.setEntityPersisterClass( ReflectHelper.classForName( + persisterNode + .getValue() + ) ); } catch (ClassNotFoundException cnfe) { throw new MappingException( "Could not find persister class: " @@ -780,7 +826,7 @@ // NONE might be a better option moving forward in the case of callable return ExecuteUpdateResultCheckStyle.COUNT; } - return ExecuteUpdateResultCheckStyle.parse( attr.getValue() ); + return ExecuteUpdateResultCheckStyle.fromExternalName( attr.getValue() ); } public static void bindUnionSubclass(Element node, UnionSubclass unionSubclass, @@ -789,11 +835,6 @@ bindClass( node, unionSubclass, mappings, inheritedMetas ); inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from - if ( unionSubclass.getEntityPersisterClass() == null ) { - unionSubclass.getRootClass().setEntityPersisterClass( - UnionSubclassEntityPersister.class ); - } - Attribute schemaNode = node.attribute( "schema" ); String schema = schemaNode == null ? mappings.getSchemaName() : schemaNode.getValue(); @@ -807,16 +848,15 @@ schema, catalog, getClassTableName(unionSubclass, node, schema, catalog, denormalizedSuperTable, mappings ), - unionSubclass.isAbstract() != null && unionSubclass.isAbstract().booleanValue(), + unionSubclass.isAbstract() != null && unionSubclass.isAbstract(), getSubselect( node ), denormalizedSuperTable ); unionSubclass.setTable( mytable ); - log.info( - "Mapping union-subclass: " + unionSubclass.getEntityName() + - " -> " + unionSubclass.getTable().getName() - ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Mapping union-subclass: %s -> %s", unionSubclass.getEntityName(), unionSubclass.getTable().getName() ); + } createClassProperties( node, unionSubclass, mappings, inheritedMetas ); @@ -828,24 +868,21 @@ bindClass( node, subclass, mappings, inheritedMetas ); inheritedMetas = getMetas( node, inheritedMetas, true ); // get meta's from - if ( subclass.getEntityPersisterClass() == null ) { - subclass.getRootClass() - .setEntityPersisterClass( SingleTableEntityPersister.class ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Mapping subclass: %s -> %s", subclass.getEntityName(), subclass.getTable().getName() ); } - log.info( - "Mapping subclass: " + subclass.getEntityName() + - " -> " + subclass.getTable().getName() - ); - // properties createClassProperties( node, subclass, mappings, inheritedMetas ); } private static String getClassTableName( - PersistentClass model, Element node, String schema, String catalog, Table denormalizedSuperTable, - Mappings mappings - ) { + PersistentClass model, + Element node, + String schema, + String catalog, + Table denormalizedSuperTable, + Mappings mappings) { Attribute tableNameNode = node.attribute( "table" ); String logicalTableName; String physicalTableName; @@ -869,11 +906,6 @@ // // joined subclasses - if ( joinedSubclass.getEntityPersisterClass() == null ) { - joinedSubclass.getRootClass() - .setEntityPersisterClass( JoinedSubclassEntityPersister.class ); - } - Attribute schemaNode = node.attribute( "schema" ); String schema = schemaNode == null ? mappings.getSchemaName() : schemaNode.getValue(); @@ -892,14 +924,13 @@ joinedSubclass.setTable( mytable ); bindComment(mytable, node); - log.info( - "Mapping joined-subclass: " + joinedSubclass.getEntityName() + - " -> " + joinedSubclass.getTable().getName() - ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Mapping joined-subclass: %s -> %s", joinedSubclass.getEntityName(), joinedSubclass.getTable().getName() ); + } // KEY Element keyNode = node.element( "key" ); - SimpleValue key = new DependantValue( mytable, joinedSubclass.getIdentifier() ); + SimpleValue key = new DependantValue( mappings, mytable, joinedSubclass.getIdentifier() ); joinedSubclass.setKey( key ); key.setCascadeDeleteEnabled( "cascade".equals( keyNode.attributeValue( "on-delete" ) ) ); bindSimpleValue( keyNode, key, false, joinedSubclass.getEntityName(), mappings ); @@ -957,14 +988,13 @@ join.setOptional( "true".equals( nullNode.getValue() ) ); } - log.info( - "Mapping class join: " + persistentClass.getEntityName() + - " -> " + join.getTable().getName() - ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Mapping class join: %s -> %s", persistentClass.getEntityName(), join.getTable().getName() ); + } // KEY Element keyNode = node.element( "key" ); - SimpleValue key = new DependantValue( table, persistentClass.getIdentifier() ); + SimpleValue key = new DependantValue( mappings, table, persistentClass.getIdentifier() ); join.setKey( key ); key.setCascadeDeleteEnabled( "cascade".equals( keyNode.attributeValue( "on-delete" ) ) ); bindSimpleValue( keyNode, key, false, persistentClass.getEntityName(), mappings ); @@ -982,20 +1012,20 @@ Value value = null; if ( "many-to-one".equals( name ) ) { - value = new ManyToOne( table ); + value = new ManyToOne( mappings, table ); bindManyToOne( subnode, (ManyToOne) value, propertyName, true, mappings ); } else if ( "any".equals( name ) ) { - value = new Any( table ); + value = new Any( mappings, table ); bindAny( subnode, (Any) value, true, mappings ); } else if ( "property".equals( name ) ) { - value = new SimpleValue( table ); + value = new SimpleValue( mappings, table ); bindSimpleValue( subnode, (SimpleValue) value, true, propertyName, mappings ); } else if ( "component".equals( name ) || "dynamic-component".equals( name ) ) { String subpath = StringHelper.qualify( path, propertyName ); - value = new Component( join ); + value = new Component( mappings, join ); bindComponent( subnode, (Component) value, @@ -1033,20 +1063,22 @@ // COLUMN(S) Attribute columnAttribute = node.attribute( "column" ); if ( columnAttribute == null ) { - Iterator iter = node.elementIterator(); + Iterator itr = node.elementIterator(); int count = 0; - while ( iter.hasNext() ) { - Element columnElement = (Element) iter.next(); + while ( itr.hasNext() ) { + Element columnElement = (Element) itr.next(); if ( columnElement.getName().equals( "column" ) ) { Column column = new Column(); column.setValue( simpleValue ); column.setTypeIndex( count++ ); bindColumn( columnElement, column, isNullable ); + String columnName = columnElement.attributeValue( "name" ); String logicalColumnName = mappings.getNamingStrategy().logicalColumnName( - columnElement.attributeValue( "name" ), propertyPath + columnName, propertyPath ); - column.setName( mappings.getNamingStrategy().columnName( - logicalColumnName ) ); + columnName = mappings.getNamingStrategy().columnName( columnName ); + columnName = quoteIdentifier( columnName, mappings ); + column.setName( columnName ); if ( table != null ) { table.addColumn( column ); // table=null -> an association // - fill it in later @@ -1069,6 +1101,16 @@ simpleValue.addFormula( formula ); } } + + // todo : another GoodThing would be to go back after all parsing and see if all the columns + // (and no formulas) are contained in a defined unique key that only contains these columns. + // That too would mark this as a logical one-to-one + final Attribute uniqueAttribute = node.attribute( "unique" ); + if ( uniqueAttribute != null + && "true".equals( uniqueAttribute.getValue() ) + && ManyToOne.class.isInstance( simpleValue ) ) { + ( (ManyToOne) simpleValue ).markAsLogicalOneToOne(); + } } else { if ( node.elementIterator( "column" ).hasNext() ) { @@ -1083,10 +1125,16 @@ Column column = new Column(); column.setValue( simpleValue ); bindColumn( node, column, isNullable ); + if ( column.isUnique() && ManyToOne.class.isInstance( simpleValue ) ) { + ( (ManyToOne) simpleValue ).markAsLogicalOneToOne(); + } + String columnName = columnAttribute.getValue(); String logicalColumnName = mappings.getNamingStrategy().logicalColumnName( - columnAttribute.getValue(), propertyPath + columnName, propertyPath ); - column.setName( mappings.getNamingStrategy().columnName( logicalColumnName ) ); + columnName = mappings.getNamingStrategy().columnName( columnName ); + columnName = quoteIdentifier( columnName, mappings ); + column.setName( columnName ); if ( table != null ) { table.addColumn( column ); // table=null -> an association - fill // it in later @@ -1102,12 +1150,14 @@ Column column = new Column(); column.setValue( simpleValue ); bindColumn( node, column, isNullable ); - column.setName( mappings.getNamingStrategy().propertyToColumnName( propertyPath ) ); + String columnName = mappings.getNamingStrategy().propertyToColumnName( propertyPath ); + columnName = quoteIdentifier( columnName, mappings ); + column.setName( columnName ); String logicalName = mappings.getNamingStrategy().logicalColumnName( null, propertyPath ); mappings.addColumnBinding( logicalName, column, table ); /* TODO: joinKeyColumnName & foreignKeyColumnName should be called either here or at a * slightly higer level in the stack (to get all the information we need) - * Right now HbmBinder does not support the + * Right now HbmMetadataSourceProcessorImpl does not support the */ simpleValue.getTable().addColumn( column ); simpleValue.addColumn( column ); @@ -1153,8 +1203,12 @@ Properties parameters = new Properties(); Attribute typeNode = node.attribute( "type" ); - if ( typeNode == null ) typeNode = node.attribute( "id-type" ); // for an any - if ( typeNode != null ) typeName = typeNode.getValue(); + if ( typeNode == null ) { + typeNode = node.attribute( "id-type" ); // for an any + } + else { + typeName = typeNode.getValue(); + } Element typeChild = node.element( "type" ); if ( typeName == null && typeChild != null ) { @@ -1170,6 +1224,11 @@ } } + resolveAndBindTypeDef(simpleValue, mappings, typeName, parameters); + } + + private static void resolveAndBindTypeDef(SimpleValue simpleValue, + Mappings mappings, String typeName, Properties parameters) { TypeDef typeDef = mappings.getTypeDef( typeName ); if ( typeDef != null ) { typeName = typeDef.getTypeClass(); @@ -1179,6 +1238,19 @@ allParameters.putAll( typeDef.getParameters() ); allParameters.putAll( parameters ); parameters = allParameters; + }else if (typeName!=null && !mappings.isInSecondPass()){ + BasicType basicType=mappings.getTypeResolver().basic(typeName); + if (basicType==null) { + /* + * If the referenced typeName isn't a basic-type, it's probably a typedef defined + * in a mapping file not read yet. + * It should be solved by deferring the resolution and binding of this type until + * all mapping files are read - the second passes. + * Fixes issue HHH-7300 + */ + SecondPass resolveUserTypeMappingSecondPass=new ResolveUserTypeMappingSecondPass(simpleValue,typeName,mappings,parameters); + mappings.addSecondPass(resolveUserTypeMappingSecondPass); + } } if ( !parameters.isEmpty() ) simpleValue.setTypeParameters( parameters ); @@ -1229,47 +1301,52 @@ Attribute generatedNode = node.attribute( "generated" ); String generationName = generatedNode == null ? null : generatedNode.getValue(); - PropertyGeneration generation = PropertyGeneration.parse( generationName ); - property.setGeneration( generation ); - if ( generation == PropertyGeneration.ALWAYS || generation == PropertyGeneration.INSERT ) { - // generated properties can *never* be insertable... - if ( property.isInsertable() ) { - if ( insertNode == null ) { - // insertable simply because that is the user did not specify - // anything; just override it + // Handle generated properties. + GenerationTiming generationTiming = GenerationTiming.parseFromName( generationName ); + if ( generationTiming == GenerationTiming.ALWAYS || generationTiming == GenerationTiming.INSERT ) { + // we had generation specified... + // HBM only supports "database generated values" + property.setValueGenerationStrategy( new GeneratedValueGeneration( generationTiming ) ); + + // generated properties can *never* be insertable... + if ( property.isInsertable() ) { + if ( insertNode == null ) { + // insertable simply because that is the user did not specify + // anything; just override it property.setInsertable( false ); - } - else { - // the user specifically supplied insert="true", - // which constitutes an illegal combo + } + else { + // the user specifically supplied insert="true", + // which constitutes an illegal combo throw new MappingException( - "cannot specify both insert=\"true\" and generated=\"" + generation.getName() + - "\" for property: " + - propName + "cannot specify both insert=\"true\" and generated=\"" + generationTiming.name().toLowerCase() + + "\" for property: " + + propName ); - } - } + } + } - // properties generated on update can never be updateable... - if ( property.isUpdateable() && generation == PropertyGeneration.ALWAYS ) { - if ( updateNode == null ) { - // updateable only because the user did not specify - // anything; just override it - property.setUpdateable( false ); - } - else { - // the user specifically supplied update="true", - // which constitutes an illegal combo + // properties generated on update can never be updateable... + if ( property.isUpdateable() && generationTiming == GenerationTiming.ALWAYS ) { + if ( updateNode == null ) { + // updateable only because the user did not specify + // anything; just override it + property.setUpdateable( false ); + } + else { + // the user specifically supplied update="true", + // which constitutes an illegal combo throw new MappingException( - "cannot specify both update=\"true\" and generated=\"" + generation.getName() + - "\" for property: " + - propName + "cannot specify both update=\"true\" and generated=\"" + generationTiming.name().toLowerCase() + + "\" for property: " + + propName ); - } - } - } + } + } + } + boolean isLazyable = "property".equals( node.getName() ) || "component".equals( node.getName() ) || "many-to-one".equals( node.getName() ) || @@ -1280,21 +1357,21 @@ property.setLazy( lazyNode != null && "true".equals( lazyNode.getValue() ) ); } - if ( log.isDebugEnabled() ) { + if ( LOG.isDebugEnabled() ) { String msg = "Mapped property: " + property.getName(); String columns = columns( property.getValue() ); if ( columns.length() > 0 ) msg += " -> " + columns; // TODO: this fails if we run with debug on! // if ( model.getType()!=null ) msg += ", type: " + model.getType().getName(); - log.debug( msg ); + LOG.debug( msg ); } property.setMetaAttributes( getMetas( node, inheritedMetas ) ); } private static String columns(Value val) { - StringBuffer columns = new StringBuffer(); + StringBuilder columns = new StringBuilder(); Iterator iter = val.getColumnIterator(); while ( iter.hasNext() ) { columns.append( ( (Selectable) iter.next() ).getText() ); @@ -1327,12 +1404,7 @@ Attribute orderNode = node.attribute( "order-by" ); if ( orderNode != null ) { - if ( Environment.jvmSupportsLinkedHashCollections() || ( collection instanceof Bag ) ) { - collection.setOrderBy( orderNode.getValue() ); - } - else { - log.warn( "Attribute \"order-by\" ignored in JDK1.3 or less" ); - } + collection.setOrderBy( orderNode.getValue() ); } Attribute whereNode = node.attribute( "where" ); if ( whereNode != null ) { @@ -1347,6 +1419,12 @@ if ( nodeName == null ) nodeName = node.attributeValue( "name" ); collection.setNodeName( nodeName ); String embed = node.attributeValue( "embed-xml" ); + // sometimes embed is set to the default value when not specified in the mapping, + // so can't seem to determine if an attribute was explicitly set; + // log a warning if embed has a value different from the default. + if ( !StringHelper.isEmpty( embed ) && !"true".equals( embed ) ) { + LOG.embedXmlAttributesNoLongerSupported(); + } collection.setEmbedded( embed==null || "true".equals(embed) ); @@ -1394,7 +1472,7 @@ Element oneToManyNode = node.element( "one-to-many" ); if ( oneToManyNode != null ) { - OneToMany oneToMany = new OneToMany( collection.getOwner() ); + OneToMany oneToMany = new OneToMany( mappings, collection.getOwner() ); collection.setElement( oneToMany ); bindOneToMany( oneToManyNode, oneToMany, mappings ); // we have to set up the table later!! yuck @@ -1419,6 +1497,9 @@ null, path ); + if ( ownerTable.isQuoted() ) { + tableName = StringHelper.quote( tableName ); + } } Attribute schemaNode = node.attribute( "schema" ); String schema = schemaNode == null ? @@ -1438,10 +1519,9 @@ collection.setCollectionTable( table ); bindComment(table, node); - log.info( - "Mapping collection: " + collection.getRole() + - " -> " + collection.getCollectionTable().getName() - ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName() ); + } } // SORT @@ -1527,11 +1607,11 @@ ) { if ( "no-proxy".equals( node.attributeValue( "lazy" ) ) ) { fetchable.setUnwrapProxy(true); - fetchable.setLazy(true); + fetchable.setLazy( true ); //TODO: better to degrade to lazy="false" if uninstrumented } else { - initLaziness(node, fetchable, mappings, "proxy", defaultLazy); + initLaziness( node, fetchable, mappings, "proxy", defaultLazy ); } } @@ -1564,10 +1644,17 @@ if ( ukName != null ) { manyToOne.setReferencedPropertyName( ukName.getValue() ); } + manyToOne.setReferenceToPrimaryKey( manyToOne.getReferencedPropertyName() == null ); manyToOne.setReferencedEntityName( getEntityName( node, mappings ) ); String embed = node.attributeValue( "embed-xml" ); + // sometimes embed is set to the default value when not specified in the mapping, + // so can't seem to determine if an attribute was explicitly set; + // log a warning if embed has a value different from the default. + if ( !StringHelper.isEmpty( embed ) && !"true".equals( embed ) ) { + LOG.embedXmlAttributesNoLongerSupported(); + } manyToOne.setEmbedded( embed == null || "true".equals( embed ) ); String notFound = node.attributeValue( "not-found" ); @@ -1582,13 +1669,13 @@ Attribute fkNode = node.attribute( "foreign-key" ); if ( fkNode != null ) manyToOne.setForeignKeyName( fkNode.getValue() ); - validateCascade( node, path ); - } - - private static void validateCascade(Element node, String path) { String cascade = node.attributeValue( "cascade" ); if ( cascade != null && cascade.indexOf( "delete-orphan" ) >= 0 ) { - throw new MappingException( "single-valued associations do not support orphan delete: " + path ); + if ( !manyToOne.isLogicalOneToOne() ) { + throw new MappingException( + "many-to-one attribute [" + path + "] does not support orphan delete as it is not unique" + ); + } } } @@ -1602,7 +1689,7 @@ Iterator iter = node.elementIterator( "meta-value" ); if ( iter.hasNext() ) { HashMap values = new HashMap(); - org.hibernate.type.Type metaType = TypeFactory.heuristicType( any.getMetaType() ); + org.hibernate.type.Type metaType = mappings.getTypeResolver().heuristicType( any.getMetaType() ); while ( iter.hasNext() ) { Element metaValue = (Element) iter.next(); try { @@ -1643,19 +1730,34 @@ initOuterJoinFetchSetting( node, oneToOne ); initLaziness( node, oneToOne, mappings, true ); - oneToOne.setEmbedded( "true".equals( node.attributeValue( "embed-xml" ) ) ); + String embed = node.attributeValue( "embed-xml" ); + // sometimes embed is set to the default value when not specified in the mapping, + // so can't seem to determine if an attribute was explicitly set; + // log a warning if embed has a value different from the default. + if ( !StringHelper.isEmpty( embed ) && !"true".equals( embed ) ) { + LOG.embedXmlAttributesNoLongerSupported(); + } + oneToOne.setEmbedded( "true".equals( embed ) ); Attribute fkNode = node.attribute( "foreign-key" ); if ( fkNode != null ) oneToOne.setForeignKeyName( fkNode.getValue() ); Attribute ukName = node.attribute( "property-ref" ); if ( ukName != null ) oneToOne.setReferencedPropertyName( ukName.getValue() ); + oneToOne.setReferenceToPrimaryKey( oneToOne.getReferencedPropertyName() == null ); oneToOne.setPropertyName( node.attributeValue( "name" ) ); oneToOne.setReferencedEntityName( getEntityName( node, mappings ) ); - validateCascade( node, path ); + String cascade = node.attributeValue( "cascade" ); + if ( cascade != null && cascade.indexOf( "delete-orphan" ) >= 0 ) { + if ( oneToOne.isConstrained() ) { + throw new MappingException( + "one-to-one attribute [" + path + "] does not support orphan delete as it is constrained" + ); + } + } } public static void bindOneToMany(Element node, OneToMany oneToMany, Mappings mappings) @@ -1664,14 +1766,20 @@ oneToMany.setReferencedEntityName( getEntityName( node, mappings ) ); String embed = node.attributeValue( "embed-xml" ); + // sometimes embed is set to the default value when not specified in the mapping, + // so can't seem to determine if an attribute was explicitly set; + // log a warning if embed has a value different from the default. + if ( !StringHelper.isEmpty( embed ) && !"true".equals( embed ) ) { + LOG.embedXmlAttributesNoLongerSupported(); + } oneToMany.setEmbedded( embed == null || "true".equals( embed ) ); String notFound = node.attributeValue( "not-found" ); oneToMany.setIgnoreNotFound( "ignore".equals( notFound ) ); } - public static void bindColumn(Element node, Column column, boolean isNullable) { + public static void bindColumn(Element node, Column column, boolean isNullable) throws MappingException { Attribute lengthNode = node.attribute( "length" ); if ( lengthNode != null ) column.setLength( Integer.parseInt( lengthNode.getValue() ) ); Attribute scalNode = node.attribute( "scale" ); @@ -1691,6 +1799,13 @@ Attribute typeNode = node.attribute( "sql-type" ); if ( typeNode != null ) column.setSqlType( typeNode.getValue() ); + String customWrite = node.attributeValue( "write" ); + if(customWrite != null && !customWrite.matches("[^?]*\\?[^?]*")) { + throw new MappingException("write expression must contain exactly one value placeholder ('?') character"); + } + column.setCustomWrite( customWrite ); + column.setCustomRead( node.attributeValue( "read" ) ); + Element comment = node.element("comment"); if (comment!=null) column.setComment( comment.getTextTrim() ); @@ -1729,7 +1844,7 @@ mappings, inheritedMetas, false - ); + ); } public static void bindCompositeId(Element node, Component component, @@ -1760,7 +1875,7 @@ if ( propertyName!=null ) { throw new MappingException("cannot combine mapped=\"true\" with specified name"); } - Component mapper = new Component(persistentClass); + Component mapper = new Component( mappings, persistentClass ); bindComponent( node, mapper, @@ -1775,7 +1890,7 @@ ); persistentClass.setIdentifierMapper(mapper); Property property = new Property(); - property.setName("_identifierMapper"); + property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY ); property.setNodeName("id"); property.setUpdateable(false); property.setInsertable(false); @@ -1861,7 +1976,7 @@ value = collection; } else if ( "many-to-one".equals( name ) || "key-many-to-one".equals( name ) ) { - value = new ManyToOne( component.getTable() ); + value = new ManyToOne( mappings, component.getTable() ); String relativePath; if (isEmbedded) { relativePath = propertyName; @@ -1872,7 +1987,7 @@ bindManyToOne( subnode, (ManyToOne) value, relativePath, isNullable, mappings ); } else if ( "one-to-one".equals( name ) ) { - value = new OneToOne( component.getTable(), component.getOwner() ); + value = new OneToOne( mappings, component.getTable(), component.getOwner() ); String relativePath; if (isEmbedded) { relativePath = propertyName; @@ -1883,11 +1998,11 @@ bindOneToOne( subnode, (OneToOne) value, relativePath, isNullable, mappings ); } else if ( "any".equals( name ) ) { - value = new Any( component.getTable() ); + value = new Any( mappings, component.getTable() ); bindAny( subnode, (Any) value, isNullable, mappings ); } else if ( "property".equals( name ) || "key-property".equals( name ) ) { - value = new SimpleValue( component.getTable() ); + value = new SimpleValue( mappings, component.getTable() ); String relativePath; if (isEmbedded) { relativePath = propertyName; @@ -1900,7 +2015,7 @@ else if ( "component".equals( name ) || "dynamic-component".equals( name ) || "nested-composite-element".equals( name ) ) { - value = new Component( component ); // a nested composite element + value = new Component( mappings, component ); // a nested composite element bindComponent( subnode, (Component) value, @@ -1980,21 +2095,41 @@ } } else { - // use old (HB 2.1) defaults if outer-join is specified - String eoj = jfNode.getValue(); - if ( "auto".equals( eoj ) ) { - fetchStyle = FetchMode.DEFAULT; + if ( "many-to-many".equals( node.getName() ) ) { + //NOTE " + collection.getCollectionTable().getName() - ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName() ); + } } // CHECK @@ -2428,7 +2585,7 @@ else { keyVal = (KeyValue) collection.getOwner().getRecursiveProperty( propRef ).getValue(); } - SimpleValue key = new DependantValue( collection.getCollectionTable(), keyVal ); + SimpleValue key = new DependantValue( mappings, collection.getCollectionTable(), keyVal ); key.setCascadeDeleteEnabled( "cascade" .equals( subnode.attributeValue( "on-delete" ) ) ); bindSimpleValue( @@ -2449,7 +2606,7 @@ } else if ( "element".equals( name ) ) { - SimpleValue elt = new SimpleValue( collection.getCollectionTable() ); + SimpleValue elt = new SimpleValue( mappings, collection.getCollectionTable() ); collection.setElement( elt ); bindSimpleValue( subnode, @@ -2460,7 +2617,7 @@ ); } else if ( "many-to-many".equals( name ) ) { - ManyToOne element = new ManyToOne( collection.getCollectionTable() ); + ManyToOne element = new ManyToOne( mappings, collection.getCollectionTable() ); collection.setElement( element ); bindManyToOne( subnode, @@ -2472,7 +2629,7 @@ bindManyToManySubelements( collection, subnode, mappings ); } else if ( "composite-element".equals( name ) ) { - Component element = new Component( collection ); + Component element = new Component( mappings, collection ); collection.setElement( element ); bindComposite( subnode, @@ -2484,7 +2641,7 @@ ); } else if ( "many-to-any".equals( name ) ) { - Any element = new Any( collection.getCollectionTable() ); + Any element = new Any( mappings, collection.getCollectionTable() ); collection.setElement( element ); bindAny( subnode, element, true, mappings ); } @@ -2539,6 +2696,7 @@ "not valid within collection using join fetching [" + collection.getRole() + "]" ); } + final boolean debugEnabled = LOG.isDebugEnabled(); while ( filters.hasNext() ) { final Element filterElement = ( Element ) filters.next(); final String name = filterElement.attributeValue( "name" ); @@ -2550,84 +2708,56 @@ if ( condition==null) { throw new MappingException("no filter condition found for filter: " + name); } - log.debug( - "Applying many-to-many filter [" + name + - "] as [" + condition + - "] to role [" + collection.getRole() + "]" - ); - collection.addManyToManyFilter( name, condition ); + Iterator aliasesIterator = filterElement.elementIterator("aliases"); + java.util.Map aliasTables = new HashMap(); + while (aliasesIterator.hasNext()){ + Element alias = (Element) aliasesIterator.next(); + aliasTables.put(alias.attributeValue("alias"), alias.attributeValue("table")); + } + if ( debugEnabled ) { + LOG.debugf( "Applying many-to-many filter [%s] as [%s] to role [%s]", name, condition, collection.getRole() ); + } + String autoAliasInjectionText = filterElement.attributeValue("autoAliasInjection"); + boolean autoAliasInjection = StringHelper.isEmpty(autoAliasInjectionText) ? true : Boolean.parseBoolean(autoAliasInjectionText); + collection.addManyToManyFilter(name, condition, autoAliasInjection, aliasTables, null); } } - public static final FlushMode getFlushMode(String flushMode) { - if ( flushMode == null ) { - return null; - } - else if ( "auto".equals( flushMode ) ) { - return FlushMode.AUTO; - } - else if ( "commit".equals( flushMode ) ) { - return FlushMode.COMMIT; - } - else if ( "never".equals( flushMode ) ) { - return FlushMode.NEVER; - } - else if ( "manual".equals( flushMode ) ) { - return FlushMode.MANUAL; - } - else if ( "always".equals( flushMode ) ) { - return FlushMode.ALWAYS; - } - else { - throw new MappingException( "unknown flushmode" ); - } - } - private static void bindNamedQuery(Element queryElem, String path, Mappings mappings) { String queryName = queryElem.attributeValue( "name" ); if (path!=null) queryName = path + '.' + queryName; String query = queryElem.getText(); - log.debug( "Named query: " + queryName + " -> " + query ); + LOG.debugf( "Named query: %s -> %s", queryName, query ); boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) ); String region = queryElem.attributeValue( "cache-region" ); Attribute tAtt = queryElem.attribute( "timeout" ); - Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() ); + Integer timeout = tAtt == null ? null : Integer.valueOf( tAtt.getValue() ); Attribute fsAtt = queryElem.attribute( "fetch-size" ); - Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() ); + Integer fetchSize = fsAtt == null ? null : Integer.valueOf( fsAtt.getValue() ); Attribute roAttr = queryElem.attribute( "read-only" ); boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() ); Attribute cacheModeAtt = queryElem.attribute( "cache-mode" ); String cacheMode = cacheModeAtt == null ? null : cacheModeAtt.getValue(); Attribute cmAtt = queryElem.attribute( "comment" ); String comment = cmAtt == null ? null : cmAtt.getValue(); - NamedQueryDefinition namedQuery = new NamedQueryDefinition( - query, - cacheable, - region, - timeout, - fetchSize, - getFlushMode( queryElem.attributeValue( "flush-mode" ) ) , - getCacheMode( cacheMode ), - readOnly, - comment, - getParameterTypes(queryElem) - ); + NamedQueryDefinition namedQuery = new NamedQueryDefinitionBuilder().setName( queryName ) + .setQuery( query ) + .setCacheable( cacheable ) + .setCacheRegion( region ) + .setTimeout( timeout ) + .setFetchSize( fetchSize ) + .setFlushMode( FlushMode.interpretExternalSetting( queryElem.attributeValue( "flush-mode" ) ) ) + .setCacheMode( CacheMode.interpretExternalSetting( cacheMode ) ) + .setReadOnly( readOnly ) + .setComment( comment ) + .setParameterTypes( getParameterTypes( queryElem ) ) + .createNamedQueryDefinition(); - mappings.addQuery( queryName, namedQuery ); + mappings.addQuery( namedQuery.getName(), namedQuery ); } - public static CacheMode getCacheMode(String cacheMode) { - if (cacheMode == null) return null; - if ( "get".equals( cacheMode ) ) return CacheMode.GET; - if ( "ignore".equals( cacheMode ) ) return CacheMode.IGNORE; - if ( "normal".equals( cacheMode ) ) return CacheMode.NORMAL; - if ( "put".equals( cacheMode ) ) return CacheMode.PUT; - if ( "refresh".equals( cacheMode ) ) return CacheMode.REFRESH; - throw new MappingException("Unknown Cache Mode: " + cacheMode); - } - public static java.util.Map getParameterTypes(Element queryElem) { java.util.Map result = new java.util.LinkedHashMap(); Iterator iter = queryElem.elementIterator("query-param"); @@ -2697,7 +2827,7 @@ (IdentifierCollection) collection, persistentClasses, mappings, - inheritedMetas + inheritedMetas ); } @@ -2715,7 +2845,7 @@ (Map) collection, persistentClasses, mappings, - inheritedMetas + inheritedMetas ); } @@ -2734,7 +2864,7 @@ } } - + static class ListSecondPass extends CollectionSecondPass { ListSecondPass(Element node, Mappings mappings, List collection, java.util.Map inheritedMetas) { super( node, mappings, collection, inheritedMetas ); @@ -2747,7 +2877,7 @@ (List) collection, persistentClasses, mappings, - inheritedMetas + inheritedMetas ); } @@ -2771,55 +2901,55 @@ private static final CollectionType MAP = new CollectionType( "map" ) { public Collection create(Element node, String path, PersistentClass owner, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { - Map map = new Map( owner ); + Map map = new Map( mappings, owner ); bindCollection( node, map, owner.getEntityName(), path, mappings, inheritedMetas ); return map; } }; private static final CollectionType SET = new CollectionType( "set" ) { public Collection create(Element node, String path, PersistentClass owner, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { - Set set = new Set( owner ); + Set set = new Set( mappings, owner ); bindCollection( node, set, owner.getEntityName(), path, mappings, inheritedMetas ); return set; } }; private static final CollectionType LIST = new CollectionType( "list" ) { public Collection create(Element node, String path, PersistentClass owner, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { - List list = new List( owner ); + List list = new List( mappings, owner ); bindCollection( node, list, owner.getEntityName(), path, mappings, inheritedMetas ); return list; } }; private static final CollectionType BAG = new CollectionType( "bag" ) { public Collection create(Element node, String path, PersistentClass owner, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { - Bag bag = new Bag( owner ); + Bag bag = new Bag( mappings, owner ); bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas ); return bag; } }; private static final CollectionType IDBAG = new CollectionType( "idbag" ) { public Collection create(Element node, String path, PersistentClass owner, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { - IdentifierBag bag = new IdentifierBag( owner ); + IdentifierBag bag = new IdentifierBag( mappings, owner ); bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas ); return bag; } }; private static final CollectionType ARRAY = new CollectionType( "array" ) { public Collection create(Element node, String path, PersistentClass owner, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { - Array array = new Array( owner ); + Array array = new Array( mappings, owner ); bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas ); return array; } }; private static final CollectionType PRIMITIVE_ARRAY = new CollectionType( "primitive-array" ) { public Collection create(Element node, String path, PersistentClass owner, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { - PrimitiveArray array = new PrimitiveArray( owner ); + PrimitiveArray array = new PrimitiveArray( mappings, owner ); bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas ); return array; } @@ -2841,21 +2971,23 @@ } } - private static int getOptimisticLockMode(Attribute olAtt) throws MappingException { + private static OptimisticLockStyle getOptimisticLockStyle(Attribute olAtt) throws MappingException { + if ( olAtt == null ) { + return OptimisticLockStyle.VERSION; + } - if ( olAtt == null ) return Versioning.OPTIMISTIC_LOCK_VERSION; - String olMode = olAtt.getValue(); + final String olMode = olAtt.getValue(); if ( olMode == null || "version".equals( olMode ) ) { - return Versioning.OPTIMISTIC_LOCK_VERSION; + return OptimisticLockStyle.VERSION; } else if ( "dirty".equals( olMode ) ) { - return Versioning.OPTIMISTIC_LOCK_DIRTY; + return OptimisticLockStyle.DIRTY; } else if ( "all".equals( olMode ) ) { - return Versioning.OPTIMISTIC_LOCK_ALL; + return OptimisticLockStyle.ALL; } else if ( "none".equals( olMode ) ) { - return Versioning.OPTIMISTIC_LOCK_NONE; + return OptimisticLockStyle.NONE; } else { throw new MappingException( "Unsupported optimistic-lock style: " + olMode ); @@ -2877,7 +3009,7 @@ boolean inheritable = Boolean .valueOf( metaNode.attributeValue( "inherit" ) ) .booleanValue(); - if ( onlyInheritable & !inheritable ) { + if ( onlyInheritable && !inheritable ) { continue; } String name = metaNode.attributeValue( "attribute" ); @@ -2887,10 +3019,10 @@ if ( meta == null ) { meta = new MetaAttribute( name ); map.put( name, meta ); - } else if (meta == inheritedAttribute) { // overriding inherited meta attribute. HBX-621 & HBX-793 - meta = new MetaAttribute( name ); - map.put( name, meta ); - } + } else if (meta == inheritedAttribute) { // overriding inherited meta attribute. HBX-621 & HBX-793 + meta = new MetaAttribute( name ); + map.put( name, meta ); + } meta.addValue( metaNode.getText() ); } return map; @@ -2920,7 +3052,7 @@ private static void parseFilterDef(Element element, Mappings mappings) { String name = element.attributeValue( "name" ); - log.debug( "Parsing filter-def [" + name + "]" ); + LOG.debugf( "Parsing filter-def [%s]", name ); String defaultCondition = element.getTextTrim(); if ( StringHelper.isEmpty( defaultCondition ) ) { defaultCondition = element.attributeValue( "condition" ); @@ -2931,12 +3063,12 @@ final Element param = (Element) params.next(); final String paramName = param.attributeValue( "name" ); final String paramType = param.attributeValue( "type" ); - log.debug( "adding filter parameter : " + paramName + " -> " + paramType ); - final Type heuristicType = TypeFactory.heuristicType( paramType ); - log.debug( "parameter heuristic type : " + heuristicType ); + LOG.debugf( "Adding filter parameter : %s -> %s", paramName, paramType ); + final Type heuristicType = mappings.getTypeResolver().heuristicType( paramType ); + LOG.debugf( "Parameter heuristic type : %s", heuristicType ); paramMappings.put( paramName, heuristicType ); } - log.debug( "Parsed filter-def [" + name + "]" ); + LOG.debugf( "Parsed filter-def [%s]", name ); FilterDefinition def = new FilterDefinition( name, defaultCondition, paramMappings ); mappings.addFilterDefinition( def ); } @@ -2950,7 +3082,7 @@ //TODO: bad implementation, cos it depends upon ordering of mapping doc // fixing this requires that Collection/PersistentClass gain access // to the Mappings reference from Configuration (or the filterDefinitions - // map directly) sometime during Configuration.buildSessionFactory + // map directly) sometime during Configuration.build // (after all the types/filter-defs are known and before building // persisters). if ( StringHelper.isEmpty(condition) ) { @@ -2959,10 +3091,37 @@ if ( condition==null) { throw new MappingException("no filter condition found for filter: " + name); } - log.debug( "Applying filter [" + name + "] as [" + condition + "]" ); - filterable.addFilter( name, condition ); + Iterator aliasesIterator = filterElement.elementIterator("aliases"); + java.util.Map aliasTables = new HashMap(); + while (aliasesIterator.hasNext()){ + Element alias = (Element) aliasesIterator.next(); + aliasTables.put(alias.attributeValue("alias"), alias.attributeValue("table")); + } + LOG.debugf( "Applying filter [%s] as [%s]", name, condition ); + String autoAliasInjectionText = filterElement.attributeValue("autoAliasInjection"); + boolean autoAliasInjection = StringHelper.isEmpty(autoAliasInjectionText) ? true : Boolean.parseBoolean(autoAliasInjectionText); + filterable.addFilter(name, condition, autoAliasInjection, aliasTables, null); } + private static void parseFetchProfile(Element element, Mappings mappings, String containingEntityName) { + String profileName = element.attributeValue( "name" ); + FetchProfile profile = mappings.findOrCreateFetchProfile( profileName, MetadataSource.HBM ); + Iterator itr = element.elementIterator( "fetch" ); + while ( itr.hasNext() ) { + final Element fetchElement = ( Element ) itr.next(); + final String association = fetchElement.attributeValue( "association" ); + final String style = fetchElement.attributeValue( "style" ); + String entityName = fetchElement.attributeValue( "entity" ); + if ( entityName == null ) { + entityName = containingEntityName; + } + if ( entityName == null ) { + throw new MappingException( "could not determine entity for fetch-profile fetch [" + profileName + "]:[" + association + "]" ); + } + profile.addFetch( entityName, association, style ); + } + } + private static String getSubselect(Element element) { String subselect = element.attributeValue( "subselect" ); if ( subselect != null ) { @@ -2978,14 +3137,14 @@ * For the given document, locate all extends attributes which refer to * entities (entity-name or class-name) not defined within said document. * - * @param doc The document to check + * @param metadataXml The document to check * @param mappings The already processed mappings. * @return The list of unresolved extends names. */ - public static java.util.List getExtendsNeeded(Document doc, Mappings mappings) { - java.util.List extendz = new ArrayList(); + public static java.util.List getExtendsNeeded(XmlDocument metadataXml, Mappings mappings) { + java.util.List extendz = new ArrayList(); Iterator[] subclasses = new Iterator[3]; - final Element hmNode = doc.getRootElement(); + final Element hmNode = metadataXml.getDocumentTree().getRootElement(); Attribute packNode = hmNode.attribute( "package" ); final String packageName = packNode == null ? null : packNode.getValue(); @@ -3019,7 +3178,7 @@ // extends names which require us to delay processing (i.e. // external to this document and not yet processed) are contained // in the returned result - final java.util.Set set = new HashSet( extendz ); + final java.util.Set set = new HashSet( extendz ); EntityElementHandler handler = new EntityElementHandler() { public void handleEntity(String entityName, String className, Mappings mappings) { if ( entityName != null ) { @@ -3072,8 +3231,36 @@ recognizeEntities( mappings, element, handler ); } } + + private static String quoteIdentifier(String identifier, Mappings mappings) { + return mappings.getObjectNameNormalizer().isUseQuotedIdentifiersGlobally() + ? StringHelper.quote( identifier ) : identifier; + } private static interface EntityElementHandler { public void handleEntity(String entityName, String className, Mappings mappings); } + + private static class ResolveUserTypeMappingSecondPass implements SecondPass{ + + private SimpleValue simpleValue; + private String typeName; + private Mappings mappings; + private Properties parameters; + + public ResolveUserTypeMappingSecondPass(SimpleValue simpleValue, + String typeName, Mappings mappings, Properties parameters) { + this.simpleValue=simpleValue; + this.typeName=typeName; + this.parameters=parameters; + this.mappings=mappings; + } + + @Override + public void doSecondPass(java.util.Map persistentClasses) + throws MappingException { + resolveAndBindTypeDef(simpleValue, mappings, typeName, parameters); + } + + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/ImprovedNamingStrategy.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/ImprovedNamingStrategy.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/ImprovedNamingStrategy.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/ImprovedNamingStrategy.java 30 Jul 2014 15:51:05 -0000 1.1.2.1 @@ -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,14 +20,13 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.io.Serializable; -import org.hibernate.util.StringHelper; import org.hibernate.AssertionFailure; +import org.hibernate.internal.util.StringHelper; /** * An improved naming strategy that prefers embedded @@ -70,7 +69,7 @@ } protected static String addUnderscores(String name) { - StringBuffer buf = new StringBuffer( name.replace('.', '_') ); + StringBuilder buf = new StringBuilder( name.replace('.', '_') ); for (int i=1; i<hibernate-mapping> element.) + * A collection of mappings from classes and collections to relational database tables. Represents a single + * <hibernate-mapping> element. + *

+ * todo : the statement about this representing a single mapping element is simply not true if it was ever the case. + * this contract actually represents 3 scopes of information:

    + *
  1. bounded state : this is information which is indeed scoped by a single mapping
  2. + *
  3. unbounded state : this is information which is Configuration wide (think of metadata repository)
  4. + *
  5. transient state : state which changed at its own pace (naming strategy)
  6. + *
+ * * @author Gavin King + * @author Steve Ebersole */ -public class Mappings implements Serializable { +public interface Mappings { + /** + * Retrieve the type resolver in effect. + * + * @return The type resolver. + */ + public TypeResolver getTypeResolver(); - private static final Logger log = LoggerFactory.getLogger(Mappings.class); + /** + * Get the current naming strategy. + * + * @return The current naming strategy. + */ + public NamingStrategy getNamingStrategy(); - protected final Map classes; - protected final Map collections; - protected final Map tables; - protected final Map queries; - protected final Map sqlqueries; - protected final Map resultSetMappings; - protected final Map typeDefs; - protected final List secondPasses; - protected final Map imports; - protected String schemaName; - protected String catalogName; - protected String defaultCascade; - protected String defaultPackage; - protected String defaultAccess; - protected boolean autoImport; - protected boolean defaultLazy; - protected final List propertyReferences; - protected final NamingStrategy namingStrategy; - protected final Map filterDefinitions; - protected final List auxiliaryDatabaseObjects; + /** + * Set the current naming strategy. + * + * @param namingStrategy The naming strategy to use. + */ + public void setNamingStrategy(NamingStrategy namingStrategy); - protected final Map extendsQueue; -// private final List extendsQueue; + /** + * Returns the currently bound default schema name. + * + * @return The currently bound schema name + */ + public String getSchemaName(); /** - * binding table between the logical column name and the name out of the naming strategy - * for each table. - * According that when the column name is not set, the property name is considered as such - * This means that while theorically possible through the naming strategy contract, it is - * forbidden to have 2 real columns having the same logical name - * + * Sets the currently bound default schema name. + * + * @param schemaName The schema name to bind as the current default. */ - protected final Map columnNameBindingPerTable; + public void setSchemaName(String schemaName); + /** - * binding between logical table name and physical one (ie after the naming strategy has been applied) - * + * Returns the currently bound default catalog name. + * + * @return The currently bound catalog name, or null if none. */ - protected final Map tableNameBinding; + public String getCatalogName(); + /** + * Sets the currently bound default catalog name. + * + * @param catalogName The catalog name to use as the current default. + */ + public void setCatalogName(String catalogName); - Mappings( - final Map classes, - final Map collections, - final Map tables, - final Map queries, - final Map sqlqueries, - final Map sqlResultSetMappings, - final Map imports, - final List secondPasses, - final List propertyReferences, - final NamingStrategy namingStrategy, - final Map typeDefs, - final Map filterDefinitions, -// final List extendsQueue, - final Map extendsQueue, - final List auxiliaryDatabaseObjects, - final Map tableNamebinding, - final Map columnNameBindingPerTable - ) { - this.classes = classes; - this.collections = collections; - this.queries = queries; - this.sqlqueries = sqlqueries; - this.resultSetMappings = sqlResultSetMappings; - this.tables = tables; - this.imports = imports; - this.secondPasses = secondPasses; - this.propertyReferences = propertyReferences; - this.namingStrategy = namingStrategy; - this.typeDefs = typeDefs; - this.filterDefinitions = filterDefinitions; - this.extendsQueue = extendsQueue; - this.auxiliaryDatabaseObjects = auxiliaryDatabaseObjects; - this.tableNameBinding = tableNamebinding; - this.columnNameBindingPerTable = columnNameBindingPerTable; - } + /** + * Get the currently bound default package name. + * + * @return The currently bound default package name + */ + public String getDefaultPackage(); - public void addClass(PersistentClass persistentClass) throws MappingException { - Object old = classes.put( persistentClass.getEntityName(), persistentClass ); - if ( old!=null ) { - throw new DuplicateMappingException( "class/entity", persistentClass.getEntityName() ); - } - } - public void addCollection(Collection collection) throws MappingException { - Object old = collections.put( collection.getRole(), collection ); - if ( old!=null ) { - throw new DuplicateMappingException( "collection role", collection.getRole() ); - } - } - public PersistentClass getClass(String className) { - return (PersistentClass) classes.get(className); - } - public Collection getCollection(String role) { - return (Collection) collections.get(role); - } + /** + * Set the current default package name. + * + * @param defaultPackage The package name to set as the current default. + */ + public void setDefaultPackage(String defaultPackage); - public void addImport(String className, String rename) throws MappingException { - String existing = (String) imports.put(rename, className); - if ( existing!=null ) { - if ( existing.equals(className) ) { - log.info( "duplicate import: " + className + "->" + rename ); - } - else { - throw new DuplicateMappingException( - "duplicate import: " + rename + - " refers to both " + className + - " and " + existing + - " (try using auto-import=\"false\")", - "import", - rename - ); - } - } - } + /** + * Determine whether auto importing of entity names is currently enabled. + * + * @return True if currently enabled; false otherwise. + */ + public boolean isAutoImport(); - public Table addTable(String schema, - String catalog, - String name, - String subselect, - boolean isAbstract - ) { - String key = subselect==null ? - Table.qualify(catalog, schema, name) : - subselect; - Table table = (Table) tables.get(key); + /** + * Set whether to enable auto importing of entity names. + * + * @param autoImport True to enable; false to diasable. + * @see #addImport + */ + public void setAutoImport(boolean autoImport); - if (table == null) { - table = new Table(); - table.setAbstract(isAbstract); - table.setName(name); - table.setSchema(schema); - table.setCatalog(catalog); - table.setSubselect(subselect); - tables.put(key, table); - } - else { - if (!isAbstract) table.setAbstract(false); - } + /** + * Determine whether default laziness is currently enabled. + * + * @return True if enabled, false otherwise. + */ + public boolean isDefaultLazy(); - return table; - } + /** + * Set whether to enable default laziness. + * + * @param defaultLazy True to enable, false to disable. + */ + public void setDefaultLazy(boolean defaultLazy); - public Table addDenormalizedTable( - String schema, - String catalog, - String name, - boolean isAbstract, - String subselect, - Table includedTable) - throws MappingException { - String key = subselect==null ? - Table.qualify(catalog, schema, name) : - subselect; - if ( tables.containsKey(key) ) { - throw new DuplicateMappingException("table", name); - } - - Table table = new DenormalizedTable(includedTable); - table.setAbstract(isAbstract); - table.setName(name); - table.setSchema(schema); - table.setCatalog(catalog); - table.setSubselect(subselect); - tables.put(key, table); - return table; - } + /** + * Get the current default cascade style. + * + * @return The current default cascade style. + */ + public String getDefaultCascade(); - public Table getTable(String schema, String catalog, String name) { - String key = Table.qualify(catalog, schema, name); - return (Table) tables.get(key); - } + /** + * Sets the current default cascade style. + * . + * @param defaultCascade The cascade style to set as the current default. + */ + public void setDefaultCascade(String defaultCascade); - public String getSchemaName() { - return schemaName; - } + /** + * Get the current default property access style. + * + * @return The current default property access style. + */ + public String getDefaultAccess(); - public String getCatalogName() { - return catalogName; - } + /** + * Sets the current default property access style. + * + * @param defaultAccess The access style to use as the current default. + */ + public void setDefaultAccess(String defaultAccess); - public String getDefaultCascade() { - return defaultCascade; - } /** - * Sets the schemaName. - * @param schemaName The schemaName to set + * Retrieves an iterator over the entity metadata present in this repository. + * + * @return Iterator over class metadata. */ - public void setSchemaName(String schemaName) { - this.schemaName = schemaName; - } + public Iterator iterateClasses(); - /** - * Sets the catalogName. - * @param catalogName The catalogName to set - */ - public void setCatalogName(String catalogName) { - this.catalogName = catalogName; - } + /** + * Retrieves the entity mapping metadata for the given entity name. + * + * @param entityName The entity name for which to retrieve the metadata. + * @return The entity mapping metadata, or null if none found matching given entity name. + */ + public PersistentClass getClass(String entityName); /** - * Sets the defaultCascade. - * @param defaultCascade The defaultCascade to set + * Retrieves the entity mapping metadata for the given entity name, potentially accounting + * for imports. + * + * @param entityName The entity name for which to retrieve the metadata. + * @return The entity mapping metadata, or null if none found matching given entity name. */ - public void setDefaultCascade(String defaultCascade) { - this.defaultCascade = defaultCascade; - } + public PersistentClass locatePersistentClassByEntityName(String entityName); /** - * sets the default access strategy - * @param defaultAccess the default access strategy. + * Add entity mapping metadata. + * + * @param persistentClass The entity metadata + * @throws DuplicateMappingException Indicates there4 was already an extry + * corresponding to the given entity name. */ - public void setDefaultAccess(String defaultAccess) { - this.defaultAccess = defaultAccess; - } + public void addClass(PersistentClass persistentClass) throws DuplicateMappingException; - public String getDefaultAccess() { - return defaultAccess; - } + /** + * Adds an import (HQL entity rename) to the repository. + * + * @param entityName The entity name being renamed. + * @param rename The rename + * @throws DuplicateMappingException If rename already is mapped to another + * entity name in this repository. + */ + public void addImport(String entityName, String rename) throws DuplicateMappingException; - public void addQuery(String name, NamedQueryDefinition query) throws MappingException { - checkQueryExist(name); - queries.put( name.intern(), query ); - } + /** + * Retrieves the collection mapping metadata for the given collection role. + * + * @param role The collection role for which to retrieve the metadata. + * @return The collection mapping metadata, or null if no matching collection role found. + */ + public Collection getCollection(String role); - public void addSQLQuery(String name, NamedSQLQueryDefinition query) throws MappingException { - checkQueryExist(name); - sqlqueries.put( name.intern(), query ); - } + /** + * Returns an iterator over collection metadata. + * + * @return Iterator over collection metadata. + */ + public Iterator iterateCollections(); - private void checkQueryExist(String name) throws MappingException { - if ( sqlqueries.containsKey(name) || queries.containsKey(name) ) { - throw new DuplicateMappingException("query", name); - } - } + /** + * Add collection mapping metadata to this repository. + * + * @param collection The collection metadata + * @throws DuplicateMappingException Indicates there was already an entry + * corresponding to the given collection role + */ + public void addCollection(Collection collection) throws DuplicateMappingException; - public void addResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping) { - final String name = sqlResultSetMapping.getName(); - if ( resultSetMappings.containsKey(name) ) { - throw new DuplicateMappingException("resultSet", name); - } - resultSetMappings.put(name, sqlResultSetMapping); - } + /** + * Returns the named table metadata. + * + * @param schema The named schema in which the table belongs (or null). + * @param catalog The named catalog in which the table belongs (or null). + * @param name The table name + * @return The table metadata, or null. + */ + public Table getTable(String schema, String catalog, String name); - public ResultSetMappingDefinition getResultSetMapping(String name) { - return (ResultSetMappingDefinition) resultSetMappings.get(name); - } + /** + * Returns an iterator over table metadata. + * + * @return Iterator over table metadata. + */ + public Iterator
propertymeaning
classname of org.hibernate.dialect.Dialect subclass
hibernate.cache.provider_classclassname of org.hibernate.cache.CacheProvider - * subclass (if not specified EHCache is used)
hibernate.connection.provider_classclassname of org.hibernate.connection.ConnectionProvider + * classname of ConnectionProvider * subclass (if not specified hueristics are used)
hibernate.connection.usernamedatabase username
hibernate.transaction.manager_lookup_classclassname of org.hibernate.transaction.TransactionManagerLookup + * hibernate.transaction.jta.platformclassname of org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform * implementor
hibernate.transaction.factory_classthe factory to use for instantiating Transactions. - * (Defaults to JDBCTransactionFactory.)
hibernate.query.substitutionsquery language token substitutions
iterateTables(); + /** + * Adds table metadata to this repository returning the created + * metadata instance. + * + * @param schema The named schema in which the table belongs (or null). + * @param catalog The named catalog in which the table belongs (or null). + * @param name The table name + * @param subselect A select statement which defines a logical table, much + * like a DB view. + * @param isAbstract Is the table abstract (i.e. not really existing in the DB)? + * @return The created table metadata, or the existing reference. + */ + public Table addTable(String schema, String catalog, String name, String subselect, boolean isAbstract); - public NamedQueryDefinition getQuery(String name) { - return (NamedQueryDefinition) queries.get(name); - } + /** + * Adds a 'denormalized table' to this repository. + * + * @param schema The named schema in which the table belongs (or null). + * @param catalog The named catalog in which the table belongs (or null). + * @param name The table name + * @param isAbstract Is the table abstract (i.e. not really existing in the DB)? + * @param subselect A select statement which defines a logical table, much + * like a DB view. + * @param includedTable ??? + * @return The created table metadata. + * @throws DuplicateMappingException If such a table mapping already exists. + */ + public Table addDenormalizedTable(String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) + throws DuplicateMappingException; - public void addSecondPass(SecondPass sp) { - addSecondPass(sp, false); - } - - public void addSecondPass(SecondPass sp, boolean onTopOfTheQueue) { - if (onTopOfTheQueue) { - secondPasses.add(0, sp); - } - else { - secondPasses.add(sp); - } - } + /** + * Get named query metadata by name. + * + * @param name The named query name + * @return The query metadata, or null. + */ + public NamedQueryDefinition getQuery(String name); /** - * Returns the autoImport. - * @return boolean + * Adds metadata for a named query to this repository. + * + * @param name The name + * @param query The metadata + * @throws DuplicateMappingException If a query already exists with that name. */ - public boolean isAutoImport() { - return autoImport; - } + public void addQuery(String name, NamedQueryDefinition query) throws DuplicateMappingException; /** - * Sets the autoImport. - * @param autoImport The autoImport to set + * Get named SQL query metadata. + * + * @param name The named SQL query name. + * @return The meatdata, or null if none found. */ - public void setAutoImport(boolean autoImport) { - this.autoImport = autoImport; - } + public NamedSQLQueryDefinition getSQLQuery(String name); - void addUniquePropertyReference(String referencedClass, String propertyName) { - PropertyReference upr = new PropertyReference(); - upr.referencedClass = referencedClass; - upr.propertyName = propertyName; - upr.unique = true; - propertyReferences.add(upr); - } + /** + * Adds metadata for a named SQL query to this repository. + * + * @param name The name + * @param query The metadata + * @throws DuplicateMappingException If a query already exists with that name. + */ + public void addSQLQuery(String name, NamedSQLQueryDefinition query) throws DuplicateMappingException; - void addPropertyReference(String referencedClass, String propertyName) { - PropertyReference upr = new PropertyReference(); - upr.referencedClass = referencedClass; - upr.propertyName = propertyName; - propertyReferences.add(upr); - } + /** + * Adds metadata for a named stored procedure call to this repository. + * + * @param definition The procedure call information + * + * @throws DuplicateMappingException If a query already exists with that name. + */ + public void addNamedProcedureCallDefinition(NamedProcedureCallDefinition definition) throws DuplicateMappingException; - private String buildTableNameKey(String schema, String catalog, String finalName) { - StringBuffer keyBuilder = new StringBuffer(); - if (schema != null) keyBuilder.append( schema ); - keyBuilder.append( "."); - if (catalog != null) keyBuilder.append( catalog ); - keyBuilder.append( "."); - keyBuilder.append( finalName ); - return keyBuilder.toString(); - } + /** + * Adds metadata for a named stored procedure call to this repository. + * + * @param definition The procedure call information + * + * @throws DuplicateMappingException If a query already exists with that name. + */ + public void addDefaultNamedProcedureCallDefinition(NamedProcedureCallDefinition definition) throws DuplicateMappingException; - static final class PropertyReference implements Serializable { - String referencedClass; - String propertyName; - boolean unique; - } + /** - * @return Returns the defaultPackage. + * Adds metadata for a named entity graph to this repository + * + * @param namedEntityGraphDefinition The procedure call information + * + * @throws DuplicateMappingException If an entity graph already exists with that name. */ - public String getDefaultPackage() { - return defaultPackage; - } + public void addNamedEntityGraphDefintion(NamedEntityGraphDefinition namedEntityGraphDefinition); /** - * @param defaultPackage The defaultPackage to set. + * Get the metadata for a named SQL result set mapping. + * + * @param name The mapping name. + * @return The SQL result set mapping metadat, or null if none found. */ - public void setDefaultPackage(String defaultPackage) { - this.defaultPackage = defaultPackage; - } + public ResultSetMappingDefinition getResultSetMapping(String name); - public NamingStrategy getNamingStrategy() { - return namingStrategy; - } + /** + * Adds the metadata for a named SQL result set mapping to this repository. + * + * @param sqlResultSetMapping The metadata + * @throws DuplicateMappingException If metadata for another SQL result mapping was + * already found under the given name. + */ + public void addResultSetMapping(ResultSetMappingDefinition sqlResultSetMapping) throws DuplicateMappingException; - public void addTypeDef(String typeName, String typeClass, Properties paramMap) { - TypeDef def = new TypeDef(typeClass, paramMap); - typeDefs.put(typeName, def); - log.debug("Added " + typeName + " with class " + typeClass); - } + /** + * Retrieve a type definition by name. + * + * @param typeName The name of the type definition to retrieve. + * @return The type definition, or null if none found. + */ + public TypeDef getTypeDef(String typeName); - public TypeDef getTypeDef(String typeName) { - return (TypeDef) typeDefs.get(typeName); - } + /** + * Adds a type definition to this metadata repository. + * + * @param typeName The type name. + * @param typeClass The class implementing the {@link org.hibernate.type.Type} contract. + * @param paramMap Map of parameters to be used to configure the type after instantiation. + */ + public void addTypeDef(String typeName, String typeClass, Properties paramMap); - public Iterator iterateCollections() { - return collections.values().iterator(); - } - - public Iterator iterateTables() { - return tables.values().iterator(); - } + /** + * Retrieves the copmplete map of filter definitions. + * + * @return The filter definition map. + */ + public Map getFilterDefinitions(); - public Map getFilterDefinitions() { - return filterDefinitions; - } + /** + * Retrieves a filter definition by name. + * + * @param name The name of the filter definition to retrieve. + * @return The filter definition, or null. + */ + public FilterDefinition getFilterDefinition(String name); - public void addFilterDefinition(FilterDefinition definition) { - filterDefinitions.put( definition.getFilterName(), definition ); - } - - public FilterDefinition getFilterDefinition(String name) { - return (FilterDefinition) filterDefinitions.get(name); - } - - public boolean isDefaultLazy() { - return defaultLazy; - } - public void setDefaultLazy(boolean defaultLazy) { - this.defaultLazy = defaultLazy; - } + /** + * Adds a filter definition to this repository. + * + * @param definition The filter definition to add. + */ + public void addFilterDefinition(FilterDefinition definition); - public void addToExtendsQueue(ExtendsQueueEntry entry) { - extendsQueue.put( entry, null ); - } + /** + * Retrieves a fetch profile by either finding one currently in this repository matching the given name + * or by creating one (and adding it). + * + * @param name The name of the profile. + * @param source The source from which this profile is named. + * @return The fetch profile metadata. + */ + public FetchProfile findOrCreateFetchProfile(String name, MetadataSource source); - public PersistentClass locatePersistentClassByEntityName(String entityName) { - PersistentClass persistentClass = ( PersistentClass ) classes.get( entityName ); - if ( persistentClass == null ) { - String actualEntityName = ( String ) imports.get( entityName ); - if ( StringHelper.isNotEmpty( actualEntityName ) ) { - persistentClass = ( PersistentClass ) classes.get( actualEntityName ); - } - } - return persistentClass; - } + /** + * @deprecated To fix misspelling; use {@link #iterateAuxiliaryDatabaseObjects} instead + */ + @Deprecated + @SuppressWarnings({ "JavaDoc" }) + public Iterator iterateAuxliaryDatabaseObjects(); - public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject) { - auxiliaryDatabaseObjects.add( auxiliaryDatabaseObject ); - } + /** + * Retrieves an iterator over the metadata pertaining to all auxiliary database objects int this repository. + * + * @return Iterator over the auxiliary database object metadata. + */ + public Iterator iterateAuxiliaryDatabaseObjects(); + /** + * @deprecated To fix misspelling; use {@link #iterateAuxiliaryDatabaseObjectsInReverse} instead + */ + @Deprecated + @SuppressWarnings({ "JavaDoc" }) + public ListIterator iterateAuxliaryDatabaseObjectsInReverse(); + + /** + * Same as {@link #iterateAuxiliaryDatabaseObjects()} except that here the iterator is reversed. + * + * @return The reversed iterator. + */ + public ListIterator iterateAuxiliaryDatabaseObjectsInReverse(); + + /** + * Add metadata pertaining to an auxiliary database object to this repository. + * + * @param auxiliaryDatabaseObject The metadata. + */ + public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject); + + /** + * Get the logical table name mapped for the given physical table. + * + * @param table The table for which to determine the logical name. + * @return The logical name. + * @throws MappingException Indicates that no logical name was bound for the given physical table. + */ + public String getLogicalTableName(Table table) throws MappingException; + + /** + * Adds a table binding to this repository. + * + * @param schema The schema in which the table belongs (may be null). + * @param catalog The catalog in which the table belongs (may be null). + * @param logicalName The logical table name. + * @param physicalName The physical table name. + * @param denormalizedSuperTable ??? + * @throws DuplicateMappingException Indicates physical table was already bound to another logical name. + */ public void addTableBinding( - String schema, String catalog, String logicalName, String physicalName, Table denormalizedSuperTable - ) { - String key = buildTableNameKey( schema, catalog, physicalName ); - TableDescription tableDescription = new TableDescription( - logicalName, denormalizedSuperTable - ); - TableDescription oldDescriptor = (TableDescription) tableNameBinding.put( key, tableDescription ); - if ( oldDescriptor != null && ! oldDescriptor.logicalName.equals( logicalName ) ) { - //TODO possibly relax that - throw new MappingException("Same physical table name reference several logical table names: " - + physicalName + " => " + "'" + oldDescriptor.logicalName + "' and '" + logicalName + "'"); - } - } + String schema, + String catalog, + String logicalName, + String physicalName, + Table denormalizedSuperTable) throws DuplicateMappingException; - public void addColumnBinding(String logicalName, Column finalColumn, Table table) { - ColumnNames binding = (ColumnNames) columnNameBindingPerTable.get(table); - if (binding == null) { - binding = new ColumnNames(); - columnNameBindingPerTable.put(table, binding); - } - String oldFinalName = (String) binding.logicalToPhysical.put( - logicalName.toLowerCase(), - finalColumn.getQuotedName() - ); - if ( oldFinalName != null && - ! ( finalColumn.isQuoted() ? - oldFinalName.equals( finalColumn.getQuotedName() ) : - oldFinalName.equalsIgnoreCase( finalColumn.getQuotedName() ) ) ) { - //TODO possibly relax that - throw new MappingException("Same logical column name referenced by different physical ones: " - + table.getName() + "." + logicalName + " => '" + oldFinalName + "' and '" + finalColumn.getQuotedName() + "'" ); - } - String oldLogicalName = (String) binding.physicalToLogical.put( - finalColumn.getQuotedName(), - logicalName - ); - if ( oldLogicalName != null && ! oldLogicalName.equals( logicalName ) ) { - //TODO possibly relax that - throw new MappingException("Same physical column represented by different logical column names: " - + table.getName() + "." + finalColumn.getQuotedName() + " => '" + oldLogicalName + "' and '" + logicalName + "'"); - } - } + /** + * Binds the given 'physicalColumn' to the give 'logicalName' within the given 'table'. + * + * @param logicalName The logical column name binding. + * @param physicalColumn The physical column metadata. + * @param table The table metadata. + * @throws DuplicateMappingException Indicates a duplicate binding for either the physical column name + * or the logical column name. + */ + public void addColumnBinding(String logicalName, Column physicalColumn, Table table) throws DuplicateMappingException; - private String getLogicalTableName(String schema, String catalog, String physicalName) { - String key = buildTableNameKey( schema, catalog, physicalName ); - TableDescription descriptor = (TableDescription) tableNameBinding.get( key ); - if (descriptor == null) { - throw new MappingException( "Unable to find physical table: " + physicalName); - } - return descriptor.logicalName; - } + /** + * Find the physical column name for the given logical column name within the given table. + * + * @param logicalName The logical name binding. + * @param table The table metatdata. + * @return The physical column name. + * @throws MappingException Indicates that no such binding was found. + */ + public String getPhysicalColumnName(String logicalName, Table table) throws MappingException; - public String getPhysicalColumnName(String logicalName, Table table) { - logicalName = logicalName.toLowerCase(); - String finalName = null; - Table currentTable = table; - do { - ColumnNames binding = (ColumnNames) columnNameBindingPerTable.get(currentTable); - if (binding != null) { - finalName = (String) binding.logicalToPhysical.get( logicalName ); - } - String key = buildTableNameKey( currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName() ); - TableDescription description = (TableDescription) tableNameBinding.get(key); - if (description != null) currentTable = description.denormalizedSupertable; - } - while (finalName == null && currentTable != null); - if (finalName == null) { - throw new MappingException( "Unable to find column with logical name " - + logicalName + " in table " + table.getName() ); - } - return finalName; - } + /** + * Find the logical column name against whcih the given physical column name was bound within the given table. + * + * @param physicalName The physical column name + * @param table The table metadata. + * @return The logical column name. + * @throws MappingException Indicates that no such binding was found. + */ + public String getLogicalColumnName(String physicalName, Table table) throws MappingException; - public String getLogicalColumnName(String physicalName, Table table) { - String logical = null; - Table currentTable = table; - TableDescription description = null; - do { - ColumnNames binding = (ColumnNames) columnNameBindingPerTable.get(currentTable); - if (binding != null) { - logical = (String) binding.physicalToLogical.get( physicalName ); - } - String key = buildTableNameKey( currentTable.getSchema(), currentTable.getCatalog(), currentTable.getName() ); - description = (TableDescription) tableNameBinding.get(key); - if (description != null) currentTable = description.denormalizedSupertable; - } - while (logical == null && currentTable != null && description != null); - if (logical == null) { - throw new MappingException( "Unable to find logical column name from physical name " - + physicalName + " in table " + table.getName() ); - } - return logical; - } + /** + * Adds a second-pass to the end of the current queue. + * + * @param sp The second pass to add. + */ + public void addSecondPass(SecondPass sp); - public String getLogicalTableName(Table table) { - return getLogicalTableName( table.getQuotedSchema(), table.getCatalog(), table.getQuotedName() ); - } + /** + * Adds a second pass. + * @param sp The second pass to add. + * @param onTopOfTheQueue True to add to the beginning of the queue; false to add to the end. + */ + public void addSecondPass(SecondPass sp, boolean onTopOfTheQueue); - static public class ColumnNames implements Serializable { - // - public Map logicalToPhysical = new HashMap(); - // - public Map physicalToLogical = new HashMap(); - public ColumnNames() { + /** + * Locate the AttributeConverterDefinition corresponding to the given AttributeConverter Class. + * + * @param attributeConverterClass The AttributeConverter Class for which to get the definition + * + * @return The corresponding AttributeConverter definition; will return {@code null} if no corresponding + * definition found. + */ + public AttributeConverterDefinition locateAttributeConverter(Class attributeConverterClass); + + /** + * All all AttributeConverter definitions + * + * @return The collection of all AttributeConverter definitions. + */ + public java.util.Collection getAttributeConverters(); + + /** + * Represents a property-ref mapping. + *

+ * TODO : currently needs to be exposed because Configuration needs access to it for second-pass processing + */ + public static final class PropertyReference implements Serializable { + public final String referencedClass; + public final String propertyName; + public final boolean unique; + + public PropertyReference(String referencedClass, String propertyName, boolean unique) { + this.referencedClass = referencedClass; + this.propertyName = propertyName; + this.unique = unique; } } - static public class TableDescription implements Serializable { - public TableDescription(String logicalName, Table denormalizedSupertable) { - this.logicalName = logicalName; - this.denormalizedSupertable = denormalizedSupertable; - } + /** + * Adds a property reference binding to this repository. + * + * @param referencedClass The referenced entity name. + * @param propertyName The referenced property name. + */ + public void addPropertyReference(String referencedClass, String propertyName); - public String logicalName; - public Table denormalizedSupertable; - } -} \ No newline at end of file + /** + * Adds a property reference binding to this repository where said proeprty reference is marked as unique. + * + * @param referencedClass The referenced entity name. + * @param propertyName The referenced property name. + */ + public void addUniquePropertyReference(String referencedClass, String propertyName); + + /** + * Adds an entry to the extends queue queue. + * + * @param entry The entry to add. + */ + public void addToExtendsQueue(ExtendsQueueEntry entry); + + /** + * Retrieve the IdentifierGeneratorFactory in effect for this mapping. + * + * @return The IdentifierGeneratorFactory + */ + public MutableIdentifierGeneratorFactory getIdentifierGeneratorFactory(); + + /** + * add a new MappedSuperclass + * This should not be called if the MappedSuperclass already exists + * (it would be erased) + * @param type type corresponding to the Mappedsuperclass + * @param mappedSuperclass MappedSuperclass + */ + public void addMappedSuperclass(Class type, org.hibernate.mapping.MappedSuperclass mappedSuperclass); + + /** + * Get a MappedSuperclass or null if not mapped + * + * @param type class corresponding to the MappedSuperclass + * @return the MappedSuperclass + */ + org.hibernate.mapping.MappedSuperclass getMappedSuperclass(Class type); + + /** + * Retrieve the database identifier normalizer for this context. + * + * @return The normalizer. + */ + public ObjectNameNormalizer getObjectNameNormalizer(); + + /** + * Retrieve the configuration properties currently in effect. + * + * @return The configuration properties + */ + public Properties getConfigurationProperties(); + + + + + + + + + + /** + * Adds a default id generator. + * + * @param generator The id generator + */ + public void addDefaultGenerator(IdGenerator generator); + + /** + * Retrieve the id-generator by name. + * + * @param name The generator name. + * + * @return The generator, or null. + */ + public IdGenerator getGenerator(String name); + + /** + * Try to find the generator from the localGenerators + * and then from the global generator list + * + * @param name generator name + * @param localGenerators local generators + * + * @return the appropriate idgenerator or null if not found + */ + public IdGenerator getGenerator(String name, Map localGenerators); + + /** + * Add a generator. + * + * @param generator The generator to add. + */ + public void addGenerator(IdGenerator generator); + + /** + * Add a generator table properties. + * + * @param name The generator name + * @param params The generator table properties. + */ + public void addGeneratorTable(String name, Properties params); + + /** + * Retrieve the properties related to a generator table. + * + * @param name generator name + * @param localGeneratorTables local generator tables + * + * @return The properties, or null. + */ + public Properties getGeneratorTableProperties(String name, Map localGeneratorTables); + + /** + * Retrieve join metadata for a particular persistent entity. + * + * @param entityName The entity name + * + * @return The join metadata + */ + public Map getJoins(String entityName); + + /** + * Add join metadata for a persistent entity. + * + * @param persistentClass The persistent entity metadata. + * @param joins The join metadata to add. + * + * @throws MappingException + */ + public void addJoins(PersistentClass persistentClass, Map joins); + + /** + * Get and maintain a cache of class type. + * + * @param clazz The XClass mapping + * + * @return The class type. + */ + public AnnotatedClassType getClassType(XClass clazz); + + /** + * FIXME should be private but will this break things? + * Add a class type. + * + * @param clazz The XClass mapping. + * + * @return The class type. + */ + public AnnotatedClassType addClassType(XClass clazz); + + /** + * @deprecated Use {@link #getUniqueConstraintHoldersByTable} instead + */ + @Deprecated + @SuppressWarnings({ "JavaDoc" }) + public Map> getTableUniqueConstraints(); + + public Map> getUniqueConstraintHoldersByTable(); + + /** + * @deprecated Use {@link #addUniqueConstraintHolders} instead + */ + @Deprecated + @SuppressWarnings({ "JavaDoc" }) + public void addUniqueConstraints(Table table, List uniqueConstraints); + + public void addUniqueConstraintHolders(Table table, List uniqueConstraintHolders); + + public void addJpaIndexHolders(Table table, List jpaIndexHolders); + + public void addMappedBy(String entityName, String propertyName, String inversePropertyName); + + public String getFromMappedBy(String entityName, String propertyName); + + public void addPropertyReferencedAssociation(String entityName, String propertyName, String propertyRef); + + public String getPropertyReferencedAssociation(String entityName, String propertyName); + + public ReflectionManager getReflectionManager(); + + public void addDefaultQuery(String name, NamedQueryDefinition query); + + public void addDefaultSQLQuery(String name, NamedSQLQueryDefinition query); + + public void addDefaultResultSetMapping(ResultSetMappingDefinition definition); + + public Map getClasses(); + + public void addAnyMetaDef(AnyMetaDef defAnn) throws AnnotationException; + + public AnyMetaDef getAnyMetaDef(String name); + + public boolean isInSecondPass(); + + /** + * Return the property annotated with @MapsId("propertyName") if any. + * Null otherwise + */ + public PropertyData getPropertyAnnotatedWithMapsId(XClass entityType, String propertyName); + + public void addPropertyAnnotatedWithMapsId(XClass entityType, PropertyData property); + + public void addPropertyAnnotatedWithMapsIdSpecj(XClass entityType, PropertyData property, String mapsIdValue); + + public boolean isSpecjProprietarySyntaxEnabled(); + + /** + * Should we use the new generator strategy mappings. This is controlled by the + * {@link AvailableSettings#USE_NEW_ID_GENERATOR_MAPPINGS} setting. + * + * @return True if the new generators should be used, false otherwise. + */ + public boolean useNewGeneratorMappings(); + + /** + * Should we handle absent DiscriminatorColumn mappings for joined inheritance by implicitly mapping a + * discriminator column? + * + * @return {@code true} indicates we should infer DiscriminatorColumn implicitly (aka, map to a discriminator + * column even without a DiscriminatorColumn annotation); {@code false} (the default) indicates that we should not. + * + * @see AvailableSettings#IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS + */ + public boolean useImplicitDiscriminatorColumnForJoinedInheritance(); + + /** + * Should we ignore explicit DiscriminatorColumn annotations when combined with joined inheritance? + * + * @return {@code true} indicates we should ignore explicit DiscriminatorColumn annotations; {@code false} (the + * default) indicates we should not ignore them + * + * @see AvailableSettings#IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS + */ + public boolean ignoreExplicitDiscriminatorColumnForJoinedInheritance(); + + /** + * Should we use nationalized variants of character data by default? This is controlled by the + * {@link AvailableSettings#USE_NATIONALIZED_CHARACTER_DATA} setting. + * + * @return {@code true} if nationalized character data should be used by default; {@code false} otherwise. + */ + public boolean useNationalizedCharacterData(); + + /** + * Return the property annotated with @ToOne and @Id if any. + * Null otherwise + */ + public PropertyData getPropertyAnnotatedWithIdAndToOne(XClass entityType, String propertyName); + + void addToOneAndIdProperty(XClass entity, PropertyData property); + + public boolean forceDiscriminatorInSelectsByDefault(); +} Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/MetadataSourceType.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/NamedSQLQuerySecondPass.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/NamedSQLQuerySecondPass.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/NamedSQLQuerySecondPass.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/NamedSQLQuerySecondPass.java 30 Jul 2014 15:51:04 -0000 1.1.2.1 @@ -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,28 +20,35 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; -import java.util.Map; import java.util.ArrayList; import java.util.Iterator; +import java.util.Map; +import org.hibernate.CacheMode; +import org.hibernate.FlushMode; import org.hibernate.MappingException; -import org.hibernate.util.StringHelper; -import org.hibernate.engine.NamedSQLQueryDefinition; import org.hibernate.engine.ResultSetMappingDefinition; +import org.hibernate.engine.spi.NamedSQLQueryDefinition; +import org.hibernate.engine.spi.NamedSQLQueryDefinitionBuilder; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.StringHelper; + +import org.jboss.logging.Logger; + import org.dom4j.Attribute; import org.dom4j.Element; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * @author Emmanuel Bernard */ public class NamedSQLQuerySecondPass extends ResultSetMappingBinder implements QuerySecondPass { - private static Logger log = LoggerFactory.getLogger( NamedSQLQuerySecondPass.class); + + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, + NamedSQLQuerySecondPass.class.getName()); + private Element queryElem; private String path; private Mappings mappings; @@ -59,17 +66,17 @@ boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) ); String region = queryElem.attributeValue( "cache-region" ); Attribute tAtt = queryElem.attribute( "timeout" ); - Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() ); + Integer timeout = tAtt == null ? null : Integer.valueOf( tAtt.getValue() ); Attribute fsAtt = queryElem.attribute( "fetch-size" ); - Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() ); + Integer fetchSize = fsAtt == null ? null : Integer.valueOf( fsAtt.getValue() ); Attribute roAttr = queryElem.attribute( "read-only" ); boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() ); Attribute cacheModeAtt = queryElem.attribute( "cache-mode" ); String cacheMode = cacheModeAtt == null ? null : cacheModeAtt.getValue(); Attribute cmAtt = queryElem.attribute( "comment" ); String comment = cmAtt == null ? null : cmAtt.getValue(); - java.util.List synchronizedTables = new ArrayList(); + java.util.List synchronizedTables = new ArrayList(); Iterator tables = queryElem.elementIterator( "synchronize" ); while ( tables.hasNext() ) { synchronizedTables.add( ( (Element) tables.next() ).attributeValue( "table" ) ); @@ -80,43 +87,45 @@ Attribute ref = queryElem.attribute( "resultset-ref" ); String resultSetRef = ref == null ? null : ref.getValue(); if ( StringHelper.isNotEmpty( resultSetRef ) ) { - namedQuery = new NamedSQLQueryDefinition( - queryElem.getText(), - resultSetRef, - synchronizedTables, - cacheable, - region, - timeout, - fetchSize, - HbmBinder.getFlushMode( queryElem.attributeValue( "flush-mode" ) ), - HbmBinder.getCacheMode( cacheMode ), - readOnly, - comment, - HbmBinder.getParameterTypes( queryElem ), - callable - ); + namedQuery = new NamedSQLQueryDefinitionBuilder().setName( queryName ) + .setQuery( queryElem.getText() ) + .setResultSetRef( resultSetRef ) + .setQuerySpaces( synchronizedTables ) + .setCacheable( cacheable ) + .setCacheRegion( region ) + .setTimeout( timeout ) + .setFetchSize( fetchSize ) + .setFlushMode( FlushMode.interpretExternalSetting( queryElem.attributeValue( "flush-mode" ) ) ) + .setCacheMode( CacheMode.interpretExternalSetting( cacheMode ) ) + .setReadOnly( readOnly ) + .setComment( comment ) + .setParameterTypes( HbmBinder.getParameterTypes( queryElem ) ) + .setCallable( callable ) + .createNamedQueryDefinition(); //TODO check there is no actual definition elemnents when a ref is defined } else { ResultSetMappingDefinition definition = buildResultSetMappingDefinition( queryElem, path, mappings ); - namedQuery = new NamedSQLQueryDefinition( - queryElem.getText(), - definition.getQueryReturns(), - synchronizedTables, - cacheable, - region, - timeout, - fetchSize, - HbmBinder.getFlushMode( queryElem.attributeValue( "flush-mode" ) ), - HbmBinder.getCacheMode( cacheMode ), - readOnly, - comment, - HbmBinder.getParameterTypes( queryElem ), - callable - ); + namedQuery = new NamedSQLQueryDefinitionBuilder().setName( queryName ) + .setQuery( queryElem.getText() ) + .setQueryReturns( definition.getQueryReturns() ) + .setQuerySpaces( synchronizedTables ) + .setCacheable( cacheable ) + .setCacheRegion( region ) + .setTimeout( timeout ) + .setFetchSize( fetchSize ) + .setFlushMode( FlushMode.interpretExternalSetting( queryElem.attributeValue( "flush-mode" ) ) ) + .setCacheMode( CacheMode.interpretExternalSetting( cacheMode ) ) + .setReadOnly( readOnly ) + .setComment( comment ) + .setParameterTypes( HbmBinder.getParameterTypes( queryElem ) ) + .setCallable( callable ) + .createNamedQueryDefinition(); } - log.debug( "Named SQL query: " + queryName + " -> " + namedQuery.getQueryString() ); + if ( LOG.isDebugEnabled() ) { + LOG.debugf( "Named SQL query: %s -> %s", namedQuery.getName(), namedQuery.getQueryString() ); + } mappings.addSQLQuery( queryName, namedQuery ); } } Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/NamingStrategy.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/NamingStrategy.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/NamingStrategy.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/NamingStrategy.java 30 Jul 2014 15:51:05 -0000 1.1.2.1 @@ -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,10 +20,10 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; + /** * A set of rules for determining the physical column * and table names given the information in the mapping Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/NotYetImplementedException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ObjectNameNormalizer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ObjectNameSource.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/OneToOneSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/PkDrivenByDefaultMapsIdSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/PropertyContainer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/PropertyData.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/PropertyHolder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/PropertyHolderBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/PropertyInferredData.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/PropertyPreloadedData.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/QuerySecondPass.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/QuerySecondPass.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/QuerySecondPass.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/QuerySecondPass.java 30 Jul 2014 15:51:06 -0000 1.1.2.1 @@ -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,10 +20,10 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; + /** * Bind query * Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/RecoverableException.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingBinder.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingBinder.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingBinder.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingBinder.java 30 Jul 2014 15:51:06 -0000 1.1.2.1 @@ -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,37 +20,36 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Set; -import java.util.HashSet; import java.util.Map; +import java.util.Set; -import org.dom4j.Element; import org.hibernate.LockMode; import org.hibernate.MappingException; -import org.hibernate.engine.query.sql.NativeSQLQueryCollectionReturn; import org.hibernate.engine.ResultSetMappingDefinition; -import org.hibernate.engine.query.sql.NativeSQLQueryJoinReturn; -import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn; -import org.hibernate.engine.query.sql.NativeSQLQueryScalarReturn; +import org.hibernate.engine.query.spi.sql.NativeSQLQueryCollectionReturn; +import org.hibernate.engine.query.spi.sql.NativeSQLQueryJoinReturn; +import org.hibernate.engine.query.spi.sql.NativeSQLQueryRootReturn; +import org.hibernate.engine.query.spi.sql.NativeSQLQueryScalarReturn; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.mapping.Component; import org.hibernate.mapping.PersistentClass; -import org.hibernate.mapping.Value; import org.hibernate.mapping.Property; import org.hibernate.mapping.ToOne; +import org.hibernate.mapping.Value; import org.hibernate.type.Type; -import org.hibernate.type.TypeFactory; -import org.hibernate.util.ArrayHelper; -import org.hibernate.util.CollectionHelper; -import org.hibernate.util.StringHelper; +import org.dom4j.Element; + /** * @author Emmanuel Bernard */ @@ -81,7 +80,7 @@ String typeFromXML = HbmBinder.getTypeFromXML( returnElem ); Type type = null; if(typeFromXML!=null) { - type = TypeFactory.heuristicType( typeFromXML ); + type = mappings.getTypeResolver().heuristicType( typeFromXML ); if ( type == null ) { throw new MappingException( "could not determine type " + type ); } @@ -103,7 +102,7 @@ private static NativeSQLQueryRootReturn bindReturn(Element returnElem, Mappings mappings, int elementCount) { String alias = returnElem.attributeValue( "alias" ); - if( StringHelper.isEmpty(alias)) { + if( StringHelper.isEmpty( alias )) { alias = "alias_" + elementCount; // hack/workaround as sqlquery impl depend on having a key. } @@ -185,7 +184,7 @@ Element discriminatorResult = returnElement.element("return-discriminator"); if(discriminatorResult!=null) { ArrayList resultColumns = getResultColumns(discriminatorResult); - propertyresults.put("class", ArrayHelper.toStringArray(resultColumns) ); + propertyresults.put("class", ArrayHelper.toStringArray( resultColumns ) ); } Iterator iterator = returnElement.elementIterator("return-property"); List properties = new ArrayList(); @@ -311,7 +310,7 @@ // } // } // but I am not clear enough on the intended purpose of this code block, especially - // in relation to the "Reorder properties" code block above... + // in relation to the "Reorder properties" code block above... // String key = StringHelper.root( name ); String key = name; ArrayList intermediateResults = (ArrayList) propertyresults.get( key ); @@ -331,7 +330,7 @@ entry.setValue( list.toArray( new String[ list.size() ] ) ); } } - return propertyresults.isEmpty() ? CollectionHelper.EMPTY_MAP : propertyresults; + return propertyresults.isEmpty() ? Collections.EMPTY_MAP : propertyresults; } private static int getIndexOfFirstMatchingProperty(List propertyNames, String follower) { @@ -376,12 +375,30 @@ else if ( "upgrade-nowait".equals( lockMode ) ) { return LockMode.UPGRADE_NOWAIT; } + else if ( "upgrade-skiplocked".equals( lockMode )) { + return LockMode.UPGRADE_SKIPLOCKED; + } else if ( "write".equals( lockMode ) ) { return LockMode.WRITE; } else if ( "force".equals( lockMode ) ) { return LockMode.FORCE; } + else if ( "optimistic".equals( lockMode ) ) { + return LockMode.OPTIMISTIC; + } + else if ( "optimistic_force_increment".equals( lockMode ) ) { + return LockMode.OPTIMISTIC_FORCE_INCREMENT; + } + else if ( "pessimistic_read".equals( lockMode ) ) { + return LockMode.PESSIMISTIC_READ; + } + else if ( "pessimistic_write".equals( lockMode ) ) { + return LockMode.PESSIMISTIC_WRITE; + } + else if ( "pessimistic_force_increment".equals( lockMode ) ) { + return LockMode.PESSIMISTIC_FORCE_INCREMENT; + } else { throw new MappingException( "unknown lockmode" ); } Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingSecondPass.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingSecondPass.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingSecondPass.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/ResultSetMappingSecondPass.java 30 Jul 2014 15:51:06 -0000 1.1.2.1 @@ -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,16 +20,16 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.util.Map; -import org.dom4j.Element; import org.hibernate.MappingException; import org.hibernate.engine.ResultSetMappingDefinition; +import org.dom4j.Element; + /** * @author Emmanuel Bernard */ Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/SecondPass.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/SecondPass.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/SecondPass.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/SecondPass.java 30 Jul 2014 15:51:03 -0000 1.1.2.1 @@ -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,10 +20,8 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; - import java.io.Serializable; import org.hibernate.MappingException; Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/SecondaryTableSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/SetSimpleValueTypeSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/Settings.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/Settings.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/Settings.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/Settings.java 30 Jul 2014 15:51:05 -0000 1.1.2.1 @@ -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,24 +20,22 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.util.Map; import org.hibernate.ConnectionReleaseMode; import org.hibernate.EntityMode; -import org.hibernate.cache.QueryCacheFactory; -import org.hibernate.cache.RegionFactory; -import org.hibernate.connection.ConnectionProvider; -import org.hibernate.dialect.Dialect; -import org.hibernate.exception.SQLExceptionConverter; -import org.hibernate.hql.QueryTranslatorFactory; -import org.hibernate.jdbc.BatcherFactory; -import org.hibernate.jdbc.util.SQLStatementLogger; -import org.hibernate.transaction.TransactionFactory; -import org.hibernate.transaction.TransactionManagerLookup; +import org.hibernate.MultiTenancyStrategy; +import org.hibernate.NullPrecedence; +import org.hibernate.cache.spi.QueryCacheFactory; +import org.hibernate.cache.spi.RegionFactory; +import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; +import org.hibernate.hql.spi.MultiTableBulkIdStrategy; +import org.hibernate.hql.spi.QueryTranslatorFactory; +import org.hibernate.loader.BatchFetchStyle; +import org.hibernate.tuple.entity.EntityTuplizerFactory; /** * Settings that affect the behaviour of Hibernate at runtime. @@ -46,12 +44,8 @@ */ public final class Settings { -// private boolean showSql; -// private boolean formatSql; - private SQLStatementLogger sqlStatementLogger; private Integer maximumFetchDepth; private Map querySubstitutions; - private Dialect dialect; private int jdbcBatchSize; private int defaultBatchFetchSize; private boolean scrollableResultSetsEnabled; @@ -60,13 +54,15 @@ private String defaultCatalogName; private Integer jdbcFetchSize; private String sessionFactoryName; + private boolean sessionFactoryNameAlsoJndiName; private boolean autoCreateSchema; private boolean autoDropSchema; private boolean autoUpdateSchema; private boolean autoValidateSchema; private boolean queryCacheEnabled; private boolean structuredCacheEntriesEnabled; private boolean secondLevelCacheEnabled; + private boolean autoEvictCollectionCache; private String cacheRegionPrefix; private boolean minimalPutsEnabled; private boolean commentsEnabled; @@ -78,12 +74,7 @@ private ConnectionReleaseMode connectionReleaseMode; private RegionFactory regionFactory; private QueryCacheFactory queryCacheFactory; - private ConnectionProvider connectionProvider; - private TransactionFactory transactionFactory; - private TransactionManagerLookup transactionManagerLookup; - private BatcherFactory batcherFactory; private QueryTranslatorFactory queryTranslatorFactory; - private SQLExceptionConverter sqlExceptionConverter; private boolean wrapResultSetsEnabled; private boolean orderUpdatesEnabled; private boolean orderInsertsEnabled; @@ -92,8 +83,25 @@ private boolean dataDefinitionInTransactionSupported; private boolean strictJPAQLCompliance; private boolean namedQueryStartupCheckingEnabled; + private EntityTuplizerFactory entityTuplizerFactory; + private boolean checkNullability; + private NullPrecedence defaultNullPrecedence; + private boolean initializeLazyStateOutsideTransactions; +// private ComponentTuplizerFactory componentTuplizerFactory; todo : HHH-3517 and HHH-1907 // private BytecodeProvider bytecodeProvider; + private String importFiles; + private MultiTenancyStrategy multiTenancyStrategy; + private JtaPlatform jtaPlatform; + + private MultiTableBulkIdStrategy multiTableBulkIdStrategy; + private BatchFetchStyle batchFetchStyle; + private boolean directReferenceCacheEntriesEnabled; + + private boolean jtaTrackByThread; + private BaselineSessionEventsListenerBuilder baselineSessionEventsListenerBuilder; + + /** * Package protected constructor */ @@ -102,16 +110,12 @@ // public getters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// public boolean isShowSqlEnabled() { -// return showSql; -// } -// -// public boolean isFormatSqlEnabled() { -// return formatSql; -// } + public String getImportFiles() { + return importFiles; + } - public SQLStatementLogger getSqlStatementLogger() { - return sqlStatementLogger; + public void setImportFiles(String importFiles) { + this.importFiles = importFiles; } public String getDefaultSchemaName() { @@ -122,10 +126,6 @@ return defaultCatalogName; } - public Dialect getDialect() { - return dialect; - } - public int getJdbcBatchSize() { return jdbcBatchSize; } @@ -158,18 +158,14 @@ return jdbcFetchSize; } - public ConnectionProvider getConnectionProvider() { - return connectionProvider; - } - - public TransactionFactory getTransactionFactory() { - return transactionFactory; - } - public String getSessionFactoryName() { return sessionFactoryName; } + public boolean isSessionFactoryNameAlsoJndiName() { + return sessionFactoryNameAlsoJndiName; + } + public boolean isAutoCreateSchema() { return autoCreateSchema; } @@ -190,10 +186,6 @@ return regionFactory; } - public TransactionManagerLookup getTransactionManagerLookup() { - return transactionManagerLookup; - } - public boolean isQueryCacheEnabled() { return queryCacheEnabled; } @@ -226,10 +218,6 @@ return flushBeforeCompletionEnabled; } - public BatcherFactory getBatcherFactory() { - return batcherFactory; - } - public boolean isAutoCloseSessionEnabled() { return autoCloseSessionEnabled; } @@ -242,10 +230,6 @@ return queryTranslatorFactory; } - public SQLExceptionConverter getSQLExceptionConverter() { - return sqlExceptionConverter; - } - public boolean isWrapResultSetsEnabled() { return wrapResultSetsEnabled; } @@ -262,6 +246,10 @@ return structuredCacheEntriesEnabled; } + public boolean isDirectReferenceCacheEntriesEnabled() { + return directReferenceCacheEntriesEnabled; + } + public EntityMode getDefaultEntityMode() { return defaultEntityMode; } @@ -286,21 +274,20 @@ return namedQueryStartupCheckingEnabled; } + public EntityTuplizerFactory getEntityTuplizerFactory() { + return entityTuplizerFactory; + } - // package protected setters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -// void setShowSqlEnabled(boolean b) { -// showSql = b; +// public ComponentTuplizerFactory getComponentTuplizerFactory() { +// return componentTuplizerFactory; // } -// -// void setFormatSqlEnabled(boolean b) { -// formatSql = b; -// } - void setSqlStatementLogger(SQLStatementLogger sqlStatementLogger) { - this.sqlStatementLogger = sqlStatementLogger; + public NullPrecedence getDefaultNullPrecedence() { + return defaultNullPrecedence; } + // package protected setters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + void setDefaultSchemaName(String string) { defaultSchemaName = string; } @@ -309,10 +296,6 @@ defaultCatalogName = string; } - void setDialect(Dialect dialect) { - this.dialect = dialect; - } - void setJdbcBatchSize(int i) { jdbcBatchSize = i; } @@ -345,18 +328,14 @@ jdbcFetchSize = integer; } - void setConnectionProvider(ConnectionProvider provider) { - connectionProvider = provider; - } - - void setTransactionFactory(TransactionFactory factory) { - transactionFactory = factory; - } - void setSessionFactoryName(String string) { sessionFactoryName = string; } + void setSessionFactoryNameAlsoJndiName(boolean sessionFactoryNameAlsoJndiName) { + this.sessionFactoryNameAlsoJndiName = sessionFactoryNameAlsoJndiName; + } + void setAutoCreateSchema(boolean b) { autoCreateSchema = b; } @@ -377,10 +356,6 @@ this.regionFactory = regionFactory; } - void setTransactionManagerLookup(TransactionManagerLookup lookup) { - transactionManagerLookup = lookup; - } - void setQueryCacheEnabled(boolean b) { queryCacheEnabled = b; } @@ -413,10 +388,6 @@ this.flushBeforeCompletionEnabled = flushBeforeCompletionEnabled; } - void setBatcherFactory(BatcherFactory batcher) { - this.batcherFactory = batcher; - } - void setAutoCloseSessionEnabled(boolean autoCloseSessionEnabled) { this.autoCloseSessionEnabled = autoCloseSessionEnabled; } @@ -429,10 +400,6 @@ this.queryTranslatorFactory = queryTranslatorFactory; } - void setSQLExceptionConverter(SQLExceptionConverter sqlExceptionConverter) { - this.sqlExceptionConverter = sqlExceptionConverter; - } - void setWrapResultSetsEnabled(boolean wrapResultSetsEnabled) { this.wrapResultSetsEnabled = wrapResultSetsEnabled; } @@ -473,12 +440,100 @@ this.namedQueryStartupCheckingEnabled = namedQueryStartupCheckingEnabled; } + void setEntityTuplizerFactory(EntityTuplizerFactory entityTuplizerFactory) { + this.entityTuplizerFactory = entityTuplizerFactory; + } -// public BytecodeProvider getBytecodeProvider() { + public boolean isCheckNullability() { + return checkNullability; + } + + public void setCheckNullability(boolean checkNullability) { + this.checkNullability = checkNullability; + } + + // void setComponentTuplizerFactory(ComponentTuplizerFactory componentTuplizerFactory) { +// this.componentTuplizerFactory = componentTuplizerFactory; +// } + + // public BytecodeProvider getBytecodeProvider() { // return bytecodeProvider; // } // // void setBytecodeProvider(BytecodeProvider bytecodeProvider) { // this.bytecodeProvider = bytecodeProvider; // } + + + public JtaPlatform getJtaPlatform() { + return jtaPlatform; + } + + void setJtaPlatform(JtaPlatform jtaPlatform) { + this.jtaPlatform = jtaPlatform; + } + + public MultiTenancyStrategy getMultiTenancyStrategy() { + return multiTenancyStrategy; + } + + void setMultiTenancyStrategy(MultiTenancyStrategy multiTenancyStrategy) { + this.multiTenancyStrategy = multiTenancyStrategy; + } + + public boolean isInitializeLazyStateOutsideTransactionsEnabled() { + return initializeLazyStateOutsideTransactions; + } + + void setInitializeLazyStateOutsideTransactions(boolean initializeLazyStateOutsideTransactions) { + this.initializeLazyStateOutsideTransactions = initializeLazyStateOutsideTransactions; + } + + public MultiTableBulkIdStrategy getMultiTableBulkIdStrategy() { + return multiTableBulkIdStrategy; + } + + void setMultiTableBulkIdStrategy(MultiTableBulkIdStrategy multiTableBulkIdStrategy) { + this.multiTableBulkIdStrategy = multiTableBulkIdStrategy; + } + + public BatchFetchStyle getBatchFetchStyle() { + return batchFetchStyle; + } + + void setBatchFetchStyle(BatchFetchStyle batchFetchStyle) { + this.batchFetchStyle = batchFetchStyle; + } + + public void setDirectReferenceCacheEntriesEnabled(boolean directReferenceCacheEntriesEnabled) { + this.directReferenceCacheEntriesEnabled = directReferenceCacheEntriesEnabled; + } + + void setDefaultNullPrecedence(NullPrecedence defaultNullPrecedence) { + this.defaultNullPrecedence = defaultNullPrecedence; + } + + public boolean isJtaTrackByThread() { + return jtaTrackByThread; + } + + public void setJtaTrackByThread(boolean jtaTrackByThread) { + this.jtaTrackByThread = jtaTrackByThread; + } + + public boolean isAutoEvictCollectionCache() { + return autoEvictCollectionCache; + } + + public void setAutoEvictCollectionCache(boolean autoEvictCollectionCache) { + this.autoEvictCollectionCache = autoEvictCollectionCache; + } + + public void setBaselineSessionEventsListenerBuilder(BaselineSessionEventsListenerBuilder baselineSessionEventsListenerBuilder) { + this.baselineSessionEventsListenerBuilder = baselineSessionEventsListenerBuilder; + } + + public BaselineSessionEventsListenerBuilder getBaselineSessionEventsListenerBuilder() { + return baselineSessionEventsListenerBuilder; + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/SettingsFactory.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/SettingsFactory.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/SettingsFactory.java 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/SettingsFactory.java 30 Jul 2014 15:51:04 -0000 1.1.2.1 @@ -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,444 +20,492 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.cfg; import java.io.Serializable; -import java.lang.reflect.Method; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Map; import java.util.Properties; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import org.hibernate.ConnectionReleaseMode; import org.hibernate.EntityMode; import org.hibernate.HibernateException; -import org.hibernate.bytecode.BytecodeProvider; -import org.hibernate.cache.QueryCacheFactory; -import org.hibernate.cache.RegionFactory; -import org.hibernate.cache.impl.NoCachingRegionFactory; -import org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge; -import org.hibernate.connection.ConnectionProvider; -import org.hibernate.connection.ConnectionProviderFactory; -import org.hibernate.dialect.Dialect; -import org.hibernate.dialect.DialectFactory; -import org.hibernate.exception.SQLExceptionConverter; -import org.hibernate.exception.SQLExceptionConverterFactory; -import org.hibernate.hql.QueryTranslatorFactory; -import org.hibernate.jdbc.BatcherFactory; -import org.hibernate.jdbc.BatchingBatcherFactory; -import org.hibernate.jdbc.NonBatchingBatcherFactory; -import org.hibernate.jdbc.util.SQLStatementLogger; -import org.hibernate.transaction.TransactionFactory; -import org.hibernate.transaction.TransactionFactoryFactory; -import org.hibernate.transaction.TransactionManagerLookup; -import org.hibernate.transaction.TransactionManagerLookupFactory; -import org.hibernate.util.PropertiesHelper; -import org.hibernate.util.ReflectHelper; -import org.hibernate.util.StringHelper; +import org.hibernate.MultiTenancyStrategy; +import org.hibernate.NullPrecedence; +import org.hibernate.SessionEventListener; +import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; +import org.hibernate.boot.registry.selector.spi.StrategySelector; +import org.hibernate.cache.internal.NoCachingRegionFactory; +import org.hibernate.cache.internal.RegionFactoryInitiator; +import org.hibernate.cache.internal.StandardQueryCacheFactory; +import org.hibernate.cache.spi.QueryCacheFactory; +import org.hibernate.cache.spi.RegionFactory; +import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; +import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider; +import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData; +import org.hibernate.engine.jdbc.spi.JdbcServices; +import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; +import org.hibernate.engine.transaction.spi.TransactionFactory; +import org.hibernate.hql.spi.MultiTableBulkIdStrategy; +import org.hibernate.hql.spi.PersistentTableBulkIdStrategy; +import org.hibernate.hql.spi.QueryTranslatorFactory; +import org.hibernate.hql.spi.TemporaryTableBulkIdStrategy; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.config.ConfigurationHelper; +import org.hibernate.loader.BatchFetchStyle; +import org.hibernate.service.ServiceRegistry; +import org.hibernate.tuple.entity.EntityTuplizerFactory; +import org.jboss.logging.Logger; + /** - * Reads configuration properties and configures a Settings instance. + * Reads configuration properties and builds a {@link Settings} instance. * * @author Gavin King */ public class SettingsFactory implements Serializable { + private static final long serialVersionUID = -1194386144994524825L; + + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SettingsFactory.class.getName()); + public static final String DEF_CACHE_REG_FACTORY = NoCachingRegionFactory.class.getName(); - private static final Logger log = LoggerFactory.getLogger(SettingsFactory.class); - protected SettingsFactory() { + public SettingsFactory() { } - - public Settings buildSettings(Properties props) { + + public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) { + final boolean debugEnabled = LOG.isDebugEnabled(); + final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class ); + final StrategySelector strategySelector = serviceRegistry.getService( StrategySelector.class ); + Settings settings = new Settings(); - + //SessionFactory name: - - String sessionFactoryName = props.getProperty(Environment.SESSION_FACTORY_NAME); - settings.setSessionFactoryName(sessionFactoryName); + String sessionFactoryName = props.getProperty( AvailableSettings.SESSION_FACTORY_NAME ); + settings.setSessionFactoryName( sessionFactoryName ); + settings.setSessionFactoryNameAlsoJndiName( + ConfigurationHelper.getBoolean( AvailableSettings.SESSION_FACTORY_NAME_IS_JNDI, props, true ) + ); + //JDBC and connection settings: - ConnectionProvider connections = createConnectionProvider(props); - settings.setConnectionProvider(connections); - //Interrogate JDBC metadata + ExtractedDatabaseMetaData meta = jdbcServices.getExtractedMetaDataSupport(); - String databaseName = null; - int databaseMajorVersion = 0; - boolean metaSupportsScrollable = false; - boolean metaSupportsGetGeneratedKeys = false; - boolean metaSupportsBatchUpdates = false; - boolean metaReportsDDLCausesTxnCommit = false; - boolean metaReportsDDLInTxnSupported = true; + settings.setDataDefinitionImplicitCommit( meta.doesDataDefinitionCauseTransactionCommit() ); + settings.setDataDefinitionInTransactionSupported( meta.supportsDataDefinitionInTransaction() ); - // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value. - // The need for it is intended to be alleviated with 3.3 developement, thus it is - // not defined as an Environment constant... - // it is used to control whether we should consult the JDBC metadata to determine - // certain Settings default values; it is useful to *not* do this when the database - // may not be available (mainly in tools usage). - boolean useJdbcMetadata = PropertiesHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", props, true ); - if ( useJdbcMetadata ) { - try { - Connection conn = connections.getConnection(); - try { - DatabaseMetaData meta = conn.getMetaData(); - databaseName = meta.getDatabaseProductName(); - databaseMajorVersion = getDatabaseMajorVersion(meta); - log.info("RDBMS: " + databaseName + ", version: " + meta.getDatabaseProductVersion() ); - log.info("JDBC driver: " + meta.getDriverName() + ", version: " + meta.getDriverVersion() ); - - metaSupportsScrollable = meta.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE); - metaSupportsBatchUpdates = meta.supportsBatchUpdates(); - metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit(); - metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions(); - - if ( Environment.jvmSupportsGetGeneratedKeys() ) { - try { - Boolean result = (Boolean) DatabaseMetaData.class.getMethod("supportsGetGeneratedKeys", null) - .invoke(meta, null); - metaSupportsGetGeneratedKeys = result.booleanValue(); - } - catch (AbstractMethodError ame) { - metaSupportsGetGeneratedKeys = false; - } - catch (Exception e) { - metaSupportsGetGeneratedKeys = false; - } - } - - } - finally { - connections.closeConnection(conn); - } - } - catch (SQLException sqle) { - log.warn("Could not obtain connection metadata", sqle); - } - catch (UnsupportedOperationException uoe) { - // user supplied JDBC connections - } - } - settings.setDataDefinitionImplicitCommit( metaReportsDDLCausesTxnCommit ); - settings.setDataDefinitionInTransactionSupported( metaReportsDDLInTxnSupported ); - - - //SQL Dialect: - Dialect dialect = determineDialect( props, databaseName, databaseMajorVersion ); - settings.setDialect(dialect); - //use dialect default properties final Properties properties = new Properties(); - properties.putAll( dialect.getDefaultProperties() ); - properties.putAll(props); - + properties.putAll( jdbcServices.getDialect().getDefaultProperties() ); + properties.putAll( props ); + // Transaction settings: - - TransactionFactory transactionFactory = createTransactionFactory(properties); - settings.setTransactionFactory(transactionFactory); - settings.setTransactionManagerLookup( createTransactionManagerLookup(properties) ); + settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) ); - boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties); - log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) ); + MultiTableBulkIdStrategy multiTableBulkIdStrategy = strategySelector.resolveStrategy( + MultiTableBulkIdStrategy.class, + properties.getProperty( AvailableSettings.HQL_BULK_ID_STRATEGY ) + ); + if ( multiTableBulkIdStrategy == null ) { + multiTableBulkIdStrategy = jdbcServices.getDialect().supportsTemporaryTables() + ? TemporaryTableBulkIdStrategy.INSTANCE + : new PersistentTableBulkIdStrategy(); + } + settings.setMultiTableBulkIdStrategy( multiTableBulkIdStrategy ); + + boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(AvailableSettings.FLUSH_BEFORE_COMPLETION, properties); + if ( debugEnabled ) { + LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) ); + } settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion); - boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties); - log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) ); + boolean autoCloseSession = ConfigurationHelper.getBoolean(AvailableSettings.AUTO_CLOSE_SESSION, properties); + if ( debugEnabled ) { + LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) ); + } settings.setAutoCloseSessionEnabled(autoCloseSession); //JDBC and connection settings: - int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0); - if ( !metaSupportsBatchUpdates ) batchSize = 0; - if (batchSize>0) log.info("JDBC batch size: " + batchSize); + int batchSize = ConfigurationHelper.getInt(AvailableSettings.STATEMENT_BATCH_SIZE, properties, 0); + if ( !meta.supportsBatchUpdates() ) { + batchSize = 0; + } + if ( batchSize > 0 && debugEnabled ) { + LOG.debugf( "JDBC batch size: %s", batchSize ); + } settings.setJdbcBatchSize(batchSize); - boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false); - if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) ); + + boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(AvailableSettings.BATCH_VERSIONED_DATA, properties, false); + if ( batchSize > 0 && debugEnabled ) { + LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) ); + } settings.setJdbcBatchVersionedData(jdbcBatchVersionedData); - settings.setBatcherFactory( createBatcherFactory(properties, batchSize) ); - - boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable); - log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) ); + + boolean useScrollableResultSets = ConfigurationHelper.getBoolean( + AvailableSettings.USE_SCROLLABLE_RESULTSET, + properties, + meta.supportsScrollableResults() + ); + if ( debugEnabled ) { + LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) ); + } settings.setScrollableResultSetsEnabled(useScrollableResultSets); - boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false); - log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) ); + boolean wrapResultSets = ConfigurationHelper.getBoolean(AvailableSettings.WRAP_RESULT_SETS, properties, false); + if ( debugEnabled ) { + LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) ); + } settings.setWrapResultSetsEnabled(wrapResultSets); - boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys); - log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) ); + boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(AvailableSettings.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys()); + if ( debugEnabled ) { + LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) ); + } settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys); - Integer statementFetchSize = PropertiesHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties); - if (statementFetchSize!=null) log.info("JDBC result set fetch size: " + statementFetchSize); + Integer statementFetchSize = ConfigurationHelper.getInteger(AvailableSettings.STATEMENT_FETCH_SIZE, properties); + if ( statementFetchSize != null && debugEnabled ) { + LOG.debugf( "JDBC result set fetch size: %s", statementFetchSize ); + } settings.setJdbcFetchSize(statementFetchSize); - String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" ); - log.info( "Connection release mode: " + releaseModeName ); + MultiTenancyStrategy multiTenancyStrategy = MultiTenancyStrategy.determineMultiTenancyStrategy( properties ); + if ( debugEnabled ) { + LOG.debugf( "multi-tenancy strategy : %s", multiTenancyStrategy ); + } + settings.setMultiTenancyStrategy( multiTenancyStrategy ); + + String releaseModeName = ConfigurationHelper.getString( AvailableSettings.RELEASE_CONNECTIONS, properties, "auto" ); + if ( debugEnabled ) { + LOG.debugf( "Connection release mode: %s", releaseModeName ); + } ConnectionReleaseMode releaseMode; if ( "auto".equals(releaseModeName) ) { - releaseMode = transactionFactory.getDefaultReleaseMode(); + releaseMode = serviceRegistry.getService( TransactionFactory.class ).getDefaultReleaseMode(); } else { releaseMode = ConnectionReleaseMode.parse( releaseModeName ); - if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && !connections.supportsAggressiveRelease() ) { - log.warn( "Overriding release mode as connection provider does not support 'after_statement'" ); - releaseMode = ConnectionReleaseMode.AFTER_TRANSACTION; + if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { + // we need to make sure the underlying JDBC connection access supports aggressive release... + boolean supportsAgrressiveRelease = multiTenancyStrategy.requiresMultiTenantConnectionProvider() + ? serviceRegistry.getService( MultiTenantConnectionProvider.class ).supportsAggressiveRelease() + : serviceRegistry.getService( ConnectionProvider.class ).supportsAggressiveRelease(); + if ( ! supportsAgrressiveRelease ) { + LOG.unsupportedAfterStatement(); + releaseMode = ConnectionReleaseMode.AFTER_TRANSACTION; + } } } settings.setConnectionReleaseMode( releaseMode ); + final BatchFetchStyle batchFetchStyle = BatchFetchStyle.interpret( properties.get( AvailableSettings.BATCH_FETCH_STYLE ) ); + LOG.debugf( "Using BatchFetchStyle : " + batchFetchStyle.name() ); + settings.setBatchFetchStyle( batchFetchStyle ); + + //SQL Generation settings: - String defaultSchema = properties.getProperty(Environment.DEFAULT_SCHEMA); - String defaultCatalog = properties.getProperty(Environment.DEFAULT_CATALOG); - if (defaultSchema!=null) log.info("Default schema: " + defaultSchema); - if (defaultCatalog!=null) log.info("Default catalog: " + defaultCatalog); - settings.setDefaultSchemaName(defaultSchema); - settings.setDefaultCatalogName(defaultCatalog); + String defaultSchema = properties.getProperty( AvailableSettings.DEFAULT_SCHEMA ); + String defaultCatalog = properties.getProperty( AvailableSettings.DEFAULT_CATALOG ); + if ( defaultSchema != null && debugEnabled ) { + LOG.debugf( "Default schema: %s", defaultSchema ); + } + if ( defaultCatalog != null && debugEnabled ) { + LOG.debugf( "Default catalog: %s", defaultCatalog ); + } + settings.setDefaultSchemaName( defaultSchema ); + settings.setDefaultCatalogName( defaultCatalog ); - Integer maxFetchDepth = PropertiesHelper.getInteger(Environment.MAX_FETCH_DEPTH, properties); - if (maxFetchDepth!=null) log.info("Maximum outer join fetch depth: " + maxFetchDepth); - settings.setMaximumFetchDepth(maxFetchDepth); - int batchFetchSize = PropertiesHelper.getInt(Environment.DEFAULT_BATCH_FETCH_SIZE, properties, 1); - log.info("Default batch fetch size: " + batchFetchSize); - settings.setDefaultBatchFetchSize(batchFetchSize); + Integer maxFetchDepth = ConfigurationHelper.getInteger( AvailableSettings.MAX_FETCH_DEPTH, properties ); + if ( maxFetchDepth != null ) { + LOG.debugf( "Maximum outer join fetch depth: %s", maxFetchDepth ); + } + settings.setMaximumFetchDepth( maxFetchDepth ); - boolean comments = PropertiesHelper.getBoolean(Environment.USE_SQL_COMMENTS, properties); - log.info( "Generate SQL with comments: " + enabledDisabled(comments) ); - settings.setCommentsEnabled(comments); - - boolean orderUpdates = PropertiesHelper.getBoolean(Environment.ORDER_UPDATES, properties); - log.info( "Order SQL updates by primary key: " + enabledDisabled(orderUpdates) ); - settings.setOrderUpdatesEnabled(orderUpdates); + int batchFetchSize = ConfigurationHelper.getInt(AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, properties, 1); + if ( debugEnabled ) { + LOG.debugf( "Default batch fetch size: %s", batchFetchSize ); + } + settings.setDefaultBatchFetchSize( batchFetchSize ); - boolean orderInserts = PropertiesHelper.getBoolean(Environment.ORDER_INSERTS, properties); - log.info( "Order SQL inserts for batching: " + enabledDisabled( orderInserts ) ); + boolean comments = ConfigurationHelper.getBoolean( AvailableSettings.USE_SQL_COMMENTS, properties ); + if ( debugEnabled ) { + LOG.debugf( "Generate SQL with comments: %s", enabledDisabled(comments) ); + } + settings.setCommentsEnabled( comments ); + + boolean orderUpdates = ConfigurationHelper.getBoolean( AvailableSettings.ORDER_UPDATES, properties ); + if ( debugEnabled ) { + LOG.debugf( "Order SQL updates by primary key: %s", enabledDisabled(orderUpdates) ); + } + settings.setOrderUpdatesEnabled( orderUpdates ); + + boolean orderInserts = ConfigurationHelper.getBoolean(AvailableSettings.ORDER_INSERTS, properties); + if ( debugEnabled ) { + LOG.debugf( "Order SQL inserts for batching: %s", enabledDisabled(orderInserts) ); + } settings.setOrderInsertsEnabled( orderInserts ); - + + String defaultNullPrecedence = ConfigurationHelper.getString( + AvailableSettings.DEFAULT_NULL_ORDERING, properties, "none", "first", "last" + ); + if ( debugEnabled ) { + LOG.debugf( "Default null ordering: %s", defaultNullPrecedence ); + } + settings.setDefaultNullPrecedence( NullPrecedence.parse( defaultNullPrecedence ) ); + //Query parser settings: - - settings.setQueryTranslatorFactory( createQueryTranslatorFactory(properties) ); - Map querySubstitutions = PropertiesHelper.toMap(Environment.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties); - log.info("Query language substitutions: " + querySubstitutions); - settings.setQuerySubstitutions(querySubstitutions); + settings.setQueryTranslatorFactory( createQueryTranslatorFactory( properties, serviceRegistry ) ); - boolean jpaqlCompliance = PropertiesHelper.getBoolean( Environment.JPAQL_STRICT_COMPLIANCE, properties, false ); + Map querySubstitutions = ConfigurationHelper.toMap( AvailableSettings.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties ); + if ( debugEnabled ) { + LOG.debugf( "Query language substitutions: %s", querySubstitutions ); + } + settings.setQuerySubstitutions( querySubstitutions ); + + boolean jpaqlCompliance = ConfigurationHelper.getBoolean( AvailableSettings.JPAQL_STRICT_COMPLIANCE, properties, false ); + if ( debugEnabled ) { + LOG.debugf( "JPA-QL strict compliance: %s", enabledDisabled(jpaqlCompliance) ); + } settings.setStrictJPAQLCompliance( jpaqlCompliance ); - log.info( "JPA-QL strict compliance: " + enabledDisabled( jpaqlCompliance ) ); - + // Second-level / query cache: - boolean useSecondLevelCache = PropertiesHelper.getBoolean(Environment.USE_SECOND_LEVEL_CACHE, properties, true); - log.info( "Second-level cache: " + enabledDisabled(useSecondLevelCache) ); - settings.setSecondLevelCacheEnabled(useSecondLevelCache); + boolean useSecondLevelCache = ConfigurationHelper.getBoolean( AvailableSettings.USE_SECOND_LEVEL_CACHE, properties, true ); + if ( debugEnabled ) { + LOG.debugf( "Second-level cache: %s", enabledDisabled(useSecondLevelCache) ); + } + settings.setSecondLevelCacheEnabled( useSecondLevelCache ); - boolean useQueryCache = PropertiesHelper.getBoolean(Environment.USE_QUERY_CACHE, properties); - log.info( "Query cache: " + enabledDisabled(useQueryCache) ); - settings.setQueryCacheEnabled(useQueryCache); + boolean useQueryCache = ConfigurationHelper.getBoolean(AvailableSettings.USE_QUERY_CACHE, properties); + if ( debugEnabled ) { + LOG.debugf( "Query cache: %s", enabledDisabled(useQueryCache) ); + } + settings.setQueryCacheEnabled( useQueryCache ); + if (useQueryCache) { + settings.setQueryCacheFactory( createQueryCacheFactory( properties, serviceRegistry ) ); + } - // The cache provider is needed when we either have second-level cache enabled - // or query cache enabled. Note that useSecondLevelCache is enabled by default - settings.setRegionFactory( createRegionFactory( properties, ( useSecondLevelCache || useQueryCache ) ) ); + settings.setRegionFactory( serviceRegistry.getService( RegionFactory.class ) ); - boolean useMinimalPuts = PropertiesHelper.getBoolean( - Environment.USE_MINIMAL_PUTS, properties, settings.getRegionFactory().isMinimalPutsEnabledByDefault() + boolean useMinimalPuts = ConfigurationHelper.getBoolean( + AvailableSettings.USE_MINIMAL_PUTS, properties, settings.getRegionFactory().isMinimalPutsEnabledByDefault() ); - log.info( "Optimize cache for minimal puts: " + enabledDisabled(useMinimalPuts) ); - settings.setMinimalPutsEnabled(useMinimalPuts); + if ( debugEnabled ) { + LOG.debugf( "Optimize cache for minimal puts: %s", enabledDisabled(useMinimalPuts) ); + } + settings.setMinimalPutsEnabled( useMinimalPuts ); - String prefix = properties.getProperty(Environment.CACHE_REGION_PREFIX); - if ( StringHelper.isEmpty(prefix) ) prefix=null; - if (prefix!=null) log.info("Cache region prefix: "+ prefix); - settings.setCacheRegionPrefix(prefix); + String prefix = properties.getProperty( AvailableSettings.CACHE_REGION_PREFIX ); + if ( StringHelper.isEmpty(prefix) ) { + prefix=null; + } + if ( prefix != null && debugEnabled ) { + LOG.debugf( "Cache region prefix: %s", prefix ); + } + settings.setCacheRegionPrefix( prefix ); - boolean useStructuredCacheEntries = PropertiesHelper.getBoolean(Environment.USE_STRUCTURED_CACHE, properties, false); - log.info( "Structured second-level cache entries: " + enabledDisabled(useStructuredCacheEntries) ); - settings.setStructuredCacheEntriesEnabled(useStructuredCacheEntries); + boolean useStructuredCacheEntries = ConfigurationHelper.getBoolean( AvailableSettings.USE_STRUCTURED_CACHE, properties, false ); + if ( debugEnabled ) { + LOG.debugf( "Structured second-level cache entries: %s", enabledDisabled(useStructuredCacheEntries) ); + } + settings.setStructuredCacheEntriesEnabled( useStructuredCacheEntries ); - if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) ); - - //SQL Exception converter: - - SQLExceptionConverter sqlExceptionConverter; - try { - sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties ); + boolean useDirectReferenceCacheEntries = ConfigurationHelper.getBoolean( + AvailableSettings.USE_DIRECT_REFERENCE_CACHE_ENTRIES, + properties, + false + ); + if ( debugEnabled ) { + LOG.debugf( "Second-level cache direct-reference entries: %s", enabledDisabled(useDirectReferenceCacheEntries) ); } - catch(HibernateException e) { - log.warn("Error building SQLExceptionConverter; using minimal converter"); - sqlExceptionConverter = SQLExceptionConverterFactory.buildMinimalSQLExceptionConverter(); + settings.setDirectReferenceCacheEntriesEnabled( useDirectReferenceCacheEntries ); + + boolean autoEvictCollectionCache = ConfigurationHelper.getBoolean( AvailableSettings.AUTO_EVICT_COLLECTION_CACHE, properties, false); + if ( debugEnabled ) { + LOG.debugf( "Automatic eviction of collection cache: %s", enabledDisabled(autoEvictCollectionCache) ); } - settings.setSQLExceptionConverter(sqlExceptionConverter); + settings.setAutoEvictCollectionCache( autoEvictCollectionCache ); //Statistics and logging: - boolean showSql = PropertiesHelper.getBoolean(Environment.SHOW_SQL, properties); - if (showSql) log.info("Echoing all SQL to stdout"); -// settings.setShowSqlEnabled(showSql); + boolean useStatistics = ConfigurationHelper.getBoolean( AvailableSettings.GENERATE_STATISTICS, properties ); + if ( debugEnabled ) { + LOG.debugf( "Statistics: %s", enabledDisabled(useStatistics) ); + } + settings.setStatisticsEnabled( useStatistics ); - boolean formatSql = PropertiesHelper.getBoolean(Environment.FORMAT_SQL, properties); -// settings.setFormatSqlEnabled(formatSql); + boolean useIdentifierRollback = ConfigurationHelper.getBoolean( AvailableSettings.USE_IDENTIFIER_ROLLBACK, properties ); + if ( debugEnabled ) { + LOG.debugf( "Deleted entity synthetic identifier rollback: %s", enabledDisabled(useIdentifierRollback) ); + } + settings.setIdentifierRollbackEnabled( useIdentifierRollback ); - settings.setSqlStatementLogger( new SQLStatementLogger( showSql, formatSql ) ); - - boolean useStatistics = PropertiesHelper.getBoolean(Environment.GENERATE_STATISTICS, properties); - log.info( "Statistics: " + enabledDisabled(useStatistics) ); - settings.setStatisticsEnabled(useStatistics); - - boolean useIdentifierRollback = PropertiesHelper.getBoolean(Environment.USE_IDENTIFIER_ROLLBACK, properties); - log.info( "Deleted entity synthetic identifier rollback: " + enabledDisabled(useIdentifierRollback) ); - settings.setIdentifierRollbackEnabled(useIdentifierRollback); - //Schema export: - - String autoSchemaExport = properties.getProperty(Environment.HBM2DDL_AUTO); - if ( "validate".equals(autoSchemaExport) ) settings.setAutoValidateSchema(true); - if ( "update".equals(autoSchemaExport) ) settings.setAutoUpdateSchema(true); - if ( "create".equals(autoSchemaExport) ) settings.setAutoCreateSchema(true); - if ( "create-drop".equals(autoSchemaExport) ) { - settings.setAutoCreateSchema(true); - settings.setAutoDropSchema(true); + + String autoSchemaExport = properties.getProperty( AvailableSettings.HBM2DDL_AUTO ); + if ( "validate".equals(autoSchemaExport) ) { + settings.setAutoValidateSchema( true ); } + else if ( "update".equals(autoSchemaExport) ) { + settings.setAutoUpdateSchema( true ); + } + else if ( "create".equals(autoSchemaExport) ) { + settings.setAutoCreateSchema( true ); + } + else if ( "create-drop".equals( autoSchemaExport ) ) { + settings.setAutoCreateSchema( true ); + settings.setAutoDropSchema( true ); + } + else if ( !StringHelper.isEmpty( autoSchemaExport ) ) { + LOG.warn( "Unrecognized value for \"hibernate.hbm2ddl.auto\": " + autoSchemaExport ); + } + settings.setImportFiles( properties.getProperty( AvailableSettings.HBM2DDL_IMPORT_FILES ) ); - EntityMode defaultEntityMode = EntityMode.parse( properties.getProperty( Environment.DEFAULT_ENTITY_MODE ) ); - log.info( "Default entity-mode: " + defaultEntityMode ); + EntityMode defaultEntityMode = EntityMode.parse( properties.getProperty( AvailableSettings.DEFAULT_ENTITY_MODE ) ); + if ( debugEnabled ) { + LOG.debugf( "Default entity-mode: %s", defaultEntityMode ); + } settings.setDefaultEntityMode( defaultEntityMode ); - boolean namedQueryChecking = PropertiesHelper.getBoolean( Environment.QUERY_STARTUP_CHECKING, properties, true ); - log.info( "Named query checking : " + enabledDisabled( namedQueryChecking ) ); + boolean namedQueryChecking = ConfigurationHelper.getBoolean( AvailableSettings.QUERY_STARTUP_CHECKING, properties, true ); + if ( debugEnabled ) { + LOG.debugf( "Named query checking : %s", enabledDisabled(namedQueryChecking) ); + } settings.setNamedQueryStartupCheckingEnabled( namedQueryChecking ); -// String provider = properties.getProperty( Environment.BYTECODE_PROVIDER ); + boolean checkNullability = ConfigurationHelper.getBoolean(AvailableSettings.CHECK_NULLABILITY, properties, true); + if ( debugEnabled ) { + LOG.debugf( "Check Nullability in Core (should be disabled when Bean Validation is on): %s", enabledDisabled(checkNullability) ); + } + settings.setCheckNullability(checkNullability); + + // TODO: Does EntityTuplizerFactory really need to be configurable? revisit for HHH-6383 + settings.setEntityTuplizerFactory( new EntityTuplizerFactory() ); + +// String provider = properties.getProperty( AvailableSettings.BYTECODE_PROVIDER ); // log.info( "Bytecode provider name : " + provider ); // BytecodeProvider bytecodeProvider = buildBytecodeProvider( provider ); // settings.setBytecodeProvider( bytecodeProvider ); - return settings; - - } - - protected BytecodeProvider buildBytecodeProvider(String providerName) { - if ( "javassist".equals( providerName ) ) { - return new org.hibernate.bytecode.javassist.BytecodeProviderImpl(); + boolean initializeLazyStateOutsideTransactionsEnabled = ConfigurationHelper.getBoolean( + AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS, + properties, + false + ); + if ( debugEnabled ) { + LOG.debugf( "Allow initialization of lazy state outside session : : %s", enabledDisabled( initializeLazyStateOutsideTransactionsEnabled ) ); } - else if ( "cglib".equals( providerName ) ) { - return new org.hibernate.bytecode.cglib.BytecodeProviderImpl(); - } - else { - log.debug( "using cglib as bytecode provider by default" ); - return new org.hibernate.bytecode.cglib.BytecodeProviderImpl(); - } - } + settings.setInitializeLazyStateOutsideTransactions( initializeLazyStateOutsideTransactionsEnabled ); - private int getDatabaseMajorVersion(DatabaseMetaData meta) { - try { - Method gdbmvMethod = DatabaseMetaData.class.getMethod("getDatabaseMajorVersion", null); - return ( (Integer) gdbmvMethod.invoke(meta, null) ).intValue(); + boolean jtaTrackByThread = ConfigurationHelper.getBoolean( + AvailableSettings.JTA_TRACK_BY_THREAD, + properties, + true + ); + if ( debugEnabled ) { + LOG.debugf( "JTA Track by Thread: %s", enabledDisabled(jtaTrackByThread) ); } - catch (NoSuchMethodException nsme) { - return 0; - } - catch (Throwable t) { - log.debug("could not get database version from JDBC metadata"); - return 0; - } + settings.setJtaTrackByThread( jtaTrackByThread ); + + final String autoSessionEventsListenerName = properties.getProperty( AvailableSettings.AUTO_SESSION_EVENTS_LISTENER ); + final Class autoSessionEventsListener = autoSessionEventsListenerName == null + ? null + : strategySelector.selectStrategyImplementor( SessionEventListener.class, autoSessionEventsListenerName ); + + final boolean logSessionMetrics = ConfigurationHelper.getBoolean( + AvailableSettings.LOG_SESSION_METRICS, + properties, + useStatistics + + ); + settings.setBaselineSessionEventsListenerBuilder( + new BaselineSessionEventsListenerBuilder( logSessionMetrics, autoSessionEventsListener ) + ); + + return settings; + } +// protected BytecodeProvider buildBytecodeProvider(String providerName) { +// if ( "javassist".equals( providerName ) ) { +// return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl(); +// } +// else { +// LOG.debug("Using javassist as bytecode provider by default"); +// return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl(); +// } +// } + private static String enabledDisabled(boolean value) { return value ? "enabled" : "disabled"; } - - protected QueryCacheFactory createQueryCacheFactory(Properties properties) { - String queryCacheFactoryClassName = PropertiesHelper.getString( - Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.StandardQueryCacheFactory" + + protected QueryCacheFactory createQueryCacheFactory(Properties properties, ServiceRegistry serviceRegistry) { + String queryCacheFactoryClassName = ConfigurationHelper.getString( + AvailableSettings.QUERY_CACHE_FACTORY, properties, StandardQueryCacheFactory.class.getName() ); - log.info("Query cache factory: " + queryCacheFactoryClassName); + LOG.debugf( "Query cache factory: %s", queryCacheFactoryClassName ); try { - return (QueryCacheFactory) ReflectHelper.classForName(queryCacheFactoryClassName).newInstance(); + return (QueryCacheFactory) serviceRegistry.getService( ClassLoaderService.class ) + .classForName( queryCacheFactoryClassName ) + .newInstance(); } - catch (Exception cnfe) { - throw new HibernateException("could not instantiate QueryCacheFactory: " + queryCacheFactoryClassName, cnfe); + catch (Exception e) { + throw new HibernateException( "could not instantiate QueryCacheFactory: " + queryCacheFactoryClassName, e ); } } - - protected RegionFactory createRegionFactory(Properties properties, boolean cachingEnabled) { - String regionFactoryClassName = PropertiesHelper.getString( Environment.CACHE_REGION_FACTORY, properties, null ); - if ( regionFactoryClassName == null && cachingEnabled ) { - String providerClassName = PropertiesHelper.getString( Environment.CACHE_PROVIDER, properties, null ); - if ( providerClassName != null ) { - // legacy behavior, apply the bridge... - regionFactoryClassName = RegionFactoryCacheProviderBridge.class.getName(); - } - } + //todo remove this once we move to new metamodel + public static RegionFactory createRegionFactory(Properties properties, boolean cachingEnabled) { + // todo : REMOVE! THIS IS TOTALLY A TEMPORARY HACK FOR org.hibernate.cfg.AnnotationBinder which will be going away + String regionFactoryClassName = RegionFactoryInitiator.mapLegacyNames( + ConfigurationHelper.getString( + AvailableSettings.CACHE_REGION_FACTORY, properties, null + ) + ); if ( regionFactoryClassName == null ) { regionFactoryClassName = DEF_CACHE_REG_FACTORY; } - log.info( "Cache region factory : " + regionFactoryClassName ); + LOG.debugf( "Cache region factory : %s", regionFactoryClassName ); try { - return ( RegionFactory ) ReflectHelper.classForName( regionFactoryClassName ) - .getConstructor( new Class[] { Properties.class } ) - .newInstance( new Object[] { properties } ); + try { + return (RegionFactory) org.hibernate.internal.util.ReflectHelper.classForName( regionFactoryClassName ) + .getConstructor( Properties.class ) + .newInstance( properties ); + } + catch ( NoSuchMethodException e ) { + // no constructor accepting Properties found, try no arg constructor + LOG.debugf( + "%s did not provide constructor accepting java.util.Properties; attempting no-arg constructor.", + regionFactoryClassName + ); + return (RegionFactory) org.hibernate.internal.util.ReflectHelper.classForName( regionFactoryClassName ) + .newInstance(); + } } catch ( Exception e ) { throw new HibernateException( "could not instantiate RegionFactory [" + regionFactoryClassName + "]", e ); } } - - protected QueryTranslatorFactory createQueryTranslatorFactory(Properties properties) { - String className = PropertiesHelper.getString( - Environment.QUERY_TRANSLATOR, properties, "org.hibernate.hql.ast.ASTQueryTranslatorFactory" + + protected QueryTranslatorFactory createQueryTranslatorFactory(Properties properties, ServiceRegistry serviceRegistry) { + String className = ConfigurationHelper.getString( + AvailableSettings.QUERY_TRANSLATOR, properties, "org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory" ); - log.info("Query translator: " + className); + LOG.debugf( "Query translator: %s", className ); try { - return (QueryTranslatorFactory) ReflectHelper.classForName(className).newInstance(); + return (QueryTranslatorFactory) serviceRegistry.getService( ClassLoaderService.class ) + .classForName( className ) + .newInstance(); } - catch (Exception cnfe) { - throw new HibernateException("could not instantiate QueryTranslatorFactory: " + className, cnfe); + catch ( Exception e ) { + throw new HibernateException( "could not instantiate QueryTranslatorFactory: " + className, e ); } } - - protected BatcherFactory createBatcherFactory(Properties properties, int batchSize) { - String batcherClass = properties.getProperty(Environment.BATCH_STRATEGY); - if (batcherClass==null) { - return batchSize==0 ? - (BatcherFactory) new NonBatchingBatcherFactory() : - (BatcherFactory) new BatchingBatcherFactory(); - } - else { - log.info("Batcher factory: " + batcherClass); - try { - return (BatcherFactory) ReflectHelper.classForName(batcherClass).newInstance(); - } - catch (Exception cnfe) { - throw new HibernateException("could not instantiate BatcherFactory: " + batcherClass, cnfe); - } - } - } - - protected ConnectionProvider createConnectionProvider(Properties properties) { - return ConnectionProviderFactory.newConnectionProvider(properties); - } - - protected TransactionFactory createTransactionFactory(Properties properties) { - return TransactionFactoryFactory.buildTransactionFactory(properties); - } - - protected TransactionManagerLookup createTransactionManagerLookup(Properties properties) { - return TransactionManagerLookupFactory.getTransactionManagerLookup(properties); - } - - private Dialect determineDialect(Properties props, String databaseName, int databaseMajorVersion) { - return DialectFactory.buildDialect( props, databaseName, databaseMajorVersion ); - } - } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ToOneBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/ToOneFkSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/UniqueConstraintHolder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/WrappedInferredData.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/cfg/package.html =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/cfg/package.html,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/cfg/package.html 17 Aug 2012 14:33:53 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/cfg/package.html 30 Jul 2014 15:51:06 -0000 1.1.2.1 @@ -1,10 +1,10 @@ Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/ArrayBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/BagBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/CollectionBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/CustomizableColumns.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/EntityBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/IdBagBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/ListBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/MapBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/MapKeyColumnDelegator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/MapKeyJoinColumnDelegator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/NamedEntityGraphDefinition.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/NamedProcedureCallDefinition.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/Nullability.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/PrimitiveArrayBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/PropertyBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/QueryBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/QueryHintDefinition.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/SetBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/SimpleValueBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/TableBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/reflection/JPAMetadataProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/reflection/PersistentAttributeFilter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/reflection/XMLContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/annotations/reflection/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/ActivationContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/BeanValidationIntegrator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/DuplicationStrategyImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/GroupsPerOperation.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/HibernateTraversableResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/IntegrationException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/cfg/beanvalidation/ValidationMode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/connection/ConnectionProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/connection/ConnectionProviderFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/connection/DatasourceConnectionProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/connection/DriverManagerConnectionProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/connection/UserSuppliedConnectionProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/connection/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/CurrentSessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/JTASessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/ManagedSessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/TenantIdentifierMismatchException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/ThreadLocalSessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/internal/JTASessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/internal/ManagedSessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/internal/ThreadLocalSessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/spi/AbstractCurrentSessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/spi/CurrentSessionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/spi/CurrentTenantIdentifierResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/context/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/AbstractEmptinessExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/AbstractEmptinessExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/AbstractEmptinessExpression.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/AbstractEmptinessExpression.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,16 +20,14 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; - import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.MappingException; import org.hibernate.QueryException; -import org.hibernate.engine.SessionFactoryImplementor; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.TypedValue; import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.entity.Loadable; import org.hibernate.persister.entity.PropertyMapping; @@ -38,7 +36,7 @@ import org.hibernate.type.Type; /** - * Implementation of AbstractEmptinessExpression. + * Base expression implementation for (not) emptiness checking of collection properties * * @author Steve Ebersole */ @@ -52,43 +50,50 @@ this.propertyName = propertyName; } + /** + * Should empty rows be excluded? + * + * @return {@code true} Indicates the expression should be 'exists'; {@code false} indicates 'not exists' + */ protected abstract boolean excludeEmpty(); + @Override public final String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { - String entityName = criteriaQuery.getEntityName( criteria, propertyName ); - String actualPropertyName = criteriaQuery.getPropertyName( propertyName ); - String sqlAlias = criteriaQuery.getSQLAlias( criteria, propertyName ); + final String entityName = criteriaQuery.getEntityName( criteria, propertyName ); + final String actualPropertyName = criteriaQuery.getPropertyName( propertyName ); + final String sqlAlias = criteriaQuery.getSQLAlias( criteria, propertyName ); - SessionFactoryImplementor factory = criteriaQuery.getFactory(); - QueryableCollection collectionPersister = getQueryableCollection( entityName, actualPropertyName, factory ); + final SessionFactoryImplementor factory = criteriaQuery.getFactory(); + final QueryableCollection collectionPersister = getQueryableCollection( entityName, actualPropertyName, factory ); - String[] collectionKeys = collectionPersister.getKeyColumnNames(); - String[] ownerKeys = ( ( Loadable ) factory.getEntityPersister( entityName ) ).getIdentifierColumnNames(); + final String[] collectionKeys = collectionPersister.getKeyColumnNames(); + final String[] ownerKeys = ( (Loadable) factory.getEntityPersister( entityName ) ).getIdentifierColumnNames(); - String innerSelect = "(select 1 from " + collectionPersister.getTableName() - + " where " - + new ConditionFragment().setTableAlias( sqlAlias ).setCondition( ownerKeys, collectionKeys ).toFragmentString() - + ")"; + final String innerSelect = "(select 1 from " + collectionPersister.getTableName() + " where " + + new ConditionFragment().setTableAlias( sqlAlias ).setCondition( ownerKeys, collectionKeys ).toFragmentString() + + ")"; return excludeEmpty() - ? "exists " + innerSelect - : "not exists " + innerSelect; + ? "exists " + innerSelect + : "not exists " + innerSelect; } - protected QueryableCollection getQueryableCollection(String entityName, String propertyName, SessionFactoryImplementor factory) - throws HibernateException { - PropertyMapping ownerMapping = ( PropertyMapping ) factory.getEntityPersister( entityName ); - Type type = ownerMapping.toType( propertyName ); + protected QueryableCollection getQueryableCollection( + String entityName, + String propertyName, + SessionFactoryImplementor factory) throws HibernateException { + final PropertyMapping ownerMapping = (PropertyMapping) factory.getEntityPersister( entityName ); + final Type type = ownerMapping.toType( propertyName ); if ( !type.isCollectionType() ) { throw new MappingException( - "Property path [" + entityName + "." + propertyName + "] does not reference a collection" + "Property path [" + entityName + "." + propertyName + "] does not reference a collection" ); } - String role = ( ( CollectionType ) type ).getRole(); + final String role = ( (CollectionType) type ).getRole(); try { - return ( QueryableCollection ) factory.getCollectionPersister( role ); + return (QueryableCollection) factory.getCollectionPersister( role ); } catch ( ClassCastException cce ) { throw new QueryException( "collection role is not queryable: " + role ); @@ -98,11 +103,13 @@ } } + @Override public final TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + throws HibernateException { return NO_VALUES; } + @Override public final String toString() { return propertyName + ( excludeEmpty() ? " is not empty" : " is empty" ); } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/AggregateProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/AggregateProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/AggregateProjection.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/AggregateProjection.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by + * third-party contributors as indicated by either @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 @@ -20,48 +20,83 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; +import java.util.Collections; +import java.util.List; import org.hibernate.Criteria; import org.hibernate.HibernateException; +import org.hibernate.dialect.function.SQLFunction; import org.hibernate.type.Type; /** - * An aggregation + * Base class for standard aggregation functions. * * @author max */ public class AggregateProjection extends SimpleProjection { - protected final String propertyName; - private final String aggregate; + private final String functionName; - protected AggregateProjection(String aggregate, String propertyName) { - this.aggregate = aggregate; + protected AggregateProjection(String functionName, String propertyName) { + this.functionName = functionName; this.propertyName = propertyName; } - public String toString() { - return aggregate + "(" + propertyName + ')'; + public String getFunctionName() { + return functionName; } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new Type[] { criteriaQuery.getType(criteria, propertyName) }; + public String getPropertyName() { + return propertyName; } - public String toSqlString(Criteria criteria, int loc, CriteriaQuery criteriaQuery) - throws HibernateException { - return new StringBuffer() - .append(aggregate) - .append("(") - .append( criteriaQuery.getColumn(criteria, propertyName) ) - .append(") as y") - .append(loc) - .append('_') - .toString(); + @Override + public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + return new Type[] { + getFunction( criteriaQuery ).getReturnType( + criteriaQuery.getType( criteria, getPropertyName() ), + criteriaQuery.getFactory() + ) + }; } + @Override + public String toSqlString(Criteria criteria, int loc, CriteriaQuery criteriaQuery) throws HibernateException { + final String functionFragment = getFunction( criteriaQuery ).render( + criteriaQuery.getType( criteria, getPropertyName() ), + buildFunctionParameterList( criteria, criteriaQuery ), + criteriaQuery.getFactory() + ); + return functionFragment + " as y" + loc + '_'; + } + + protected SQLFunction getFunction(CriteriaQuery criteriaQuery) { + return getFunction( getFunctionName(), criteriaQuery ); + } + + protected SQLFunction getFunction(String functionName, CriteriaQuery criteriaQuery) { + final SQLFunction function = criteriaQuery.getFactory() + .getSqlFunctionRegistry() + .findSQLFunction( functionName ); + if ( function == null ) { + throw new HibernateException( "Unable to locate mapping for function named [" + functionName + "]" ); + } + return function; + } + + protected List buildFunctionParameterList(Criteria criteria, CriteriaQuery criteriaQuery) { + return buildFunctionParameterList( criteriaQuery.getColumn( criteria, getPropertyName() ) ); + } + + protected List buildFunctionParameterList(String column) { + return Collections.singletonList( column ); + } + + @Override + public String toString() { + return functionName + "(" + propertyName + ')'; + } + } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/AliasedProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/AliasedProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/AliasedProjection.java 17 Aug 2012 14:33:48 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/AliasedProjection.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,69 +20,87 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; - import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.type.Type; /** + * Represents a projection that specifies an alias + * * @author Gavin King */ -public class AliasedProjection implements Projection { - +public class AliasedProjection implements EnhancedProjection { private final Projection projection; private final String alias; - - public String toString() { - return projection.toString() + " as " + alias; - } - + protected AliasedProjection(Projection projection, String alias) { this.projection = projection; this.alias = alias; } - public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) - throws HibernateException { - return projection.toSqlString(criteria, position, criteriaQuery); + @Override + public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) throws HibernateException { + return projection.toSqlString( criteria, position, criteriaQuery ); } - public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return projection.toGroupSqlString(criteria, criteriaQuery); + @Override + public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) { + return projection.toGroupSqlString( criteria, criteriaQuery ); } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return projection.getTypes(criteria, criteriaQuery); + @Override + public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + return projection.getTypes( criteria, criteriaQuery ); } + @Override public String[] getColumnAliases(int loc) { - return projection.getColumnAliases(loc); + return projection.getColumnAliases( loc ); } - public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return this.alias.equals(alias) ? - getTypes(criteria, criteriaQuery) : - null; + @Override + public String[] getColumnAliases(int loc, Criteria criteria, CriteriaQuery criteriaQuery) { + return projection instanceof EnhancedProjection + ? ( (EnhancedProjection) projection ).getColumnAliases( loc, criteria, criteriaQuery ) + : getColumnAliases( loc ); } + @Override + public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + return this.alias.equals( alias ) + ? getTypes( criteria, criteriaQuery ) + : null; + } + + @Override public String[] getColumnAliases(String alias, int loc) { - return this.alias.equals(alias) ? - getColumnAliases(loc) : - null; + return this.alias.equals( alias ) + ? getColumnAliases( loc ) + : null; } + @Override + public String[] getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery) { + return this.alias.equals( alias ) + ? getColumnAliases( loc, criteria, criteriaQuery ) + : null; + } + + @Override public String[] getAliases() { - return new String[]{ alias }; + return new String[] { alias }; } + @Override public boolean isGrouped() { return projection.isGrouped(); } + @Override + public String toString() { + return projection.toString() + " as " + alias; + } + } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/AvgProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/AvgProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/AvgProjection.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/AvgProjection.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by + * third-party contributors as indicated by either @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 @@ -20,28 +20,21 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; -import org.hibernate.Criteria; -import org.hibernate.Hibernate; -import org.hibernate.HibernateException; -import org.hibernate.type.Type; - /** * An avg() projection * * @author Gavin King */ public class AvgProjection extends AggregateProjection { - + /** + * Constructs the AvgProjection + * + * @param propertyName The name of the property to average + */ public AvgProjection(String propertyName) { - super("avg", propertyName); + super( "avg", propertyName ); } - - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new Type[] { Hibernate.DOUBLE }; - } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/BetweenExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/BetweenExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/BetweenExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/BetweenExpression.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,22 +20,20 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; - import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; -import org.hibernate.util.StringHelper; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.util.StringHelper; /** * Constrains a property to between two values + * * @author Gavin King */ public class BetweenExpression implements Criterion { - private final String propertyName; private final Object lo; private final Object hi; @@ -46,24 +44,22 @@ this.hi = hi; } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return StringHelper.join( - " and ", - StringHelper.suffix( criteriaQuery.getColumnsUsingProjection(criteria, propertyName), " between ? and ?" ) - ); - - //TODO: get SQL rendering out of this package! + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final String[] columns = criteriaQuery.findColumns( propertyName, criteria ); + final String[] expressions = StringHelper.suffix( columns, " between ? and ?" ); + return StringHelper.join( " and ", expressions ); } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { return new TypedValue[] { - criteriaQuery.getTypedValue(criteria, propertyName, lo), - criteriaQuery.getTypedValue(criteria, propertyName, hi) + criteriaQuery.getTypedValue( criteria, propertyName, lo ), + criteriaQuery.getTypedValue( criteria, propertyName, hi ) }; } + @Override public String toString() { return propertyName + " between " + lo + " and " + hi; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Conjunction.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Conjunction.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Conjunction.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Conjunction.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2012, 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,17 +20,26 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; /** + * Defines a conjunction (AND series). + * * @author Gavin King + * @author Steve Ebersole + * + * @see Disjunction */ public class Conjunction extends Junction { - + /** + * Constructs a Conjunction + */ public Conjunction() { - super("and"); + super( Nature.AND ); } + protected Conjunction(Criterion... criterion) { + super( Nature.AND, criterion ); + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/CountProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/CountProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/CountProjection.java 17 Aug 2012 14:33:48 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/CountProjection.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * Copyright (c) 2009 by Red Hat Inc and/or its affiliates or by + * third-party contributors as indicated by either @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 @@ -20,55 +20,66 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.hibernate.Criteria; -import org.hibernate.Hibernate; -import org.hibernate.HibernateException; -import org.hibernate.type.Type; /** - * A count + * A count projection + * * @author Gavin King */ public class CountProjection extends AggregateProjection { - private boolean distinct; + /** + * Constructs the count projection. + * + * @param prop The property name + * + * @see Projections#count(String) + * @see Projections#countDistinct(String) + */ protected CountProjection(String prop) { - super("count", prop); + super( "count", prop ); } - public String toString() { - if(distinct) { - return "distinct " + super.toString(); - } else { - return super.toString(); - } + @Override + protected List buildFunctionParameterList(Criteria criteria, CriteriaQuery criteriaQuery) { + final String[] cols = criteriaQuery.getColumns( propertyName, criteria ); + return ( distinct ? buildCountDistinctParameterList( cols ) : Arrays.asList( cols ) ); } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new Type[] { Hibernate.INTEGER }; + @SuppressWarnings("unchecked") + private List buildCountDistinctParameterList(String[] cols) { + final List params = new ArrayList( cols.length + 1 ); + params.add( "distinct" ); + params.addAll( Arrays.asList( cols ) ); + return params; } - public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) - throws HibernateException { - StringBuffer buf = new StringBuffer(); - buf.append("count("); - if (distinct) buf.append("distinct "); - return buf.append( criteriaQuery.getColumn(criteria, propertyName) ) - .append(") as y") - .append(position) - .append('_') - .toString(); - } - + /** + * Sets the count as being distinct + * + * @return {@code this}, for method chaining + */ public CountProjection setDistinct() { distinct = true; return this; } - + + @Override + public String toString() { + if ( distinct ) { + return "distinct " + super.toString(); + } + else { + return super.toString(); + } + } + } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaQuery.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaQuery.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaQuery.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaQuery.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,14 +20,13 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.engine.SessionFactoryImplementor; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.TypedValue; import org.hibernate.type.Type; /** @@ -39,77 +38,183 @@ * @author Gavin King */ public interface CriteriaQuery { + /** + * Provides access to the SessionFactory + * + * @return The SessionFactory + */ public SessionFactoryImplementor getFactory(); /** - * Get the names of the columns mapped by a property path, - * ignoring projection aliases + * Resolve a property path to the name of the column it maps to. Ignores projection aliases. + * + * @param criteria The overall criteria + * @param propertyPath The property path to resolve + * + * @return The column name + * + * @throws HibernateException if the property maps to more than 1 column, or if the property could not be resolved + * + * @see #getColumns */ - public String getColumn(Criteria criteria, String propertyPath) - throws HibernateException; - + public String getColumn(Criteria criteria, String propertyPath) throws HibernateException; + /** - * Get the type of a property path, ignoring projection aliases + * Resolve a property path to the names of the columns it maps to. Ignores projection aliases + * + * @param criteria The criteria + * @param propertyPath The property path to resolve + * + * @return The column names + * + * @throws HibernateException if the property maps to more than 1 column, or if the property could not be resolved */ - public Type getType(Criteria criteria, String propertyPath) - throws HibernateException; + public String[] getColumns(String propertyPath, Criteria criteria) throws HibernateException; /** - * Get the names of the columns mapped by a property path + * Get the names of the columns mapped by a property path; if the property path is not found in criteria, try + * the "outer" query. Projection aliases are ignored. + * + * @param criteria The criteria + * @param propertyPath The property path to resolve + * + * @return The column names + * + * @throws HibernateException if the property could not be resolved */ - public String[] getColumnsUsingProjection(Criteria criteria, String propertyPath) - throws HibernateException; - + public String[] findColumns(String propertyPath, Criteria criteria) throws HibernateException; + /** - * Get the type of a property path + * Get the type of a property path. + * + * @param criteria The criteria + * @param propertyPath The property path to resolve + * + * @return The type + * + * @throws HibernateException if the property could not be resolved */ - public Type getTypeUsingProjection(Criteria criteria, String propertyPath) - throws HibernateException; + public Type getType(Criteria criteria, String propertyPath) throws HibernateException; /** - * Get the a typed value for the given property value. + * Get the names of the columns mapped by a property path. Here, the property path can refer to + * a projection alias. + * + * @param criteria The criteria + * @param propertyPath The property path to resolve or projection alias + * + * @return The column names + * + * @throws HibernateException if the property/alias could not be resolved */ - public TypedValue getTypedValue(Criteria criteria, String propertyPath, Object value) - throws HibernateException; - + public String[] getColumnsUsingProjection(Criteria criteria, String propertyPath) throws HibernateException; + /** + * Get the type of a property path. Here, the property path can refer to a projection alias. + * + * @param criteria The criteria + * @param propertyPath The property path to resolve or projection alias + * + * @return The type + * + * @throws HibernateException if the property/alias could not be resolved + */ + public Type getTypeUsingProjection(Criteria criteria, String propertyPath) throws HibernateException; + + /** + * Build a typed-value for the property/value combo. Essentially the same as manually building a TypedValue + * using the given value and the resolved type using {@link #getTypeUsingProjection}. + * + * @param criteria The criteria query + * @param propertyPath The property path/alias to resolve to type. + * @param value The value + * + * @return The TypedValue + * + * @throws HibernateException if the property/alias could not be resolved + */ + public TypedValue getTypedValue(Criteria criteria, String propertyPath, Object value) throws HibernateException; + + /** * Get the entity name of an entity + * + * @param criteria The criteria + * + * @return The entity name */ public String getEntityName(Criteria criteria); /** - * Get the entity name of an entity, taking into account - * the qualifier of the property path + * Get the entity name of an entity, taking into account the qualifier of the property path + * + * @param criteria The criteria + * @param propertyPath The property path that (supposedly) references an entity + * + * @return The entity name */ public String getEntityName(Criteria criteria, String propertyPath); /** * Get the root table alias of an entity + * + * @param criteria The criteria + * + * @return The SQL table alias for the given criteria */ - public String getSQLAlias(Criteria subcriteria); + public String getSQLAlias(Criteria criteria); /** * Get the root table alias of an entity, taking into account * the qualifier of the property path + * + * @param criteria The criteria + * @param propertyPath The property path whose SQL alias should be returned. + * + * @return The SQL table alias for the given criteria */ public String getSQLAlias(Criteria criteria, String propertyPath); /** * Get the property name, given a possibly qualified property name + * + * @param propertyName The (possibly qualified) property name + * + * @return The simple property name */ public String getPropertyName(String propertyName); /** * Get the identifier column names of this entity + * + * @param criteria The criteria + * + * @return The identifier column names */ - public String[] getIdentifierColumns(Criteria subcriteria); + public String[] getIdentifierColumns(Criteria criteria); /** * Get the identifier type of this entity + * + * @param criteria The criteria + * + * @return The identifier type. */ - public Type getIdentifierType(Criteria subcriteria); - - public TypedValue getTypedIdentifierValue(Criteria subcriteria, Object value); - + public Type getIdentifierType(Criteria criteria); + + /** + * Build a TypedValue for the given identifier value. + * + * @param criteria The criteria whose identifier is referenced. + * @param value The identifier value + * + * @return The TypedValue + */ + public TypedValue getTypedIdentifierValue(Criteria criteria, Object value); + + /** + * Generate a unique SQL alias + * + * @return The generated alias + */ public String generateSQLAlias(); -} \ No newline at end of file +} Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaSpecification.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/CriteriaSpecification.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,17 +20,19 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; +import org.hibernate.sql.JoinType; import org.hibernate.transform.AliasToEntityMapResultTransformer; import org.hibernate.transform.DistinctRootEntityResultTransformer; import org.hibernate.transform.PassThroughResultTransformer; import org.hibernate.transform.ResultTransformer; import org.hibernate.transform.RootEntityResultTransformer; /** + * Commonality between different types of Criteria. + * * @author Gavin King */ public interface CriteriaSpecification { @@ -62,17 +64,27 @@ /** * Specifies joining to an entity based on an inner join. + * + * @deprecated use {@link org.hibernate.sql.JoinType#INNER_JOIN} */ - public static final int INNER_JOIN = org.hibernate.sql.JoinFragment.INNER_JOIN; + @Deprecated + public static final int INNER_JOIN = JoinType.INNER_JOIN.getJoinTypeValue(); /** * Specifies joining to an entity based on a full join. + * + * @deprecated use {@link org.hibernate.sql.JoinType#FULL_JOIN} */ - public static final int FULL_JOIN = org.hibernate.sql.JoinFragment.FULL_JOIN; + @Deprecated + public static final int FULL_JOIN = JoinType.FULL_JOIN.getJoinTypeValue(); /** * Specifies joining to an entity based on a left outer join. + * + * @deprecated use {@link org.hibernate.sql.JoinType#LEFT_OUTER_JOIN} */ - public static final int LEFT_JOIN = org.hibernate.sql.JoinFragment.LEFT_OUTER_JOIN; - + @Deprecated + public static final int LEFT_JOIN = JoinType.LEFT_OUTER_JOIN.getJoinTypeValue(); + + } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Criterion.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Criterion.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Criterion.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Criterion.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -23,12 +23,11 @@ * */ package org.hibernate.criterion; - import java.io.Serializable; import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; /** * An object-oriented representation of a query criterion that may be used Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/DetachedCriteria.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/DetachedCriteria.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/DetachedCriteria.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/DetachedCriteria.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,157 +20,427 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import java.io.Serializable; import org.hibernate.Criteria; import org.hibernate.FetchMode; -import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.Session; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.impl.CriteriaImpl; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.internal.CriteriaImpl; +import org.hibernate.sql.JoinType; import org.hibernate.transform.ResultTransformer; /** - * Some applications need to create criteria queries in "detached - * mode", where the Hibernate session is not available. This class - * may be instantiated anywhere, and then a Criteria - * may be obtained by passing a session to - * getExecutableCriteria(). All methods have the - * same semantics and behavior as the corresponding methods of the - * Criteria interface. - * - * @see org.hibernate.Criteria + * Models a detached form of a Criteria (not associated with a Session). + * + * Some applications need to create criteria queries in "detached mode", where the Hibernate Session is + * not available. Applications would create a DetachableCriteria to describe the query, and then later + * associated it with a Session to obtain the "executable" Criteria: + * + * DetachedCriteria detached = new DetachedCriteria(); + * ... + * Criteria criteria = detached.getExecutableCriteria( session ); + * ... + * criteria.list(); + * + * + * All methods have the same semantics and behavior as the corresponding methods of the Criteria interface. + * * @author Gavin King + * + * @see org.hibernate.Criteria */ public class DetachedCriteria implements CriteriaSpecification, Serializable { - private final CriteriaImpl impl; private final Criteria criteria; - + protected DetachedCriteria(String entityName) { - impl = new CriteriaImpl(entityName, null); + impl = new CriteriaImpl( entityName, null ); criteria = impl; } - + protected DetachedCriteria(String entityName, String alias) { - impl = new CriteriaImpl(entityName, alias, null); + impl = new CriteriaImpl( entityName, alias, null ); criteria = impl; } - + protected DetachedCriteria(CriteriaImpl impl, Criteria criteria) { this.impl = impl; this.criteria = criteria; } - + /** - * Get an executable instance of Criteria, - * to actually run the query. + * Get an executable instance of Criteria to actually run the query. + * + * @param session The session to associate the built Criteria with + * + * @return The "executable" Criteria */ public Criteria getExecutableCriteria(Session session) { - impl.setSession( ( SessionImplementor ) session ); + impl.setSession( (SessionImplementor) session ); return impl; } - + + /** + * Obtain the alias associated with this DetachedCriteria + * + * @return The alias + */ + public String getAlias() { + return criteria.getAlias(); + } + + /** + * Retrieve the CriteriaImpl used internally to hold the DetachedCriteria state + * + * @return The internally maintained CriteriaImpl + */ + CriteriaImpl getCriteriaImpl() { + return impl; + } + + /** + * Static builder to create a DetachedCriteria for the given entity. + * + * @param entityName The name of the entity to create a DetachedCriteria for + * + * @return The DetachedCriteria + */ + @SuppressWarnings("UnusedDeclaration") public static DetachedCriteria forEntityName(String entityName) { - return new DetachedCriteria(entityName); + return new DetachedCriteria( entityName ); } - + + /** + * Static builder to create a DetachedCriteria for the given entity. + * + * @param entityName The name of the entity to create a DetachedCriteria for + * @param alias The alias to apply to the entity + * + * @return The DetachedCriteria + */ + @SuppressWarnings("UnusedDeclaration") public static DetachedCriteria forEntityName(String entityName, String alias) { - return new DetachedCriteria(entityName, alias); + return new DetachedCriteria( entityName, alias ); } - + + /** + * Static builder to create a DetachedCriteria for the given entity, by its Class. + * + * @param clazz The entity class + * + * @return The DetachedCriteria + */ public static DetachedCriteria forClass(Class clazz) { return new DetachedCriteria( clazz.getName() ); } - + + /** + * Static builder to create a DetachedCriteria for the given entity, by its Class. + * + * @param clazz The entity class + * @param alias The alias to apply to the entity + * + * @return The DetachedCriteria + */ public static DetachedCriteria forClass(Class clazz, String alias) { return new DetachedCriteria( clazz.getName() , alias ); } - + + /** + * Add a restriction + * + * @param criterion The restriction + * + * @return {@code this}, for method chaining + */ public DetachedCriteria add(Criterion criterion) { - criteria.add(criterion); + criteria.add( criterion ); return this; } + /** + * Adds an ordering + * + * @param order The ordering + * + * @return {@code this}, for method chaining + */ public DetachedCriteria addOrder(Order order) { - criteria.addOrder(order); + criteria.addOrder( order ); return this; } - public DetachedCriteria createAlias(String associationPath, String alias) - throws HibernateException { - criteria.createAlias(associationPath, alias); + /** + * Set the fetch mode for a given association + * + * @param associationPath The association path + * @param mode The fetch mode to apply + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria setFetchMode(String associationPath, FetchMode mode) { + criteria.setFetchMode( associationPath, mode ); return this; } - public DetachedCriteria createCriteria(String associationPath, String alias) - throws HibernateException { - return new DetachedCriteria( impl, criteria.createCriteria(associationPath, alias) ); + /** + * Set the projection to use. + * + * @param projection The projection to use + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria setProjection(Projection projection) { + criteria.setProjection( projection ); + return this; } - public DetachedCriteria createCriteria(String associationPath) - throws HibernateException { - return new DetachedCriteria( impl, criteria.createCriteria(associationPath) ); + /** + * Set the result transformer to use. + * + * @param resultTransformer The result transformer to use + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria setResultTransformer(ResultTransformer resultTransformer) { + criteria.setResultTransformer( resultTransformer ); + return this; } - public String getAlias() { - return criteria.getAlias(); + /** + * Creates an association path alias within this DetachedCriteria. The alias can then be used in further + * alias creations or restrictions, etc. + * + * @param associationPath The association path + * @param alias The alias to apply to that association path + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria createAlias(String associationPath, String alias) { + criteria.createAlias( associationPath, alias ); + return this; } - public DetachedCriteria setFetchMode(String associationPath, FetchMode mode) - throws HibernateException { - criteria.setFetchMode(associationPath, mode); + /** + * Creates an association path alias within this DetachedCriteria specifying the type of join. The alias + * can then be used in further alias creations or restrictions, etc. + * + * @param associationPath The association path + * @param alias The alias to apply to that association path + * @param joinType The type of join to use + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria createAlias(String associationPath, String alias, JoinType joinType) { + criteria.createAlias( associationPath, alias, joinType ); return this; } - public DetachedCriteria setProjection(Projection projection) { - criteria.setProjection(projection); + /** + * Creates an association path alias within this DetachedCriteria specifying the type of join. The alias + * can then be used in further alias creations or restrictions, etc. + * + * @param associationPath The association path + * @param alias The alias to apply to that association path + * @param joinType The type of join to use + * @param withClause An additional restriction on the join + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria createAlias(String associationPath, String alias, JoinType joinType, Criterion withClause) { + criteria.createAlias( associationPath, alias, joinType, withClause ); return this; } - public DetachedCriteria setResultTransformer(ResultTransformer resultTransformer) { - criteria.setResultTransformer(resultTransformer); - return this; + /** + * Deprecated! + * + * @param associationPath The association path + * @param alias The alias to apply to that association path + * @param joinType The type of join to use + * + * @return {@code this}, for method chaining + * + * @deprecated use {@link #createAlias(String, String, JoinType)} + */ + @Deprecated + public DetachedCriteria createAlias(String associationPath, String alias, int joinType) { + return createAlias( associationPath, alias, JoinType.parse( joinType ) ); } - - public String toString() { - return "DetachableCriteria(" + criteria.toString() + ')'; + + /** + * Deprecated! + * + * @param associationPath The association path + * @param alias The alias to apply to that association path + * @param joinType The type of join to use + * @param withClause An additional restriction on the join + * + * @return {@code this}, for method chaining + * + * @deprecated use {@link #createAlias(String, String, JoinType, Criterion)} + */ + @Deprecated + public DetachedCriteria createAlias(String associationPath, String alias, int joinType, Criterion withClause) { + return createAlias( associationPath, alias, JoinType.parse( joinType ), withClause ); } - - CriteriaImpl getCriteriaImpl() { - return impl; + + /** + * Creates an nested DetachedCriteria representing the association path. + * + * @param associationPath The association path + * @param alias The alias to apply to that association path + * + * @return the newly created, nested DetachedCriteria + */ + public DetachedCriteria createCriteria(String associationPath, String alias) { + return new DetachedCriteria( impl, criteria.createCriteria( associationPath, alias ) ); } - public DetachedCriteria createAlias(String associationPath, String alias, int joinType) throws HibernateException { - criteria.createAlias(associationPath, alias, joinType); - return this; - } + /** + * Creates an nested DetachedCriteria representing the association path. + * + * @param associationPath The association path + * + * @return the newly created, nested DetachedCriteria + */ + public DetachedCriteria createCriteria(String associationPath) { + return new DetachedCriteria( impl, criteria.createCriteria( associationPath ) ); + } - public DetachedCriteria createCriteria(String associationPath, int joinType) throws HibernateException { - return new DetachedCriteria(impl, criteria.createCriteria(associationPath, joinType)); - } + /** + * Creates an nested DetachedCriteria representing the association path, specifying the type of join to use. + * + * @param associationPath The association path + * @param joinType The type of join to use + * + * @return the newly created, nested DetachedCriteria + */ + public DetachedCriteria createCriteria(String associationPath, JoinType joinType) { + return new DetachedCriteria( impl, criteria.createCriteria( associationPath, joinType ) ); + } - public DetachedCriteria createCriteria(String associationPath, String alias, int joinType) throws HibernateException { - return new DetachedCriteria(impl, criteria.createCriteria(associationPath, alias, joinType)); - } + /** + * Creates an nested DetachedCriteria representing the association path, specifying the type of join to use. + * + * @param associationPath The association path + * @param alias The alias to associate with this "join". + * @param joinType The type of join to use + * + * @return the newly created, nested DetachedCriteria + */ + public DetachedCriteria createCriteria(String associationPath, String alias, JoinType joinType) { + return new DetachedCriteria( impl, criteria.createCriteria( associationPath, alias, joinType ) ); + } - public DetachedCriteria setComment(String comment) { - criteria.setComment(comment); - return this; - } + /** + * Creates an nested DetachedCriteria representing the association path, specifying the type of join to use and + * an additional join restriction. + * + * @param associationPath The association path + * @param alias The alias to associate with this "join". + * @param joinType The type of join to use + * @param withClause The additional join restriction + * + * @return the newly created, nested DetachedCriteria + */ + public DetachedCriteria createCriteria(String associationPath, String alias, JoinType joinType, Criterion withClause) { + return new DetachedCriteria(impl, criteria.createCriteria( associationPath, alias, joinType, withClause ) ); + } - public DetachedCriteria setLockMode(LockMode lockMode) { - criteria.setLockMode(lockMode); - return this; - } + /** + * Deprecated! + * + * @param associationPath The association path + * @param joinType The type of join to use + * + * @return the newly created, nested DetachedCriteria + * + * @deprecated use {@link #createCriteria(String, JoinType)} + */ + @Deprecated + public DetachedCriteria createCriteria(String associationPath, int joinType) { + return createCriteria( associationPath, JoinType.parse( joinType ) ); + } - public DetachedCriteria setLockMode(String alias, LockMode lockMode) { - criteria.setLockMode(alias, lockMode); - return this; - } + /** + * Deprecated! + * + * @param associationPath The association path + * @param alias The alias + * @param joinType The type of join to use + * + * @return the newly created, nested DetachedCriteria + * + * @deprecated use {@link #createCriteria(String, String, JoinType)} + */ + @Deprecated + public DetachedCriteria createCriteria(String associationPath, String alias, int joinType) { + return createCriteria( associationPath, alias, JoinType.parse( joinType ) ); + } + + /** + * Deprecated! + * + * @param associationPath The association path + * @param alias The alias to associate with this "join". + * @param joinType The type of join to use + * @param withClause The additional join restriction + * + * @return the newly created, nested DetachedCriteria + * + * @deprecated use {@link #createCriteria(String, String, JoinType, Criterion)} + */ + @Deprecated + public DetachedCriteria createCriteria(String associationPath, String alias, int joinType, Criterion withClause) { + return createCriteria( associationPath, alias, JoinType.parse( joinType ), withClause ); + } + + /** + * Set the SQL comment to use. + * + * @param comment The SQL comment to use + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria setComment(String comment) { + criteria.setComment( comment ); + return this; + } + + /** + * Set the lock mode to use. + * + * @param lockMode The lock mode to use + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria setLockMode(LockMode lockMode) { + criteria.setLockMode( lockMode ); + return this; + } + + /** + * Set an alias-specific lock mode. The specified lock mode applies only to that alias. + * + * @param alias The alias to apply the lock to + * @param lockMode The lock mode to use. + * + * @return {@code this}, for method chaining + */ + public DetachedCriteria setLockMode(String alias, LockMode lockMode) { + criteria.setLockMode( alias, lockMode ); + return this; + } + + @Override + public String toString() { + return "DetachableCriteria(" + criteria.toString() + ')'; + } + } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Disjunction.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Disjunction.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Disjunction.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Disjunction.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2012, 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,17 +20,26 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; /** + * Defines a disjunction (OR series). + * * @author Gavin King + * @author Steve Ebersole + * + * @see Conjunction */ public class Disjunction extends Junction { - + /** + * Constructs a Disjunction + */ protected Disjunction() { - super("or"); + super( Nature.OR ); } + protected Disjunction(Criterion[] conditions) { + super( Nature.OR, conditions ); + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Distinct.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Distinct.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Distinct.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Distinct.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,62 +20,85 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; -import org.hibernate.HibernateException; import org.hibernate.type.Type; /** + * A wrappedProjection that is a wrapper around other projections to apply distinction. + * * @author Gavin King */ -public class Distinct implements Projection { +public class Distinct implements EnhancedProjection { + private final Projection wrappedProjection; - private final Projection projection; - - public Distinct(Projection proj) { - this.projection = proj; + /** + * Constructs a Distinct + * + * @param wrappedProjection The wrapped projection + */ + public Distinct(Projection wrappedProjection) { + this.wrappedProjection = wrappedProjection; } - public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) - throws HibernateException { - return "distinct " + projection.toSqlString(criteria, position, criteriaQuery); + @Override + public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) { + return "distinct " + wrappedProjection.toSqlString( criteria, position, criteriaQuery ); } - public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return projection.toGroupSqlString(criteria, criteriaQuery); + @Override + public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) { + return wrappedProjection.toGroupSqlString( criteria, criteriaQuery ); } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return projection.getTypes(criteria, criteriaQuery); + @Override + public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) { + return wrappedProjection.getTypes( criteria, criteriaQuery ); } - public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return projection.getTypes(alias, criteria, criteriaQuery); + @Override + public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) { + return wrappedProjection.getTypes( alias, criteria, criteriaQuery ); } + @Override public String[] getColumnAliases(int loc) { - return projection.getColumnAliases(loc); + return wrappedProjection.getColumnAliases( loc ); } + @Override + public String[] getColumnAliases(int loc, Criteria criteria, CriteriaQuery criteriaQuery) { + return wrappedProjection instanceof EnhancedProjection + ? ( (EnhancedProjection) wrappedProjection).getColumnAliases( loc, criteria, criteriaQuery ) + : getColumnAliases( loc ); + } + + @Override public String[] getColumnAliases(String alias, int loc) { - return projection.getColumnAliases(alias, loc); + return wrappedProjection.getColumnAliases( alias, loc ); } + @Override + public String[] getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery) { + return wrappedProjection instanceof EnhancedProjection + ? ( (EnhancedProjection) wrappedProjection).getColumnAliases( alias, loc, criteria, criteriaQuery ) + : getColumnAliases( alias, loc ); + } + + @Override public String[] getAliases() { - return projection.getAliases(); + return wrappedProjection.getAliases(); } + @Override public boolean isGrouped() { - return projection.isGrouped(); + return wrappedProjection.isGrouped(); } + @Override public String toString() { - return "distinct " + projection.toString(); + return "distinct " + wrappedProjection.toString(); } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/EmptyExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/EmptyExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/EmptyExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/EmptyExpression.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,21 +20,28 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; /** + * An expression asserting that a collection property is empty + * * @author Gavin King */ public class EmptyExpression extends AbstractEmptinessExpression implements Criterion { - + /** + * Constructs an EmptyExpression + * + * @param propertyName The collection property name + * + * @see Restrictions#isEmpty + */ protected EmptyExpression(String propertyName) { super( propertyName ); } + @Override protected boolean excludeEmpty() { return false; } - } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/criterion/EnhancedProjection.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Example.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Example.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Example.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Example.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -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.criterion; @@ -32,193 +31,190 @@ import org.hibernate.Criteria; import org.hibernate.EntityMode; -import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.util.StringHelper; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.type.AbstractComponentType; +import org.hibernate.type.CompositeType; import org.hibernate.type.Type; -import org.hibernate.util.StringHelper; /** * Support for query by example. + * *

  * List results = session.createCriteria(Parent.class)
  *     .add( Example.create(parent).ignoreCase() )
  *     .createCriteria("child")
  *         .add( Example.create( parent.getChild() ) )
  *     .list();
  * 
- * "Examples" may be mixed and matched with "Expressions" in the same Criteria. + * + * "Examples" may be mixed and matched with "Expressions" in the same Criteria. + * * @see org.hibernate.Criteria * @author Gavin King */ public class Example implements Criterion { - - private final Object entity; - private final Set excludedProperties = new HashSet(); + private final Object exampleEntity; private PropertySelector selector; + private boolean isLikeEnabled; private Character escapeCharacter; private boolean isIgnoreCaseEnabled; private MatchMode matchMode; + private final Set excludedProperties = new HashSet(); + /** - * A strategy for choosing property values for inclusion in the query - * criteria + * Create a new Example criterion instance, which includes all non-null properties by default + * + * @param exampleEntity The example bean to use. + * + * @return a new instance of Example */ - - public static interface PropertySelector extends Serializable { - public boolean include(Object propertyValue, String propertyName, Type type); - } - - private static final PropertySelector NOT_NULL = new NotNullPropertySelector(); - private static final PropertySelector ALL = new AllPropertySelector(); - private static final PropertySelector NOT_NULL_OR_ZERO = new NotNullOrZeroPropertySelector(); - - static final class AllPropertySelector implements PropertySelector { - public boolean include(Object object, String propertyName, Type type) { - return true; + public static Example create(Object exampleEntity) { + if ( exampleEntity == null ) { + throw new NullPointerException( "null example entity" ); } - - private Object readResolve() { - return ALL; - } + return new Example( exampleEntity, NotNullPropertySelector.INSTANCE ); } - static final class NotNullPropertySelector implements PropertySelector { - public boolean include(Object object, String propertyName, Type type) { - return object!=null; - } - - private Object readResolve() { - return NOT_NULL; - } + /** + * Allow subclasses to instantiate as needed. + * + * @param exampleEntity The example bean + * @param selector The property selector to use + */ + protected Example(Object exampleEntity, PropertySelector selector) { + this.exampleEntity = exampleEntity; + this.selector = selector; } - static final class NotNullOrZeroPropertySelector implements PropertySelector { - public boolean include(Object object, String propertyName, Type type) { - return object!=null && ( - !(object instanceof Number) || ( (Number) object ).longValue()!=0 - ); - } - - private Object readResolve() { - return NOT_NULL_OR_ZERO; - } - } - /** - * Set escape character for "like" clause + * Set escape character for "like" clause if like matching was enabled + * + * @param escapeCharacter The escape character + * + * @return {@code this}, for method chaining + * + * @see #enableLike */ public Example setEscapeCharacter(Character escapeCharacter) { this.escapeCharacter = escapeCharacter; return this; } /** - * Set the property selector + * Use the "like" operator for all string-valued properties. This form implicitly uses {@link MatchMode#EXACT} + * + * @return {@code this}, for method chaining */ - public Example setPropertySelector(PropertySelector selector) { - this.selector = selector; - return this; + public Example enableLike() { + return enableLike( MatchMode.EXACT ); } /** - * Exclude zero-valued properties + * Use the "like" operator for all string-valued properties + * + * @param matchMode The match mode to use. + * + * @return {@code this}, for method chaining */ - public Example excludeZeroes() { - setPropertySelector(NOT_NULL_OR_ZERO); + public Example enableLike(MatchMode matchMode) { + this.isLikeEnabled = true; + this.matchMode = matchMode; return this; } /** - * Don't exclude null or zero-valued properties + * Ignore case for all string-valued properties + * + * @return {@code this}, for method chaining */ - public Example excludeNone() { - setPropertySelector(ALL); + public Example ignoreCase() { + this.isIgnoreCaseEnabled = true; return this; } /** - * Use the "like" operator for all string-valued properties + * Set the property selector to use. + * + * The property selector operates separate from excluding a property. + * + * @param selector The selector to use + * + * @return {@code this}, for method chaining + * + * @see #excludeProperty */ - public Example enableLike(MatchMode matchMode) { - isLikeEnabled = true; - this.matchMode = matchMode; + public Example setPropertySelector(PropertySelector selector) { + this.selector = selector; return this; } /** - * Use the "like" operator for all string-valued properties + * Exclude zero-valued properties. + * + * Equivalent to calling {@link #setPropertySelector} passing in {@link NotNullOrZeroPropertySelector#INSTANCE} + * + * @return {@code this}, for method chaining + * + * @see #setPropertySelector */ - public Example enableLike() { - return enableLike(MatchMode.EXACT); + public Example excludeZeroes() { + setPropertySelector( NotNullOrZeroPropertySelector.INSTANCE ); + return this; } /** - * Ignore case for all string-valued properties + * Include all properties. + * + * Equivalent to calling {@link #setPropertySelector} passing in {@link AllPropertySelector#INSTANCE} + * + * @return {@code this}, for method chaining + * + * @see #setPropertySelector */ - public Example ignoreCase() { - isIgnoreCaseEnabled = true; + public Example excludeNone() { + setPropertySelector( AllPropertySelector.INSTANCE ); return this; } /** - * Exclude a particular named property + * Exclude a particular property by name. + * + * @param name The name of the property to exclude + * + * @return {@code this}, for method chaining + * + * @see #setPropertySelector */ public Example excludeProperty(String name) { - excludedProperties.add(name); + excludedProperties.add( name ); return this; } - /** - * Create a new instance, which includes all non-null properties - * by default - * @param entity - * @return a new instance of Example - */ - public static Example create(Object entity) { - if (entity==null) throw new NullPointerException("null example"); - return new Example(entity, NOT_NULL); - } + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) { + final StringBuilder buf = new StringBuilder().append( '(' ); + final EntityPersister meta = criteriaQuery.getFactory().getEntityPersister( + criteriaQuery.getEntityName( criteria ) + ); + final String[] propertyNames = meta.getPropertyNames(); + final Type[] propertyTypes = meta.getPropertyTypes(); - protected Example(Object entity, PropertySelector selector) { - this.entity = entity; - this.selector = selector; - } + final Object[] propertyValues = meta.getPropertyValues( exampleEntity ); + for ( int i=0; i list = new ArrayList(); + for ( int i=0; i list) { + if ( value != null ) { if ( value instanceof String ) { String string = (String) value; - if (isIgnoreCaseEnabled) string = string.toLowerCase(); - if (isLikeEnabled) string = matchMode.toMatchString(string); + if ( isIgnoreCaseEnabled ) { + string = string.toLowerCase(); + } + if ( isLikeEnabled ) { + string = matchMode.toMatchString( string ); + } value = string; } - list.add( new TypedValue(type, value, null) ); + list.add( new TypedValue( type, value ) ); } } protected void addComponentTypedValues( String path, Object component, - AbstractComponentType type, - List list, + CompositeType type, + List list, Criteria criteria, - CriteriaQuery criteriaQuery) - throws HibernateException { - - if (component!=null) { - String[] propertyNames = type.getPropertyNames(); - Type[] subtypes = type.getSubtypes(); - Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) ); - for (int i=0; i1 && critCondition.trim().length()>0 ) buf.append(" and "); - buf.append(critCondition); + + final String conditionFragment = condition.toSqlString( criteria, cq ); + if ( conditionFragment.trim().length() > 0 ) { + if ( buf.length() > 1 ) { + buf.append( " and " ); + } + buf.append( conditionFragment ); + } } protected void appendComponentCondition( - String path, - Object component, - AbstractComponentType type, - Criteria criteria, - CriteriaQuery criteriaQuery, - StringBuffer buf) - throws HibernateException { - - if (component!=null) { - String[] propertyNames = type.getPropertyNames(); - Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) ); - Type[] subtypes = type.getSubtypes(); - for (int i=0; iRestrictions. - * @see Restrictions + * Factory for Criterion objects. Deprecated! + * * @author Gavin King + * + * @see Restrictions + * + * @deprecated Use {@link Restrictions} instead */ +@Deprecated public final class Expression extends Restrictions { - - private Expression() { - //cannot be instantiated - } - /** - * Apply a constraint expressed in SQL, with the given JDBC - * parameters. Any occurrences of {alias} will be + * Apply a constraint expressed in SQL, with JDBC parameters. Any occurrences of {alias} will be * replaced by the table alias. * - * @deprecated use {@link org.hibernate.criterion.Restrictions#sqlRestriction(String, Object[], Type[])} - * @param sql - * @param values - * @param types + * @param sql The sql + * @param values The parameter values + * @param types The parameter types + * * @return Criterion + * + * @deprecated use {@link org.hibernate.criterion.Restrictions#sqlRestriction(String, Object[], Type[])} */ + @Deprecated public static Criterion sql(String sql, Object[] values, Type[] types) { - return new SQLCriterion(sql, values, types); + return new SQLCriterion( sql, values, types ); } + /** - * Apply a constraint expressed in SQL, with the given JDBC - * parameter. Any occurrences of {alias} will be replaced - * by the table alias. + * Apply a constraint expressed in SQL, with a JDBC parameter. Any occurrences of {alias} will be + * replaced by the table alias. * - * @deprecated use {@link org.hibernate.criterion.Restrictions#sqlRestriction(String, Object, Type)} - * @param sql - * @param value - * @param type + * @param sql The sql + * @param value The parameter value + * @param type The parameter type + * * @return Criterion + * + * @deprecated use {@link org.hibernate.criterion.Restrictions#sqlRestriction(String, Object, Type)} */ + @Deprecated public static Criterion sql(String sql, Object value, Type type) { - return new SQLCriterion(sql, new Object[] { value }, new Type[] { type } ); + return new SQLCriterion( sql, value, type ); } + /** - * Apply a constraint expressed in SQL. Any occurrences of {alias} - * will be replaced by the table alias. + * Apply a constraint expressed in SQL with no parameters. Any occurrences of {alias} will be + * replaced by the table alias. * - * @deprecated use {@link org.hibernate.criterion.Restrictions#sqlRestriction(String)} - * @param sql + * @param sql The sql + * * @return Criterion + * + * @deprecated use {@link org.hibernate.criterion.Restrictions#sqlRestriction(String)} */ + @Deprecated public static Criterion sql(String sql) { - return new SQLCriterion(sql, ArrayHelper.EMPTY_OBJECT_ARRAY, ArrayHelper.EMPTY_TYPE_ARRAY); + return new SQLCriterion( sql ); } + private Expression() { + //cannot be instantiated + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierEqExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierEqExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierEqExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierEqExpression.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,48 +20,49 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; - import org.hibernate.Criteria; -import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; -import org.hibernate.util.StringHelper; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.util.StringHelper; /** * An identifier constraint + * * @author Gavin King */ public class IdentifierEqExpression implements Criterion { - private final Object value; + /** + * Constructs an IdentifierEqExpression + * + * @param value The identifier value + * + * @see Restrictions#idEq + */ protected IdentifierEqExpression(Object value) { this.value = value; } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) { + final String[] columns = criteriaQuery.getIdentifierColumns( criteria ); - String[] columns = criteriaQuery.getIdentifierColumns(criteria); - - String result = StringHelper.join( - " and ", - StringHelper.suffix( columns, " = ?" ) - ); - if (columns.length>1) result = '(' + result + ')'; + String result = StringHelper.join( " and ", StringHelper.suffix( columns, " = ?" ) ); + if ( columns.length > 1) { + result = '(' + result + ')'; + } return result; - - //TODO: get SQL rendering out of this package! } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new TypedValue[] { criteriaQuery.getTypedIdentifierValue(criteria, value) }; + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) { + return new TypedValue[] { criteriaQuery.getTypedIdentifierValue( criteria, value ) }; } + @Override public String toString() { return "id = " + value; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierProjection.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/IdentifierProjection.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,65 +20,77 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; -import org.hibernate.HibernateException; +import org.hibernate.internal.util.StringHelper; import org.hibernate.type.Type; -import org.hibernate.util.StringHelper; /** * A property value, or grouped property value + * * @author Gavin King */ public class IdentifierProjection extends SimpleProjection { - private boolean grouped; - - protected IdentifierProjection(boolean grouped) { - this.grouped = grouped; - } - + + /** + * Constructs a non-grouped identifier projection + * + * @see Projections#id + */ protected IdentifierProjection() { - this(false); + this( false ); } - - public String toString() { - return "id"; + + /** + * + * Not used externally + */ + private IdentifierProjection(boolean grouped) { + this.grouped = grouped; } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new Type[] { criteriaQuery.getIdentifierType(criteria) }; + @Override + public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) { + return new Type[] { criteriaQuery.getIdentifierType( criteria ) }; } - public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) - throws HibernateException { - StringBuffer buf = new StringBuffer(); - String[] cols = criteriaQuery.getIdentifierColumns(criteria); + @Override + public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) { + final StringBuilder buf = new StringBuilder(); + final String[] cols = criteriaQuery.getIdentifierColumns( criteria ); for ( int i=0; i1 ) singleValueParam = '(' + singleValueParam + ')'; - String params = values.length>0 ? - StringHelper.repeat( singleValueParam + ", ", values.length-1 ) + singleValueParam : - ""; - String cols = StringHelper.join(", ", columns); - if ( columns.length>1 ) cols = '(' + cols + ')'; - return cols + " in (" + params + ')'; + @Override + public String toSqlString( Criteria criteria, CriteriaQuery criteriaQuery ) { + final String[] columns = criteriaQuery.findColumns( propertyName, criteria ); + if ( criteriaQuery.getFactory().getDialect().supportsRowValueConstructorSyntaxInInList() || columns.length <= 1 ) { + String singleValueParam = StringHelper.repeat( "?, ", columns.length - 1 ) + "?"; + if ( columns.length > 1 ) { + singleValueParam = '(' + singleValueParam + ')'; + } + final String params = values.length > 0 + ? StringHelper.repeat( singleValueParam + ", ", values.length - 1 ) + singleValueParam + : ""; + String cols = StringHelper.join( ", ", columns ); + if ( columns.length > 1 ) { + cols = '(' + cols + ')'; + } + return cols + " in (" + params + ')'; + } + else { + String cols = " ( " + StringHelper.join( " = ? and ", columns ) + "= ? ) "; + cols = values.length > 0 + ? StringHelper.repeat( cols + "or ", values.length - 1 ) + cols + : ""; + cols = " ( " + cols + " ) "; + return cols; + } } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - ArrayList list = new ArrayList(); - Type type = criteriaQuery.getTypeUsingProjection(criteria, propertyName); + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) { + final ArrayList list = new ArrayList(); + final Type type = criteriaQuery.getTypeUsingProjection( criteria, propertyName ); if ( type.isComponentType() ) { - AbstractComponentType actype = (AbstractComponentType) type; - Type[] types = actype.getSubtypes(); - for ( int i=0; i conditions = new ArrayList(); - private final List criteria = new ArrayList(); - private final String op; - - protected Junction(String op) { - this.op = op; + protected Junction(Nature nature) { + this.nature = nature; } - + + protected Junction(Nature nature, Criterion... criterion) { + this( nature ); + Collections.addAll( conditions, criterion ); + } + + /** + * Adds a criterion to the junction (and/or) + * + * @param criterion The criterion to add + * + * @return {@code this}, for method chaining + */ public Junction add(Criterion criterion) { - criteria.add(criterion); + conditions.add( criterion ); return this; } - public String getOp() { - return op; + public Nature getNature() { + return nature; } - public TypedValue[] getTypedValues(Criteria crit, CriteriaQuery criteriaQuery) - throws HibernateException { - ArrayList typedValues = new ArrayList(); - Iterator iter = criteria.iterator(); - while ( iter.hasNext() ) { - TypedValue[] subvalues = ( (Criterion) iter.next() ).getTypedValues(crit, criteriaQuery); - for ( int i=0; i conditions() { + return conditions; + } + + @Override + public TypedValue[] getTypedValues(Criteria crit, CriteriaQuery criteriaQuery) throws HibernateException { + final ArrayList typedValues = new ArrayList(); + for ( Criterion condition : conditions ) { + final TypedValue[] subValues = condition.getTypedValues( crit, criteriaQuery ); + Collections.addAll( typedValues, subValues ); } - return (TypedValue[]) typedValues.toArray( new TypedValue[ typedValues.size() ] ); + return typedValues.toArray( new TypedValue[ typedValues.size() ] ); } - public String toSqlString(Criteria crit, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public String toSqlString(Criteria crit, CriteriaQuery criteriaQuery) throws HibernateException { + if ( conditions.size()==0 ) { + return "1=1"; + } - if ( criteria.size()==0 ) return "1=1"; - - StringBuffer buffer = new StringBuffer() - .append('('); - Iterator iter = criteria.iterator(); - while ( iter.hasNext() ) { - buffer.append( ( (Criterion) iter.next() ).toSqlString(crit, criteriaQuery) ); - if ( iter.hasNext() ) buffer.append(' ').append(op).append(' '); + final StringBuilder buffer = new StringBuilder().append( '(' ); + final Iterator itr = conditions.iterator(); + while ( itr.hasNext() ) { + buffer.append( ( (Criterion) itr.next() ).toSqlString( crit, criteriaQuery ) ); + if ( itr.hasNext() ) { + buffer.append( ' ' ) + .append( nature.getOperator() ) + .append( ' ' ); + } } - return buffer.append(')').toString(); + + return buffer.append( ')' ).toString(); } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { - return '(' + StringHelper.join( ' ' + op + ' ', criteria.iterator() ) + ')'; + return '(' + StringHelper.join( ' ' + nature.getOperator() + ' ', conditions.iterator() ) + ')'; } + /** + * The type of junction + */ + public static enum Nature { + /** + * An AND + */ + AND, + /** + * An OR + */ + OR; + + /** + * The corresponding SQL operator + * + * @return SQL operator + */ + public String getOperator() { + return name().toLowerCase(); + } + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/LikeExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/LikeExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/LikeExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/LikeExpression.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,14 +20,13 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.dialect.Dialect; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; /** * A criterion representing a "like" expression @@ -52,16 +51,12 @@ this.ignoreCase = ignoreCase; } - protected LikeExpression( - String propertyName, - String value) { + protected LikeExpression(String propertyName, String value) { this( propertyName, value, null, false ); } - protected LikeExpression( - String propertyName, - String value, - MatchMode matchMode) { + @SuppressWarnings("UnusedDeclaration") + protected LikeExpression(String propertyName, String value, MatchMode matchMode) { this( propertyName, matchMode.toMatchString( value ) ); } @@ -74,26 +69,33 @@ this( propertyName, matchMode.toMatchString( value ), escapeChar, ignoreCase ); } - public String toSqlString( - Criteria criteria, - CriteriaQuery criteriaQuery) throws HibernateException { - Dialect dialect = criteriaQuery.getFactory().getDialect(); - String[] columns = criteriaQuery.getColumnsUsingProjection( criteria, propertyName ); + @Override + public String toSqlString(Criteria criteria,CriteriaQuery criteriaQuery) { + final Dialect dialect = criteriaQuery.getFactory().getDialect(); + final String[] columns = criteriaQuery.findColumns( propertyName, criteria ); if ( columns.length != 1 ) { throw new HibernateException( "Like may only be used with single-column properties" ); } - String lhs = ignoreCase - ? dialect.getLowercaseFunction() + '(' + columns[0] + ')' - : columns[0]; - return lhs + " like ?" + ( escapeChar == null ? "" : " escape \'" + escapeChar + "\'" ); + final String escape = escapeChar == null ? "" : " escape \'" + escapeChar + "\'"; + final String column = columns[0]; + if ( ignoreCase ) { + if ( dialect.supportsCaseInsensitiveLike() ) { + return column +" " + dialect.getCaseInsensitiveLike() + " ?" + escape; + } + else { + return dialect.getLowercaseFunction() + '(' + column + ')' + " like ?" + escape; + } + } + else { + return column + " like ?" + escape; + } } - public TypedValue[] getTypedValues( - Criteria criteria, - CriteriaQuery criteriaQuery) throws HibernateException { - return new TypedValue[] { - criteriaQuery.getTypedValue( criteria, propertyName, value.toString().toLowerCase() ) - }; + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) { + final String matchValue = ignoreCase ? value.toString().toLowerCase() : value.toString(); + + return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, matchValue ) }; } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/LogicalExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/LogicalExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/LogicalExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/LogicalExpression.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,21 +20,18 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; - import org.hibernate.Criteria; -import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; /** * Superclass of binary logical expressions + * * @author Gavin King */ public class LogicalExpression implements Criterion { - private final Criterion lhs; private final Criterion rhs; private final String op; @@ -45,33 +42,33 @@ this.op = op; } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) { + final TypedValue[] lhsTypedValues = lhs.getTypedValues( criteria, criteriaQuery ); + final TypedValue[] rhsTypedValues = rhs.getTypedValues( criteria, criteriaQuery ); - TypedValue[] lhstv = lhs.getTypedValues(criteria, criteriaQuery); - TypedValue[] rhstv = rhs.getTypedValues(criteria, criteriaQuery); - TypedValue[] result = new TypedValue[ lhstv.length + rhstv.length ]; - System.arraycopy(lhstv, 0, result, 0, lhstv.length); - System.arraycopy(rhstv, 0, result, lhstv.length, rhstv.length); + final TypedValue[] result = new TypedValue[ lhsTypedValues.length + rhsTypedValues.length ]; + System.arraycopy( lhsTypedValues, 0, result, 0, lhsTypedValues.length ); + System.arraycopy( rhsTypedValues, 0, result, lhsTypedValues.length, rhsTypedValues.length ); return result; } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - - return '(' + - lhs.toSqlString(criteria, criteriaQuery) + - ' ' + - getOp() + - ' ' + - rhs.toSqlString(criteria, criteriaQuery) + - ')'; + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) { + return '(' + + lhs.toSqlString( criteria, criteriaQuery ) + + ' ' + + getOp() + + ' ' + + rhs.toSqlString( criteria, criteriaQuery ) + + ')'; } public String getOp() { return op; } + @Override public String toString() { return lhs.toString() + ' ' + getOp() + ' ' + rhs.toString(); } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/NaturalIdentifier.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/NaturalIdentifier.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/NaturalIdentifier.java 17 Aug 2012 14:33:48 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/NaturalIdentifier.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 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,31 +20,71 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; /** + * An expression pertaining to an entity's defined natural identifier + * * @author Gavin King + * + * @see org.hibernate.Session#byNaturalId(Class) + * @see org.hibernate.Session#byNaturalId(String) + * @see org.hibernate.Session#bySimpleNaturalId(Class) + * @see org.hibernate.Session#bySimpleNaturalId(String) */ public class NaturalIdentifier implements Criterion { - - private Junction conjunction = new Conjunction(); + private final Conjunction conjunction = new Conjunction(); + @Override public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { - return conjunction.getTypedValues(criteria, criteriaQuery); + return conjunction.getTypedValues( criteria, criteriaQuery ); } + @Override public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { - return conjunction.toSqlString(criteria, criteriaQuery); + return conjunction.toSqlString( criteria, criteriaQuery ); } - + + /** + * Get a map of set of the natural identifier values set on this criterion (for composite natural identifiers + * this need not be the full set of properties). + * + * @return The value map. + */ + public Map getNaturalIdValues() { + final Map naturalIdValueMap = new ConcurrentHashMap(); + for ( Criterion condition : conjunction.conditions() ) { + if ( !SimpleExpression.class.isInstance( condition ) ) { + continue; + } + final SimpleExpression equalsCondition = SimpleExpression.class.cast( condition ); + if ( !"=".equals( equalsCondition.getOp() ) ) { + continue; + } + + naturalIdValueMap.put( equalsCondition.getPropertyName(), equalsCondition.getValue() ); + } + return naturalIdValueMap; + } + + /** + * Set a natural identifier value for this expression + * + * @param property The specific property name + * @param value The value to use + * + * @return {@code this}, for method chaining + */ public NaturalIdentifier set(String property, Object value) { - conjunction.add( Restrictions.eq(property, value) ); + conjunction.add( Restrictions.eq( property, value ) ); return this; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotEmptyExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/NotEmptyExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotEmptyExpression.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotEmptyExpression.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,19 +20,27 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; /** + * An expression asserting that a collection property is empty + * * @author Gavin King */ public class NotEmptyExpression extends AbstractEmptinessExpression implements Criterion { - + /** + * Constructs an EmptyExpression + * + * @param propertyName The collection property name + * + * @see Restrictions#isNotEmpty + */ protected NotEmptyExpression(String propertyName) { super( propertyName ); } + @Override protected boolean excludeEmpty() { return true; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/NotExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotExpression.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotExpression.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -23,41 +23,42 @@ * */ package org.hibernate.criterion; - - import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.dialect.MySQLDialect; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; /** - * Negates another criterion + * A criterion that is a wrapper for another, negating the wrapped one. + * * @author Gavin King */ public class NotExpression implements Criterion { - private Criterion criterion; + /** + * Constructs a NotExpression + * + * @param criterion The expression to wrap and negate + * + * @see Restrictions#not + */ protected NotExpression(Criterion criterion) { this.criterion = criterion; } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - if ( criteriaQuery.getFactory().getDialect() instanceof MySQLDialect ) { - return "not (" + criterion.toSqlString(criteria, criteriaQuery) + ')'; - } - else { - return "not " + criterion.toSqlString(criteria, criteriaQuery); - } + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + return criteriaQuery.getFactory().getDialect().getNotExpression( + criterion.toSqlString( criteria, criteriaQuery ) + ); } - public TypedValue[] getTypedValues( - Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return criterion.getTypedValues(criteria, criteriaQuery); + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + return criterion.getTypedValues( criteria, criteriaQuery ); } + @Override public String toString() { return "not " + criterion.toString(); } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotNullExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/NotNullExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotNullExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/NotNullExpression.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,48 +20,47 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; - import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; -import org.hibernate.util.StringHelper; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.util.StringHelper; /** * Constrains a property to be non-null + * * @author Gavin King */ public class NotNullExpression implements Criterion { + private static final TypedValue[] NO_VALUES = new TypedValue[0]; private final String propertyName; - private static final TypedValue[] NO_VALUES = new TypedValue[0]; - protected NotNullExpression(String propertyName) { this.propertyName = propertyName; } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final String[] columns = criteriaQuery.findColumns( propertyName, criteria ); String result = StringHelper.join( - " or ", - StringHelper.suffix( columns, " is not null" ) + " or ", + StringHelper.suffix( columns, " is not null" ) ); - if (columns.length>1) result = '(' + result + ')'; + if ( columns.length > 1 ) { + result = '(' + result + ')'; + } return result; - - //TODO: get SQL rendering out of this package! } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { return NO_VALUES; } + @Override public String toString() { return propertyName + " is not null"; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/NullExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/NullExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/NullExpression.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/NullExpression.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -23,45 +23,51 @@ * */ package org.hibernate.criterion; - - import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; -import org.hibernate.util.StringHelper; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.util.StringHelper; /** * Constrains a property to be null + * * @author Gavin King */ public class NullExpression implements Criterion { + private static final TypedValue[] NO_VALUES = new TypedValue[0]; private final String propertyName; - private static final TypedValue[] NO_VALUES = new TypedValue[0]; - + /** + * Constructs a NullExpression + * + * @param propertyName The name of the property to check for null + * + * @see Restrictions#isNull + */ protected NullExpression(String propertyName) { this.propertyName = propertyName; } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final String[] columns = criteriaQuery.findColumns( propertyName, criteria ); String result = StringHelper.join( - " and ", - StringHelper.suffix( columns, " is null" ) + " and ", + StringHelper.suffix( columns, " is null" ) ); - if (columns.length>1) result = '(' + result + ')'; + if ( columns.length > 1 ) { + result = '(' + result + ')'; + } return result; - - //TODO: get SQL rendering out of this package! } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { return NO_VALUES; } + @Override public String toString() { return propertyName + " is null"; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Projection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Projection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Projection.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Projection.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,85 +20,117 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; - import java.io.Serializable; import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.type.Type; /** - * An object-oriented representation of a query result set projection - * in a Criteria query. Built-in projection types are provided - * by the Projections factory class. - * This interface might be implemented by application classes that - * define custom projections. + * An object-oriented representation of a query result set projection in a {@link Criteria} query. + * Built-in projection types are provided by the {@link Projections} factory class. This interface might be + * implemented by application classes that define custom projections. * - * @see Projections - * @see org.hibernate.Criteria * @author Gavin King + * @author Steve Ebersole + * + * @see Projections + * @see Criteria */ public interface Projection extends Serializable { /** - * Render the SQL fragment - * @param criteriaQuery - * @param columnAlias - * @return String - * @throws HibernateException + * Render the SQL fragment to be used in the SELECT clause. + * + * @param criteria The local criteria to which this project is attached (for resolution). + * @param position The number of columns rendered in the SELECT clause before this projection. Generally + * speaking this is useful to ensure uniqueness of the individual columns aliases. + * @param criteriaQuery The overall criteria query instance. + * @return The SQL fragment to plug into the SELECT + * @throws HibernateException Indicates a problem performing the rendering */ - public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) - throws HibernateException; - + public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) + throws HibernateException; + /** - * Render the SQL fragment to be used in the group by clause - * @param criteriaQuery - * @param columnAlias - * @return String - * @throws HibernateException + * Render the SQL fragment to be used in the GROUP BY clause + * + * @param criteria The local criteria to which this project is attached (for resolution). + * @param criteriaQuery The overall criteria query instance. + * @return The SQL fragment to plug into the GROUP BY + * @throws HibernateException Indicates a problem performing the rendering */ - public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException; - + public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) + throws HibernateException; + /** - * Return types returned by the rendered SQL fragment - * @param criteria - * @param criteriaQuery - * @return Type[] - * @throws HibernateException + * Types returned by the rendered SQL {@link #toSqlString fragment}. In other words what are the types + * that would represent the values this projection asked to be pulled into the result set? + * + * @param criteria The local criteria to which this project is attached (for resolution). + * @param criteriaQuery The overall criteria query instance. + * @return The return types. + * @throws HibernateException Indicates a problem resolving the types */ - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException; + public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) + throws HibernateException; + /** - * Return types for a particular user-visible alias + * Get the return types for a particular user-visible alias. + *

+ * Differs from {@link #getTypes(org.hibernate.Criteria, CriteriaQuery)} in that here we are only interested in + * the types related to the given criteria-level alias. + * + * @param alias The criteria-level alias for which to find types. + * @param criteria The local criteria to which this project is attached (for resolution). + * @param criteriaQuery The overall criteria query instance. + * @return The return types; expected to return null if this projection does not understand this alias. + * @throws HibernateException Indicates a problem resolving the types */ - public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException; - + public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) + throws HibernateException; + + /** - * Get the SQL select clause column aliases + * Get the SQL column aliases used by this projection for the columns it writes for inclusion into the + * SELECT clause ({@link #toSqlString}. Hibernate always uses column aliases to extract data from the + * JDBC {@link java.sql.ResultSet}, so it is important that these be implemented correctly in order for + * Hibernate to be able to extract these val;ues correctly. + * + * @param position Just as in {@link #toSqlString}, represents the number of columns rendered + * prior to this projection. + * @return The columns aliases. */ - public String[] getColumnAliases(int loc); + public String[] getColumnAliases(int position); + /** - * Get the SQL select clause column aliases for a particular - * user-visible alias + * Get the SQL column aliases used by this projection for the columns it writes for inclusion into the + * SELECT clause ({@link #toSqlString} for a particular criteria-level alias. + * + * @param alias The criteria-level alias + * @param position Just as in {@link #toSqlString}, represents the number of columns rendered + * prior to this projection. + * @return The columns aliases pertaining to a particular criteria-level alias; expected to return null if + * this projection does not understand this alias. */ - public String[] getColumnAliases(String alias, int loc); - + public String[] getColumnAliases(String alias, int position); + /** - * Get the user-visible aliases for this projection - * (ie. the ones that will be passed to the - * ResultTransformer) + * Get the criteria-level aliases for this projection (ie. the ones that will be passed to the + * {@link org.hibernate.transform.ResultTransformer}) + * + * @return The aliases */ public String[] getAliases(); - + /** - * Does this projection specify grouping attributes? + * Is this projection fragment (SELECT clause) also part of the GROUP BY + * + * @return True if the projection is also part of the GROUP BY; false otherwise. */ public boolean isGrouped(); - + } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/ProjectionList.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/ProjectionList.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/ProjectionList.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/ProjectionList.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,129 +20,223 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.hibernate.Criteria; import org.hibernate.HibernateException; import org.hibernate.type.Type; -import org.hibernate.util.ArrayHelper; /** + * A projection that wraps other projections to allow selecting multiple values. + * * @author Gavin King */ -public class ProjectionList implements Projection { - - private List elements = new ArrayList(); - - protected ProjectionList() {} - +public class ProjectionList implements EnhancedProjection { + private List elements = new ArrayList(); + + /** + * Constructs a ProjectionList + * + * @see Projections#projectionList() + */ + protected ProjectionList() { + } + + /** + * Lol + * + * @return duh + * + * @deprecated an instance factory method does not make sense + * + * @see Projections#projectionList() + */ + @Deprecated public ProjectionList create() { return new ProjectionList(); } - - public ProjectionList add(Projection proj) { - elements.add(proj); + + /** + * Add a projection to this list of projections + * + * @param projection The projection to add + * + * @return {@code this}, for method chaining + */ + public ProjectionList add(Projection projection) { + elements.add( projection ); return this; } + /** + * Adds a projection to this list of projections after wrapping it with an alias + * + * @param projection The projection to add + * @param alias The alias to apply to the projection + * + * @return {@code this}, for method chaining + * + * @see Projections#alias + */ public ProjectionList add(Projection projection, String alias) { - return add( Projections.alias(projection, alias) ); + return add( Projections.alias( projection, alias ) ); } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - List types = new ArrayList( getLength() ); - for ( int i=0; i types = new ArrayList( getLength() ); + for ( Projection projection : elements ) { + final Type[] elemTypes = projection.getTypes( criteria, criteriaQuery ); + Collections.addAll( types, elemTypes ); } + return types.toArray( new Type[types.size()] ); + } + + @Override + public String toSqlString(Criteria criteria, int loc, CriteriaQuery criteriaQuery) throws HibernateException { + final StringBuilder buf = new StringBuilder(); + String separator = ""; + + for ( Projection projection : elements ) { + buf.append( separator ).append( projection.toSqlString( criteria, loc, criteriaQuery ) ); + loc += getColumnAliases( loc, criteria, criteriaQuery, projection ).length; + separator = ", "; + } return buf.toString(); } - - public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - StringBuffer buf = new StringBuffer(); - for ( int i=0; i2 ) buf.setLength( buf.length()-2 ); //pull off the last ", " return buf.toString(); } - - public String[] getColumnAliases(int loc) { - List result = new ArrayList( getLength() ); - for ( int i=0; i result = new ArrayList( getLength() ); + for ( Projection projection : elements ) { + final String[] aliases = projection.getColumnAliases( position ); + Collections.addAll( result, aliases ); + position += aliases.length; } - return ArrayHelper.toStringArray(result); + return result.toArray( new String[ result.size() ] ); } - public String[] getColumnAliases(String alias, int loc) { - for ( int i=0; i result = new ArrayList( getLength() ); + for ( Projection projection : elements ) { + final String[] aliases = getColumnAliases( position, criteria, criteriaQuery, projection ); + Collections.addAll( result, aliases ); + position += aliases.length; } + return result.toArray( new String[result.size()] ); + } + + @Override + public String[] getColumnAliases(String alias, final int loc) { + int position = loc; + for ( Projection projection : elements ) { + final String[] aliases = projection.getColumnAliases( alias, position ); + if ( aliases != null ) { + return aliases; + } + position += projection.getColumnAliases( position ).length; + } return null; } + @Override + public String[] getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery) { + int position = loc; + for ( Projection projection : elements ) { + final String[] aliases = getColumnAliases( alias, position, criteria, criteriaQuery, projection ); + if ( aliases != null ) { + return aliases; + } + position += getColumnAliases( position, criteria, criteriaQuery, projection ).length; + } + return null; + } + + private static String[] getColumnAliases(int loc, Criteria criteria, CriteriaQuery criteriaQuery, Projection projection) { + return projection instanceof EnhancedProjection + ? ( (EnhancedProjection) projection ).getColumnAliases( loc, criteria, criteriaQuery ) + : projection.getColumnAliases( loc ); + } + + private static String[] getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery, Projection projection) { + return projection instanceof EnhancedProjection + ? ( (EnhancedProjection) projection ).getColumnAliases( alias, loc, criteria, criteriaQuery ) + : projection.getColumnAliases( alias, loc ); + } + + @Override public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) { - for ( int i=0; i result = new ArrayList( getLength() ); + for ( Projection projection : elements ) { + final String[] aliases = projection.getAliases(); + Collections.addAll( result, aliases ); } - return ArrayHelper.toStringArray(result); - + return result.toArray( new String[result.size()] ); } - + + /** + * Access a wrapped projection by index + * + * @param i The index of the projection to return + * + * @return The projection + */ + @SuppressWarnings("UnusedDeclaration") public Projection getProjection(int i) { - return (Projection) elements.get(i); + return elements.get( i ); } - + public int getLength() { return elements.size(); } - + + @Override public String toString() { return elements.toString(); } - public boolean isGrouped() { - for ( int i=0; icriterion package may be used by applications as a framework for building * new kinds of Projection. However, it is intended that most applications will - * simply use the built-in projection types via the static factory methods of this class.
- *
+ * simply use the built-in projection types via the static factory methods of this class. + * * The factory methods that take an alias allow the projected value to be referred to by * criterion and order instances. * - * @see org.hibernate.Criteria - * @see Restrictions factory methods for Criterion instances + * See also the {@link Restrictions} factory methods for generating {@link Criterion} instances + * * @author Gavin King + * @author Steve Ebersole + * + * @see org.hibernate.Criteria */ public final class Projections { + /** + * A property value projection + * + * @param propertyName The name of the property whose values should be projected + * + * @return The property projection + * + * @see PropertyProjection + */ + public static PropertyProjection property(String propertyName) { + return new PropertyProjection( propertyName ); + } - private Projections() { - //cannot be instantiated + /** + * A grouping property value projection + * + * @param propertyName The name of the property to group + * + * @return The grouped projection + * + * @see PropertyProjection + */ + public static PropertyProjection groupProperty(String propertyName) { + return new PropertyProjection( propertyName, true ); } - + /** - * Create a distinct projection from a projection + * An identifier value projection. + * + * @return The identifier projection + * + * @see IdentifierProjection */ - public static Projection distinct(Projection proj) { - return new Distinct(proj); + public static IdentifierProjection id() { + return new IdentifierProjection(); } + + /** + * Create a distinct projection from a projection. + * + * @param projection The project to treat distinctly + * + * @return The distinct projection + * + * @see Distinct + */ + public static Projection distinct(Projection projection) { + return new Distinct( projection ); + } /** - * Create a new projection list + * Create a new projection list. + * + * @return The projection list */ public static ProjectionList projectionList() { return new ProjectionList(); } /** * The query row count, ie. count(*) + * + * @return The projection representing the row count + * + * @see RowCountProjection */ public static Projection rowCount() { return new RowCountProjection(); } /** - * A property value count + * A property value count projection + * + * @param propertyName The name of the property to count over + * + * @return The count projection + * + * @see CountProjection */ public static CountProjection count(String propertyName) { - return new CountProjection(propertyName); + return new CountProjection( propertyName ); } /** - * A distinct property value count + * A distinct property value count projection + * + * @param propertyName The name of the property to count over + * + * @return The count projection + * + * @see CountProjection */ public static CountProjection countDistinct(String propertyName) { - return new CountProjection(propertyName).setDistinct(); + return new CountProjection( propertyName ).setDistinct(); } /** - * A property maximum value + * A property maximum value projection + * + * @param propertyName The property for which to find the max + * + * @return the max projection + * + * @see AggregateProjection */ public static AggregateProjection max(String propertyName) { - return new AggregateProjection("max", propertyName); + return new AggregateProjection( "max", propertyName ); } /** - * A property minimum value + * A property minimum value projection + * + * @param propertyName The property for which to find the min + * + * @return the min projection + * + * @see AggregateProjection */ public static AggregateProjection min(String propertyName) { - return new AggregateProjection("min", propertyName); + return new AggregateProjection( "min", propertyName ); } /** - * A property average value + * A property average value projection + * + * @param propertyName The property over which to find the average + * + * @return the avg projection + * + * @see AvgProjection */ public static AggregateProjection avg(String propertyName) { - return new AvgProjection(propertyName); + return new AvgProjection( propertyName ); } /** - * A property value sum + * A property value sum projection + * + * @param propertyName The property over which to sum + * + * @return the sum projection + * + * @see AggregateProjection */ public static AggregateProjection sum(String propertyName) { - return new AggregateProjection("sum", propertyName); + return new AggregateProjection( "sum", propertyName ); } /** + * Assign an alias to a projection, by wrapping it + * + * @param projection The projection to be aliased + * @param alias The alias to apply + * + * @return The aliased projection + * + * @see AliasedProjection + */ + public static Projection alias(Projection projection, String alias) { + return new AliasedProjection( projection, alias ); + } + + /** * A SQL projection, a typed select clause fragment + * + * @param sql The SQL fragment + * @param columnAliases The column aliases + * @param types The resulting types + * + * @return The SQL projection + * + * @see SQLProjection */ public static Projection sqlProjection(String sql, String[] columnAliases, Type[] types) { - return new SQLProjection(sql, columnAliases, types); + return new SQLProjection( sql, columnAliases, types ); } - + /** * A grouping SQL projection, specifying both select clause and group by clause fragments + * + * @param sql The SQL SELECT fragment + * @param groupBy The SQL GROUP BY fragment + * @param columnAliases The column aliases + * @param types The resulting types + * + * @return The SQL projection + * + * @see SQLProjection */ + @SuppressWarnings("UnusedDeclaration") public static Projection sqlGroupProjection(String sql, String groupBy, String[] columnAliases, Type[] types) { return new SQLProjection(sql, groupBy, columnAliases, types); } - /** - * A grouping property value - */ - public static PropertyProjection groupProperty(String propertyName) { - return new PropertyProjection(propertyName, true); + private Projections() { + //cannot be instantiated } - - /** - * A projected property value - */ - public static PropertyProjection property(String propertyName) { - return new PropertyProjection(propertyName); - } - - /** - * A projected identifier value - */ - public static IdentifierProjection id() { - return new IdentifierProjection(); - } - - /** - * Assign an alias to a projection, by wrapping it - */ - public static Projection alias(Projection projection, String alias) { - return new AliasedProjection(projection, alias); - } + } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertiesSubqueryExpression.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Property.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Property.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Property.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Property.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,237 +20,737 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import java.util.Collection; /** * A factory for property-specific criterion and projection instances + * * @author Gavin King + * @author Steve Ebersole */ public class Property extends PropertyProjection { - //private String propertyName; + /** + * Factory for Property instances. + * + * @param propertyName The name of the property. + * + * @return The Property instance + */ + public static Property forName(String propertyName) { + return new Property( propertyName ); + } + + /** + * Constructs a Property. non-private to allow subclassing. + * + * @param propertyName The property name. + */ protected Property(String propertyName) { - super(propertyName); + super( propertyName ); } + /** + * Creates a BETWEEN restriction for this property between the given min and max + * + * @param min The minimum + * @param max The maximum + * + * @return The BETWEEN restriction + * + * @see Restrictions#between(String, Object, Object) + */ public Criterion between(Object min, Object max) { - return Restrictions.between(getPropertyName(), min, max); + return Restrictions.between( getPropertyName(), min, max ); } + /** + * Creates an IN restriction for this property based on the given list of literals + * + * @param values The literal values + * + * @return The IN restriction + * + * @see Restrictions#in(String, Collection) + */ public Criterion in(Collection values) { - return Restrictions.in(getPropertyName(), values); + return Restrictions.in( getPropertyName(), values ); } + /** + * Creates an IN restriction for this property based on the given list of literals + * + * @param values The literal values + * + * @return The IN restriction + * + * @see Restrictions#in(String, Object[]) + */ public Criterion in(Object[] values) { - return Restrictions.in(getPropertyName(), values); + return Restrictions.in( getPropertyName(), values ); } + /** + * Creates a LIKE restriction for this property + * + * @param value The value to like compare with + * + * @return The LIKE restriction + * + * @see Restrictions#like(String, Object) + */ public SimpleExpression like(Object value) { - return Restrictions.like(getPropertyName(), value); + return Restrictions.like( getPropertyName(), value ); } + /** + * Creates a LIKE restriction for this property + * + * @param value The value to like compare with + * @param matchMode The match mode to apply to the LIKE + * + * @return The LIKE restriction + * + * @see Restrictions#like(String, String, MatchMode) + */ public SimpleExpression like(String value, MatchMode matchMode) { - return Restrictions.like(getPropertyName(), value, matchMode); + return Restrictions.like( getPropertyName(), value, matchMode ); } + /** + * Creates an equality restriction. + * + * @param value The value to check against + * + * @return The equality restriction. + * + * @see Restrictions#eq(String, Object) + */ public SimpleExpression eq(Object value) { - return Restrictions.eq(getPropertyName(), value); + return Restrictions.eq( getPropertyName(), value ); } + /** + * Creates an equality restriction capable of also rendering as IS NULL if the given value is {@code null} + * + * @param value The value to check against + * + * @return The equality restriction. + * + * @see Restrictions#eqOrIsNull(String, Object) + * @see #eq + * @see #isNull + */ + @SuppressWarnings("UnusedDeclaration") + public Criterion eqOrIsNull(Object value) { + return Restrictions.eqOrIsNull( getPropertyName(), value ); + } + + /** + * Creates an non-equality restriction. + * + * @param value The value to check against + * + * @return The non-equality restriction. + * + * @see Restrictions#ne(String, Object) + */ public SimpleExpression ne(Object value) { - return Restrictions.ne(getPropertyName(), value); + return Restrictions.ne( getPropertyName(), value ); } + /** + * Creates an non-equality restriction capable of also rendering as IS NOT NULL if the given value is {@code null} + * + * @param value The value to check against + * + * @return The non-equality restriction. + * + * @see Restrictions#neOrIsNotNull(String, Object) + * @see #ne + * @see #isNotNull + */ + @SuppressWarnings("UnusedDeclaration") + public Criterion neOrIsNotNull(Object value) { + return Restrictions.neOrIsNotNull( getPropertyName(), value ); + } + + /** + * Create a greater-than restriction based on this property + * + * @param value The value to check against + * + * @return The greater-than restriction + * + * @see Restrictions#gt(String, Object) + */ public SimpleExpression gt(Object value) { - return Restrictions.gt(getPropertyName(), value); + return Restrictions.gt( getPropertyName(), value ); } + /** + * Create a less-than restriction based on this property + * + * @param value The value to check against + * + * @return The less-than restriction + * + * @see Restrictions#lt(String, Object) + */ public SimpleExpression lt(Object value) { - return Restrictions.lt(getPropertyName(), value); + return Restrictions.lt( getPropertyName(), value ); } + /** + * Create a less-than-or-equal-to restriction based on this property + * + * @param value The value to check against + * + * @return The less-than-or-equal-to restriction + * + * @see Restrictions#le(String, Object) + */ public SimpleExpression le(Object value) { - return Restrictions.le(getPropertyName(), value); + return Restrictions.le( getPropertyName(), value ); } + /** + * Create a greater-than-or-equal-to restriction based on this property + * + * @param value The value to check against + * + * @return The greater-than-or-equal-to restriction + * + * @see Restrictions#ge(String, Object) + */ public SimpleExpression ge(Object value) { - return Restrictions.ge(getPropertyName(), value); + return Restrictions.ge( getPropertyName(), value ); } + /** + * Creates an equality restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#eqProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") public PropertyExpression eqProperty(Property other) { return Restrictions.eqProperty( getPropertyName(), other.getPropertyName() ); } + /** + * Creates an equality restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#eqProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") + public PropertyExpression eqProperty(String other) { + return Restrictions.eqProperty( getPropertyName(), other ); + } + + /** + * Creates an non-equality restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#neProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") public PropertyExpression neProperty(Property other) { return Restrictions.neProperty( getPropertyName(), other.getPropertyName() ); } - - public PropertyExpression leProperty(Property other) { - return Restrictions.leProperty( getPropertyName(), other.getPropertyName() ); - } - public PropertyExpression geProperty(Property other) { - return Restrictions.geProperty( getPropertyName(), other.getPropertyName() ); + /** + * Creates an non-equality restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#neProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") + public PropertyExpression neProperty(String other) { + return Restrictions.neProperty( getPropertyName(), other ); } - - public PropertyExpression ltProperty(Property other) { - return Restrictions.ltProperty( getPropertyName(), other.getPropertyName() ); - } - public PropertyExpression gtProperty(Property other) { - return Restrictions.gtProperty( getPropertyName(), other.getPropertyName() ); + /** + * Creates an less-than-or-equal-to restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#leProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") + public PropertyExpression leProperty(Property other) { + return Restrictions.leProperty( getPropertyName(), other.getPropertyName() ); } - - public PropertyExpression eqProperty(String other) { - return Restrictions.eqProperty( getPropertyName(), other ); - } - public PropertyExpression neProperty(String other) { - return Restrictions.neProperty( getPropertyName(), other ); - } - + /** + * Creates an less-than-or-equal-to restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#leProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") public PropertyExpression leProperty(String other) { return Restrictions.leProperty( getPropertyName(), other ); } + /** + * Creates an greater-than-or-equal-to restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#geProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") + public PropertyExpression geProperty(Property other) { + return Restrictions.geProperty( getPropertyName(), other.getPropertyName() ); + } + + /** + * Creates an greater-than-or-equal-to restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#geProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") public PropertyExpression geProperty(String other) { return Restrictions.geProperty( getPropertyName(), other ); } - + + /** + * Creates an less-than restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#ltProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") + public PropertyExpression ltProperty(Property other) { + return Restrictions.ltProperty( getPropertyName(), other.getPropertyName() ); + } + + /** + * Creates an less-than restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#ltProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") public PropertyExpression ltProperty(String other) { return Restrictions.ltProperty( getPropertyName(), other ); } + /** + * Creates an greater-than restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#geProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") + public PropertyExpression gtProperty(Property other) { + return Restrictions.gtProperty( getPropertyName(), other.getPropertyName() ); + } + + /** + * Creates an greater-than restriction between 2 properties + * + * @param other The other property to compare against + * + * @return The restriction + * + * @see Restrictions#geProperty(String, String) + */ + @SuppressWarnings("UnusedDeclaration") public PropertyExpression gtProperty(String other) { return Restrictions.gtProperty( getPropertyName(), other ); } - + + /** + * Creates a NULL restriction + * + * @return The restriction + * + * @see Restrictions#isNull(String) + */ public Criterion isNull() { - return Restrictions.isNull(getPropertyName()); + return Restrictions.isNull( getPropertyName() ); } + /** + * Creates a NOT NULL restriction + * + * @return The restriction + * + * @see Restrictions#isNotNull(String) + */ public Criterion isNotNull() { - return Restrictions.isNotNull(getPropertyName()); + return Restrictions.isNotNull( getPropertyName() ); } + /** + * Creates a restriction to check that a collection is empty + * + * @return The restriction + * + * @see Restrictions#isEmpty(String) + */ public Criterion isEmpty() { - return Restrictions.isEmpty(getPropertyName()); + return Restrictions.isEmpty( getPropertyName() ); } + /** + * Creates a restriction to check that a collection is not empty + * + * @return The restriction + * + * @see Restrictions#isNotEmpty(String) + */ public Criterion isNotEmpty() { - return Restrictions.isNotEmpty(getPropertyName()); + return Restrictions.isNotEmpty( getPropertyName() ); } - + + /** + * Creates a property count projection + * + * @return The projection + * + * @see Projections#count + */ public CountProjection count() { - return Projections.count(getPropertyName()); + return Projections.count( getPropertyName() ); } - + + /** + * Creates a property max projection + * + * @return The projection + * + * @see Projections#max + */ public AggregateProjection max() { - return Projections.max(getPropertyName()); + return Projections.max( getPropertyName() ); } + /** + * Creates a property min projection + * + * @return The projection + * + * @see Projections#min + */ public AggregateProjection min() { - return Projections.min(getPropertyName()); + return Projections.min( getPropertyName() ); } + /** + * Creates a property avg projection + * + * @return The projection + * + * @see Projections#avg + */ public AggregateProjection avg() { - return Projections.avg(getPropertyName()); + return Projections.avg( getPropertyName() ); } - - /*public PropertyProjection project() { - return Projections.property(getPropertyName()); - }*/ + /** + * Creates a projection for this property as a group expression + * + * @return The group projection + * + * @see Projections#groupProperty + */ public PropertyProjection group() { - return Projections.groupProperty(getPropertyName()); + return Projections.groupProperty( getPropertyName() ); } - + + /** + * Creates an ascending ordering for this property + * + * @return The order + */ public Order asc() { - return Order.asc(getPropertyName()); + return Order.asc( getPropertyName() ); } + /** + * Creates a descending ordering for this property + * + * @return The order + */ public Order desc() { - return Order.desc(getPropertyName()); + return Order.desc( getPropertyName() ); } - - public static Property forName(String propertyName) { - return new Property(propertyName); - } /** - * Get a component attribute of this property + * Get a component attribute of this property. + * + * @param propertyName The sub property name + * + * @return The property */ public Property getProperty(String propertyName) { return forName( getPropertyName() + '.' + propertyName ); } - + + /** + * Creates a sub-query equality expression for this property + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyEq(String, DetachedCriteria) + */ public Criterion eq(DetachedCriteria subselect) { return Subqueries.propertyEq( getPropertyName(), subselect ); } + /** + * Creates a sub-query non-equality expression for this property + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyNe(String, DetachedCriteria) + */ public Criterion ne(DetachedCriteria subselect) { return Subqueries.propertyNe( getPropertyName(), subselect ); } + /** + * Creates a sub-query less-than expression for this property + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyLt(String, DetachedCriteria) + */ public Criterion lt(DetachedCriteria subselect) { return Subqueries.propertyLt( getPropertyName(), subselect ); } + /** + * Creates a sub-query less-than-or-equal-to expression for this property + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyLe(String, DetachedCriteria) + */ public Criterion le(DetachedCriteria subselect) { return Subqueries.propertyLe( getPropertyName(), subselect ); } + /** + * Creates a sub-query greater-than expression for this property + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyGt(String, DetachedCriteria) + */ public Criterion gt(DetachedCriteria subselect) { return Subqueries.propertyGt( getPropertyName(), subselect ); } + /** + * Creates a sub-query greater-than-or-equal-to expression for this property + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyGe(String, DetachedCriteria) + */ public Criterion ge(DetachedCriteria subselect) { return Subqueries.propertyGe( getPropertyName(), subselect ); } + /** + * Creates a sub-query NOT IN expression for this property. I.e., {@code [prop] NOT IN [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyNotIn(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion notIn(DetachedCriteria subselect) { return Subqueries.propertyNotIn( getPropertyName(), subselect ); } + /** + * Creates a sub-query IN expression for this property. I.e., {@code [prop] IN [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyIn(String, DetachedCriteria) + */ public Criterion in(DetachedCriteria subselect) { return Subqueries.propertyIn( getPropertyName(), subselect ); } + /** + * Creates a equals-all sub-query expression for this property. I.e., {@code [prop] = ALL [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyEqAll(String, DetachedCriteria) + */ public Criterion eqAll(DetachedCriteria subselect) { return Subqueries.propertyEqAll( getPropertyName(), subselect ); } + /** + * Creates a greater-than-all sub-query expression for this property. I.e., {@code [prop] > ALL [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyGtAll(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion gtAll(DetachedCriteria subselect) { return Subqueries.propertyGtAll( getPropertyName(), subselect ); } + /** + * Creates a less-than-all sub-query expression for this property. I.e., {@code [prop] < ALL [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyLtAll(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion ltAll(DetachedCriteria subselect) { return Subqueries.propertyLtAll( getPropertyName(), subselect ); } + /** + * Creates a less-than-or-equal-to-all sub-query expression for this property. I.e., {@code [prop] <= ALL [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyLeAll(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion leAll(DetachedCriteria subselect) { return Subqueries.propertyLeAll( getPropertyName(), subselect ); } + /** + * Creates a greater-than-or-equal-to-all sub-query expression for this property. I.e., {@code [prop] >= ALL [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyGeAll(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion geAll(DetachedCriteria subselect) { return Subqueries.propertyGeAll( getPropertyName(), subselect ); } + /** + * Creates a greater-than-some sub-query expression for this property. I.e., {@code [prop] > SOME [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyGtSome(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion gtSome(DetachedCriteria subselect) { return Subqueries.propertyGtSome( getPropertyName(), subselect ); } + /** + * Creates a less-than-some sub-query expression for this property. I.e., {@code [prop] < SOME [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyLtSome(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion ltSome(DetachedCriteria subselect) { return Subqueries.propertyLtSome( getPropertyName(), subselect ); } + /** + * Creates a less-than-or-equal-to-some sub-query expression for this property. I.e., {@code [prop] <= SOME [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyLeSome(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion leSome(DetachedCriteria subselect) { return Subqueries.propertyLeSome( getPropertyName(), subselect ); } + /** + * Creates a greater-than-or-equal-to-some sub-query expression for this property. I.e., {@code [prop] >= SOME [subquery]} + * + * @param subselect The sub-query + * + * @return The expression + * + * @see Subqueries#propertyGeSome(String, DetachedCriteria) + */ + @SuppressWarnings("UnusedDeclaration") public Criterion geSome(DetachedCriteria subselect) { return Subqueries.propertyGeSome( getPropertyName(), subselect ); } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyExpression.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,57 +20,58 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; -import org.hibernate.util.StringHelper; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.util.StringHelper; /** * superclass for comparisons between two properties (with SQL binary operators) + * * @author Gavin King */ public class PropertyExpression implements Criterion { + private static final TypedValue[] NO_TYPED_VALUES = new TypedValue[0]; private final String propertyName; private final String otherPropertyName; private final String op; - private static final TypedValue[] NO_TYPED_VALUES = new TypedValue[0]; - protected PropertyExpression(String propertyName, String otherPropertyName, String op) { this.propertyName = propertyName; this.otherPropertyName = otherPropertyName; this.op = op; } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - String[] xcols = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); - String[] ycols = criteriaQuery.getColumnsUsingProjection(criteria, otherPropertyName); - String result = StringHelper.join( - " and ", - StringHelper.add(xcols, getOp(), ycols) - ); - if (xcols.length>1) result = '(' + result + ')'; - return result; - //TODO: get SQL rendering out of this package! + public String getOp() { + return op; } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final String[] lhsColumns = criteriaQuery.findColumns( propertyName, criteria ); + final String[] rhsColumns = criteriaQuery.findColumns( otherPropertyName, criteria ); + + final String[] comparisons = StringHelper.add( lhsColumns, getOp(), rhsColumns ); + if ( comparisons.length > 1 ) { + return '(' + StringHelper.join( " and ", comparisons ) + ')'; + } + else { + return comparisons[0]; + } + } + + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) { return NO_TYPED_VALUES; } + @Override public String toString() { return propertyName + getOp() + otherPropertyName; } - public String getOp() { - return op; - } - } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyProjection.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/PropertyProjection.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -23,64 +23,73 @@ * */ package org.hibernate.criterion; - import org.hibernate.Criteria; import org.hibernate.HibernateException; +import org.hibernate.internal.util.StringHelper; import org.hibernate.type.Type; /** * A property value, or grouped property value + * * @author Gavin King + * @author Steve Ebersole */ public class PropertyProjection extends SimpleProjection { - private String propertyName; private boolean grouped; - + protected PropertyProjection(String prop, boolean grouped) { this.propertyName = prop; this.grouped = grouped; } - + protected PropertyProjection(String prop) { - this(prop, false); + this( prop, false ); } + @Override + public boolean isGrouped() { + return grouped; + } + public String getPropertyName() { return propertyName; } - - public String toString() { - return propertyName; - } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new Type[] { criteriaQuery.getType(criteria, propertyName) }; + @Override + public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + return new Type[] { criteriaQuery.getType( criteria, propertyName ) }; } - public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) - throws HibernateException { - return new StringBuffer() - .append( criteriaQuery.getColumn(criteria, propertyName) ) - .append(" as y") - .append(position) - .append('_') - .toString(); + @Override + public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) throws HibernateException { + final StringBuilder buf = new StringBuilder(); + final String[] cols = criteriaQuery.getColumns( propertyName, criteria ); + for ( int i=0; icriterion package may be used by applications as a framework for building * new kinds of Criterion. However, it is intended that most applications will * simply use the built-in criterion types via the static factory methods of this class. * - * @see org.hibernate.Criteria - * @see Projections factory methods for Projection instances + * See also the {@link Projections} factory methods for generating {@link Projection} instances + * * @author Gavin King + * @author Steve Ebersole + * + * @see org.hibernate.Criteria */ public class Restrictions { - - Restrictions() { - //cannot be instantiated - } - /** * Apply an "equal" constraint to the identifier property - * @param propertyName - * @param value + * + * @param value The value to use in comparison + * * @return Criterion + * + * @see IdentifierEqExpression */ public static Criterion idEq(Object value) { - return new IdentifierEqExpression(value); + return new IdentifierEqExpression( value ); } /** * Apply an "equal" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return SimpleExpression + * + * @see SimpleExpression */ public static SimpleExpression eq(String propertyName, Object value) { - return new SimpleExpression(propertyName, value, "="); + return new SimpleExpression( propertyName, value, "=" ); } + /** + * Apply an "equal" constraint to the named property. If the value + * is null, instead apply "is null". + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see #eq + * @see #isNull + */ + public static Criterion eqOrIsNull(String propertyName, Object value) { + return value == null + ? isNull( propertyName ) + : eq( propertyName, value ); + } + + /** * Apply a "not equal" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + + * @see SimpleExpression */ public static SimpleExpression ne(String propertyName, Object value) { - return new SimpleExpression(propertyName, value, "<>"); + return new SimpleExpression( propertyName, value, "<>" ); } + /** + * Apply a "not equal" constraint to the named property. If the value + * is null, instead apply "is not null". + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see #ne + * @see #isNotNull + */ + public static Criterion neOrIsNotNull(String propertyName, Object value) { + return value == null + ? isNotNull( propertyName ) + : ne( propertyName, value ); + } + + /** * Apply a "like" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see SimpleExpression */ public static SimpleExpression like(String propertyName, Object value) { - return new SimpleExpression(propertyName, value, " like "); + // todo : update this to use LikeExpression + return new SimpleExpression( propertyName, value, " like " ); } + /** - * Apply a "like" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * Apply a "like" constraint to the named property using the provided match mode + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * @param matchMode The match mode to use in comparison + * + * @return The Criterion + * + * @see SimpleExpression */ public static SimpleExpression like(String propertyName, String value, MatchMode matchMode) { - return new SimpleExpression(propertyName, matchMode.toMatchString(value), " like " ); + // todo : update this to use LikeExpression + return new SimpleExpression( propertyName, matchMode.toMatchString( value ), " like " ); } + /** - * A case-insensitive "like", similar to Postgres ilike - * operator + * A case-insensitive "like" (similar to Postgres ilike operator) * - * @param propertyName - * @param value - * @return Criterion + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see LikeExpression */ - public static Criterion ilike(String propertyName, String value, MatchMode matchMode) { - return new IlikeExpression(propertyName, value, matchMode); + public static Criterion ilike(String propertyName, Object value) { + if ( value == null ) { + throw new IllegalArgumentException( "Comparison value passed to ilike cannot be null" ); + } + return ilike( propertyName, value.toString(), MatchMode.EXACT ); } + /** - * A case-insensitive "like", similar to Postgres ilike - * operator + * A case-insensitive "like" (similar to Postgres ilike operator) using the provided match mode * - * @param propertyName - * @param value - * @return Criterion + * @param propertyName The name of the property + * @param value The value to use in comparison + * @param matchMode The match mode to use in comparison + * + * @return The Criterion + * + * @see LikeExpression */ - public static Criterion ilike(String propertyName, Object value) { - return new IlikeExpression(propertyName, value); + public static Criterion ilike(String propertyName, String value, MatchMode matchMode) { + if ( value == null ) { + throw new IllegalArgumentException( "Comparison value passed to ilike cannot be null" ); + } + return new LikeExpression( propertyName, value, matchMode, null, true ); } + /** * Apply a "greater than" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see SimpleExpression */ public static SimpleExpression gt(String propertyName, Object value) { - return new SimpleExpression(propertyName, value, ">"); + return new SimpleExpression( propertyName, value, ">" ); } + /** * Apply a "less than" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see SimpleExpression */ public static SimpleExpression lt(String propertyName, Object value) { - return new SimpleExpression(propertyName, value, "<"); + return new SimpleExpression( propertyName, value, "<" ); } + /** * Apply a "less than or equal" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see SimpleExpression */ public static SimpleExpression le(String propertyName, Object value) { - return new SimpleExpression(propertyName, value, "<="); + return new SimpleExpression( propertyName, value, "<=" ); } /** * Apply a "greater than or equal" constraint to the named property - * @param propertyName - * @param value - * @return Criterion + * + * @param propertyName The name of the property + * @param value The value to use in comparison + * + * @return The Criterion + * + * @see SimpleExpression */ public static SimpleExpression ge(String propertyName, Object value) { - return new SimpleExpression(propertyName, value, ">="); + return new SimpleExpression( propertyName, value, ">=" ); } + /** * Apply a "between" constraint to the named property - * @param propertyName - * @param lo value - * @param hi value - * @return Criterion + * + * @param propertyName The name of the property + * @param lo The low value + * @param hi The high value + * + * @return The Criterion + * + * @see BetweenExpression */ public static Criterion between(String propertyName, Object lo, Object hi) { - return new BetweenExpression(propertyName, lo, hi); + return new BetweenExpression( propertyName, lo, hi ); } + /** - * Apply an "in" constraint to the named property - * @param propertyName - * @param values - * @return Criterion + * Apply an "in" constraint to the named property. + * + * @param propertyName The name of the property + * @param values The literal values to use in the IN restriction + * + * @return The Criterion + * + * @see InExpression */ public static Criterion in(String propertyName, Object[] values) { - return new InExpression(propertyName, values); + return new InExpression( propertyName, values ); } + /** - * Apply an "in" constraint to the named property - * @param propertyName - * @param values - * @return Criterion + * Apply an "in" constraint to the named property. + * + * @param propertyName The name of the property + * @param values The literal values to use in the IN restriction + * + * @return The Criterion + * + * @see InExpression */ public static Criterion in(String propertyName, Collection values) { return new InExpression( propertyName, values.toArray() ); } + /** * Apply an "is null" constraint to the named property + * + * @param propertyName The name of the property + * * @return Criterion + * + * @see NullExpression */ public static Criterion isNull(String propertyName) { - return new NullExpression(propertyName); + return new NullExpression( propertyName ); } + /** + * Apply an "is not null" constraint to the named property + * + * @param propertyName The property name + * + * @return The Criterion + * + * @see NotNullExpression + */ + public static Criterion isNotNull(String propertyName) { + return new NotNullExpression( propertyName ); + } + + /** * Apply an "equal" constraint to two properties + * + * @param propertyName One property name + * @param otherPropertyName The other property name + * + * @return The Criterion + * + * @see PropertyExpression */ public static PropertyExpression eqProperty(String propertyName, String otherPropertyName) { - return new PropertyExpression(propertyName, otherPropertyName, "="); + return new PropertyExpression( propertyName, otherPropertyName, "=" ); } + /** * Apply a "not equal" constraint to two properties + * + * @param propertyName One property name + * @param otherPropertyName The other property name + * + * @return The Criterion + * + * @see PropertyExpression */ public static PropertyExpression neProperty(String propertyName, String otherPropertyName) { - return new PropertyExpression(propertyName, otherPropertyName, "<>"); + return new PropertyExpression( propertyName, otherPropertyName, "<>" ); } + /** * Apply a "less than" constraint to two properties + * + * @param propertyName One property name + * @param otherPropertyName The other property name + * + * @return The Criterion + * + * @see PropertyExpression */ public static PropertyExpression ltProperty(String propertyName, String otherPropertyName) { - return new PropertyExpression(propertyName, otherPropertyName, "<"); + return new PropertyExpression( propertyName, otherPropertyName, "<" ); } + /** * Apply a "less than or equal" constraint to two properties + * + * @param propertyName One property name + * @param otherPropertyName The other property name + * + * @return The Criterion + * + * @see PropertyExpression */ public static PropertyExpression leProperty(String propertyName, String otherPropertyName) { - return new PropertyExpression(propertyName, otherPropertyName, "<="); + return new PropertyExpression( propertyName, otherPropertyName, "<=" ); } + /** * Apply a "greater than" constraint to two properties + * + * @param propertyName One property name + * @param otherPropertyName The other property name + * + * @return The Criterion + * + * @see PropertyExpression */ public static PropertyExpression gtProperty(String propertyName, String otherPropertyName) { - return new PropertyExpression(propertyName, otherPropertyName, ">"); + return new PropertyExpression( propertyName, otherPropertyName, ">" ); } + /** * Apply a "greater than or equal" constraint to two properties + * + * @param propertyName One property name + * @param otherPropertyName The other property name + * + * @return The Criterion + * + * @see PropertyExpression */ public static PropertyExpression geProperty(String propertyName, String otherPropertyName) { - return new PropertyExpression(propertyName, otherPropertyName, ">="); + return new PropertyExpression( propertyName, otherPropertyName, ">=" ); } + /** - * Apply an "is not null" constraint to the named property - * @return Criterion - */ - public static Criterion isNotNull(String propertyName) { - return new NotNullExpression(propertyName); - } - /** * Return the conjuction of two expressions * - * @param lhs - * @param rhs - * @return Criterion + * @param lhs One expression + * @param rhs The other expression + * + * @return The Criterion */ public static LogicalExpression and(Criterion lhs, Criterion rhs) { return new LogicalExpression(lhs, rhs, "and"); } /** + * Return the conjuction of multiple expressions + * + * @param predicates The predicates making up the initial junction + * + * @return The conjunction + */ + public static Conjunction and(Criterion... predicates) { + return conjunction( predicates ); + } + + /** * Return the disjuction of two expressions * - * @param lhs - * @param rhs - * @return Criterion + * @param lhs One expression + * @param rhs The other expression + * + * @return The Criterion */ public static LogicalExpression or(Criterion lhs, Criterion rhs) { - return new LogicalExpression(lhs, rhs, "or"); + return new LogicalExpression( lhs, rhs, "or" ); } + /** + * Return the disjuction of multiple expressions + * + * @param predicates The predicates making up the initial junction + * + * @return The conjunction + */ + public static Disjunction or(Criterion... predicates) { + return disjunction( predicates ); + } + + /** * Return the negation of an expression * - * @param expression + * @param expression The expression to be negated + * * @return Criterion + * + * @see NotExpression */ public static Criterion not(Criterion expression) { - return new NotExpression(expression); + return new NotExpression( expression ); } + /** - * Apply a constraint expressed in SQL, with the given JDBC - * parameters. Any occurrences of {alias} will be + * Create a restriction expressed in SQL with JDBC parameters. Any occurrences of {alias} will be * replaced by the table alias. * - * @param sql - * @param values - * @param types - * @return Criterion + * @param sql The SQL restriction + * @param values The parameter values + * @param types The parameter types + * + * @return The Criterion + * + * @see SQLCriterion */ public static Criterion sqlRestriction(String sql, Object[] values, Type[] types) { - return new SQLCriterion(sql, values, types); + return new SQLCriterion( sql, values, types ); } + /** - * Apply a constraint expressed in SQL, with the given JDBC - * parameter. Any occurrences of {alias} will be replaced - * by the table alias. + * Create a restriction expressed in SQL with one JDBC parameter. Any occurrences of {alias} will be + * replaced by the table alias. * - * @param sql - * @param value - * @param type - * @return Criterion + * @param sql The SQL restriction + * @param value The parameter value + * @param type The parameter type + * + * @return The Criterion + * + * @see SQLCriterion */ public static Criterion sqlRestriction(String sql, Object value, Type type) { - return new SQLCriterion(sql, new Object[] { value }, new Type[] { type } ); + return new SQLCriterion( sql, value, type ); } + /** - * Apply a constraint expressed in SQL. Any occurrences of {alias} - * will be replaced by the table alias. + * Apply a constraint expressed in SQL with no JDBC parameters. Any occurrences of {alias} will be + * replaced by the table alias. * - * @param sql - * @return Criterion + * @param sql The SQL restriction + * + * @return The Criterion + * + * @see SQLCriterion */ public static Criterion sqlRestriction(String sql) { - return new SQLCriterion(sql, ArrayHelper.EMPTY_OBJECT_ARRAY, ArrayHelper.EMPTY_TYPE_ARRAY); + return new SQLCriterion( sql ); } /** - * Group expressions together in a single conjunction (A and B and C...) + * Group expressions together in a single conjunction (A and B and C...). * + * This form creates an empty conjunction. See {@link Conjunction#add(Criterion)} + * * @return Conjunction */ public static Conjunction conjunction() { return new Conjunction(); } /** - * Group expressions together in a single disjunction (A or B or C...) + * Group expressions together in a single conjunction (A and B and C...). * + * @param conditions The initial set of conditions to put into the Conjunction + * * @return Conjunction */ + public static Conjunction conjunction(Criterion... conditions) { + return new Conjunction( conditions ); + } + + /** + * Group expressions together in a single disjunction (A or B or C...). + * + * This form creates an empty disjunction. See {@link Disjunction#add(Criterion)} + * + * @return Conjunction + */ public static Disjunction disjunction() { return new Disjunction(); } /** - * Apply an "equals" constraint to each property in the - * key set of a Map + * Group expressions together in a single disjunction (A or B or C...). * + * @param conditions The initial set of conditions to put into the Disjunction + * + * @return Conjunction + */ + public static Disjunction disjunction(Criterion... conditions) { + return new Disjunction( conditions ); + } + + /** + * Apply an "equals" constraint to each property in the key set of a Map + * * @param propertyNameValues a map from property names to values + * * @return Criterion + * + * @see Conjunction */ - public static Criterion allEq(Map propertyNameValues) { - Conjunction conj = conjunction(); - Iterator iter = propertyNameValues.entrySet().iterator(); - while ( iter.hasNext() ) { - Map.Entry me = (Map.Entry) iter.next(); - conj.add( eq( (String) me.getKey(), me.getValue() ) ); + @SuppressWarnings("UnusedDeclaration") + public static Criterion allEq(Map propertyNameValues) { + final Conjunction conj = conjunction(); + + for ( Map.Entry entry : propertyNameValues.entrySet() ) { + conj.add( eq( entry.getKey(), entry.getValue() ) ); } return conj; } - + /** * Constrain a collection valued property to be empty + * + * @param propertyName The name of the collection property + * + * @return The Criterion + * + * @see EmptyExpression */ public static Criterion isEmpty(String propertyName) { - return new EmptyExpression(propertyName); + return new EmptyExpression( propertyName ); } /** * Constrain a collection valued property to be non-empty + * + * @param propertyName The name of the collection property + * + * @return The Criterion + * + * @see NotEmptyExpression */ public static Criterion isNotEmpty(String propertyName) { - return new NotEmptyExpression(propertyName); + return new NotEmptyExpression( propertyName ); } - + /** * Constrain a collection valued property by size + * + * @param propertyName The name of the collection property + * @param size The size to use in comparison + * + * @return The Criterion + * + * @see SizeExpression */ public static Criterion sizeEq(String propertyName, int size) { - return new SizeExpression(propertyName, size, "="); + return new SizeExpression( propertyName, size, "=" ); } - + /** * Constrain a collection valued property by size + * + * @param propertyName The name of the collection property + * @param size The size to use in comparison + * + * @return The Criterion + * + * @see SizeExpression */ + @SuppressWarnings("UnusedDeclaration") public static Criterion sizeNe(String propertyName, int size) { - return new SizeExpression(propertyName, size, "<>"); + return new SizeExpression( propertyName, size, "<>" ); } - + /** * Constrain a collection valued property by size + * + * @param propertyName The name of the collection property + * @param size The size to use in comparison + * + * @return The Criterion + * + * @see SizeExpression */ + @SuppressWarnings("UnusedDeclaration") public static Criterion sizeGt(String propertyName, int size) { - return new SizeExpression(propertyName, size, "<"); + return new SizeExpression( propertyName, size, "<" ); } - + /** * Constrain a collection valued property by size + * + * @param propertyName The name of the collection property + * @param size The size to use in comparison + * + * @return The Criterion + * + * @see SizeExpression */ + @SuppressWarnings("UnusedDeclaration") public static Criterion sizeLt(String propertyName, int size) { - return new SizeExpression(propertyName, size, ">"); + return new SizeExpression( propertyName, size, ">" ); } - + /** * Constrain a collection valued property by size + * + * @param propertyName The name of the collection property + * @param size The size to use in comparison + * + * @return The Criterion + * + * @see SizeExpression */ + @SuppressWarnings("UnusedDeclaration") public static Criterion sizeGe(String propertyName, int size) { - return new SizeExpression(propertyName, size, "<="); + return new SizeExpression( propertyName, size, "<=" ); } - + /** * Constrain a collection valued property by size + * + * @param propertyName The name of the collection property + * @param size The size to use in comparison + * + * @return The Criterion + * + * @see SizeExpression */ + @SuppressWarnings("UnusedDeclaration") public static Criterion sizeLe(String propertyName, int size) { - return new SizeExpression(propertyName, size, ">="); + return new SizeExpression( propertyName, size, ">=" ); } - + + /** + * Consider using any of the natural id based loading stuff from session instead, especially in cases + * where the restriction is the full set of natural id values. + * + * @return The Criterion + * + * @see NaturalIdentifier + * + * @see org.hibernate.Session#byNaturalId(Class) + * @see org.hibernate.Session#byNaturalId(String) + * @see org.hibernate.Session#bySimpleNaturalId(Class) + * @see org.hibernate.Session#bySimpleNaturalId(String) + */ public static NaturalIdentifier naturalId() { return new NaturalIdentifier(); } - + + protected Restrictions() { + // cannot be instantiated, but needs to be protected so Expression can extend it + } + } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/RowCountProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/RowCountProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/RowCountProjection.java 17 Aug 2012 14:33:48 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/RowCountProjection.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -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, 2013, 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,39 +20,47 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; +import java.util.List; + import org.hibernate.Criteria; -import org.hibernate.Hibernate; import org.hibernate.HibernateException; +import org.hibernate.dialect.function.SQLFunction; +import org.hibernate.dialect.function.SQLFunctionRegistry; import org.hibernate.type.Type; /** * A row count + * * @author Gavin King */ public class RowCountProjection extends SimpleProjection { + private static final List ARGS = java.util.Collections.singletonList( "*" ); - protected RowCountProjection() {} - - public String toString() { - return "count(*)"; + @Override + public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final Type countFunctionReturnType = getFunction( criteriaQuery ).getReturnType( null, criteriaQuery.getFactory() ); + return new Type[] { countFunctionReturnType }; } - public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new Type[] { Hibernate.INTEGER }; + @Override + public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) throws HibernateException { + return getFunction( criteriaQuery ).render( null, ARGS, criteriaQuery.getFactory() ) + " as y" + position + '_'; } - public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) - throws HibernateException { - return new StringBuffer() - .append("count(*) as y") - .append(position) - .append('_') - .toString(); + protected SQLFunction getFunction(CriteriaQuery criteriaQuery) { + final SQLFunctionRegistry sqlFunctionRegistry = criteriaQuery.getFactory().getSqlFunctionRegistry(); + final SQLFunction function = sqlFunctionRegistry.findSQLFunction( "count" ); + if ( function == null ) { + throw new HibernateException( "Unable to locate count function mapping" ); + } + return function; } + @Override + public String toString() { + return "count(*)"; + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/SQLCriterion.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/SQLCriterion.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/SQLCriterion.java 17 Aug 2012 14:33:48 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/SQLCriterion.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,48 +20,52 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; -import org.hibernate.EntityMode; -import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.util.StringHelper; import org.hibernate.type.Type; -import org.hibernate.util.StringHelper; /** * A SQL fragment. The string {alias} will be replaced by the * alias of the root entity. */ public class SQLCriterion implements Criterion { - private final String sql; private final TypedValue[] typedValues; - public String toSqlString( - Criteria criteria, - CriteriaQuery criteriaQuery) - throws HibernateException { - return StringHelper.replace( sql, "{alias}", criteriaQuery.getSQLAlias(criteria) ); + protected SQLCriterion(String sql, Object[] values, Type[] types) { + this.sql = sql; + this.typedValues = new TypedValue[values.length]; + for ( int i=0; i1) fragment.append('('); - SessionFactoryImplementor factory = criteriaQuery.getFactory(); - int[] sqlTypes = type.sqlTypes( factory ); - for ( int i=0; i 1 ) { + fragment.append( '(' ); + } + final SessionFactoryImplementor factory = criteriaQuery.getFactory(); + final int[] sqlTypes = type.sqlTypes( factory ); + for ( int i = 0; i < columns.length; i++ ) { + final boolean lower = ignoreCase && (sqlTypes[i] == Types.VARCHAR || sqlTypes[i] == Types.CHAR); + if ( lower ) { + fragment.append( factory.getDialect().getLowercaseFunction() ).append( '(' ); } fragment.append( columns[i] ); - if (lower) fragment.append(')'); - fragment.append( getOp() ).append("?"); - if ( i1) fragment.append(')'); + if ( columns.length > 1 ) { + fragment.append( ')' ); + } return fragment.toString(); - } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - Object icvalue = ignoreCase ? value.toString().toLowerCase() : value; - return new TypedValue[] { criteriaQuery.getTypedValue(criteria, propertyName, icvalue) }; + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final Object casedValue = ignoreCase ? value.toString().toLowerCase() : value; + return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, casedValue ) }; } + @Override public String toString() { return propertyName + getOp() + value; } - protected final String getOp() { - return op; - } - } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleProjection.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleProjection.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleProjection.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleProjection.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,47 +20,112 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; -import org.hibernate.HibernateException; import org.hibernate.type.Type; - /** * A single-column projection that may be aliased + * * @author Gavin King */ -public abstract class SimpleProjection implements Projection { +public abstract class SimpleProjection implements EnhancedProjection { + private static final int NUM_REUSABLE_ALIASES = 40; + private static final String[] REUSABLE_ALIASES = initializeReusableAliases(); + private static String[] initializeReusableAliases() { + final String[] aliases = new String[NUM_REUSABLE_ALIASES]; + for ( int i = 0; i < NUM_REUSABLE_ALIASES; i++ ) { + aliases[i] = aliasForLocation( i ); + } + return aliases; + } + + private static String aliasForLocation(final int loc) { + return "y" + loc + "_"; + } + + private static String getAliasForLocation(final int loc) { + if ( loc >= NUM_REUSABLE_ALIASES ) { + return aliasForLocation( loc ); + } + else { + return REUSABLE_ALIASES[loc]; + } + } + + /** + * Create an aliased form of this projection + * + * @param alias The alias to apply + * + * @return The aliased projection + */ public Projection as(String alias) { - return Projections.alias(this, alias); + return Projections.alias( this, alias ); } + @Override public String[] getColumnAliases(String alias, int loc) { return null; } - - public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + + @Override + public String[] getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery) { + return getColumnAliases( alias, loc ); + } + + @Override + public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery) { return null; } + @Override public String[] getColumnAliases(int loc) { - return new String[] { "y" + loc + "_" }; + return new String[] { getAliasForLocation( loc ) }; } - + + /** + * Count the number of columns this projection uses. + * + * @param criteria The criteria + * @param criteriaQuery The query + * + * @return The number of columns + */ + public int getColumnCount(Criteria criteria, CriteriaQuery criteriaQuery) { + final Type[] types = getTypes( criteria, criteriaQuery ); + int count = 0; + for ( Type type : types ) { + count += type.getColumnSpan( criteriaQuery.getFactory() ); + } + return count; + } + + @Override + public String[] getColumnAliases(int loc, Criteria criteria, CriteriaQuery criteriaQuery) { + final int numColumns = getColumnCount( criteria, criteriaQuery ); + final String[] aliases = new String[ numColumns ]; + for (int i = 0; i < numColumns; i++) { + aliases[i] = getAliasForLocation( loc ); + loc++; + } + return aliases; + } + + @Override public String[] getAliases() { return new String[1]; } - public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - throw new UnsupportedOperationException("not a grouping projection"); + @Override + public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) { + throw new UnsupportedOperationException( "not a grouping projection" ); } + @Override public boolean isGrouped() { return false; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleSubqueryExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleSubqueryExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleSubqueryExpression.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/SimpleSubqueryExpression.java 30 Jul 2014 15:51:10 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,38 +20,36 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; -import org.hibernate.EntityMode; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; /** * A comparison between a constant value and the the result of a subquery + * * @author Gavin King */ public class SimpleSubqueryExpression extends SubqueryExpression { - private Object value; - + protected SimpleSubqueryExpression(Object value, String op, String quantifier, DetachedCriteria dc) { - super(op, quantifier, dc); + super( op, quantifier, dc ); this.value = value; } - - - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - TypedValue[] superTv = super.getTypedValues(criteria, criteriaQuery); - TypedValue[] result = new TypedValue[superTv.length+1]; - System.arraycopy(superTv, 0, result, 1, superTv.length); - result[0] = new TypedValue( getTypes()[0], value, EntityMode.POJO ); + + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final TypedValue[] subQueryTypedValues = super.getTypedValues( criteria, criteriaQuery ); + final TypedValue[] result = new TypedValue[subQueryTypedValues.length+1]; + System.arraycopy( subQueryTypedValues, 0, result, 1, subQueryTypedValues.length ); + result[0] = new TypedValue( getTypes()[0], value ); return result; } - + + @Override protected String toLeftSqlString(Criteria criteria, CriteriaQuery criteriaQuery) { return "?"; } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/SizeExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/SizeExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/SizeExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/SizeExpression.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2011, 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,24 +20,24 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; import org.hibernate.Criteria; -import org.hibernate.EntityMode; -import org.hibernate.Hibernate; import org.hibernate.HibernateException; -import org.hibernate.engine.TypedValue; +import org.hibernate.engine.spi.TypedValue; import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.entity.Loadable; import org.hibernate.sql.ConditionFragment; +import org.hibernate.type.StandardBasicTypes; /** + * Used to define a restriction on a collection property based on its size. + * * @author Gavin King + * @author Steve Ebersole */ public class SizeExpression implements Criterion { - private final String propertyName; private final int size; private final String op; @@ -48,38 +48,35 @@ this.op = op; } - public String toString() { - return propertyName + ".size" + op + size; + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final String entityName =criteriaQuery.getEntityName( criteria, propertyName ); + final String role = entityName + '.' + criteriaQuery.getPropertyName( propertyName ); + final QueryableCollection cp = (QueryableCollection) criteriaQuery.getFactory().getCollectionPersister( role ); + + final String[] fk = cp.getKeyColumnNames(); + final String[] pk = ( (Loadable) cp.getOwnerEntityPersister() ).getIdentifierColumnNames(); + + final ConditionFragment subQueryRestriction = new ConditionFragment() + .setTableAlias( criteriaQuery.getSQLAlias( criteria, propertyName ) ) + .setCondition( pk, fk ); + + return String.format( + "? %s (select count(*) from %s where %s)", + op, + cp.getTableName(), + subQueryRestriction.toFragmentString() + ); } - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - String role = criteriaQuery.getEntityName(criteria, propertyName) + - '.' + - criteriaQuery.getPropertyName(propertyName); - QueryableCollection cp = (QueryableCollection) criteriaQuery.getFactory() - .getCollectionPersister(role); - //String[] fk = StringHelper.qualify( "collection_", cp.getKeyColumnNames() ); - String[] fk = cp.getKeyColumnNames(); - String[] pk = ( (Loadable) cp.getOwnerEntityPersister() ).getIdentifierColumnNames(); //TODO: handle property-ref - return "? " + - op + - " (select count(*) from " + - cp.getTableName() + - //" collection_ where " + - " where " + - new ConditionFragment() - .setTableAlias( criteriaQuery.getSQLAlias(criteria, propertyName) ) - .setCondition(pk, fk) - .toFragmentString() + - ")"; + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + return new TypedValue[] { new TypedValue( StandardBasicTypes.INTEGER, size ) }; } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { - return new TypedValue[] { - new TypedValue( Hibernate.INTEGER, new Integer(size), EntityMode.POJO ) - }; + @Override + public String toString() { + return propertyName + ".size" + op + size; } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Subqueries.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Subqueries.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Subqueries.java 17 Aug 2012 14:33:49 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Subqueries.java 30 Jul 2014 15:51:40 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2011, 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,164 +20,629 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; /** * Factory class for criterion instances that represent expressions * involving subqueries. * - * @see Restriction + * @see Restrictions * @see Projection * @see org.hibernate.Criteria + * * @author Gavin King + * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) */ +@SuppressWarnings( {"UnusedDeclaration"}) public class Subqueries { - + + /** + * Creates a criterion which checks for the existence of rows in the subquery result + * + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see ExistsSubqueryExpression + */ public static Criterion exists(DetachedCriteria dc) { - return new ExistsSubqueryExpression("exists", dc); + return new ExistsSubqueryExpression( "exists", dc ); } - + + /** + * Creates a criterion which checks for the non-existence of rows in the subquery result + * + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see ExistsSubqueryExpression + */ public static Criterion notExists(DetachedCriteria dc) { - return new ExistsSubqueryExpression("not exists", dc); + return new ExistsSubqueryExpression( "not exists", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property equals ALL the values in the + * subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyEqAll(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "=", "all", dc); + return new PropertySubqueryExpression( propertyName, "=", "all", dc ); } - - public static Criterion propertyIn(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "in", null, dc); - } - - public static Criterion propertyNotIn(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "not in", null, dc); - } - - public static Criterion propertyEq(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "=", null, dc); - } - - public static Criterion propertyNe(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "<>", null, dc); - } - - public static Criterion propertyGt(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, ">", null, dc); - } - - public static Criterion propertyLt(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "<", null, dc); - } - - public static Criterion propertyGe(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, ">=", null, dc); - } - - public static Criterion propertyLe(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "<=", null, dc); - } - + + /** + * Creates a criterion which checks that the value of a given property is greater-than ALL the values in the + * subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyGtAll(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, ">", "all", dc); + return new PropertySubqueryExpression( propertyName, ">", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property is less-than ALL the values in the + * subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyLtAll(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "<", "all", dc); + return new PropertySubqueryExpression( propertyName, "<", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property is greater-than-or-equal-to ALL the + * values in the subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyGeAll(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, ">=", "all", dc); + return new PropertySubqueryExpression( propertyName, ">=", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property is less-than-or-equal-to ALL the + * values in the subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyLeAll(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "<=", "all", dc); + return new PropertySubqueryExpression( propertyName, "<=", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property is greater-than SOME of the + * values in the subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyGtSome(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, ">", "some", dc); + return new PropertySubqueryExpression( propertyName, ">", "some", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property is less-than SOME of the + * values in the subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyLtSome(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "<", "some", dc); + return new PropertySubqueryExpression( propertyName, "<", "some", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property is greater-than-or-equal-to SOME of the + * values in the subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyGeSome(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, ">=", "some", dc); + return new PropertySubqueryExpression( propertyName, ">=", "some", dc ); } - + + /** + * Creates a criterion which checks that the value of a given property is less-than-or-equal-to SOME of the + * values in the subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ public static Criterion propertyLeSome(String propertyName, DetachedCriteria dc) { - return new PropertySubqueryExpression(propertyName, "<=", "some", dc); + return new PropertySubqueryExpression( propertyName, "<=", "some", dc ); } - - public static Criterion eqAll(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "=", "all", dc); + + /** + * Creates a criterion which checks that the value of a given property is in the set of values in the + * subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ + public static Criterion propertyIn(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression( propertyName, "in", null, dc ); } - - public static Criterion in(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "in", null, dc); + + /** + * Creates a criterion which checks that the value of a given property is not-in the set of values in + * the subquery result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ + public static Criterion propertyNotIn(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression( propertyName, "not in", null, dc ); } - - public static Criterion notIn(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "not in", null, dc); + + /** + * Creates a criterion which checks that the value of a given property as being equal to the set of values in + * the subquery result. The implication is that the subquery returns a single result.. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ + public static Criterion propertyEq(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression( propertyName, "=", null, dc ); } - - public static Criterion eq(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "=", null, dc); + + /** + * Creates a criterion which checks that the value of a given property is not equal to the value in the + * subquery result. The assumption is that the subquery returns a single result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + */ + public static Criterion propertyNe(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression(propertyName, "<>", null, dc); } - - public static Criterion gt(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, ">", null, dc); + + /** + * Creates a criterion which checks that the value of a given property is greater-than the value in the + * subquery result. The assumption is that the subquery returns a single result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + * @see #propertyGtAll + * @see #propertyGtSome + */ + public static Criterion propertyGt(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression( propertyName, ">", null, dc ); } - - public static Criterion lt(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "<", null, dc); + + /** + * Creates a criterion which checks that the value of a given property is less-than the value in the + * subquery result. The assumption is that the subquery returns a single result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + * @see #propertyLtAll + * @see #propertyLtSome + */ + public static Criterion propertyLt(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression( propertyName, "<", null, dc ); } - - public static Criterion ge(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, ">=", null, dc); + + /** + * Creates a criterion which checks that the value of a given property is greater-than-or-equal-to the value + * in the subquery result. The assumption is that the subquery returns a single result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + * @see #propertyGeAll + * @see #propertyGeSome + */ + public static Criterion propertyGe(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression( propertyName, ">=", null, dc ); } - - public static Criterion le(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "<=", null, dc); + + /** + * Creates a criterion which checks that the value of a given property is less-than-or-equal-to the value + * in the subquery result. The assumption is that the subquery returns a single result. + * + * @param propertyName The name of the property to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertySubqueryExpression + * @see #propertyLeAll + * @see #propertyLeSome + */ + public static Criterion propertyLe(String propertyName, DetachedCriteria dc) { + return new PropertySubqueryExpression( propertyName, "<=", null, dc ); } - - public static Criterion ne(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "<>", null, dc); + + /** + * Creates a criterion which checks that the value of multiple given properties as being equal to the set of + * values in the subquery result. The implication is that the subquery returns a single result. This form is + * however implicitly using tuple comparisons + * + * @param propertyNames The names of the properties to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertiesSubqueryExpression + */ + public static Criterion propertiesEq(String[] propertyNames, DetachedCriteria dc) { + return new PropertiesSubqueryExpression( propertyNames, "=", dc ); } - + + /** + * Creates a criterion which checks that the value of multiple given properties as being not-equal to the set of + * values in the subquery result. The assumption is that the subquery returns a single result. This form is + * however implicitly using tuple comparisons + * + * @param propertyNames The names of the properties to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertiesSubqueryExpression + */ + public static Criterion propertiesNotEq(String[] propertyNames, DetachedCriteria dc) { + return new PropertiesSubqueryExpression( propertyNames, "<>", dc ); + } + + /** + * Creates a criterion which checks that the value of multiple given properties as being in to the set of + * values in the subquery result. This form is implicitly using tuple comparisons + * + * @param propertyNames The names of the properties to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertiesSubqueryExpression + */ + public static Criterion propertiesIn(String[] propertyNames, DetachedCriteria dc) { + return new PropertiesSubqueryExpression( propertyNames, "in", dc ); + } + + /** + * Creates a criterion which checks that the value of multiple given properties as being not-in to the set of + * values in the subquery result. This form is implicitly using tuple comparisons + * + * @param propertyNames The names of the properties to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see PropertiesSubqueryExpression + */ + public static Criterion propertiesNotIn(String[] propertyNames, DetachedCriteria dc) { + return new PropertiesSubqueryExpression( propertyNames, "not in", dc ); + } + + /** + * Creates a criterion which checks that the value of a literal equals ALL the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion eqAll(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, "=", "all", dc ); + } + + /** + * Creates a criterion which checks that the value of a literal is greater-than ALL the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion gtAll(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, ">", "all", dc); + return new SimpleSubqueryExpression( value, ">", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a literal is less-than ALL the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion ltAll(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "<", "all", dc); + return new SimpleSubqueryExpression( value, "<", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a literal is greater-than-or-equal-to ALL the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion geAll(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, ">=", "all", dc); + return new SimpleSubqueryExpression( value, ">=", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a literal is less-than-or-equal-to ALL the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion leAll(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "<=", "all", dc); + return new SimpleSubqueryExpression( value, "<=", "all", dc ); } - + + /** + * Creates a criterion which checks that the value of a literal is greater-than SOME of the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion gtSome(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, ">", "some", dc); + return new SimpleSubqueryExpression( value, ">", "some", dc ); } - + + /** + * Creates a criterion which checks that the value of a literal is less-than SOME of the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion ltSome(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "<", "some", dc); + return new SimpleSubqueryExpression( value, "<", "some", dc ); } - + + /** + * Creates a criterion which checks that the value of a literal is greater-than-or-equal-to SOME of the values + * in the subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion geSome(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, ">=", "some", dc); + return new SimpleSubqueryExpression( value, ">=", "some", dc ); } - + + /** + * Creates a criterion which checks that the value of a literal is less-than-or-equal-to SOME of the values + * in the subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ public static Criterion leSome(Object value, DetachedCriteria dc) { - return new SimpleSubqueryExpression(value, "<=", "some", dc); + return new SimpleSubqueryExpression( value, "<=", "some", dc ); } - + /** + * Creates a criterion which checks that the value of a literal is IN the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion in(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, "in", null, dc ); + } + + /** + * Creates a criterion which checks that the value of a literal is NOT IN the values in the + * subquery result. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion notIn(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, "not in", null, dc ); + } + + /** + * Creates a criterion which checks that the value of a given literal as being equal to the value in + * the subquery result. The implication is that the subquery returns a single result.. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion eq(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, "=", null, dc ); + } + + /** + * Creates a criterion which checks that the value of a given literal as being not-equal to the value in + * the subquery result. The implication is that the subquery returns a single result.. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion ne(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression(value, "<>", null, dc); + } + + /** + * Creates a criterion which checks that the value of a given literal as being greater-than the value in + * the subquery result. The implication is that the subquery returns a single result.. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion gt(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, ">", null, dc ); + } + + /** + * Creates a criterion which checks that the value of a given literal as being less-than the value in + * the subquery result. The implication is that the subquery returns a single result.. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion lt(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, "<", null, dc ); + } + + /** + * Creates a criterion which checks that the value of a given literal as being greater-than-or-equal-to the + * value in the subquery result. The implication is that the subquery returns a single result.. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion ge(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, ">=", null, dc ); + } + + /** + * Creates a criterion which checks that the value of a given literal as being less-than-or-equal-to the + * value in the subquery result. The implication is that the subquery returns a single result.. + * + * @param value The literal value to use in comparison + * @param dc The detached criteria representing the subquery + * + * @return The Criterion + * + * @see SimpleSubqueryExpression + */ + public static Criterion le(Object value, DetachedCriteria dc) { + return new SimpleSubqueryExpression( value, "<=", null, dc ); + } + + private Subqueries() { + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/SubqueryExpression.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/SubqueryExpression.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/criterion/SubqueryExpression.java 17 Aug 2012 14:33:50 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/SubqueryExpression.java 30 Jul 2014 15:51:09 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2013, 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,98 +20,114 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.criterion; -import java.util.HashMap; - import org.hibernate.Criteria; -import org.hibernate.EntityMode; import org.hibernate.HibernateException; -import org.hibernate.engine.QueryParameters; -import org.hibernate.engine.SessionFactoryImplementor; -import org.hibernate.engine.TypedValue; -import org.hibernate.impl.CriteriaImpl; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.engine.spi.TypedValue; +import org.hibernate.internal.CriteriaImpl; import org.hibernate.loader.criteria.CriteriaJoinWalker; import org.hibernate.loader.criteria.CriteriaQueryTranslator; import org.hibernate.persister.entity.OuterJoinLoadable; import org.hibernate.type.Type; /** + * A criterion that involves a subquery + * * @author Gavin King + * @author Steve Ebersole */ public abstract class SubqueryExpression implements Criterion { - private CriteriaImpl criteriaImpl; private String quantifier; private String op; private QueryParameters params; private Type[] types; private CriteriaQueryTranslator innerQuery; - protected Type[] getTypes() { - return types; - } - protected SubqueryExpression(String op, String quantifier, DetachedCriteria dc) { this.criteriaImpl = dc.getCriteriaImpl(); this.quantifier = quantifier; this.op = op; } - + + protected Type[] getTypes() { + return types; + } + protected abstract String toLeftSqlString(Criteria criteria, CriteriaQuery outerQuery); - public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { + final StringBuilder buf = new StringBuilder( toLeftSqlString( criteria, criteriaQuery ) ); + if ( op != null ) { + buf.append( ' ' ).append( op ).append( ' ' ); + } + if ( quantifier != null ) { + buf.append( quantifier ).append( ' ' ); + } final SessionFactoryImplementor factory = criteriaQuery.getFactory(); - final OuterJoinLoadable persister = (OuterJoinLoadable) factory.getEntityPersister( criteriaImpl.getEntityOrClassName() ); + final OuterJoinLoadable persister = + (OuterJoinLoadable) factory.getEntityPersister( criteriaImpl.getEntityOrClassName() ); createAndSetInnerQuery( criteriaQuery, factory ); - - CriteriaJoinWalker walker = new CriteriaJoinWalker( + criteriaImpl.setSession( deriveRootSession( criteria ) ); + + final CriteriaJoinWalker walker = new CriteriaJoinWalker( persister, innerQuery, factory, criteriaImpl, criteriaImpl.getEntityOrClassName(), - new HashMap(), - innerQuery.getRootSQLALias()); + criteriaImpl.getSession().getLoadQueryInfluencers(), + innerQuery.getRootSQLALias() + ); - String sql = walker.getSQLString(); + return buf.append( '(' ).append( walker.getSQLString() ).append( ')' ).toString(); + } - final StringBuffer buf = new StringBuffer() - .append( toLeftSqlString(criteria, criteriaQuery) ); - if (op!=null) buf.append(' ').append(op).append(' '); - if (quantifier!=null) buf.append(quantifier).append(' '); - return buf.append('(').append(sql).append(')') - .toString(); + private SessionImplementor deriveRootSession(Criteria criteria) { + if ( criteria instanceof CriteriaImpl ) { + return ( (CriteriaImpl) criteria ).getSession(); + } + else if ( criteria instanceof CriteriaImpl.Subcriteria ) { + return deriveRootSession( ( (CriteriaImpl.Subcriteria) criteria ).getParent() ); + } + else { + // could happen for custom Criteria impls. Not likely, but... + // for long term solution, see HHH-3514 + return null; + } } - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) - throws HibernateException { + @Override + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { //the following two lines were added to ensure that this.params is not null, which //can happen with two-deep nested subqueries - SessionFactoryImplementor factory = criteriaQuery.getFactory(); - createAndSetInnerQuery(criteriaQuery, factory); - - Type[] ppTypes = params.getPositionalParameterTypes(); - Object[] ppValues = params.getPositionalParameterValues(); - TypedValue[] tv = new TypedValue[ppTypes.length]; + final SessionFactoryImplementor factory = criteriaQuery.getFactory(); + createAndSetInnerQuery( criteriaQuery, factory ); + + final Type[] ppTypes = params.getPositionalParameterTypes(); + final Object[] ppValues = params.getPositionalParameterValues(); + final TypedValue[] tv = new TypedValue[ppTypes.length]; for ( int i=0; i queryReturns = new ArrayList(); + /** + * Constructs a ResultSetMappingDefinition + * + * @param name The mapping name + */ public ResultSetMappingDefinition(String name) { this.name = name; } @@ -48,6 +51,11 @@ return name; } + /** + * Adds a return. + * + * @param queryReturn The return + */ public void addQueryReturn(NativeSQLQueryReturn queryReturn) { queryReturns.add( queryReturn ); } @@ -63,7 +71,28 @@ // } public NativeSQLQueryReturn[] getQueryReturns() { - return ( NativeSQLQueryReturn[] ) queryReturns.toArray( new NativeSQLQueryReturn[0] ); + return queryReturns.toArray( new NativeSQLQueryReturn[queryReturns.size()] ); } + public String traceLoggableFormat() { + final StringBuilder buffer = new StringBuilder() + .append( "ResultSetMappingDefinition[\n" ) + .append( " name=" ).append( name ).append( "\n" ) + .append( " returns=[\n" ); + + for ( NativeSQLQueryReturn rtn : queryReturns ) { + rtn.traceLog( + new NativeSQLQueryReturn.TraceLogger() { + @Override + public void writeLine(String traceLine) { + buffer.append( " " ).append( traceLine ).append( "\n" ); + } + } + ); + } + + buffer.append( " ]\n" ).append( "]" ); + + return buffer.toString(); + } } Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/RowSelection.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/SessionFactoryImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/SessionImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/StatefulPersistenceContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/Status.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/SubselectFetch.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/TransactionHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/TwoPhaseLoad.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/TypedValue.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/UnsavedValueFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/ValueInclusion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/VersionValue.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/Versioning.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/config/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/config/internal/ConfigurationServiceImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/config/internal/ConfigurationServiceInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/config/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/config/spi/ConfigurationService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/config/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/CacheHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/Cascade.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/CascadePoint.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/Collections.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/EntityEntryContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/ForeignKeys.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/JoinHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/JoinSequence.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/NaturalIdXrefDelegate.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/NonNullableTransientDependencies.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/Nullability.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/ParameterBinder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/SessionEventListenerManagerImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/StatefulPersistenceContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/StatisticalLoggingSessionEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/TwoPhaseLoad.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/UnsavedValueFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/Versioning.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/AbstractLobCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/BinaryStream.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/BlobImplementer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/BlobProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/CharacterStream.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/ClobImplementer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/ClobProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/ColumnNameCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/ContextualLobCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/LobCreationContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/LobCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/NClobImplementer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/NClobProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/NonContextualLobCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/ReaderInputStream.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/ResultSetWrapperProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/SerializableBlobProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/SerializableClobProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/SerializableNClobProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/StreamUtils.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/WrappedBlob.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/WrappedClob.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/WrappedNClob.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/internal/BasicBatchKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/internal/BatchBuilderImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/internal/BatchingBatch.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/spi/Batch.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/spi/BatchBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/spi/BatchKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/spi/BatchObserver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/batch/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/BasicConnectionCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/ConnectionCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/ConnectionCreatorBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/ConnectionProviderInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/DatasourceConnectionProviderImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/DriverConnectionCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionCreator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionProviderImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/MultiTenantConnectionProviderInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/UserSuppliedConnectionProviderImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/spi/AbstractDataSourceBasedMultiTenantConnectionProviderImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/spi/AbstractMultiTenantConnectionProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/spi/ConnectionProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/spi/DataSourceBasedMultiTenantConnectionProviderImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/spi/MultiTenantConnectionProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/connections/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/cursor/internal/RefCursorSupportInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/cursor/internal/StandardRefCursorSupport.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/cursor/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/cursor/spi/RefCursorSupport.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/cursor/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/internal/DialectResolverInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/internal/DialectResolverSet.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/internal/StandardDialectResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/BasicDialectResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/BasicSQLExceptionConverter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/DatabaseMetaDataDialectResolutionInfoAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/DialectFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/DialectResolutionInfo.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/DialectResolutionInfoSource.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/DialectResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/dialect/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/BinaryStreamImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/CharacterStreamImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/DDLFormatterImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/FormatStyle.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/Formatter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/JdbcServicesImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/JdbcServicesInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/LobCreatorBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/LogicalConnectionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/ResultSetWrapperImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/ConnectionObserver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/ConnectionObserverAdapter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/ExtractedDatabaseMetaData.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/InvalidatableWrapper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/JdbcConnectionAccess.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/JdbcCoordinator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/JdbcServices.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/JdbcWrapper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/LogicalConnection.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/LogicalConnectionImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/NonDurableConnectionObserver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/ResultSetReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/ResultSetWrapper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/SchemaNameResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/SqlExceptionHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/SqlStatementLogger.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/StatementPreparer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/TypeInfo.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/TypeNullability.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/TypeSearchability.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jdbc/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/JndiException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/JndiNameException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/internal/JndiServiceImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/internal/JndiServiceInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/spi/JndiService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/jndi/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/CollectionLoadContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/EntityLoadContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/LoadContexts.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/LoadingCollectionEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/internal/CollectionLoadContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/internal/EntityLoadContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/internal/LoadContexts.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/internal/LoadingCollectionEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/loading/internal/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/profile/Association.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/profile/Fetch.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/profile/FetchProfile.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/profile/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/FilterQueryPlan.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/HQLQueryPlan.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/NamedParameterDescriptor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/NativeSQLQueryPlan.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/OrdinalParameterDescriptor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/ParamLocationRecognizer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/ParameterMetadata.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/ParameterParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/QueryMetadata.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/QueryPlanCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/ReturnMetadata.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/EntityGraphQueryHint.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/FilterQueryPlan.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/HQLQueryPlan.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/NamedParameterDescriptor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/NativeSQLQueryPlan.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/OrdinalParameterDescriptor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/ParamLocationRecognizer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/ParameterMetadata.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/ParameterParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/QueryPlanCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/ReturnMetadata.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQueryCollectionReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQueryConstructorReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQueryJoinReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQueryNonScalarReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQueryReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQueryRootReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQueryScalarReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/spi/sql/NativeSQLQuerySpecification.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/sql/NativeSQLQueryCollectionReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/sql/NativeSQLQueryJoinReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/sql/NativeSQLQueryNonScalarReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/sql/NativeSQLQueryReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/sql/NativeSQLQueryRootReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/sql/NativeSQLQueryScalarReturn.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/query/sql/NativeSQLQuerySpecification.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/ActionQueue.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/AssociationKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/BatchFetchQueue.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CacheImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CacheInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CachedNaturalIdValueSource.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CascadeStyle.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CascadeStyles.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CascadingAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CascadingActions.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CollectionEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CollectionKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CompositeOwner.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/CompositeTracker.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/EntityEntry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/EntityKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/EntityUniqueKey.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/ExecutableList.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/ExecuteUpdateResultCheckStyle.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/FilterDefinition.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/IdentifierValue.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/LoadQueryInfluencers.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/Managed.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/ManagedComposite.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/ManagedEntity.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/Mapping.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/NamedQueryDefinition.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/NamedQueryDefinitionBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/NamedSQLQueryDefinition.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/NamedSQLQueryDefinitionBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/PersistenceContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/PersistentAttributeInterceptable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/PersistentAttributeInterceptor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/QueryParameters.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/RowSelection.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SelfDirtinessTracker.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SessionBuilderImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SessionEventListenerManager.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SessionFactoryImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SessionImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SessionOwner.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/Status.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/SubselectFetch.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/TypedValue.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/UnsavedValueStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/ValueInclusion.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/spi/VersionValue.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/IsolatedWork.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/Isolater.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/NullSynchronizationException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/SynchronizationRegistryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/TransactionCoordinatorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/TransactionFactoryInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jdbc/JdbcIsolationDelegate.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jdbc/JdbcTransaction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jdbc/JdbcTransactionFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jta/CMTTransaction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jta/CMTTransactionFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jta/JtaStatusHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jta/JtaTransaction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/internal/jta/JtaTransactionFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/AbstractJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/BitronixJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/BorlandEnterpriseServerJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JBossAppServerJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JBossStandAloneJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JOTMJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JOnASJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JRun4JtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JtaPlatformInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JtaPlatformResolverInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/JtaSynchronizationStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/NoJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/OC4JJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/OrionJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/ResinJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/StandardJtaPlatformResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/SunOneJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/SynchronizationRegistryAccess.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/SynchronizationRegistryBasedSynchronizationStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/TransactionManagerAccess.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/TransactionManagerBasedSynchronizationStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/WebSphereExtendedJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/WebSphereJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/internal/WeblogicJtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/spi/JtaPlatform.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/spi/JtaPlatformException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/spi/JtaPlatformProvider.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/jta/platform/spi/JtaPlatformResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/AbstractTransactionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/IsolationDelegate.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/JoinStatus.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/LocalStatus.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/SynchronizationRegistry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/TransactionContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/TransactionCoordinator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/TransactionEnvironment.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/TransactionFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/TransactionImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/spi/TransactionObserver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/synchronization/internal/RegisteredSynchronization.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/synchronization/internal/SynchronizationCallbackCoordinatorNonTrackingImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/synchronization/internal/SynchronizationCallbackCoordinatorTrackingImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/synchronization/spi/AfterCompletionAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/synchronization/spi/ExceptionMapper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/synchronization/spi/ManagedFlushChecker.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/engine/transaction/synchronization/spi/SynchronizationCallbackCoordinator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/AbstractCollectionEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/AbstractEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/AbstractPreDatabaseOperationEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/AutoFlushEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/AutoFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/DeleteEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/DeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/Destructible.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/DirtyCheckEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/DirtyCheckEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/EventListeners.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/EventSource.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/EvictEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/EvictEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/FlushEntityEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/FlushEntityEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/FlushEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/FlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/Initializable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/InitializeCollectionEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/InitializeCollectionEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/LoadEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/LoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/LockEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/LockEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/MergeEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/MergeEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PersistEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PersistEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostCollectionRecreateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostCollectionRecreateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostCollectionRemoveEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostCollectionRemoveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostCollectionUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostCollectionUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostDeleteEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostDeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostInsertEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostInsertEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostLoadEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PostUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreCollectionRecreateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreCollectionRecreateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreCollectionRemoveEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreCollectionRemoveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreCollectionUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreCollectionUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreDeleteEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreDeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreInsertEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreInsertEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreLoadEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/PreUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/RefreshEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/RefreshEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/ReplicateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/ReplicateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/SaveOrUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/SaveOrUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/AbstractFlushingEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/AbstractLockUpgradeEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/AbstractReassociateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/AbstractSaveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/AbstractVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultAutoFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultDeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultDirtyCheckEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultEvictEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultFlushEntityEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultInitializeCollectionEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultLockEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultMergeEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultPersistEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultPersistOnFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultPostLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultPreLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultRefreshEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultReplicateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultSaveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultSaveOrUpdateCopyEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultSaveOrUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DefaultUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/DirtyCollectionSearchVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/EvictVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/FlushVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/OnLockVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/OnReplicateVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/OnUpdateVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/ProxyVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/ReattachVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/WrapVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/def/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/AbstractFlushingEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/AbstractLockUpgradeEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/AbstractReassociateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/AbstractSaveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/AbstractVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultAutoFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultDeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultDirtyCheckEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultEvictEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultFlushEntityEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultLockEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultMergeEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultPersistEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultPersistOnFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultPostLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultPreLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultRefreshEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultReplicateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultResolveNaturalIdEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultSaveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultSaveOrUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/DirtyCollectionSearchVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/EventCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/EvictVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/FlushVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/OnLockVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/OnReplicateVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/OnUpdateVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/ProxyVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/ReattachVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/WrapVisitor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/internal/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/internal/EventListenerGroupImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/internal/EventListenerRegistryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/internal/EventListenerServiceInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/internal/PostCommitEventListenerGroupImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/spi/DuplicationStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/spi/EventListenerGroup.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/spi/EventListenerRegistrationException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/service/spi/EventListenerRegistry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/AbstractCollectionEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/AbstractEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/AbstractPreDatabaseOperationEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/AutoFlushEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/AutoFlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/ClearEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/ClearEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/DeleteEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/DeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/DirtyCheckEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/DirtyCheckEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/EventSource.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/EventType.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/EvictEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/EvictEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/FlushEntityEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/FlushEntityEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/FlushEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/FlushEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/InitializeCollectionEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/InitializeCollectionEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/LoadEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/LoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/LockEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/LockEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/MergeEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/MergeEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PersistEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PersistEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCollectionRecreateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCollectionRecreateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCollectionRemoveEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCollectionRemoveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCollectionUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCollectionUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCommitDeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCommitInsertEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostCommitUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostDeleteEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostDeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostInsertEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostInsertEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostLoadEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PostUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreCollectionRecreateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreCollectionRecreateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreCollectionRemoveEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreCollectionRemoveEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreCollectionUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreCollectionUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreDeleteEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreDeleteEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreInsertEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreInsertEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreLoadEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreLoadEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/PreUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/RefreshEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/RefreshEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/ReplicateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/ReplicateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/ResolveNaturalIdEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/ResolveNaturalIdEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/SaveOrUpdateEvent.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/event/spi/SaveOrUpdateEventListener.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/graph/spi/AttributeNodeImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/graph/spi/GraphNodeImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/CollectionProperties.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/CollectionSubqueryFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/FilterTranslator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/HolderInstantiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/NameGenerator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ParameterTranslations.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/QueryExecutionRequestException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/QuerySplitter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/QueryTranslator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/QueryTranslatorFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlBaseLexer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlBaseLexer.smap'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlBaseParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlBaseParser.smap'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlSqlBaseWalker.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlSqlBaseWalker.smap'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlSqlTokenTypes.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlSqlTokenTypes.txt'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlTokenTypes.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/HqlTokenTypes.txt'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/SqlGeneratorBase.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/SqlGeneratorBase.smap'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/SqlTokenTypes.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/SqlTokenTypes.txt'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/antlr/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/ASTQueryTranslatorFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/DetailedSemanticException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/ErrorCounter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/ErrorReporter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/HqlASTFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/HqlLexer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/HqlParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/HqlSqlWalker.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/HqlToken.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/InvalidPathException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/InvalidWithClauseException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/ParameterTranslationsImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/ParseErrorHandler.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/QuerySyntaxException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/QueryTranslatorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/SqlASTFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/SqlGenerator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/exec/BasicExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/exec/MultiTableDeleteExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/exec/MultiTableUpdateExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/exec/StatementExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/AbstractNullnessCheckNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/AbstractRestrictableStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/AbstractSelectExpression.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/AbstractStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/AggregateNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/AssignmentSpecification.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/BetweenOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/BinaryArithmeticOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/BinaryLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/BinaryOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/BooleanLiteralNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/Case2Node.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/CaseNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/CollectionFunction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/ConstructorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/CountNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/DeleteStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/DisplayableNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/DotNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/ExpectedTypeAwareNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/FromClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/FromElement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/FromElementFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/FromElementType.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/FromReferenceNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/HqlSqlWalkerNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/IdentNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/ImpliedFromElement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/InLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/IndexNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/InitializeableNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/InsertStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/IntoClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/IsNotNullLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/IsNullLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/JavaConstantNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/LiteralNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/MethodNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/Node.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/OperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/OrderByClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/ParameterNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/PathNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/QueryNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/ResolvableNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/RestrictableStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/SelectClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/SelectExpression.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/SelectExpressionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/SelectExpressionList.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/SessionFactoryAwareNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/SqlFragment.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/SqlNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/Statement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/UnaryArithmeticNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/UnaryLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/UnaryOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/tree/UpdateStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/ASTAppender.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/ASTIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/ASTParentsFirstIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/ASTPrinter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/ASTUtil.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/AliasGenerator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/ColumnHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/JoinProcessor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/LiteralProcessor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/NodeTraverser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/PathHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/SessionFactoryHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/ast/util/SyntheticAndFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/ClassicQueryTranslatorFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/ClauseParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/FromParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/FromPathExpressionParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/GroupByParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/HavingParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/OrderByParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/Parser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/ParserHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/PathExpressionParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/PreprocessingParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/QueryTranslatorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/SelectParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/SelectPathExpressionParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/WhereParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/classic/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/CollectionProperties.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/CollectionSubqueryFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/HolderInstantiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/NameGenerator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/QueryExecutionRequestException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/QuerySplitter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/antlr/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/ASTQueryTranslatorFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/DetailedSemanticException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/ErrorCounter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/ErrorReporter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/HqlASTFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/HqlLexer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/HqlParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/HqlSqlWalker.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/HqlToken.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/InvalidPathException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/InvalidWithClauseException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/ParameterTranslationsImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/ParseErrorHandler.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/QuerySyntaxException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/QueryTranslatorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/SqlASTFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/SqlGenerator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/TypeDiscriminatorMetadata.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/exec/BasicExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/exec/DeleteExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/exec/MultiTableDeleteExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/exec/MultiTableUpdateExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/exec/StatementExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AbstractMapComponentNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AbstractNullnessCheckNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AbstractRestrictableStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AbstractSelectExpression.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AbstractStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AggregateNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AggregatedSelectExpression.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/AssignmentSpecification.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/BetweenOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/BinaryArithmeticOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/BinaryLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/BinaryOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/BooleanLiteralNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/Case2Node.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/CaseNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/CollectionFunction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ComponentJoin.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ConstructorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/CountNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/DeleteStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/DisplayableNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/DotNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ExpectedTypeAwareNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/FromClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/FromElement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/FromElementFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/FromElementType.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/FromReferenceNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/FunctionNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/HqlSqlWalkerNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/IdentNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ImpliedFromElement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/InLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/IndexNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/InitializeableNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/InsertStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/IntoClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/IsNotNullLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/IsNullLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/JavaConstantNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/LiteralNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/MapEntryNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/MapKeyNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/MapValueNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/MethodNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/Node.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/OperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/OrderByClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ParameterContainer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ParameterNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/PathNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/QueryNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ResolvableNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/RestrictableStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/ResultVariableRefNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/SelectClause.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/SelectExpression.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/SelectExpressionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/SelectExpressionList.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/SessionFactoryAwareNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/SqlFragment.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/SqlNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/Statement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/UnaryArithmeticNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/UnaryLogicOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/UnaryOperatorNode.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/tree/UpdateStatement.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/ASTAppender.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/ASTIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/ASTParentsFirstIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/ASTPrinter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/ASTUtil.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/AliasGenerator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/ColumnHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/JoinProcessor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/LiteralProcessor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/NodeTraverser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/PathHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/SessionFactoryHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/ast/util/SyntheticAndFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/ClassicQueryTranslatorFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/ClauseParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/FromParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/FromPathExpressionParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/GroupByParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/HavingParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/OrderByParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/Parser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/ParserHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/PathExpressionParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/PreprocessingParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/QueryTranslatorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/SelectParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/SelectPathExpressionParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/WhereParser.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/internal/classic/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/AbstractTableBasedBulkIdHandler.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/FilterTranslator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/MultiTableBulkIdStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/ParameterTranslations.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/PersistentTableBulkIdStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/QueryTranslator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/QueryTranslatorFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/TableBasedDeleteHandlerImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/TableBasedUpdateHandlerImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hql/spi/TemporaryTableBulkIdStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/AbstractQueryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/AbstractScrollableResults.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/AbstractSessionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/CollectionFilterImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/CriteriaImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/FetchingScrollableResultsImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/FilterImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/IteratorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/QueryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/SQLQueryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/ScrollableResultsImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/SessionFactoryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/SessionFactoryObjectFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/SessionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/StatelessSessionImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/impl/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/AbstractFieldInterceptor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/FieldInterceptionHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/FieldInterceptor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/LazyPropertyInitializer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/package.html'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/cglib/CGLIBHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/cglib/FieldInterceptorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/javassist/FieldInterceptorImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/intercept/javassist/JavassistHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/AbstractBatcher.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/AbstractReturningWork.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/AbstractWork.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchFailedException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchFailedException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchFailedException.java 17 Aug 2012 14:33:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchFailedException.java 30 Jul 2014 15:52:06 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.jdbc; - import org.hibernate.HibernateException; /** Index: 3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java 17 Aug 2012 14:33:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java 30 Jul 2014 15:52:06 -0000 1.1.2.1 @@ -24,6 +24,7 @@ */ package org.hibernate.jdbc; + /** * Much like {@link TooManyRowsAffectedException}, indicates that more * rows than what we were expcecting were affected. Additionally, this form Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/Batcher.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatcherFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchingBatcher.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/BatchingBatcherFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/BorrowedConnectionProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/ColumnNameCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/ConnectionManager.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/ConnectionWrapper.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectation.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectation.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectation.java 17 Aug 2012 14:33:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectation.java 30 Jul 2014 15:52:06 -0000 1.1.2.1 @@ -23,12 +23,11 @@ * */ package org.hibernate.jdbc; +import java.sql.PreparedStatement; +import java.sql.SQLException; import org.hibernate.HibernateException; -import java.sql.SQLException; -import java.sql.PreparedStatement; - /** * Defines an expected DML operation outcome. * Index: 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectations.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectations.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectations.java 17 Aug 2012 14:33:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Expectations.java 30 Jul 2014 15:52:06 -0000 1.1.2.1 @@ -24,27 +24,30 @@ */ package org.hibernate.jdbc; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.hibernate.StaleStateException; -import org.hibernate.HibernateException; -import org.hibernate.engine.ExecuteUpdateResultCheckStyle; -import org.hibernate.util.JDBCExceptionReporter; -import org.hibernate.exception.GenericJDBCException; - import java.sql.CallableStatement; -import java.sql.SQLException; import java.sql.PreparedStatement; +import java.sql.SQLException; import java.sql.Types; +import org.hibernate.HibernateException; +import org.hibernate.StaleStateException; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; +import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle; +import org.hibernate.exception.GenericJDBCException; +import org.hibernate.internal.CoreMessageLogger; + +import org.jboss.logging.Logger; + /** * Holds various often used {@link Expectation} definitions. * * @author Steve Ebersole */ public class Expectations { - private static final Logger log = LoggerFactory.getLogger( Expectations.class ); + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Expectations.class.getName()); + private static SqlExceptionHelper sqlExceptionHelper = new SqlExceptionHelper(); + public static final int USUAL_EXPECTED_COUNT = 1; public static final int USUAL_PARAM_POSITION = 1; @@ -72,22 +75,13 @@ } private void checkBatched(int rowCount, int batchPosition) { - if ( rowCount == -2 ) { - if ( log.isDebugEnabled() ) { - log.debug( "success of batch update unknown: " + batchPosition ); - } - } - else if ( rowCount == -3 ) { - throw new BatchFailedException( "Batch update failed: " + batchPosition ); - } + if (rowCount == -2) LOG.debugf("Success of batch update unknown: %s", batchPosition); + else if (rowCount == -3) throw new BatchFailedException("Batch update failed: " + batchPosition); else { - if ( expectedRowCount > rowCount ) { - throw new StaleStateException( - "Batch update returned unexpected row count from update [" + batchPosition + - "]; actual row count: " + rowCount + - "; expected: " + expectedRowCount - ); - } + if (expectedRowCount > rowCount) throw new StaleStateException( + "Batch update returned unexpected row count from update [" + + batchPosition + "]; actual row count: " + rowCount + + "; expected: " + expectedRowCount); if ( expectedRowCount < rowCount ) { String msg = "Batch update returned unexpected row count from update [" + batchPosition + "]; actual row count: " + rowCount + @@ -129,21 +123,24 @@ this.parameterPosition = parameterPosition; } - public int prepare(PreparedStatement statement) throws SQLException, HibernateException { + @Override + public int prepare(PreparedStatement statement) throws SQLException, HibernateException { toCallableStatement( statement ).registerOutParameter( parameterPosition, Types.NUMERIC ); return 1; } - public boolean canBeBatched() { + @Override + public boolean canBeBatched() { return false; } - protected int determineRowCount(int reportedRowCount, PreparedStatement statement) { + @Override + protected int determineRowCount(int reportedRowCount, PreparedStatement statement) { try { return toCallableStatement( statement ).getInt( parameterPosition ); } catch( SQLException sqle ) { - JDBCExceptionReporter.logExceptions( sqle, "could not extract row counts from CallableStatement" ); + sqlExceptionHelper.logExceptions( sqle, "could not extract row counts from CallableStatement" ); throw new GenericJDBCException( "could not extract row counts from CallableStatement", sqle ); } } @@ -161,7 +158,7 @@ public static final Expectation NONE = new Expectation() { public void verifyOutcome(int rowCount, PreparedStatement statement, int batchPosition) { - // explicitly perform no checking... + // explicitly doAfterTransactionCompletion no checking... } public int prepare(PreparedStatement statement) { Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/JDBCContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/NonBatchingBatcher.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/NonBatchingBatcherFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/ResultSetWrapper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/ReturningWork.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/jdbc/TooManyRowsAffectedException.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/jdbc/TooManyRowsAffectedException.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/jdbc/TooManyRowsAffectedException.java 17 Aug 2012 14:33:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/jdbc/TooManyRowsAffectedException.java 30 Jul 2014 15:52:06 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.jdbc; - import org.hibernate.HibernateException; /** Index: 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Work.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/jdbc/Work.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Work.java 17 Aug 2012 14:33:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/jdbc/Work.java 30 Jul 2014 15:52:06 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.jdbc; - import java.sql.Connection; import java.sql.SQLException; Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/WorkExecutor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/WorkExecutorVisitable.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/jdbc/package.html =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/jdbc/package.html,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/jdbc/package.html 17 Aug 2012 14:33:38 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/jdbc/package.html 30 Jul 2014 15:52:06 -0000 1.1.2.1 @@ -1,10 +1,10 @@ -

- This package abstracts the mechanism for dispatching SQL statements - to the database, and implements interaction with JDBC. + Essentially defines {@link org.hibernate.jdbc.Work}, {@link org.hibernate.jdbc.ReturningWork} and + {@link org.hibernate.jdbc.Expectation} as well as some exceptions

-

- Concrete implementations of the Batcher interface may be - selected by specifying hibernate.jdbc.factory_class. -

Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/util/BasicFormatterImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/util/DDLFormatterImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/util/FormatStyle.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/util/Formatter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/jdbc/util/SQLStatementLogger.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/param/AbstractExplicitParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/AbstractExplicitParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/AbstractExplicitParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/AbstractExplicitParameterSpecification.java 30 Jul 2014 15:52:32 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.param; - import org.hibernate.type.Type; /** @@ -32,28 +31,37 @@ * @author Steve Ebersole */ public abstract class AbstractExplicitParameterSpecification implements ExplicitParameterSpecification { - private final int sourceLine; private final int sourceColumn; private Type expectedType; + /** + * Constructs an AbstractExplicitParameterSpecification. + * + * @param sourceLine See {@link #getSourceLine()} + * @param sourceColumn See {@link #getSourceColumn()} + */ protected AbstractExplicitParameterSpecification(int sourceLine, int sourceColumn) { this.sourceLine = sourceLine; this.sourceColumn = sourceColumn; } + @Override public int getSourceLine() { return sourceLine; } + @Override public int getSourceColumn() { return sourceColumn; } + @Override public Type getExpectedType() { return expectedType; } + @Override public void setExpectedType(Type expectedType) { this.expectedType = expectedType; } Index: 3rdParty_sources/hibernate-core/org/hibernate/param/CollectionFilterKeyParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/CollectionFilterKeyParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/CollectionFilterKeyParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/CollectionFilterKeyParameterSpecification.java 30 Jul 2014 15:52:33 -0000 1.1.2.1 @@ -23,22 +23,20 @@ * */ package org.hibernate.param; - import java.sql.PreparedStatement; import java.sql.SQLException; -import org.hibernate.engine.QueryParameters; -import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.type.Type; /** - * A specialized ParameterSpecification impl for dealing with a collection-key - * as part of a collection filter compilation. + * A specialized ParameterSpecification impl for dealing with a collection-key as part of a collection filter + * compilation. * * @author Steve Ebersole */ public class CollectionFilterKeyParameterSpecification implements ParameterSpecification { - private final String collectionRole; private final Type keyType; private final int queryParameterPosition; @@ -48,7 +46,7 @@ * * @param collectionRole The collection role being filtered. * @param keyType The mapped collection-key type. - * @param queryParameterPosition The position within {@link org.hibernate.engine.QueryParameters} where + * @param queryParameterPosition The position within {@link org.hibernate.engine.spi.QueryParameters} where * we can find the appropriate param value to bind. */ public CollectionFilterKeyParameterSpecification(String collectionRole, Type keyType, int queryParameterPosition) { @@ -57,6 +55,7 @@ this.queryParameterPosition = queryParameterPosition; } + @Override public int bind( PreparedStatement statement, QueryParameters qp, @@ -67,14 +66,17 @@ return keyType.getColumnSpan( session.getFactory() ); } + @Override public Type getExpectedType() { return keyType; } + @Override public void setExpectedType(Type expectedType) { // todo : throw exception? } + @Override public String renderDisplayInfo() { return "collection-filter-key=" + collectionRole; } Index: 3rdParty_sources/hibernate-core/org/hibernate/param/DynamicFilterParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/DynamicFilterParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/DynamicFilterParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/DynamicFilterParameterSpecification.java 30 Jul 2014 15:52:33 -0000 1.1.2.1 @@ -23,61 +23,77 @@ * */ package org.hibernate.param; - import java.sql.PreparedStatement; import java.sql.SQLException; +import java.util.Collection; +import java.util.Iterator; -import org.hibernate.engine.QueryParameters; -import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.type.Type; /** - * A specialized ParameterSpecification impl for dealing with a dynamic filter - * parameters. - *

- * Note: this class is currently not used. The ideal way to deal with dynamic filter - * parameters for HQL would be to track them just as we do with other parameters - * in the translator. However, the problem with that is that we currently do not - * know the filters which actually apply to the query; we know the active/enabled ones, - * but not the ones that actually "make it into" the resulting query. + * A specialized ParameterSpecification impl for dealing with a dynamic filter parameters. + * + * @see org.hibernate.Session#enableFilter(String) * * @author Steve Ebersole */ public class DynamicFilterParameterSpecification implements ParameterSpecification { private final String filterName; private final String parameterName; private final Type definedParameterType; - private final int queryParameterPosition; + /** + * Constructs a parameter specification for a particular filter parameter. + * + * @param filterName The name of the filter + * @param parameterName The name of the parameter + * @param definedParameterType The paremeter type specified on the filter metadata + */ public DynamicFilterParameterSpecification( String filterName, String parameterName, - Type definedParameterType, - int queryParameterPosition) { + Type definedParameterType) { this.filterName = filterName; this.parameterName = parameterName; this.definedParameterType = definedParameterType; - this.queryParameterPosition = queryParameterPosition; } + @Override public int bind( PreparedStatement statement, QueryParameters qp, SessionImplementor session, - int position) throws SQLException { - Object value = qp.getFilteredPositionalParameterValues()[queryParameterPosition]; - definedParameterType.nullSafeSet( statement, value, position, session ); - return definedParameterType.getColumnSpan( session.getFactory() ); + int start) throws SQLException { + final int columnSpan = definedParameterType.getColumnSpan( session.getFactory() ); + final Object value = session.getLoadQueryInfluencers().getFilterParameterValue( filterName + '.' + parameterName ); + if ( Collection.class.isInstance( value ) ) { + int positions = 0; + Iterator itr = ( ( Collection ) value ).iterator(); + while ( itr.hasNext() ) { + definedParameterType.nullSafeSet( statement, itr.next(), start + positions, session ); + positions += columnSpan; + } + return positions; + } + else { + definedParameterType.nullSafeSet( statement, value, start, session ); + return columnSpan; + } } + @Override public Type getExpectedType() { return definedParameterType; } + @Override public void setExpectedType(Type expectedType) { - // todo : throw exception? + // todo : throw exception? maybe warn if not the same? } + @Override public String renderDisplayInfo() { return "dynamic-filter={filterName=" + filterName + ",paramName=" + parameterName + "}"; } Index: 3rdParty_sources/hibernate-core/org/hibernate/param/ExplicitParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/ExplicitParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/ExplicitParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/ExplicitParameterSpecification.java 30 Jul 2014 15:52:32 -0000 1.1.2.1 @@ -24,14 +24,25 @@ */ package org.hibernate.param; + /** - * An additional contract for parameters which originate from - * parameters explicitly encountered in the source statement + * An additional contract for parameters which originate from parameters explicitly encountered in the source statement * (HQL or native-SQL). * * @author Steve Ebersole */ public interface ExplicitParameterSpecification extends ParameterSpecification { + /** + * Retrieves the line number on which this parameter occurs in the source query. + * + * @return The line number. + */ public int getSourceLine(); + + /** + * Retrieves the column number (within the {@link #getSourceLine()}) where this parameter occurs. + * + * @return The column number. + */ public int getSourceColumn(); } Index: 3rdParty_sources/hibernate-core/org/hibernate/param/NamedParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/NamedParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/NamedParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/NamedParameterSpecification.java 30 Jul 2014 15:52:33 -0000 1.1.2.1 @@ -23,23 +23,28 @@ * */ package org.hibernate.param; - -import org.hibernate.engine.QueryParameters; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.engine.TypedValue; - import java.sql.PreparedStatement; import java.sql.SQLException; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.engine.spi.TypedValue; + /** - * Relates to an explicit query named-parameter. + * Parameter bind specification for an explicit named parameter. * * @author Steve Ebersole */ -public class NamedParameterSpecification extends AbstractExplicitParameterSpecification implements ParameterSpecification { - +public class NamedParameterSpecification extends AbstractExplicitParameterSpecification { private final String name; + /** + * Constructs a named parameter bind specification. + * + * @param sourceLine See {@link #getSourceLine()} + * @param sourceColumn See {@link #getSourceColumn()} + * @param name The named parameter name. + */ public NamedParameterSpecification(int sourceLine, int sourceColumn, String name) { super( sourceLine, sourceColumn ); this.name = name; @@ -55,17 +60,24 @@ * * @return The number of sql bind positions "eaten" by this bind operation. */ + @Override public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) throws SQLException { - TypedValue typedValue = ( TypedValue ) qp.getNamedParameters().get( name ); + TypedValue typedValue = qp.getNamedParameters().get( name ); typedValue.getType().nullSafeSet( statement, typedValue.getValue(), position, session ); return typedValue.getType().getColumnSpan( session.getFactory() ); } + @Override public String renderDisplayInfo() { return "name=" + name + ", expectedType=" + getExpectedType(); } + /** + * Getter for property 'name'. + * + * @return Value for property 'name'. + */ public String getName() { return name; } Index: 3rdParty_sources/hibernate-core/org/hibernate/param/ParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/ParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/ParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/ParameterSpecification.java 30 Jul 2014 15:52:33 -0000 1.1.2.1 @@ -23,14 +23,13 @@ * */ package org.hibernate.param; - -import org.hibernate.engine.QueryParameters; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.type.Type; - import java.sql.PreparedStatement; import java.sql.SQLException; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.type.Type; + /** * Maintains information relating to parameters which need to get bound into a * JDBC {@link PreparedStatement}. Index: 3rdParty_sources/hibernate-core/org/hibernate/param/PositionalParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/PositionalParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/PositionalParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/PositionalParameterSpecification.java 30 Jul 2014 15:52:33 -0000 1.1.2.1 @@ -23,23 +23,28 @@ * */ package org.hibernate.param; - -import org.hibernate.engine.QueryParameters; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.type.Type; - import java.sql.PreparedStatement; import java.sql.SQLException; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.type.Type; + /** - * Relates to an explicit query positional (or ordinal) parameter. + * Parameter bind specification for an explicit positional (or ordinal) parameter. * * @author Steve Ebersole */ -public class PositionalParameterSpecification extends AbstractExplicitParameterSpecification implements ParameterSpecification { - +public class PositionalParameterSpecification extends AbstractExplicitParameterSpecification { private final int hqlPosition; + /** + * Constructs a position/ordinal parameter bind specification. + * + * @param sourceLine See {@link #getSourceLine()} + * @param sourceColumn See {@link #getSourceColumn()} + * @param hqlPosition The position in the source query, relative to the other source positional parameters. + */ public PositionalParameterSpecification(int sourceLine, int sourceColumn, int hqlPosition) { super( sourceLine, sourceColumn ); this.hqlPosition = hqlPosition; @@ -55,6 +60,7 @@ * * @return The number of sql bind positions "eaten" by this bind operation. */ + @Override public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) throws SQLException { Type type = qp.getPositionalParameterTypes()[hqlPosition]; Object value = qp.getPositionalParameterValues()[hqlPosition]; @@ -63,10 +69,16 @@ return type.getColumnSpan( session.getFactory() ); } + @Override public String renderDisplayInfo() { return "ordinal=" + hqlPosition + ", expectedType=" + getExpectedType(); } + /** + * Getter for property 'hqlPosition'. + * + * @return Value for property 'hqlPosition'. + */ public int getHqlPosition() { return hqlPosition; } Index: 3rdParty_sources/hibernate-core/org/hibernate/param/VersionTypeSeedParameterSpecification.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/param/VersionTypeSeedParameterSpecification.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/param/VersionTypeSeedParameterSpecification.java 17 Aug 2012 14:33:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/param/VersionTypeSeedParameterSpecification.java 30 Jul 2014 15:52:32 -0000 1.1.2.1 @@ -23,45 +23,49 @@ * */ package org.hibernate.param; - -import org.hibernate.engine.QueryParameters; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.type.VersionType; -import org.hibernate.type.Type; - import java.sql.PreparedStatement; import java.sql.SQLException; +import org.hibernate.engine.spi.QueryParameters; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.type.Type; +import org.hibernate.type.VersionType; + /** - * Implementation of VersionTypeSeedParameterSpecification. + * Parameter bind specification used for optimisitc lock version seeding (from insert statements). * * @author Steve Ebersole */ public class VersionTypeSeedParameterSpecification implements ParameterSpecification { + private final VersionType type; - private VersionType type; - + /** + * Constructs a version seed parameter bind specification. + * + * @param type The version type. + */ public VersionTypeSeedParameterSpecification(VersionType type) { this.type = type; } - /** - * @see org.hibernate.param.ParameterSpecification#bind - */ + @Override public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) throws SQLException { type.nullSafeSet( statement, type.seed( session ), position, session ); return 1; } + @Override public Type getExpectedType() { return type; } + @Override public void setExpectedType(Type expectedType) { // expected type is intrinsic here... } + @Override public String renderDisplayInfo() { return "version-seed, type=" + type; } Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/AbstractLazyInitializer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/AbstractLazyInitializer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/AbstractLazyInitializer.java 17 Aug 2012 14:36:30 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/AbstractLazyInitializer.java 30 Jul 2014 15:52:08 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2011, 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,79 +20,158 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.proxy; import java.io.Serializable; +import javax.naming.NamingException; +import org.hibernate.FlushMode; import org.hibernate.HibernateException; import org.hibernate.LazyInitializationException; -import org.hibernate.engine.EntityKey; -import org.hibernate.engine.SessionImplementor; +import org.hibernate.Session; +import org.hibernate.SessionException; +import org.hibernate.TransientObjectException; +import org.hibernate.engine.spi.EntityKey; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.internal.SessionFactoryRegistry; +import org.hibernate.persister.entity.EntityPersister; +import org.jboss.logging.Logger; + /** - * Convenience base class for lazy initialization handlers. Centralizes the - * basic plumbing of doing lazy initialization freeing subclasses to - * acts as essentially adapters to their intended entity mode and/or + * Convenience base class for lazy initialization handlers. Centralizes the basic plumbing of doing lazy + * initialization freeing subclasses to acts as essentially adapters to their intended entity mode and/or * proxy generation strategy. * * @author Gavin King */ public abstract class AbstractLazyInitializer implements LazyInitializer { - - private Object target; - private boolean initialized; + private static final Logger log = Logger.getLogger( AbstractLazyInitializer.class ); + private String entityName; private Serializable id; - private transient SessionImplementor session; + private Object target; + private boolean initialized; + private boolean readOnly; private boolean unwrap; + private transient SessionImplementor session; + private Boolean readOnlyBeforeAttachedToSession; + private String sessionFactoryUuid; + private boolean allowLoadOutsideTransaction; + /** * For serialization from the non-pojo initializers (HHH-3309) */ protected AbstractLazyInitializer() { } - + + /** + * Main constructor. + * + * @param entityName The name of the entity being proxied. + * @param id The identifier of the entity being proxied. + * @param session The session owning the proxy. + */ protected AbstractLazyInitializer(String entityName, Serializable id, SessionImplementor session) { - this.id = id; - this.session = session; this.entityName = entityName; + this.id = id; + // initialize other fields depending on session state + if ( session == null ) { + unsetSession(); + } + else { + setSession( session ); + } } + @Override + public final String getEntityName() { + return entityName; + } + + @Override public final Serializable getIdentifier() { return id; } + @Override public final void setIdentifier(Serializable id) { this.id = id; } - public final String getEntityName() { - return entityName; - } - + @Override public final boolean isUninitialized() { return !initialized; } + @Override public final SessionImplementor getSession() { return session; } + @Override + public final void setSession(SessionImplementor s) throws HibernateException { + if ( s != session ) { + // check for s == null first, since it is least expensive + if ( s == null ) { + unsetSession(); + } + else if ( isConnectedToSession() ) { + //TODO: perhaps this should be some other RuntimeException... + throw new HibernateException( "illegally attempted to associate a proxy with two open Sessions" ); + } + else { + // s != null + session = s; + if ( readOnlyBeforeAttachedToSession == null ) { + // use the default read-only/modifiable setting + final EntityPersister persister = s.getFactory().getEntityPersister( entityName ); + setReadOnly( s.getPersistenceContext().isDefaultReadOnly() || !persister.isMutable() ); + } + else { + // use the read-only/modifiable setting indicated during deserialization + setReadOnly( readOnlyBeforeAttachedToSession ); + readOnlyBeforeAttachedToSession = null; + } + } + } + } + + private static EntityKey generateEntityKeyOrNull(Serializable id, SessionImplementor s, String entityName) { + if ( id == null || s == null || entityName == null ) { + return null; + } + return s.generateEntityKey( id, s.getFactory().getEntityPersister( entityName ) ); + } + + @Override + public final void unsetSession() { + prepareForPossibleLoadingOutsideTransaction(); + session = null; + readOnly = false; + readOnlyBeforeAttachedToSession = null; + } + + @Override public final void initialize() throws HibernateException { - if (!initialized) { - if ( session==null ) { - throw new LazyInitializationException("could not initialize proxy - no Session"); + if ( !initialized ) { + if ( allowLoadOutsideTransaction ) { + permissiveInitialization(); } + else if ( session == null ) { + throw new LazyInitializationException( "could not initialize proxy - no Session" ); + } else if ( !session.isOpen() ) { - throw new LazyInitializationException("could not initialize proxy - the owning Session was closed"); + throw new LazyInitializationException( "could not initialize proxy - the owning Session was closed" ); } else if ( !session.isConnected() ) { - throw new LazyInitializationException("could not initialize proxy - the owning Session is disconnected"); + throw new LazyInitializationException( "could not initialize proxy - the owning Session is disconnected" ); } else { - target = session.immediateLoad(entityName, id); + target = session.immediateLoad( entityName, id ); initialized = true; checkTargetState(); } @@ -102,6 +181,81 @@ } } + protected void permissiveInitialization() { + if ( session == null ) { + //we have a detached collection thats set to null, reattach + if ( sessionFactoryUuid == null ) { + throw new LazyInitializationException( "could not initialize proxy - no Session" ); + } + try { + SessionFactoryImplementor sf = (SessionFactoryImplementor) + SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid ); + SessionImplementor session = (SessionImplementor) sf.openSession(); + session.getPersistenceContext().setDefaultReadOnly( true ); + session.setFlushMode( FlushMode.MANUAL ); + + boolean isJTA = session.getTransactionCoordinator() + .getTransactionContext().getTransactionEnvironment() + .getTransactionFactory() + .compatibleWithJtaSynchronization(); + + if ( !isJTA ) { + // Explicitly handle the transactions only if we're not in + // a JTA environment. A lazy loading temporary session can + // be created even if a current session and transaction are + // open (ex: session.clear() was used). We must prevent + // multiple transactions. + ( ( Session) session ).beginTransaction(); + } + + try { + target = session.immediateLoad( entityName, id ); + } + finally { + // make sure the just opened temp session gets closed! + try { + if ( !isJTA ) { + ( ( Session) session ).getTransaction().commit(); + } + ( (Session) session ).close(); + } + catch (Exception e) { + log.warn( "Unable to close temporary session used to load lazy proxy associated to no session" ); + } + } + initialized = true; + checkTargetState(); + } + catch (Exception e) { + e.printStackTrace(); + throw new LazyInitializationException( e.getMessage() ); + } + } + else if ( session.isOpen() && session.isConnected() ) { + target = session.immediateLoad( entityName, id ); + initialized = true; + checkTargetState(); + } + else { + throw new LazyInitializationException( "could not initialize proxy - Session was closed or disced" ); + } + } + + protected void prepareForPossibleLoadingOutsideTransaction() { + if ( session != null ) { + allowLoadOutsideTransaction = session.getFactory().getSettings().isInitializeLazyStateOutsideTransactionsEnabled(); + + if ( allowLoadOutsideTransaction && sessionFactoryUuid == null ) { + try { + sessionFactoryUuid = (String) session.getFactory().getReference().get( "uuid" ).getContent(); + } + catch (NamingException e) { + //not much we can do if this fails... + } + } + } + } + private void checkTargetState() { if ( !unwrap ) { if ( target == null ) { @@ -110,60 +264,146 @@ } } - public final void setSession(SessionImplementor s) throws HibernateException { - if (s!=session) { - if ( isConnectedToSession() ) { - //TODO: perhaps this should be some other RuntimeException... - throw new HibernateException("illegally attempted to associate a proxy with two open Sessions"); - } - else { - session = s; - } + /** + * Getter for property 'connectedToSession'. + * + * @return Value for property 'connectedToSession'. + */ + protected final boolean isConnectedToSession() { + return getProxyOrNull() != null; + } + + private Object getProxyOrNull() { + final EntityKey entityKey = generateEntityKeyOrNull( getIdentifier(), session, getEntityName() ); + if ( entityKey != null && session != null && session.isOpen() ) { + return session.getPersistenceContext().getProxy( entityKey ); } + return null; } - protected final boolean isConnectedToSession() { - return session!=null && - session.isOpen() && - session.getPersistenceContext().containsProxy(this); + @Override + public final Object getImplementation() { + initialize(); + return target; } - + + @Override public final void setImplementation(Object target) { this.target = target; initialized = true; } + @Override + public final Object getImplementation(SessionImplementor s) throws HibernateException { + final EntityKey entityKey = generateEntityKeyOrNull( getIdentifier(), s, getEntityName() ); + return (entityKey == null ? null : s.getPersistenceContext().getEntity( entityKey )); + } + /** - * Return the underlying persistent object, initializing if necessary + * Getter for property 'target'. + *

+ * Same as {@link #getImplementation()} except that this method will not force initialization. + * + * @return Value for property 'target'. */ - public final Object getImplementation() { - initialize(); + protected final Object getTarget() { return target; } + @Override + public final boolean isReadOnlySettingAvailable() { + return (session != null && !session.isClosed()); + } + + private void errorIfReadOnlySettingNotAvailable() { + if ( session == null ) { + throw new TransientObjectException( + "Proxy is detached (i.e, session is null). The read-only/modifiable setting is only accessible when the proxy is associated with an open session." + ); + } + if ( session.isClosed() ) { + throw new SessionException( + "Session is closed. The read-only/modifiable setting is only accessible when the proxy is associated with an open session." + ); + } + } + + @Override + public final boolean isReadOnly() { + errorIfReadOnlySettingNotAvailable(); + return readOnly; + } + + @Override + public final void setReadOnly(boolean readOnly) { + errorIfReadOnlySettingNotAvailable(); + // only update if readOnly is different from current setting + if ( this.readOnly != readOnly ) { + final EntityPersister persister = session.getFactory().getEntityPersister( entityName ); + if ( !persister.isMutable() && !readOnly ) { + throw new IllegalStateException( "cannot make proxies for immutable entities modifiable" ); + } + this.readOnly = readOnly; + if ( initialized ) { + EntityKey key = generateEntityKeyOrNull( getIdentifier(), session, getEntityName() ); + if ( key != null && session.getPersistenceContext().containsEntity( key ) ) { + session.getPersistenceContext().setReadOnly( target, readOnly ); + } + } + } + } + /** - * Return the underlying persistent object in the given Session, or null, - * do not initialize the proxy + * Get the read-only/modifiable setting that should be put in affect when it is + * attached to a session. + *

+ * This method should only be called during serialization when read-only/modifiable setting + * is not available (i.e., isReadOnlySettingAvailable() == false) + * + * @return null, if the default setting should be used; + * true, for read-only; + * false, for modifiable + * + * @throws IllegalStateException if isReadOnlySettingAvailable() == true */ - public final Object getImplementation(SessionImplementor s) throws HibernateException { - final EntityKey entityKey = new EntityKey( - getIdentifier(), - s.getFactory().getEntityPersister( getEntityName() ), - s.getEntityMode() + protected final Boolean isReadOnlyBeforeAttachedToSession() { + if ( isReadOnlySettingAvailable() ) { + throw new IllegalStateException( + "Cannot call isReadOnlyBeforeAttachedToSession when isReadOnlySettingAvailable == true" ); - return s.getPersistenceContext().getEntity( entityKey ); + } + return readOnlyBeforeAttachedToSession; } - protected final Object getTarget() { - return target; + /** + * Set the read-only/modifiable setting that should be put in affect when it is + * attached to a session. + *

+ * This method should only be called during deserialization, before associating + * the proxy with a session. + * + * @param readOnlyBeforeAttachedToSession, the read-only/modifiable setting to use when + * associated with a session; null indicates that the default should be used. + * + * @throws IllegalStateException if isReadOnlySettingAvailable() == true + */ + /* package-private */ + final void setReadOnlyBeforeAttachedToSession(Boolean readOnlyBeforeAttachedToSession) { + if ( isReadOnlySettingAvailable() ) { + throw new IllegalStateException( + "Cannot call setReadOnlyBeforeAttachedToSession when isReadOnlySettingAvailable == true" + ); + } + this.readOnlyBeforeAttachedToSession = readOnlyBeforeAttachedToSession; } + @Override public boolean isUnwrap() { return unwrap; } + @Override public void setUnwrap(boolean unwrap) { this.unwrap = unwrap; } - } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/proxy/AbstractSerializableProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/EntityNotFoundDelegate.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/EntityNotFoundDelegate.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/EntityNotFoundDelegate.java 17 Aug 2012 14:36:30 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/EntityNotFoundDelegate.java 30 Jul 2014 15:52:08 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.proxy; - import java.io.Serializable; /** Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxy.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxy.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxy.java 17 Aug 2012 14:36:30 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxy.java 30 Jul 2014 15:52:08 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.proxy; - import java.io.Serializable; /** Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxyHelper.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxyHelper.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxyHelper.java 17 Aug 2012 14:36:30 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/HibernateProxyHelper.java 30 Jul 2014 15:52:08 -0000 1.1.2.1 @@ -25,6 +25,7 @@ package org.hibernate.proxy; + /** * Utility methods for working with proxies. (this class is being phased out) * @author Gavin King Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/LazyInitializer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/LazyInitializer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/LazyInitializer.java 17 Aug 2012 14:36:30 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/LazyInitializer.java 30 Jul 2014 15:52:08 -0000 1.1.2.1 @@ -23,76 +23,160 @@ * */ package org.hibernate.proxy; - import java.io.Serializable; import org.hibernate.HibernateException; -import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.spi.SessionImplementor; /** * Handles fetching of the underlying entity for a proxy + * * @author Gavin King + * @author Steve Ebersole */ public interface LazyInitializer { - /** - * Initialize the proxy, fetching the target - * entity if necessary + * Initialize the proxy, fetching the target entity if necessary. + * + * @throws HibernateException Indicates a problem initializing the proxy. */ - public abstract void initialize() throws HibernateException; - + public void initialize() throws HibernateException; + /** - * Get the identifier held by the proxy + * Retrieve the identifier value for the entity our owning proxy represents. + * + * @return The identifier value. */ - public abstract Serializable getIdentifier(); + public Serializable getIdentifier(); /** - * Set the identifier property of the proxy + * Set the identifier value for the entity our owning proxy represents. + * + * @param id The identifier value. */ - public abstract void setIdentifier(Serializable id); - + public void setIdentifier(Serializable id); + /** - * Get the entity name + * The entity-name of the entity our owning proxy represents. + * + * @return The entity-name. */ - public abstract String getEntityName(); - + public String getEntityName(); + /** - * Get the actual class of the entity (don't - * use this, use the entityName) + * Get the actual class of the entity. Generally, {@link #getEntityName()} should be used instead. + * + * @return The actual entity class. */ - public abstract Class getPersistentClass(); - + public Class getPersistentClass(); + /** * Is the proxy uninitialzed? + * + * @return True if uninitialized; false otherwise. */ - public abstract boolean isUninitialized(); - + public boolean isUninitialized(); + /** - * Initialize the proxy manually + * Return the underlying persistent object, initializing if necessary + * + * @return The underlying target entity. */ - public abstract void setImplementation(Object target); - + public Object getImplementation(); + /** - * Get the session, if this proxy is attached + * Return the underlying persistent object in the given session, or null if not contained in this session's + * persistence context. + * + * @param session The session to check + * + * @return The target, or null. + * + * @throws HibernateException Indicates problem locating the target. */ - public abstract SessionImplementor getSession(); - + public Object getImplementation(SessionImplementor session) throws HibernateException; + /** - * Attach the proxy to a session + * Initialize the proxy manually by injecting its target. + * + * @param target The proxy target (the actual entity being proxied). */ - public abstract void setSession(SessionImplementor s) throws HibernateException; + public void setImplementation(Object target); /** - * Return the underlying persistent object, initializing if necessary + * Is the proxy's read-only/modifiable setting available? + * @return true, if the setting is available + * false, if the proxy is detached or its associated session is closed */ - public abstract Object getImplementation(); + public boolean isReadOnlySettingAvailable(); /** - * Return the underlying persistent object in the given Session, or null + * Is the proxy read-only?. + * + * The read-only/modifiable setting is not available when the proxy is + * detached or its associated session is closed. + * + * To check if the read-only/modifiable setting is available: + * + * @return true, if this proxy is read-only; false, otherwise + * @throws org.hibernate.TransientObjectException if the proxy is detached (getSession() == null) + * @throws org.hibernate.SessionException if the proxy is associated with a sesssion that is closed + * + * @see org.hibernate.proxy.LazyInitializer#isReadOnlySettingAvailable() + * @see org.hibernate.Session#isReadOnly(Object entityOrProxy) */ - public abstract Object getImplementation(SessionImplementor s) - throws HibernateException; + public boolean isReadOnly(); + + /** + * Set an associated modifiable proxy to read-only mode, or a read-only + * proxy to modifiable mode. If the proxy is currently initialized, its + * implementation will be set to the same mode; otherwise, when the + * proxy is initialized, its implementation will have the same read-only/ + * modifiable setting as the proxy. In read-only mode, no snapshot is + * maintained and the instance is never dirty checked. + * + * If the associated proxy already has the specified read-only/modifiable + * setting, then this method does nothing. + * + * @param readOnly if true, the associated proxy is made read-only; + * if false, the associated proxy is made modifiable. + * @throws org.hibernate.TransientObjectException if the proxy is not association with a session + * @throws org.hibernate.SessionException if the proxy is associated with a session that is closed + * + * @see org.hibernate.Session#setReadOnly(Object entityOrProxy, boolean readOnly) + */ + public void setReadOnly(boolean readOnly); + + /** + * Get the session to which this proxy is associated, or null if it is not attached. + * + * @return The associated session. + */ + public SessionImplementor getSession(); + + /** + * Associate the proxy with the given session. + *

+ * Care should be given to make certain that the proxy is added to the session's persistence context as well + * to maintain the symetry of the association. That must be done seperately as this method simply sets an + * internal reference. We do also check that if there is already an associated session that the proxy + * reference was removed from that previous session's persistence contet. + * + * @param session The session + * @throws HibernateException Indicates that the proxy was still contained in the persistence context of the + * "previous session". + */ + public void setSession(SessionImplementor session) throws HibernateException; + + /** + * Unset this initializer's reference to session. It is assumed that the caller is also taking care or + * cleaning up the owning proxy's reference in the persistence context. + *

+ * Generally speaking this is intended to be called only during {@link org.hibernate.Session#evict} and + * {@link org.hibernate.Session#clear} processing; most other use-cases should call {@link #setSession} instead. + */ + public void unsetSession(); public void setUnwrap(boolean unwrap); public boolean isUnwrap(); -} \ No newline at end of file +} Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/ProxyFactory.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/ProxyFactory.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/ProxyFactory.java 17 Aug 2012 14:36:30 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/ProxyFactory.java 30 Jul 2014 15:52:08 -0000 1.1.2.1 @@ -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,17 +20,15 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.proxy; - import java.io.Serializable; import java.lang.reflect.Method; import java.util.Set; import org.hibernate.HibernateException; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.type.AbstractComponentType; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.type.CompositeType; /** * Contract for run-time, proxy-based lazy initialization proxies. @@ -42,7 +40,7 @@ /** * Called immediately after instantiation of this factory. *

- * Essentially equivalent to contructor injection, but contracted + * Essentially equivalent to constructor injection, but contracted * here via interface. * * @param entityName The name of the entity for which this factory should @@ -65,11 +63,11 @@ */ public void postInstantiate( String entityName, - Class persistentClass, - Set interfaces, - Method getIdentifierMethod, - Method setIdentifierMethod, - AbstractComponentType componentIdType) throws HibernateException; + Class persistentClass, + Set interfaces, + Method getIdentifierMethod, + Method setIdentifierMethod, + CompositeType componentIdType) throws HibernateException; /** * Create a new proxy instance Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/proxy/dom4j/Dom4jLazyInitializer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/proxy/dom4j/Dom4jProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/proxy/dom4j/Dom4jProxyFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapLazyInitializer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapLazyInitializer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapLazyInitializer.java 17 Aug 2012 14:36:41 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapLazyInitializer.java 30 Jul 2014 15:52:43 -0000 1.1.2.1 @@ -23,11 +23,10 @@ * */ package org.hibernate.proxy.map; - import java.io.Serializable; import java.util.Map; -import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.proxy.AbstractLazyInitializer; /** Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxy.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxy.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxy.java 17 Aug 2012 14:36:40 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxy.java 30 Jul 2014 15:52:43 -0000 1.1.2.1 @@ -23,15 +23,14 @@ * */ package org.hibernate.proxy.map; - -import org.hibernate.proxy.HibernateProxy; -import org.hibernate.proxy.LazyInitializer; - import java.io.Serializable; import java.util.Collection; import java.util.Map; import java.util.Set; +import org.hibernate.proxy.HibernateProxy; +import org.hibernate.proxy.LazyInitializer; + /** * Proxy for "dynamic-map" entity representations. * Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxyFactory.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxyFactory.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxyFactory.java 17 Aug 2012 14:36:41 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/map/MapProxyFactory.java 30 Jul 2014 15:52:43 -0000 1.1.2.1 @@ -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,19 +20,17 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.proxy.map; - import java.io.Serializable; import java.lang.reflect.Method; import java.util.Set; import org.hibernate.HibernateException; -import org.hibernate.proxy.ProxyFactory; +import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.proxy.HibernateProxy; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.type.AbstractComponentType; +import org.hibernate.proxy.ProxyFactory; +import org.hibernate.type.CompositeType; /** * @author Gavin King @@ -42,23 +40,19 @@ private String entityName; public void postInstantiate( - final String entityName, - final Class persistentClass, - final Set interfaces, - final Method getIdentifierMethod, - final Method setIdentifierMethod, - AbstractComponentType componentIdType) - throws HibernateException { - + final String entityName, + final Class persistentClass, + final Set interfaces, + final Method getIdentifierMethod, + final Method setIdentifierMethod, + CompositeType componentIdType) throws HibernateException { this.entityName = entityName; } - public HibernateProxy getProxy( - final Serializable id, - final SessionImplementor session) - throws HibernateException { - return new MapProxy( new MapLazyInitializer(entityName, id, session) ); + public HibernateProxy getProxy(final Serializable id, final SessionImplementor session) + throws HibernateException { + return new MapProxy( new MapLazyInitializer( entityName, id, session ) ); } } Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/BasicLazyInitializer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/BasicLazyInitializer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/BasicLazyInitializer.java 17 Aug 2012 14:36:54 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/BasicLazyInitializer.java 30 Jul 2014 15:52:41 -0000 1.1.2.1 @@ -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,87 +20,81 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.proxy.pojo; import java.io.Serializable; import java.lang.reflect.Method; -import org.hibernate.engine.EntityKey; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.type.AbstractComponentType; -import org.hibernate.util.MarkerObject; -import org.hibernate.util.ReflectHelper; +import org.hibernate.engine.spi.EntityKey; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.internal.util.MarkerObject; import org.hibernate.proxy.AbstractLazyInitializer; +import org.hibernate.type.CompositeType; /** * Lazy initializer for POJOs - * + * * @author Gavin King */ public abstract class BasicLazyInitializer extends AbstractLazyInitializer { protected static final Object INVOKE_IMPLEMENTATION = new MarkerObject("INVOKE_IMPLEMENTATION"); - protected Class persistentClass; - protected Method getIdentifierMethod; - protected Method setIdentifierMethod; - protected boolean overridesEquals; + protected final Class persistentClass; + protected final Method getIdentifierMethod; + protected final Method setIdentifierMethod; + protected final boolean overridesEquals; + protected final CompositeType componentIdType; + private Object replacement; - protected AbstractComponentType componentIdType; protected BasicLazyInitializer( String entityName, Class persistentClass, Serializable id, Method getIdentifierMethod, Method setIdentifierMethod, - AbstractComponentType componentIdType, - SessionImplementor session) { + CompositeType componentIdType, + SessionImplementor session, + boolean overridesEquals) { super(entityName, id, session); this.persistentClass = persistentClass; this.getIdentifierMethod = getIdentifierMethod; this.setIdentifierMethod = setIdentifierMethod; this.componentIdType = componentIdType; - overridesEquals = ReflectHelper.overridesEquals(persistentClass); + this.overridesEquals = overridesEquals; } protected abstract Object serializableProxy(); protected final Object invoke(Method method, Object[] args, Object proxy) throws Throwable { - String methodName = method.getName(); int params = args.length; if ( params==0 ) { - if ( "writeReplace".equals(methodName) ) { return getReplacement(); } else if ( !overridesEquals && "hashCode".equals(methodName) ) { - return new Integer( System.identityHashCode(proxy) ); + return System.identityHashCode(proxy); } else if ( isUninitialized() && method.equals(getIdentifierMethod) ) { return getIdentifier(); } - else if ( "getHibernateLazyInitializer".equals(methodName) ) { return this; } - } else if ( params==1 ) { - if ( !overridesEquals && "equals".equals(methodName) ) { - return args[0]==proxy ? Boolean.TRUE : Boolean.FALSE; + return args[0]==proxy; } else if ( method.equals(setIdentifierMethod) ) { initialize(); setIdentifier( (Serializable) args[0] ); return INVOKE_IMPLEMENTATION; } - } //if it is a property of an embedded component, invoke on the "identifier" @@ -114,14 +108,12 @@ } private Object getReplacement() { - final SessionImplementor session = getSession(); if ( isUninitialized() && session != null && session.isOpen()) { - final EntityKey key = new EntityKey( + final EntityKey key = session.generateEntityKey( getIdentifier(), - session.getFactory().getEntityPersister( getEntityName() ), - session.getEntityMode() - ); + session.getFactory().getEntityPersister( getEntityName() ) + ); final Object entity = session.getPersistenceContext().getEntity(key); if (entity!=null) setImplementation( entity ); } Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/cglib/CGLIBLazyInitializer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/cglib/CGLIBProxyFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/cglib/SerializableProxy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java 17 Aug 2012 14:36:56 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java 30 Jul 2014 15:52:14 -0000 1.1.2.1 @@ -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.proxy.pojo.javassist; @@ -30,23 +29,25 @@ import javassist.util.proxy.MethodFilter; import javassist.util.proxy.MethodHandler; +import javassist.util.proxy.Proxy; import javassist.util.proxy.ProxyFactory; -import javassist.util.proxy.ProxyObject; -import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.proxy.pojo.BasicLazyInitializer; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.internal.CoreLogging; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.ReflectHelper; import org.hibernate.proxy.HibernateProxy; -import org.hibernate.type.AbstractComponentType; -import org.hibernate.util.ReflectHelper; +import org.hibernate.proxy.pojo.BasicLazyInitializer; +import org.hibernate.type.CompositeType; /** * A Javassist-based lazy initializer proxy. * * @author Muga Nishizawa */ public class JavassistLazyInitializer extends BasicLazyInitializer implements MethodHandler { + private static final CoreMessageLogger LOG = CoreLogging.messageLogger( JavassistLazyInitializer.class ); private static final MethodFilter FINALIZE_FILTER = new MethodFilter() { public boolean isHandled(Method m) { @@ -56,82 +57,81 @@ }; private Class[] interfaces; - private boolean constructed = false; + private boolean constructed; private JavassistLazyInitializer( final String entityName, - final Class persistentClass, - final Class[] interfaces, - final Serializable id, - final Method getIdentifierMethod, - final Method setIdentifierMethod, - final AbstractComponentType componentIdType, - final SessionImplementor session) { - super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session ); + final Class persistentClass, + final Class[] interfaces, + final Serializable id, + final Method getIdentifierMethod, + final Method setIdentifierMethod, + final CompositeType componentIdType, + final SessionImplementor session, + final boolean overridesEquals) { + super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals ); this.interfaces = interfaces; } public static HibernateProxy getProxy( final String entityName, - final Class persistentClass, - final Class[] interfaces, - final Method getIdentifierMethod, - final Method setIdentifierMethod, - AbstractComponentType componentIdType, - final Serializable id, - final SessionImplementor session) throws HibernateException { + final Class persistentClass, + final Class[] interfaces, + final Method getIdentifierMethod, + final Method setIdentifierMethod, + CompositeType componentIdType, + final Serializable id, + final SessionImplementor session) throws HibernateException { // note: interface is assumed to already contain HibernateProxy.class try { final JavassistLazyInitializer instance = new JavassistLazyInitializer( entityName, - persistentClass, - interfaces, - id, - getIdentifierMethod, - setIdentifierMethod, - componentIdType, - session + persistentClass, + interfaces, + id, + getIdentifierMethod, + setIdentifierMethod, + componentIdType, + session, + ReflectHelper.overridesEquals(persistentClass) ); ProxyFactory factory = new ProxyFactory(); factory.setSuperclass( interfaces.length == 1 ? persistentClass : null ); factory.setInterfaces( interfaces ); factory.setFilter( FINALIZE_FILTER ); Class cl = factory.createClass(); final HibernateProxy proxy = ( HibernateProxy ) cl.newInstance(); - ( ( ProxyObject ) proxy ).setHandler( instance ); + ( ( Proxy ) proxy ).setHandler( instance ); instance.constructed = true; return proxy; } catch ( Throwable t ) { - LoggerFactory.getLogger( BasicLazyInitializer.class ).error( - "Javassist Enhancement failed: " + entityName, t - ); - throw new HibernateException( - "Javassist Enhancement failed: " - + entityName, t - ); + LOG.error(LOG.javassistEnhancementFailed(entityName), t); + throw new HibernateException(LOG.javassistEnhancementFailed(entityName), t); } } public static HibernateProxy getProxy( final Class factory, - final String entityName, - final Class persistentClass, - final Class[] interfaces, - final Method getIdentifierMethod, - final Method setIdentifierMethod, - final AbstractComponentType componentIdType, - final Serializable id, - final SessionImplementor session) throws HibernateException { + final String entityName, + final Class persistentClass, + final Class[] interfaces, + final Method getIdentifierMethod, + final Method setIdentifierMethod, + final CompositeType componentIdType, + final Serializable id, + final SessionImplementor session, + final boolean classOverridesEquals) throws HibernateException { final JavassistLazyInitializer instance = new JavassistLazyInitializer( entityName, - persistentClass, - interfaces, id, - getIdentifierMethod, - setIdentifierMethod, - componentIdType, - session + persistentClass, + interfaces, id, + getIdentifierMethod, + setIdentifierMethod, + componentIdType, + session, + classOverridesEquals ); final HibernateProxy proxy; @@ -144,14 +144,14 @@ + persistentClass.getName(), e ); } - ( ( ProxyObject ) proxy ).setHandler( instance ); + ( ( Proxy ) proxy ).setHandler( instance ); instance.constructed = true; return proxy; } public static Class getProxyFactory( Class persistentClass, - Class[] interfaces) throws HibernateException { + Class[] interfaces) throws HibernateException { // note: interfaces is assumed to already contain HibernateProxy.class try { @@ -162,17 +162,12 @@ return factory.createClass(); } catch ( Throwable t ) { - LoggerFactory.getLogger( BasicLazyInitializer.class ).error( - "Javassist Enhancement failed: " - + persistentClass.getName(), t - ); - throw new HibernateException( - "Javassist Enhancement failed: " - + persistentClass.getName(), t - ); + LOG.error(LOG.javassistEnhancementFailed(persistentClass.getName()), t); + throw new HibernateException(LOG.javassistEnhancementFailed(persistentClass.getName()), t); } } + @Override public Object invoke( final Object proxy, final Method thisMethod, @@ -192,17 +187,28 @@ try { if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) { if ( !thisMethod.getDeclaringClass().isInstance( target ) ) { - throw new ClassCastException( target.getClass().getName() ); + throw new ClassCastException( + target.getClass().getName() + + " incompatible with " + + thisMethod.getDeclaringClass().getName() + ); } returnValue = thisMethod.invoke( target, args ); } else { - if ( !thisMethod.isAccessible() ) { - thisMethod.setAccessible( true ); - } + thisMethod.setAccessible( true ); returnValue = thisMethod.invoke( target, args ); } - return returnValue == target ? proxy : returnValue; + + if ( returnValue == target ) { + if ( returnValue.getClass().isInstance(proxy) ) { + return proxy; + } + else { + LOG.narrowingProxy( returnValue.getClass() ); + } + } + return returnValue; } catch ( InvocationTargetException ite ) { throw ite.getTargetException(); @@ -223,15 +229,17 @@ } } + @Override protected Object serializableProxy() { return new SerializableProxy( getEntityName(), - persistentClass, - interfaces, - getIdentifier(), - getIdentifierMethod, - setIdentifierMethod, - componentIdType + persistentClass, + interfaces, + getIdentifier(), + ( isReadOnlySettingAvailable() ? Boolean.valueOf( isReadOnly() ) : isReadOnlyBeforeAttachedToSession() ), + getIdentifierMethod, + setIdentifierMethod, + componentIdType ); } } Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java 17 Aug 2012 14:36:56 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java 30 Jul 2014 15:52:14 -0000 1.1.2.1 @@ -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,19 +20,18 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.proxy.pojo.javassist; - import java.io.Serializable; import java.lang.reflect.Method; import java.util.Set; import org.hibernate.HibernateException; -import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.internal.util.ReflectHelper; import org.hibernate.proxy.HibernateProxy; import org.hibernate.proxy.ProxyFactory; -import org.hibernate.type.AbstractComponentType; +import org.hibernate.type.CompositeType; /** * A {@link ProxyFactory} implementation for producing Javassist-based proxies. @@ -47,38 +46,43 @@ private Class[] interfaces; private Method getIdentifierMethod; private Method setIdentifierMethod; - private AbstractComponentType componentIdType; + private CompositeType componentIdType; private Class factory; + private boolean overridesEquals; + @Override public void postInstantiate( final String entityName, final Class persistentClass, - final Set interfaces, + final Set interfaces, final Method getIdentifierMethod, - final Method setIdentifierMethod, - AbstractComponentType componentIdType) throws HibernateException { + final Method setIdentifierMethod, + CompositeType componentIdType) throws HibernateException { this.entityName = entityName; this.persistentClass = persistentClass; this.interfaces = (Class[]) interfaces.toArray(NO_CLASSES); this.getIdentifierMethod = getIdentifierMethod; this.setIdentifierMethod = setIdentifierMethod; this.componentIdType = componentIdType; - factory = JavassistLazyInitializer.getProxyFactory( persistentClass, this.interfaces ); + this.factory = JavassistLazyInitializer.getProxyFactory( persistentClass, this.interfaces ); + this.overridesEquals = ReflectHelper.overridesEquals(persistentClass); } + @Override public HibernateProxy getProxy( Serializable id, - SessionImplementor session) throws HibernateException { + SessionImplementor session) throws HibernateException { return JavassistLazyInitializer.getProxy( factory, - entityName, + entityName, persistentClass, - interfaces, - getIdentifierMethod, + interfaces, + getIdentifierMethod, setIdentifierMethod, - componentIdType, - id, - session + componentIdType, + id, + session, + overridesEquals ); } Index: 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/SerializableProxy.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/SerializableProxy.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/SerializableProxy.java 17 Aug 2012 14:36:56 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/proxy/pojo/javassist/SerializableProxy.java 30 Jul 2014 15:52:14 -0000 1.1.2.1 @@ -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,47 +20,45 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.proxy.pojo.javassist; - import java.io.Serializable; import java.lang.reflect.Method; import org.hibernate.HibernateException; -import org.hibernate.type.AbstractComponentType; +import org.hibernate.proxy.AbstractSerializableProxy; +import org.hibernate.proxy.HibernateProxy; +import org.hibernate.type.CompositeType; /** * Serializable placeholder for Javassist proxies */ -public final class SerializableProxy implements Serializable { +public final class SerializableProxy extends AbstractSerializableProxy { - private String entityName; private Class persistentClass; private Class[] interfaces; - private Serializable id; private Class getIdentifierMethodClass; private Class setIdentifierMethodClass; private String getIdentifierMethodName; private String setIdentifierMethodName; private Class[] setIdentifierMethodParams; - private AbstractComponentType componentIdType; + private CompositeType componentIdType; - public SerializableProxy() {} + public SerializableProxy() { + } public SerializableProxy( - final String entityName, - final Class persistentClass, - final Class[] interfaces, - final Serializable id, - final Method getIdentifierMethod, - final Method setIdentifierMethod, - AbstractComponentType componentIdType - ) { - this.entityName = entityName; + final String entityName, + final Class persistentClass, + final Class[] interfaces, + final Serializable id, + final Boolean readOnly, + final Method getIdentifierMethod, + final Method setIdentifierMethod, + CompositeType componentIdType) { + super( entityName, id, readOnly ); this.persistentClass = persistentClass; this.interfaces = interfaces; - this.id = id; if (getIdentifierMethod!=null) { getIdentifierMethodClass = getIdentifierMethod.getDeclaringClass(); getIdentifierMethodName = getIdentifierMethod.getName(); @@ -75,24 +73,25 @@ private Object readResolve() { try { - return JavassistLazyInitializer.getProxy( - entityName, + HibernateProxy proxy = JavassistLazyInitializer.getProxy( + getEntityName(), persistentClass, interfaces, - getIdentifierMethodName==null ? - null : - getIdentifierMethodClass.getDeclaredMethod(getIdentifierMethodName, null), - setIdentifierMethodName==null ? - null : - setIdentifierMethodClass.getDeclaredMethod(setIdentifierMethodName, setIdentifierMethodParams), - componentIdType, - id, + getIdentifierMethodName==null + ? null + : getIdentifierMethodClass.getDeclaredMethod( getIdentifierMethodName, (Class[]) null ), + setIdentifierMethodName==null + ? null + : setIdentifierMethodClass.getDeclaredMethod(setIdentifierMethodName, setIdentifierMethodParams), + componentIdType, + getId(), null ); + setReadOnlyBeforeAttachedToSession( ( JavassistLazyInitializer ) proxy.getHibernateLazyInitializer() ); + return proxy; } catch (NoSuchMethodException nsme) { - throw new HibernateException("could not create proxy for entity: " + entityName, nsme); + throw new HibernateException("could not create proxy for entity: " + getEntityName(), nsme); } } - } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/NoMoreReturnsException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/Output.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/Outputs.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/ResultSetOutput.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/UpdateCountOutput.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/package-info.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/internal/OutputsImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/internal/ResultSetOutputImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/internal/UpdateCountOutputImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/result/spi/ResultContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/BootstrapServiceRegistry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/BootstrapServiceRegistryBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/ConfigLoader.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/Service.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/ServiceRegistry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/ServiceRegistryBuilder.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/StandardServiceInitiators.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/UnknownServiceException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/UnknownUnwrapTypeException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/AbstractServiceRegistryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/ConcurrentServiceBinding.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/JaxbProcessor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/ProvidedService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/ServiceDependencyException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/ServiceProxyGenerationException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/SessionFactoryServiceRegistryFactoryInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/SessionFactoryServiceRegistryImpl.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/internal/StandardSessionFactoryServiceInitiators.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/Configurable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/InjectService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/Manageable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/ServiceBinding.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/ServiceContributor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/ServiceException.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/ServiceInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/ServiceRegistryAwareService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/ServiceRegistryImplementor.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/SessionFactoryServiceInitiator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/SessionFactoryServiceRegistry.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/Startable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/Stoppable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/service/spi/Wrapped.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/ANSICaseFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/ANSICaseFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/ANSICaseFragment.java 17 Aug 2012 14:36:46 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/ANSICaseFragment.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,34 +20,31 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.sql; -import java.util.Iterator; import java.util.Map; /** - An ANSI SQL CASE expression. -
- case when ... then ... end as ... -
- @author Gavin King, Simon Harris + * An ANSI SQL CASE expression : {@code case when ... then ... end as ..} + * + * @author Gavin King + * @author Simon Harris */ public class ANSICaseFragment extends CaseFragment { + @Override public String toFragmentString() { - StringBuffer buf = new StringBuffer( cases.size() * 15 + 10 ) + final StringBuilder buf = new StringBuilder( cases.size() * 15 + 10 ) .append("case"); - Iterator iter = cases.entrySet().iterator(); - while ( iter.hasNext() ) { - Map.Entry me = (Map.Entry) iter.next(); - buf.append(" when ") - .append( me.getKey() ) - .append(" is not null then ") - .append( me.getValue() ); + for ( Object o : cases.entrySet() ) { + Map.Entry me = (Map.Entry) o; + buf.append( " when " ) + .append( me.getKey() ) + .append( " is not null then " ) + .append( me.getValue() ); } buf.append(" end"); @@ -60,4 +57,4 @@ return buf.toString(); } -} \ No newline at end of file +} Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/ANSIJoinFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/ANSIJoinFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/ANSIJoinFragment.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/ANSIJoinFragment.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,28 +20,53 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.sql; import org.hibernate.AssertionFailure; /** - * An ANSI-style join + * An ANSI-style join. * * @author Gavin King */ public class ANSIJoinFragment extends JoinFragment { + private StringBuilder buffer = new StringBuilder(); + private StringBuilder conditions = new StringBuilder(); - private StringBuffer buffer = new StringBuffer(); - private StringBuffer conditions = new StringBuffer(); - - public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, int joinType) { - addJoin(tableName, alias, fkColumns, pkColumns, joinType, null); + /** + * Adds a join, represented by the given information, to the fragment. + * + * @param tableName The name of the table being joined. + * @param alias The alias applied to the table being joined. + * @param fkColumns The columns (from the table being joined) used to define the join-restriction (the ON) + * @param pkColumns The columns (from the table being joined to) used to define the join-restriction (the ON) + * @param joinType The type of join to produce (INNER, etc). + */ + public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType) { + addJoin( tableName, alias, fkColumns, pkColumns, joinType, null ); } - public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, int joinType, String on) { - String joinString; + /** + * Adds a join, represented by the given information, to the fragment. + * + * @param rhsTableName The name of the table being joined (the RHS table). + * @param rhsAlias The alias applied to the table being joined (the alias for the RHS table). + * @param lhsColumns The columns (from the table being joined) used to define the join-restriction (the ON). These + * are the LHS columns, and are expected to be qualified. + * @param rhsColumns The columns (from the table being joined to) used to define the join-restriction (the ON). These + * are the RHS columns and are expected to *not* be qualified. + * @param joinType The type of join to produce (INNER, etc). + * @param on Any extra join restrictions + */ + public void addJoin( + String rhsTableName, + String rhsAlias, + String[] lhsColumns, + String[] rhsColumns, + JoinType joinType, + String on) { + final String joinString; switch (joinType) { case INNER_JOIN: joinString = " inner join "; @@ -59,82 +84,95 @@ throw new AssertionFailure("undefined join type"); } - buffer.append(joinString) - .append(tableName) + this.buffer.append(joinString) + .append(rhsTableName) .append(' ') - .append(alias) + .append(rhsAlias) .append(" on "); - for ( int j=0; jDELETE statement * @@ -34,10 +35,11 @@ public class Delete { private String tableName; - private String[] primaryKeyColumnNames; private String versionColumnName; private String where; + private Map primaryKeyColumns = new LinkedHashMap(); + private String comment; public Delete setComment(String comment) { this.comment = comment; @@ -50,17 +52,22 @@ } public String toStatementString() { - StringBuffer buf = new StringBuffer( tableName.length() + 10 ); + StringBuilder buf = new StringBuilder( tableName.length() + 10 ); if ( comment!=null ) { buf.append( "/* " ).append(comment).append( " */ " ); } buf.append( "delete from " ).append(tableName); - if ( where != null || primaryKeyColumnNames != null || versionColumnName != null ) { + if ( where != null || !primaryKeyColumns.isEmpty() || versionColumnName != null ) { buf.append( " where " ); } boolean conditionsAppended = false; - if ( primaryKeyColumnNames != null ) { - buf.append( StringHelper.join( "=? and ", primaryKeyColumnNames ) ).append( "=?" ); + Iterator iter = primaryKeyColumns.entrySet().iterator(); + while ( iter.hasNext() ) { + Map.Entry e = (Map.Entry) iter.next(); + buf.append( e.getKey() ).append( '=' ).append( e.getValue() ); + if ( iter.hasNext() ) { + buf.append( " and " ); + } conditionsAppended = true; } if ( where!=null ) { @@ -94,11 +101,38 @@ return this; } - public Delete setPrimaryKeyColumnNames(String[] primaryKeyColumnNames) { - this.primaryKeyColumnNames = primaryKeyColumnNames; + public Delete setPrimaryKeyColumnNames(String[] columnNames) { + this.primaryKeyColumns.clear(); + addPrimaryKeyColumns(columnNames); return this; + } + + public Delete addPrimaryKeyColumns(String[] columnNames) { + for ( int i=0; i0 ) buffer.append(" or "); - buffer.append("(") - .append( fragment.toFragmentString() ) - .append(")"); + addCondition( fragment.toFragmentString() ); return this; } + public DisjunctionFragment addCondition(String fragment) { + if ( buffer.length() > 0 ) { + buffer.append(" or "); + } + buffer.append( '(' ) + .append( fragment ) + .append( ')' ); + return this; + } + public String toFragmentString() { return buffer.toString(); } Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/ForUpdateFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/ForUpdateFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/ForUpdateFragment.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/ForUpdateFragment.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -28,39 +28,53 @@ import java.util.Map; import org.hibernate.LockMode; +import org.hibernate.LockOptions; import org.hibernate.QueryException; import org.hibernate.dialect.Dialect; -import org.hibernate.util.StringHelper; +import org.hibernate.internal.util.StringHelper; /** * @author Gavin King */ public class ForUpdateFragment { - private final StringBuffer aliases = new StringBuffer(); + private final StringBuilder aliases = new StringBuilder(); private boolean isNowaitEnabled; + private boolean isSkipLockedEnabled; private final Dialect dialect; + private LockMode lockMode; + private LockOptions lockOptions; public ForUpdateFragment(Dialect dialect) { this.dialect = dialect; } - public ForUpdateFragment(Dialect dialect, Map lockModes, Map keyColumnNames) throws QueryException { + public ForUpdateFragment(Dialect dialect, LockOptions lockOptions, Map keyColumnNames) throws QueryException { this( dialect ); LockMode upgradeType = null; - Iterator iter = lockModes.entrySet().iterator(); + Iterator iter = lockOptions.getAliasLockIterator(); + this.lockOptions = lockOptions; + + if ( !iter.hasNext()) { // no tables referenced + final LockMode lockMode = lockOptions.getLockMode(); + if ( LockMode.READ.lessThan( lockMode ) ) { + upgradeType = lockMode; + this.lockMode = lockMode; + } + } + while ( iter.hasNext() ) { final Map.Entry me = ( Map.Entry ) iter.next(); final LockMode lockMode = ( LockMode ) me.getValue(); if ( LockMode.READ.lessThan( lockMode ) ) { final String tableAlias = ( String ) me.getKey(); if ( dialect.forUpdateOfColumns() ) { - String[] keyColumns = ( String[] ) keyColumnNames.get( tableAlias ); //use the id column alias + String[] keyColumns = keyColumnNames.get( tableAlias ); //use the id column alias if ( keyColumns == null ) { throw new IllegalArgumentException( "alias not found: " + tableAlias ); } keyColumns = StringHelper.qualify( tableAlias, keyColumns ); - for ( int i = 0; i < keyColumns.length; i++ ) { - addTableAlias( keyColumns[i] ); + for ( String keyColumn : keyColumns ) { + addTableAlias( keyColumn ); } } else { @@ -76,6 +90,10 @@ if ( upgradeType == LockMode.UPGRADE_NOWAIT ) { setNowaitEnabled( true ); } + + if ( upgradeType == LockMode.UPGRADE_SKIPLOCKED ) { + setSkipLockedEnabled( true ); + } } public ForUpdateFragment addTableAlias(String alias) { @@ -87,16 +105,35 @@ } public String toFragmentString() { - if ( aliases.length() == 0 ) { + if ( lockOptions!= null ) { + return dialect.getForUpdateString( aliases.toString(), lockOptions ); + } + else if ( aliases.length() == 0) { + if ( lockMode != null ) { + return dialect.getForUpdateString( lockMode ); + } return ""; } - return isNowaitEnabled ? - dialect.getForUpdateNowaitString( aliases.toString() ) : - dialect.getForUpdateString( aliases.toString() ); + // TODO: pass lockmode + if(isNowaitEnabled) { + return dialect.getForUpdateNowaitString( aliases.toString() ); + } + else if (isSkipLockedEnabled) { + return dialect.getForUpdateSkipLockedString( aliases.toString() ); + } + else { + return dialect.getForUpdateString( aliases.toString() ); + } } public ForUpdateFragment setNowaitEnabled(boolean nowait) { isNowaitEnabled = nowait; return this; } + + public ForUpdateFragment setSkipLockedEnabled(boolean skipLocked) { + isSkipLockedEnabled = skipLocked; + return this; + } + } Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/HSQLCaseFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/HSQLCaseFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/HSQLCaseFragment.java 17 Aug 2012 14:36:46 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/HSQLCaseFragment.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.sql; - import java.util.Iterator; import java.util.Map; @@ -37,8 +36,8 @@ public class HSQLCaseFragment extends CaseFragment { public String toFragmentString() { - StringBuffer buf = new StringBuffer( cases.size() * 15 + 10 ); - StringBuffer buf2 = new StringBuffer( cases.size() ); + StringBuilder buf = new StringBuilder( cases.size() * 15 + 10 ); + StringBuilder buf2 = new StringBuilder( cases.size() ); Iterator iter = cases.entrySet().iterator(); while ( iter.hasNext() ) { Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/InFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/InFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/InFragment.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/InFragment.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -25,16 +25,17 @@ package org.hibernate.sql; import java.util.ArrayList; -import java.util.Iterator; +import java.util.Collections; import java.util.List; -import org.hibernate.util.StringHelper; +import org.hibernate.internal.util.StringHelper; /** * An SQL IN expression. *
* ... in(...) *
+ * * @author Gavin King */ public class InFragment { @@ -43,75 +44,100 @@ public static final String NOT_NULL = "not null"; private String columnName; - private List values = new ArrayList(); + private List values = new ArrayList(); /** - * @param value, an SQL literal, NULL, or NOT_NULL + * @param value an SQL literal, NULL, or NOT_NULL + * + * @return {@code this}, for method chaining */ public InFragment addValue(Object value) { - values.add(value); + values.add( value ); return this; } + public InFragment addValues(Object[] values) { + Collections.addAll( this.values, values ); + return this; + } + public InFragment setColumn(String columnName) { this.columnName = columnName; return this; } public InFragment setColumn(String alias, String columnName) { - this.columnName = StringHelper.qualify(alias, columnName); - return setColumn(this.columnName); + this.columnName = StringHelper.qualify( alias, columnName ); + return setColumn( this.columnName ); } public InFragment setFormula(String alias, String formulaTemplate) { - this.columnName = StringHelper.replace(formulaTemplate, Template.TEMPLATE, alias); - return setColumn(this.columnName); + this.columnName = StringHelper.replace( formulaTemplate, Template.TEMPLATE, alias ); + return setColumn( this.columnName ); } public String toFragmentString() { - if ( values.size()==0 ) return "1=2"; - StringBuffer buf = new StringBuffer( values.size() * 5 ); - buf.append(columnName); - //following doesn't handle (null, not null) but unnecessary - //since this would mean all rows - if ( values.size()>1 ) { - boolean allowNull = false; - buf.append(" in ("); - Iterator iter = values.iterator(); - while ( iter.hasNext() ) { - Object value = iter.next(); - if ( NULL.equals(value) ) { - allowNull = true; + if ( values.size() == 0 ) { + return "1=2"; + } + + StringBuilder buf = new StringBuilder( values.size() * 5 ); + + if ( values.size() == 1 ) { + Object value = values.get( 0 ); + buf.append( columnName ); + + if ( NULL.equals( value ) ) { + buf.append( " is null" ); + } + else { + if ( NOT_NULL.equals( value ) ) { + buf.append( " is not null" ); } - else if ( NOT_NULL.equals(value) ) { - throw new IllegalArgumentException("not null makes no sense for in expression"); - } else { - buf.append(value); - buf.append(", "); + buf.append( '=' ).append( value ); } } - buf.setLength( buf.length()-2 ); - buf.append(')'); - if (allowNull) { - buf.insert(0, " is null or ") - .insert(0, columnName) - .insert(0, '(') - .append(')'); - } + return buf.toString(); } - else { - Object value = values.iterator().next(); - if ( NULL.equals(value) ) { - buf.append(" is null"); + + boolean allowNull = false; + + for ( Object value : values ) { + if ( NULL.equals( value ) ) { + allowNull = true; } - else if ( NOT_NULL.equals(value) ) { - buf.append(" is not null"); - } else { - buf.append("=").append(value); + if ( NOT_NULL.equals( value ) ) { + throw new IllegalArgumentException( "not null makes no sense for in expression" ); + } } } + + if ( allowNull ) { + buf.append( '(' ).append( columnName ).append( " is null or " ).append( columnName ).append( " in (" ); + } + else { + buf.append( columnName ).append( " in (" ); + } + + for ( Object value : values ) { + if ( !NULL.equals( value ) ) { + buf.append( value ); + buf.append( ", " ); + } + } + + buf.setLength( buf.length() - 2 ); + + if ( allowNull ) { + buf.append( "))" ); + } + else { + buf.append( ')' ); + } + return buf.toString(); + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/Insert.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/Insert.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/Insert.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/Insert.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -23,10 +23,9 @@ * */ package org.hibernate.sql; - import java.util.Iterator; -import java.util.Map; import java.util.LinkedHashMap; +import java.util.Map; import org.hibernate.dialect.Dialect; import org.hibernate.type.LiteralType; @@ -75,11 +74,20 @@ return this; } - public Insert addColumn(String columnName, String value) { - columns.put(columnName, value); + public Insert addColumns(String[] columnNames, boolean[] insertable, String[] valueExpressions) { + for ( int i=0; i i + 3 && "is ".equals( buf.substring( i + 1, i + 4 ) ) ); + final boolean isInsertPoint = OPERATORS.contains( Character.valueOf( character ) ) + || ( character == ' ' && buf.length() > i + 3 && "is ".equals( buf.substring( i + 1, i + 4 ) ) ); if ( isInsertPoint ) { buf.insert( i, "(+)" ); i += 3; @@ -143,8 +142,8 @@ private static final Set OPERATORS = new HashSet(); static { - OPERATORS.add( new Character( '=' ) ); - OPERATORS.add( new Character( '<' ) ); - OPERATORS.add( new Character( '>' ) ); + OPERATORS.add( Character.valueOf( '=' ) ); + OPERATORS.add( Character.valueOf( '<' ) ); + OPERATORS.add( Character.valueOf( '>' ) ); } } Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/QueryJoinFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/QueryJoinFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/QueryJoinFragment.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/QueryJoinFragment.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.sql; - import org.hibernate.dialect.Dialect; /** @@ -33,8 +32,8 @@ */ public class QueryJoinFragment extends JoinFragment { - private StringBuffer afterFrom = new StringBuffer(); - private StringBuffer afterWhere = new StringBuffer(); + private StringBuilder afterFrom = new StringBuilder(); + private StringBuilder afterWhere = new StringBuilder(); private Dialect dialect; private boolean useThetaStyleInnerJoins; @@ -43,16 +42,16 @@ this.useThetaStyleInnerJoins = useThetaStyleInnerJoins; } - public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, int joinType) { + public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType) { addJoin( tableName, alias, alias, fkColumns, pkColumns, joinType, null ); } - public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, int joinType, String on) { + public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType, String on) { addJoin( tableName, alias, alias, fkColumns, pkColumns, joinType, on ); } - private void addJoin(String tableName, String alias, String concreteAlias, String[] fkColumns, String[] pkColumns, int joinType, String on) { - if ( !useThetaStyleInnerJoins || joinType != INNER_JOIN ) { + private void addJoin(String tableName, String alias, String concreteAlias, String[] fkColumns, String[] pkColumns, JoinType joinType, String on) { + if ( !useThetaStyleInnerJoins || joinType != JoinType.INNER_JOIN ) { JoinFragment jf = dialect.createOuterJoinFragment(); jf.addJoin( tableName, alias, fkColumns, pkColumns, joinType, on ); addFragment( jf ); @@ -79,8 +78,8 @@ public JoinFragment copy() { QueryJoinFragment copy = new QueryJoinFragment( dialect, useThetaStyleInnerJoins ); - copy.afterFrom = new StringBuffer( afterFrom.toString() ); - copy.afterWhere = new StringBuffer( afterWhere.toString() ); + copy.afterFrom = new StringBuilder( afterFrom.toString() ); + copy.afterWhere = new StringBuilder( afterWhere.toString() ); return copy; } Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/QuerySelect.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/QuerySelect.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/QuerySelect.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/QuerySelect.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.sql; - import java.util.HashSet; import java.util.Iterator; @@ -36,13 +35,13 @@ public class QuerySelect { private Dialect dialect; private JoinFragment joins; - private StringBuffer select = new StringBuffer(); - private StringBuffer where = new StringBuffer(); - private StringBuffer groupBy = new StringBuffer(); - private StringBuffer orderBy = new StringBuffer(); - private StringBuffer having = new StringBuffer(); + private StringBuilder select = new StringBuilder(); + private StringBuilder where = new StringBuilder(); + private StringBuilder groupBy = new StringBuilder(); + private StringBuilder orderBy = new StringBuilder(); + private StringBuilder having = new StringBuilder(); private String comment; - private boolean distinct=false; + private boolean distinct; private static final HashSet DONT_SPACE_TOKENS = new HashSet(); static { @@ -134,7 +133,7 @@ } public String toQueryString() { - StringBuffer buf = new StringBuffer(50); + StringBuilder buf = new StringBuilder(50); if (comment!=null) buf.append("/* ").append(comment).append(" */ "); buf.append("select "); if (distinct) buf.append("distinct "); @@ -177,7 +176,7 @@ return dialect.transformSelectString( buf.toString() ); } - private static void appendTokens(StringBuffer buf, Iterator iter) { + private static void appendTokens(StringBuilder buf, Iterator iter) { boolean lastSpaceable=true; boolean lastQuoted=false; while ( iter.hasNext() ) { Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/Select.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/Select.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/Select.java 17 Aug 2012 14:36:46 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/Select.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -23,10 +23,10 @@ * */ package org.hibernate.sql; - import org.hibernate.LockMode; +import org.hibernate.LockOptions; import org.hibernate.dialect.Dialect; -import org.hibernate.util.StringHelper; +import org.hibernate.internal.util.StringHelper; /** @@ -43,7 +43,7 @@ private String orderByClause; private String groupByClause; private String comment; - private LockMode lockMode; + private LockOptions lockOptions = new LockOptions(); public final Dialect dialect; private int guesstimatedBufferSize = 20; @@ -56,7 +56,7 @@ * Construct an SQL SELECT statement from the given clauses */ public String toStatementString() { - StringBuffer buf = new StringBuffer(guesstimatedBufferSize); + StringBuilder buf = new StringBuilder(guesstimatedBufferSize); if ( StringHelper.isNotEmpty(comment) ) { buf.append("/* ").append(comment).append(" */ "); } @@ -78,7 +78,7 @@ buf.append( " and " ); } } - if ( StringHelper.isNotEmpty(whereClause) ) { + if ( StringHelper.isNotEmpty( whereClause ) ) { buf.append(whereClause); } } @@ -91,8 +91,8 @@ buf.append(" order by ").append(orderByClause); } - if (lockMode!=null) { - buf.append( dialect.getForUpdateString(lockMode) ); + if (lockOptions.getLockMode()!=LockMode.NONE) { + buf.append( dialect.getForUpdateString(lockOptions) ); } return dialect.transformSelectString( buf.toString() ); @@ -151,6 +151,11 @@ return this; } + public Select setSelectClause(SelectFragment selectFragment) { + setSelectClause( selectFragment.toFragmentString().substring( 2 ) ); + return this; + } + /** * Sets the whereClause. * @param whereClause The whereClause to set @@ -167,12 +172,41 @@ return this; } + /** + * Get the current lock mode + * @return LockMode + * @deprecated Instead use getLockOptions + */ public LockMode getLockMode() { - return lockMode; + return lockOptions.getLockMode(); } - + + /** + * Set the lock mode + * @param lockMode + * @return this object + * @deprecated Instead use setLockOptions + */ public Select setLockMode(LockMode lockMode) { - this.lockMode = lockMode; + lockOptions.setLockMode(lockMode); return this; } + + /** + * Get the current lock options + * @return LockOptions + */ + public LockOptions getLockOptions() { + return lockOptions; + } + + /** + * Set the lock options + * @param lockOptions + * @return this object + */ + public Select setLockOptions(LockOptions lockOptions) { + LockOptions.copy(lockOptions, this.lockOptions); + return this; + } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/sql/SelectExpression.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/SelectFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/SelectFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/SelectFragment.java 17 Aug 2012 14:36:46 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/SelectFragment.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -30,7 +30,7 @@ import java.util.Iterator; import java.util.List; -import org.hibernate.util.StringHelper; +import org.hibernate.internal.util.StringHelper; /** * A fragment of an SQL SELECT clause @@ -44,19 +44,27 @@ private List columnAliases = new ArrayList(); private String extraSelectList; private String[] usedAliases; - + public SelectFragment() {} - + + public List getColumns() { + return columns; + } + + public String getExtraSelectList() { + return extraSelectList; + } + public SelectFragment setUsedAliases(String[] aliases) { usedAliases = aliases; return this; } - + public SelectFragment setExtraSelectList(String extraSelectList) { this.extraSelectList = extraSelectList; return this; } - + public SelectFragment setExtraSelectList(CaseFragment caseFragment, String fragmentAlias) { setExtraSelectList( caseFragment.setReturnColumnName(fragmentAlias, suffix).toFragmentString() ); return this; @@ -109,13 +117,23 @@ } public SelectFragment addFormula(String tableAlias, String formula, String formulaAlias) { - columns.add( StringHelper.replace(formula, Template.TEMPLATE, tableAlias) ); + columns.add( StringHelper.replace( formula, Template.TEMPLATE, tableAlias ) ); columnAliases.add(formulaAlias); return this; } + public SelectFragment addColumnTemplate(String tableAlias, String columnTemplate, String columnAlias) { + // In this context, there's no difference between a column template and a formula. + return addFormula( tableAlias, columnTemplate, columnAlias ); + } + + public SelectFragment addColumnTemplates(String tableAlias, String[] columnTemplates, String[] columnAliases) { + // In this context, there's no difference between a column template and a formula. + return addFormulas( tableAlias, columnTemplates, columnAliases ); + } + public String toFragmentString() { - StringBuffer buf = new StringBuffer( columns.size() * 10 ); + StringBuilder buf = new StringBuilder( columns.size() * 10 ); Iterator iter = columns.iterator(); Iterator columnAliasIter = columnAliases.iterator(); //HashMap columnsUnique = new HashMap(); Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/sql/SelectValues.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/SimpleSelect.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/SimpleSelect.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/SimpleSelect.java 17 Aug 2012 14:36:46 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/SimpleSelect.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.sql; - import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -33,6 +32,7 @@ import java.util.Set; import org.hibernate.LockMode; +import org.hibernate.LockOptions; import org.hibernate.dialect.Dialect; /** @@ -51,7 +51,7 @@ private String tableName; private String orderBy; private Dialect dialect; - private LockMode lockMode = LockMode.READ; + private LockOptions lockOptions = new LockOptions( LockMode.READ); private String comment; private List columns = new ArrayList(); @@ -99,8 +99,13 @@ return this; } + public SimpleSelect setLockOptions( LockOptions lockOptions ) { + LockOptions.copy(lockOptions, this.lockOptions); + return this; + } + public SimpleSelect setLockMode(LockMode lockMode) { - this.lockMode = lockMode; + this.lockOptions.setLockMode( lockMode ); return this; } @@ -142,7 +147,7 @@ } public String toStatementString() { - StringBuffer buf = new StringBuffer( + StringBuilder buf = new StringBuilder( columns.size()*10 + tableName.length() + whereTokens.size() * 10 + @@ -172,7 +177,7 @@ } buf.append(" from ") - .append( dialect.appendLockHint(lockMode, tableName) ); + .append( dialect.appendLockHint(lockOptions, tableName) ); if ( whereTokens.size() > 0 ) { buf.append(" where ") @@ -181,15 +186,15 @@ if (orderBy!=null) buf.append(orderBy); - if (lockMode!=null) { - buf.append( dialect.getForUpdateString(lockMode) ); + if (lockOptions!=null) { + buf.append( dialect.getForUpdateString(lockOptions) ); } return dialect.transformSelectString( buf.toString() ); } public String toWhereClause() { - StringBuffer buf = new StringBuffer( whereTokens.size() * 5 ); + StringBuilder buf = new StringBuilder( whereTokens.size() * 5 ); Iterator iter = whereTokens.iterator(); while ( iter.hasNext() ) { buf.append( iter.next() ); Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/Sybase11JoinFragment.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/Sybase11JoinFragment.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/Sybase11JoinFragment.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/Sybase11JoinFragment.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -33,31 +33,36 @@ */ public class Sybase11JoinFragment extends JoinFragment { - private StringBuffer afterFrom = new StringBuffer(); - private StringBuffer afterWhere = new StringBuffer(); + private StringBuilder afterFrom = new StringBuilder(); + private StringBuilder afterWhere = new StringBuilder(); - public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, int joinType) { + public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType) { - addCrossJoin(tableName, alias); + addCrossJoin( tableName, alias ); - for ( int j=0; j KEYWORDS = new HashSet(); + private static final Set BEFORE_TABLE_KEYWORDS = new HashSet(); + private static final Set FUNCTION_KEYWORDS = new HashSet(); static { KEYWORDS.add("and"); KEYWORDS.add("or"); KEYWORDS.add("not"); KEYWORDS.add("like"); + KEYWORDS.add("escape"); KEYWORDS.add("is"); KEYWORDS.add("in"); KEYWORDS.add("between"); @@ -76,7 +89,7 @@ BEFORE_TABLE_KEYWORDS.add("from"); BEFORE_TABLE_KEYWORDS.add("join"); - + FUNCTION_KEYWORDS.add("as"); FUNCTION_KEYWORDS.add("leading"); FUNCTION_KEYWORDS.add("trailing"); @@ -104,13 +117,20 @@ * * @deprecated Only intended for annotations usage; use {@link #renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry)} instead */ + @Deprecated + @SuppressWarnings({ "JavaDoc" }) public static String renderWhereStringTemplate(String sqlWhereString, String placeholder, Dialect dialect) { - return renderWhereStringTemplate( sqlWhereString, placeholder, dialect, new SQLFunctionRegistry( dialect, java.util.Collections.EMPTY_MAP ) ); + return renderWhereStringTemplate( + sqlWhereString, + placeholder, + dialect, + new SQLFunctionRegistry( dialect, java.util.Collections.emptyMap() ) + ); } /** - * Takes the where condition provided in the mapping attribute and interpolates the alias. - * Handles subselects, quoted identifiers, quoted strings, expressions, SQL functions, + * Takes the where condition provided in the mapping attribute and interpolates the alias. + * Handles sub-selects, quoted identifiers, quoted strings, expressions, SQL functions, * named parameters. * * @param sqlWhereString The string into which to interpolate the placeholder value @@ -120,51 +140,55 @@ * @return The rendered sql fragment */ public static String renderWhereStringTemplate(String sqlWhereString, String placeholder, Dialect dialect, SQLFunctionRegistry functionRegistry ) { - //TODO: make this a bit nicer - String symbols = new StringBuffer() - .append("=> operands = new ArrayList(); + StringBuilder builder = new StringBuilder(); + + boolean hasMoreOperands = true; + String operandToken = tokens.nextToken(); + boolean quotedOperand = false; + while ( hasMoreOperands ) { + final boolean isQuote = "'".equals( operandToken ); + if ( isQuote ) { + quotedOperand = !quotedOperand; + if ( !quotedOperand ) { + operands.add( builder.append( '\'' ).toString() ); + builder.setLength( 0 ); + } + else { + builder.append( '\'' ); + } + } + else if ( quotedOperand ) { + builder.append( operandToken ); + } + else if ( operandToken.length() == 1 && Character.isWhitespace( operandToken.charAt( 0 ) ) ) { + // do nothing + } + else { + operands.add( operandToken ); + } + operandToken = tokens.nextToken(); + hasMoreOperands = tokens.hasMoreTokens() && ! ")".equals( operandToken ); + } + + TrimOperands trimOperands = new TrimOperands( operands ); + result.append( "trim(" ); + if ( trimOperands.trimSpec != null ) { + result.append( trimOperands.trimSpec ).append( ' ' ); + } + if ( trimOperands.trimChar != null ) { + if ( trimOperands.trimChar.startsWith( "'" ) && trimOperands.trimChar.endsWith( "'" ) ) { + result.append( trimOperands.trimChar ); + } + else { + result.append( + renderWhereStringTemplate( trimOperands.trimSpec, placeholder, dialect, functionRegistry ) + ); + } + result.append( ' ' ); + } + if ( trimOperands.from != null ) { + result.append( trimOperands.from ).append( ' ' ); + } + else if ( trimOperands.trimSpec != null || trimOperands.trimChar != null ) { + // I think ANSI SQL says that the 'from' is not optional if either trim-spec or trim-char are specified + result.append( "from " ); + } + + result.append( renderWhereStringTemplate( trimOperands.trimSource, placeholder, dialect, functionRegistry ) ) + .append( ')' ); + + hasMore = tokens.hasMoreTokens(); + nextToken = hasMore ? tokens.nextToken() : null; + + continue; + } + + boolean quotedOrWhitespace = quoted || quotedIdentifier || isQuoteCharacter + || Character.isWhitespace( token.charAt(0) ); + + if ( quotedOrWhitespace ) { + result.append( token ); + } + else if ( beforeTable ) { + result.append( token ); beforeTable = false; afterFromTable = true; } - else if (afterFromTable) { - if ( !"as".equals(lcToken) ) afterFromTable = false; + else if ( afterFromTable ) { + if ( !"as".equals(lcToken) ) { + afterFromTable = false; + } result.append(token); } else if ( isNamedParameter(token) ) { result.append(token); } - else if ( - isIdentifier(token, dialect) && - !isFunctionOrKeyword(lcToken, nextToken, dialect , functionRegistry) - ) { + else if ( isIdentifier(token) + && !isFunctionOrKeyword(lcToken, nextToken, dialect , functionRegistry) ) { result.append(placeholder) - .append('.') - .append( dialect.quote(token) ); + .append('.') + .append( dialect.quote(token) ); } else { if ( BEFORE_TABLE_KEYWORDS.contains(lcToken) ) { @@ -220,124 +324,443 @@ } result.append(token); } - - if ( //Yuck: - inFromClause && - KEYWORDS.contains(lcToken) && //"as" is not in KEYWORDS - !BEFORE_TABLE_KEYWORDS.contains(lcToken) - ) { + + //Yuck: + if ( inFromClause + && KEYWORDS.contains( lcToken ) //"as" is not in KEYWORDS + && !BEFORE_TABLE_KEYWORDS.contains( lcToken ) ) { inFromClause = false; } - } + return result.toString(); } - /** - * Takes order by clause provided in the mapping attribute and interpolates the alias. - * Handles asc, desc, SQL functions, quoted identifiers. - */ - public static String renderOrderByStringTemplate(String sqlOrderByString, Dialect dialect, SQLFunctionRegistry functionRegistry) { - //TODO: make this a bit nicer - String symbols = new StringBuffer() - .append("=> operands = new ArrayList(); +// StringBuilder builder = new StringBuilder(); +// +// boolean hasMoreOperands = true; +// String operandToken = tokens.nextToken(); +// boolean quoted = false; +// while ( hasMoreOperands ) { +// final boolean isQuote = "'".equals( operandToken ); +// if ( isQuote ) { +// quoted = !quoted; +// if ( !quoted ) { +// operands.add( builder.append( '\'' ).toString() ); +// builder.setLength( 0 ); +// } +// else { +// builder.append( '\'' ); +// } +// } +// else if ( quoted ) { +// builder.append( operandToken ); +// } +// else if ( operandToken.length() == 1 && Character.isWhitespace( operandToken.charAt( 0 ) ) ) { +// // do nothing +// } +// else { +// operands.add( operandToken ); +// } +// operandToken = tokens.nextToken(); +// hasMoreOperands = tokens.hasMoreTokens() && ! ")".equals( operandToken ); +// } +// +// TrimOperands trimOperands = new TrimOperands( operands ); +// result.append( "trim(" ); +// if ( trimOperands.trimSpec != null ) { +// result.append( trimOperands.trimSpec ).append( ' ' ); +// } +// if ( trimOperands.trimChar != null ) { +// if ( trimOperands.trimChar.startsWith( "'" ) && trimOperands.trimChar.endsWith( "'" ) ) { +// result.append( trimOperands.trimChar ); +// } +// else { +// result.append( +// renderWhereStringTemplate( trimOperands.trimSpec, placeholder, dialect, functionRegistry ) +// ); +// } +// result.append( ' ' ); +// } +// if ( trimOperands.from != null ) { +// result.append( trimOperands.from ).append( ' ' ); +// } +// else if ( trimOperands.trimSpec != null || trimOperands.trimChar != null ) { +// // I think ANSI SQL says that the 'from' is not optional if either trim-spec or trim-char are specified +// result.append( "from " ); +// } +// +// result.append( renderWhereStringTemplate( trimOperands.trimSource, placeholder, dialect, functionRegistry ) ) +// .append( ')' ); +// +// hasMore = tokens.hasMoreTokens(); +// nextToken = hasMore ? tokens.nextToken() : null; +// +// continue; +// } +// +// +// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// if ( Character.isWhitespace( token.charAt( 0 ) ) ) { +// result.append( token ); +// } +// else if ( state.beforeTable ) { +// result.append( token ); +// state.beforeTable = false; +// state.afterFromTable = true; +// } +// else if ( state.afterFromTable ) { +// if ( !"as".equals(lcToken) ) { +// state.afterFromTable = false; +// } +// result.append(token); +// } +// else if ( isNamedParameter(token) ) { +// result.append(token); +// } +// else if ( isIdentifier(token, dialect) +// && !isFunctionOrKeyword(lcToken, nextToken, dialect , functionRegistry) ) { +// result.append(placeholder) +// .append('.') +// .append( dialect.quote(token) ); +// } +// else { +// if ( BEFORE_TABLE_KEYWORDS.contains(lcToken) ) { +// state.beforeTable = true; +// state.inFromClause = true; +// } +// else if ( state.inFromClause && ",".equals(lcToken) ) { +// state.beforeTable = true; +// } +// result.append(token); +// } +// +// //Yuck: +// if ( state.inFromClause +// && KEYWORDS.contains( lcToken ) //"as" is not in KEYWORDS +// && !BEFORE_TABLE_KEYWORDS.contains( lcToken ) ) { +// state.inFromClause = false; +// } +// } +// +// return result.toString(); +// } +// +// private static class ProcessingState { +// boolean quoted = false; +// boolean quotedIdentifier = false; +// boolean beforeTable = false; +// boolean inFromClause = false; +// boolean afterFromTable = false; +// } +// +// private static enum QuotingCharacterDisposition { NONE, OPEN, CLOSE } + + private static class TrimOperands { + private final String trimSpec; + private final String trimChar; + private final String from; + private final String trimSource; + + private TrimOperands(List operands) { + final int size = operands.size(); + if ( size == 1 ) { + trimSpec = null; + trimChar = null; + from = null; + trimSource = operands.get(0); } - - if ( !quoted ) { - - boolean isOpenQuote; - if ( "`".equals(token) ) { - isOpenQuote = !quotedIdentifier; - token = lcToken = isOpenQuote ? - new Character( dialect.openQuote() ).toString() : - new Character( dialect.closeQuote() ).toString(); - quotedIdentifier = isOpenQuote; - isQuoteCharacter = true; + else if ( size == 4 ) { + trimSpec = operands.get(0); + trimChar = operands.get(1); + from = operands.get(2); + trimSource = operands.get(3); + } + else { + if ( size < 1 || size > 4 ) { + throw new HibernateException( "Unexpected number of trim function operands : " + size ); } - else if ( !quotedIdentifier && ( dialect.openQuote()==token.charAt(0) ) ) { - isOpenQuote = true; - quotedIdentifier = true; - isQuoteCharacter = true; + + // trim-source will always be the last operand + trimSource = operands.get( size - 1 ); + + // ANSI SQL says that more than one operand means that the FROM is required + if ( ! "from".equals( operands.get( size - 2 ) ) ) { + throw new HibernateException( "Expecting FROM, found : " + operands.get( size - 2 ) ); } - else if ( quotedIdentifier && ( dialect.closeQuote()==token.charAt(0) ) ) { - quotedIdentifier = false; - isQuoteCharacter = true; - isOpenQuote = false; + from = operands.get( size - 2 ); + + // trim-spec, if there is one will always be the first operand + if ( "leading".equalsIgnoreCase( operands.get(0) ) + || "trailing".equalsIgnoreCase( operands.get(0) ) + || "both".equalsIgnoreCase( operands.get(0) ) ) { + trimSpec = operands.get(0); + trimChar = null; } else { - isOpenQuote = false; + trimSpec = null; + if ( size - 2 == 0 ) { + trimChar = null; + } + else { + trimChar = operands.get( 0 ); + } } - - if (isOpenQuote) { - result.append(TEMPLATE).append('.'); - } - } - - boolean quotedOrWhitespace = quoted || - quotedIdentifier || - isQuoteCharacter || - Character.isWhitespace( token.charAt(0) ); - - if (quotedOrWhitespace) { - result.append(token); + } + } + + private static String extractUntil(StringTokenizer tokens, String delimiter) { + StringBuilder valueBuilder = new StringBuilder(); + String token = tokens.nextToken(); + while ( ! delimiter.equalsIgnoreCase( token ) ) { + valueBuilder.append( token ); + token = tokens.nextToken(); + } + return valueBuilder.toString().trim(); + } + + public static class NoOpColumnMapper implements ColumnMapper { + public static final NoOpColumnMapper INSTANCE = new NoOpColumnMapper(); + public SqlValueReference[] map(String reference) { +// return new String[] { reference }; + return null; + } + } + + /** + * Performs order-by template rendering without {@link ColumnMapper column mapping}. An ORDER BY template + * has all column references "qualified" with a placeholder identified by {@link Template#TEMPLATE} + * + * @param orderByFragment The order-by fragment to render. + * @param dialect The SQL dialect being used. + * @param functionRegistry The SQL function registry + * + * @return The rendered ORDER BY template. + * + * @deprecated Use {@link #translateOrderBy} instead + */ + @Deprecated + public static String renderOrderByStringTemplate( + String orderByFragment, + Dialect dialect, + SQLFunctionRegistry functionRegistry) { + return renderOrderByStringTemplate( + orderByFragment, + NoOpColumnMapper.INSTANCE, + null, + dialect, + functionRegistry + ); + } + + public static String renderOrderByStringTemplate( + String orderByFragment, + final ColumnMapper columnMapper, + final SessionFactoryImplementor sessionFactory, + final Dialect dialect, + final SQLFunctionRegistry functionRegistry) { + return translateOrderBy( + orderByFragment, + columnMapper, + sessionFactory, + dialect, + functionRegistry + ).injectAliases( LEGACY_ORDER_BY_ALIAS_RESOLVER ); + } + + public static OrderByAliasResolver LEGACY_ORDER_BY_ALIAS_RESOLVER = new OrderByAliasResolver() { + @Override + public String resolveTableAlias(String columnReference) { + return TEMPLATE; + } + }; + + /** + * Performs order-by template rendering allowing {@link ColumnMapper column mapping}. An ORDER BY template + * has all column references "qualified" with a placeholder identified by {@link Template#TEMPLATE} which can later + * be used to easily inject the SQL alias. + * + * @param orderByFragment The order-by fragment to render. + * @param columnMapper The column mapping strategy to use. + * @param sessionFactory The session factory. + * @param dialect The SQL dialect being used. + * @param functionRegistry The SQL function registry + * + * @return The rendered ORDER BY template. + */ + public static OrderByTranslation translateOrderBy( + String orderByFragment, + final ColumnMapper columnMapper, + final SessionFactoryImplementor sessionFactory, + final Dialect dialect, + final SQLFunctionRegistry functionRegistry) { + TranslationContext context = new TranslationContext() { + public SessionFactoryImplementor getSessionFactory() { + return sessionFactory; } - else if ( - isIdentifier(token, dialect) && - !isFunctionOrKeyword(lcToken, nextToken, dialect, functionRegistry) - ) { - result.append(TEMPLATE) - .append('.') - .append( dialect.quote(token) ); + + public Dialect getDialect() { + return dialect; } - else { - result.append(token); + + public SQLFunctionRegistry getSqlFunctionRegistry() { + return functionRegistry; } - } - return result.toString(); + + public ColumnMapper getColumnMapper() { + return columnMapper; + } + }; + + return OrderByFragmentTranslator.translate( context, orderByFragment ); } - + private static boolean isNamedParameter(String token) { return token.startsWith(":"); } private static boolean isFunctionOrKeyword(String lcToken, String nextToken, Dialect dialect, SQLFunctionRegistry functionRegistry) { return "(".equals(nextToken) || KEYWORDS.contains(lcToken) || - functionRegistry.hasFunction(lcToken) || + isFunction(lcToken, nextToken, functionRegistry ) || dialect.getKeywords().contains(lcToken) || FUNCTION_KEYWORDS.contains(lcToken); } - private static boolean isIdentifier(String token, Dialect dialect) { + private static boolean isFunction(String lcToken, String nextToken, SQLFunctionRegistry functionRegistry) { + // checking for "(" is currently redundant because it is checked before getting here; + // doing the check anyhow, in case that earlier check goes away; + if ( "(".equals( nextToken ) ) { + return true; + } + SQLFunction function = functionRegistry.findSQLFunction(lcToken); + if ( function == null ) { + // lcToken does not refer to a function + return false; + } + // if function.hasParenthesesIfNoArguments() is true, then assume + // lcToken is not a function (since it is not followed by '(') + return ! function.hasParenthesesIfNoArguments(); + } + + private static boolean isIdentifier(String token) { return token.charAt(0)=='`' || ( //allow any identifier quoted with backtick Character.isLetter( token.charAt(0) ) && //only recognizes identifiers beginning with a letter token.indexOf('.') < 0 ); } - } Index: 3rdParty_sources/hibernate-core/org/hibernate/sql/Update.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/sql/Update.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/sql/Update.java 17 Aug 2012 14:36:47 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/sql/Update.java 30 Jul 2014 15:52:04 -0000 1.1.2.1 @@ -23,14 +23,12 @@ * */ package org.hibernate.sql; - import java.util.Iterator; -import java.util.Map; import java.util.LinkedHashMap; +import java.util.Map; import org.hibernate.dialect.Dialect; import org.hibernate.type.LiteralType; -import org.hibernate.util.StringHelper; /** * An SQL UPDATE statement @@ -40,12 +38,12 @@ public class Update { private String tableName; - private String[] primaryKeyColumnNames; private String versionColumnName; private String where; private String assignments; private String comment; + private Map primaryKeyColumns = new LinkedHashMap(); private Map columns = new LinkedHashMap(); private Map whereColumns = new LinkedHashMap(); @@ -74,11 +72,38 @@ return this; } - public Update setPrimaryKeyColumnNames(String[] primaryKeyColumnNames) { - this.primaryKeyColumnNames = primaryKeyColumnNames; + public Update setPrimaryKeyColumnNames(String[] columnNames) { + this.primaryKeyColumns.clear(); + addPrimaryKeyColumns(columnNames); return this; + } + + public Update addPrimaryKeyColumns(String[] columnNames) { + for ( int i=0; i - * Since this transformer is stateless, all instances would be considered equal. So for optimization purposes - * we limit it to a single, singleton {@link #INSTANCE instance} (this is not quite true yet, see deprecation notice - * on {@link #AliasToEntityMapResultTransformer() constructor}). + * Since this transformer is stateless, all instances would be considered equal. + * So for optimization purposes we limit it to a single, singleton {@link #INSTANCE instance}. * * @author Gavin King * @author Steve Ebersole */ -public class AliasToEntityMapResultTransformer extends BasicTransformerAdapter implements Serializable { +public class AliasToEntityMapResultTransformer extends AliasedTupleSubsetResultTransformer { public static final AliasToEntityMapResultTransformer INSTANCE = new AliasToEntityMapResultTransformer(); /** - * Instantiate AliasToEntityMapResultTransformer. - *

- * todo : make private, see deprecation... - * - * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4). + * Disallow instantiation of AliasToEntityMapResultTransformer. */ - public AliasToEntityMapResultTransformer() { + private AliasToEntityMapResultTransformer() { } - /** - * {@inheritDoc} - */ + @Override public Object transformTuple(Object[] tuple, String[] aliases) { Map result = new HashMap(tuple.length); for ( int i=0; i - * Since this transformer is stateless, all instances would be considered equal. So for optimization purposes - * we limit it to a single, singleton {@link #INSTANCE instance} (this is not quite true yet: see deprecation notice - * on {@link #DistinctRootEntityResultTransformer() constructor}). + * Since this transformer is stateless, all instances would be considered equal. + * So for optimization purposes we limit it to a single, singleton {@link #INSTANCE instance}. * * @author Gavin King * @author Steve Ebersole */ -public class DistinctRootEntityResultTransformer implements ResultTransformer, Serializable { +public class DistinctRootEntityResultTransformer implements TupleSubsetResultTransformer { public static final DistinctRootEntityResultTransformer INSTANCE = new DistinctRootEntityResultTransformer(); /** - * Instantiate a DistinctRootEntityResultTransformer. - *

- * todo : make private, see deprecation notice - * - * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4). + * Disallow instantiation of DistinctRootEntityResultTransformer. */ - public DistinctRootEntityResultTransformer() { + private DistinctRootEntityResultTransformer() { } /** @@ -58,6 +52,7 @@ * @param aliases The tuple aliases * @return The transformed tuple row. */ + @Override public Object transformTuple(Object[] tuple, String[] aliases) { return RootEntityResultTransformer.INSTANCE.transformTuple( tuple, aliases ); } @@ -68,10 +63,21 @@ * @param list The list to transform. * @return The transformed List. */ + @Override public List transformList(List list) { return DistinctResultTransformer.INSTANCE.transformList( list ); } + @Override + public boolean[] includeInTransform(String[] aliases, int tupleLength) { + return RootEntityResultTransformer.INSTANCE.includeInTransform( aliases, tupleLength ); + } + + @Override + public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) { + return RootEntityResultTransformer.INSTANCE.isTransformedValueATupleElement( null, tupleLength ); + } + /** * Serialization hook for ensuring singleton uniqueing. * @@ -81,16 +87,4 @@ return INSTANCE; } - - // all DistinctRootEntityResultTransformer are considered equal ~~~~~~~~~~~ - - public int hashCode() { - // todo : we can remove this once the deprecated ctor can be made private... - return DistinctRootEntityResultTransformer.class.getName().hashCode(); - } - - public boolean equals(Object other) { - // todo : we can remove this once the deprecated ctor can be made private... - return other != null && DistinctRootEntityResultTransformer.class.isInstance( other ); - } } Index: 3rdParty_sources/hibernate-core/org/hibernate/transform/PassThroughResultTransformer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/transform/PassThroughResultTransformer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/transform/PassThroughResultTransformer.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/transform/PassThroughResultTransformer.java 30 Jul 2014 15:52:31 -0000 1.1.2.1 @@ -23,30 +23,58 @@ * */ package org.hibernate.transform; +import java.util.Arrays; +import java.util.List; -import java.io.Serializable; - /** * ??? * * @author max */ -public class PassThroughResultTransformer extends BasicTransformerAdapter implements Serializable { +public class PassThroughResultTransformer extends BasicTransformerAdapter implements TupleSubsetResultTransformer { public static final PassThroughResultTransformer INSTANCE = new PassThroughResultTransformer(); /** - * Instamtiate a PassThroughResultTransformer. - * - * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4). + * Disallow instantiation of PassThroughResultTransformer. */ - public PassThroughResultTransformer() { + private PassThroughResultTransformer() { } + @Override public Object transformTuple(Object[] tuple, String[] aliases) { return tuple.length==1 ? tuple[0] : tuple; } + @Override + public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) { + return tupleLength == 1; + } + + @Override + public boolean[] includeInTransform(String[] aliases, int tupleLength) { + boolean[] includeInTransformedResult = new boolean[tupleLength]; + Arrays.fill( includeInTransformedResult, true ); + return includeInTransformedResult; + } + + /* package-protected */ + List untransformToTuples(List results, boolean isSingleResult) { + // untransform only if necessary; if transformed, do it in place; + if ( isSingleResult ) { + for ( int i = 0 ; i < results.size() ; i++ ) { + Object[] tuple = untransformToTuple( results.get( i ), isSingleResult); + results.set( i, tuple ); + } + } + return results; + } + + /* package-protected */ + Object[] untransformToTuple(Object transformed, boolean isSingleResult ) { + return isSingleResult ? new Object[] { transformed } : ( Object[] ) transformed; + } + /** * Serialization hook for ensuring singleton uniqueing. * @@ -56,14 +84,4 @@ return INSTANCE; } - public int hashCode() { - // todo : we can remove this once the deprecated ctor can be made private... - return PassThroughResultTransformer.class.getName().hashCode(); - } - - public boolean equals(Object other) { - // todo : we can remove this once the deprecated ctor can be made private... - return other != null && PassThroughResultTransformer.class.isInstance( other ); - } - } Index: 3rdParty_sources/hibernate-core/org/hibernate/transform/ResultTransformer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/transform/ResultTransformer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/transform/ResultTransformer.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/transform/ResultTransformer.java 30 Jul 2014 15:52:31 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.transform; - import java.io.Serializable; import java.util.List; Index: 3rdParty_sources/hibernate-core/org/hibernate/transform/RootEntityResultTransformer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/transform/RootEntityResultTransformer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/transform/RootEntityResultTransformer.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/transform/RootEntityResultTransformer.java 30 Jul 2014 15:52:31 -0000 1.1.2.1 @@ -24,8 +24,7 @@ */ package org.hibernate.transform; -import java.util.List; -import java.io.Serializable; +import org.hibernate.internal.util.collections.ArrayHelper; /** * {@link ResultTransformer} implementation which limits the result tuple @@ -37,25 +36,42 @@ * @author Gavin King * @author Steve Ebersole */ -public final class RootEntityResultTransformer extends BasicTransformerAdapter implements Serializable { +public final class RootEntityResultTransformer extends BasicTransformerAdapter implements TupleSubsetResultTransformer { public static final RootEntityResultTransformer INSTANCE = new RootEntityResultTransformer(); /** - * Instantiate RootEntityResultTransformer. - * - * @deprecated Use the {@link #INSTANCE} reference instead of explicitly creating a new one (to be removed in 3.4). + * Disallow instantiation of RootEntityResultTransformer. */ - public RootEntityResultTransformer() { + private RootEntityResultTransformer() { } /** * Return just the root entity from the row tuple. */ - public Object transformTuple(Object[] tuple, String[] aliases) { + @Override + public Object transformTuple(Object[] tuple, String[] aliases) { return tuple[ tuple.length-1 ]; } + @Override + public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) { + return true; + } + + @Override + public boolean[] includeInTransform(String[] aliases, int tupleLength) { + boolean[] includeInTransform; + if ( tupleLength == 1 ) { + includeInTransform = ArrayHelper.TRUE; + } + else { + includeInTransform = new boolean[tupleLength]; + includeInTransform[ tupleLength - 1 ] = true; + } + return includeInTransform; + } + /** * Serialization hook for ensuring singleton uniqueing. * @@ -64,14 +80,4 @@ private Object readResolve() { return INSTANCE; } - - public int hashCode() { - // todo : we can remove this once the deprecated ctor can be made private... - return RootEntityResultTransformer.class.getName().hashCode(); - } - - public boolean equals(Object other) { - // todo : we can remove this once the deprecated ctor can be made private... - return other != null && RootEntityResultTransformer.class.isInstance( other ); - } } Index: 3rdParty_sources/hibernate-core/org/hibernate/transform/ToListResultTransformer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/transform/ToListResultTransformer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/transform/ToListResultTransformer.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/transform/ToListResultTransformer.java 30 Jul 2014 15:52:31 -0000 1.1.2.1 @@ -26,14 +26,12 @@ import java.util.Arrays; import java.util.List; -import java.io.Serializable; /** * Tranforms each result row from a tuple into a {@link List}, such that what * you end up with is a {@link List} of {@link List Lists}. */ -public class ToListResultTransformer extends BasicTransformerAdapter implements Serializable { - +public class ToListResultTransformer extends BasicTransformerAdapter { public static final ToListResultTransformer INSTANCE = new ToListResultTransformer(); /** @@ -42,9 +40,7 @@ private ToListResultTransformer() { } - /** - * {@inheritDoc} - */ + @Override public Object transformTuple(Object[] tuple, String[] aliases) { return Arrays.asList( tuple ); } Index: 3rdParty_sources/hibernate-core/org/hibernate/transform/Transformers.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/transform/Transformers.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/transform/Transformers.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/transform/Transformers.java 30 Jul 2014 15:52:31 -0000 1.1.2.1 @@ -24,6 +24,7 @@ */ package org.hibernate.transform; + final public class Transformers { private Transformers() {} Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/transform/TupleSubsetResultTransformer.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/AbstractAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/AbstractNonIdentifierAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/AnnotationValueGeneration.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/Attribute.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/BaselineAttributeInformation.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/CreationTimestampGeneration.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/Dom4jInstantiator.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/Dom4jInstantiator.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/Dom4jInstantiator.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/Dom4jInstantiator.java 30 Jul 2014 15:52:20 -0000 1.1.2.1 @@ -28,11 +28,12 @@ import java.util.HashSet; import java.util.Iterator; -import org.dom4j.Element; -import org.hibernate.util.XMLHelper; -import org.hibernate.mapping.PersistentClass; +import org.hibernate.internal.util.xml.XMLHelper; import org.hibernate.mapping.Component; +import org.hibernate.mapping.PersistentClass; +import org.dom4j.Element; + /** * Performs "instantiation" based on DOM4J elements. */ @@ -74,4 +75,4 @@ return false; } } -} \ No newline at end of file +} Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/DynamicMapInstantiator.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/DynamicMapInstantiator.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/DynamicMapInstantiator.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/DynamicMapInstantiator.java 30 Jul 2014 15:52:21 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.tuple; - import java.io.Serializable; import java.util.HashMap; import java.util.HashSet; @@ -32,6 +31,7 @@ import java.util.Set; import org.hibernate.mapping.PersistentClass; +import org.hibernate.metamodel.binding.EntityBinding; public class DynamicMapInstantiator implements Instantiator { @@ -56,6 +56,14 @@ } } + public DynamicMapInstantiator(EntityBinding mappingInfo) { + this.entityName = mappingInfo.getEntity().getName(); + isInstanceEntityNames.add( entityName ); + for ( EntityBinding subEntityBinding : mappingInfo.getPostOrderSubEntityBindingClosure() ) { + isInstanceEntityNames.add( subEntityBinding.getEntity().getName() ); + } + } + public final Object instantiate(Serializable id) { return instantiate(); } @@ -84,4 +92,4 @@ protected Map generateMap() { return new HashMap(); } -} \ No newline at end of file +} Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/ElementWrapper.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/ElementWrapper.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/ElementWrapper.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/ElementWrapper.java 30 Jul 2014 15:52:21 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.tuple; - import java.io.IOException; import java.io.Serializable; import java.io.Writer; Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/EntityModeToTuplizerMapping.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/GeneratedValueGeneration.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/GenerationTiming.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/IdentifierAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/IdentifierProperty.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/IdentifierProperty.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/IdentifierProperty.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/IdentifierProperty.java 30 Jul 2014 15:52:21 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,11 +20,10 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.tuple; -import org.hibernate.engine.IdentifierValue; +import org.hibernate.engine.spi.IdentifierValue; import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.PostInsertIdentifierGenerator; import org.hibernate.type.Type; @@ -35,7 +34,7 @@ * * @author Steve Ebersole */ -public class IdentifierProperty extends Property { +public class IdentifierProperty extends AbstractAttribute implements IdentifierAttribute { private boolean virtual; private boolean embedded; @@ -64,7 +63,7 @@ boolean embedded, IdentifierValue unsavedValue, IdentifierGenerator identifierGenerator) { - super(name, node, type); + super( name, type ); this.virtual = false; this.embedded = embedded; this.hasIdentifierMapper = false; @@ -88,7 +87,7 @@ boolean hasIdentifierMapper, IdentifierValue unsavedValue, IdentifierGenerator identifierGenerator) { - super(null, null, type); + super( null, type ); this.virtual = true; this.embedded = embedded; this.hasIdentifierMapper = hasIdentifierMapper; @@ -97,27 +96,38 @@ this.identifierAssignedByInsert = identifierGenerator instanceof PostInsertIdentifierGenerator; } + @Override public boolean isVirtual() { return virtual; } + @Override public boolean isEmbedded() { return embedded; } + @Override public IdentifierValue getUnsavedValue() { return unsavedValue; } + @Override public IdentifierGenerator getIdentifierGenerator() { return identifierGenerator; } + @Override public boolean isIdentifierAssignedByInsert() { return identifierAssignedByInsert; } + @Override public boolean hasIdentifierMapper() { return hasIdentifierMapper; } + + @Override + public String toString() { + return "IdentifierAttribute(" + getName() + ")"; + } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/InDatabaseValueGenerationStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/InMemoryValueGenerationStrategy.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/Instantiator.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/Instantiator.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/Instantiator.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/Instantiator.java 30 Jul 2014 15:52:21 -0000 1.1.2.1 @@ -23,8 +23,6 @@ * */ package org.hibernate.tuple; - - import java.io.Serializable; /** @@ -56,7 +54,7 @@ * or component which this Instantiator instantiates. * * @param object The object to be checked. - * @return True is the object does respresent an instance of the underlying + * @return True is the object does represent an instance of the underlying * entity/component. */ public boolean isInstance(Object object); Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/NonIdentifierAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/PojoInstantiator.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/PojoInstantiator.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/PojoInstantiator.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/PojoInstantiator.java 30 Jul 2014 15:52:21 -0000 1.1.2.1 @@ -28,31 +28,35 @@ import java.io.Serializable; import java.lang.reflect.Constructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.hibernate.InstantiationException; import org.hibernate.PropertyNotFoundException; -import org.hibernate.bytecode.ReflectionOptimizer; -import org.hibernate.mapping.PersistentClass; +import org.hibernate.bytecode.spi.ReflectionOptimizer; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.ReflectHelper; import org.hibernate.mapping.Component; -import org.hibernate.util.ReflectHelper; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.metamodel.binding.EntityBinding; +import org.jboss.logging.Logger; + /** * Defines a POJO-based instantiator for use from the tuplizers. */ public class PojoInstantiator implements Instantiator, Serializable { - private static final Logger log = LoggerFactory.getLogger(PojoInstantiator.class); + private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PojoInstantiator.class.getName()); private transient Constructor constructor; private final Class mappedClass; private final transient ReflectionOptimizer.InstantiationOptimizer optimizer; private final boolean embeddedIdentifier; private final Class proxyInterface; + private final boolean isAbstract; public PojoInstantiator(Component component, ReflectionOptimizer.InstantiationOptimizer optimizer) { this.mappedClass = component.getComponentClass(); + this.isAbstract = ReflectHelper.isAbstractClass( mappedClass ); this.optimizer = optimizer; this.proxyInterface = null; @@ -62,17 +66,14 @@ constructor = ReflectHelper.getDefaultConstructor(mappedClass); } catch ( PropertyNotFoundException pnfe ) { - log.info( - "no default (no-argument) constructor for class: " + - mappedClass.getName() + - " (class must be instantiated by Interceptor)" - ); + LOG.noDefaultConstructor(mappedClass.getName()); constructor = null; } } public PojoInstantiator(PersistentClass persistentClass, ReflectionOptimizer.InstantiationOptimizer optimizer) { this.mappedClass = persistentClass.getMappedClass(); + this.isAbstract = ReflectHelper.isAbstractClass( mappedClass ); this.proxyInterface = persistentClass.getProxyInterface(); this.embeddedIdentifier = persistentClass.hasEmbeddedIdentifier(); this.optimizer = optimizer; @@ -81,23 +82,35 @@ constructor = ReflectHelper.getDefaultConstructor( mappedClass ); } catch ( PropertyNotFoundException pnfe ) { - log.info( - "no default (no-argument) constructor for class: " + - mappedClass.getName() + - " (class must be instantiated by Interceptor)" - ); + LOG.noDefaultConstructor(mappedClass.getName()); constructor = null; } } + public PojoInstantiator(EntityBinding entityBinding, ReflectionOptimizer.InstantiationOptimizer optimizer) { + this.mappedClass = entityBinding.getEntity().getClassReference(); + this.isAbstract = ReflectHelper.isAbstractClass( mappedClass ); + this.proxyInterface = entityBinding.getProxyInterfaceType().getValue(); + this.embeddedIdentifier = entityBinding.getHierarchyDetails().getEntityIdentifier().isEmbedded(); + this.optimizer = optimizer; + + try { + constructor = ReflectHelper.getDefaultConstructor( mappedClass ); + } + catch ( PropertyNotFoundException pnfe ) { + LOG.noDefaultConstructor(mappedClass.getName()); + constructor = null; + } + } + private void readObject(java.io.ObjectInputStream stream) throws ClassNotFoundException, IOException { stream.defaultReadObject(); - constructor = ReflectHelper.getDefaultConstructor(mappedClass); + constructor = ReflectHelper.getDefaultConstructor( mappedClass ); } public Object instantiate() { - if ( ReflectHelper.isAbstractClass(mappedClass) ) { + if ( isAbstract ) { throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass ); } else if ( optimizer != null ) { @@ -108,23 +121,23 @@ } else { try { - return constructor.newInstance( null ); + return constructor.newInstance( (Object[]) null ); } catch ( Exception e ) { throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e ); } } } - + public Object instantiate(Serializable id) { - final boolean useEmbeddedIdentifierInstanceAsEntity = embeddedIdentifier && - id != null && + final boolean useEmbeddedIdentifierInstanceAsEntity = embeddedIdentifier && + id != null && id.getClass().equals(mappedClass); return useEmbeddedIdentifierInstanceAsEntity ? id : instantiate(); } public boolean isInstance(Object object) { - return mappedClass.isInstance(object) || + return mappedClass.isInstance(object) || ( proxyInterface!=null && proxyInterface.isInstance(object) ); //this one needed only for guessEntityMode() } -} \ No newline at end of file +} Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/Property.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/Property.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/Property.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/Property.java 30 Jul 2014 15:52:21 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,53 +20,16 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.tuple; -import org.hibernate.type.Type; - -import java.io.Serializable; - /** * Defines the basic contract of a Property within the runtime metamodel. * * @author Steve Ebersole */ -public abstract class Property implements Serializable { - private String name; - private String node; - private Type type; - - /** - * Constructor for Property instances. - * - * @param name The name by which the property can be referenced within - * its owner. - * @param node The node name to use for XML-based representation of this - * property. - * @param type The Hibernate Type of this property. - */ - protected Property(String name, String node, Type type) { - this.name = name; - this.node = node; - this.type = type; - } - - public String getName() { - return name; - } - - public String getNode() { - return node; - } - - public Type getType() { - return type; - } - - public String toString() { - return "Property(" + name + ':' + type.getName() + ')'; - } - +@Deprecated +public interface Property extends Attribute { + @Deprecated + public String getNode(); } Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/PropertyFactory.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/PropertyFactory.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/PropertyFactory.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/PropertyFactory.java 30 Jul 2014 15:52:20 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,46 +20,66 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.tuple; import java.lang.reflect.Constructor; import org.hibernate.EntityMode; -import org.hibernate.mapping.PropertyGeneration; -import org.hibernate.engine.IdentifierValue; -import org.hibernate.engine.UnsavedValueFactory; -import org.hibernate.engine.VersionValue; +import org.hibernate.FetchMode; +import org.hibernate.HibernateException; +import org.hibernate.cfg.NotYetImplementedException; +import org.hibernate.engine.internal.UnsavedValueFactory; +import org.hibernate.engine.spi.CascadeStyle; +import org.hibernate.engine.spi.CascadeStyles; +import org.hibernate.engine.spi.IdentifierValue; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.VersionValue; import org.hibernate.id.IdentifierGenerator; +import org.hibernate.internal.util.ReflectHelper; import org.hibernate.mapping.KeyValue; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; +import org.hibernate.metamodel.binding.AbstractPluralAttributeBinding; +import org.hibernate.metamodel.binding.AssociationAttributeBinding; +import org.hibernate.metamodel.binding.AttributeBinding; +import org.hibernate.metamodel.binding.BasicAttributeBinding; +import org.hibernate.metamodel.binding.EntityBinding; +import org.hibernate.metamodel.binding.SimpleValueBinding; +import org.hibernate.metamodel.binding.SingularAttributeBinding; +import org.hibernate.persister.entity.EntityPersister; import org.hibernate.property.Getter; import org.hibernate.property.PropertyAccessor; import org.hibernate.property.PropertyAccessorFactory; +import org.hibernate.tuple.entity.EntityBasedAssociationAttribute; +import org.hibernate.tuple.entity.EntityBasedBasicAttribute; +import org.hibernate.tuple.entity.EntityBasedCompositionAttribute; +import org.hibernate.tuple.entity.VersionProperty; import org.hibernate.type.AssociationType; +import org.hibernate.type.CompositeType; import org.hibernate.type.Type; import org.hibernate.type.VersionType; -import org.hibernate.util.ReflectHelper; /** * Responsible for generation of runtime metamodel {@link Property} representations. * Makes distinction between identifier, version, and other (standard) properties. * * @author Steve Ebersole */ -public class PropertyFactory { +public final class PropertyFactory { + private PropertyFactory() { + } /** - * Generates an IdentifierProperty representation of the for a given entity mapping. + * Generates the attribute representation of the identifier for a given entity mapping. * * @param mappedEntity The mapping definition of the entity. * @param generator The identifier value generator to use for this identifier. * @return The appropriate IdentifierProperty definition. */ - public static IdentifierProperty buildIdentifierProperty(PersistentClass mappedEntity, IdentifierGenerator generator) { - + public static IdentifierProperty buildIdentifierAttribute( + PersistentClass mappedEntity, + IdentifierGenerator generator) { String mappedUnsavedValue = mappedEntity.getIdentifier().getNullValue(); Type type = mappedEntity.getIdentifier().getType(); Property property = mappedEntity.getIdentifierProperty(); @@ -94,54 +114,139 @@ } /** + * Generates an IdentifierProperty representation of the for a given entity mapping. + * + * @param mappedEntity The mapping definition of the entity. + * @param generator The identifier value generator to use for this identifier. + * @return The appropriate IdentifierProperty definition. + */ + public static IdentifierProperty buildIdentifierProperty( + EntityBinding mappedEntity, + IdentifierGenerator generator) { + + final BasicAttributeBinding property = mappedEntity.getHierarchyDetails().getEntityIdentifier().getValueBinding(); + + // TODO: the following will cause an NPE with "virtual" IDs; how should they be set? + // (steve) virtual attributes will still be attributes, they will simply be marked as virtual. + // see org.hibernate.metamodel.domain.AbstractAttributeContainer.locateOrCreateVirtualAttribute() + + final String mappedUnsavedValue = property.getUnsavedValue(); + final Type type = property.getHibernateTypeDescriptor().getResolvedTypeMapping(); + + IdentifierValue unsavedValue = UnsavedValueFactory.getUnsavedIdentifierValue( + mappedUnsavedValue, + getGetter( property ), + type, + getConstructor( mappedEntity ) + ); + + if ( property == null ) { + // this is a virtual id property... + return new IdentifierProperty( + type, + mappedEntity.getHierarchyDetails().getEntityIdentifier().isEmbedded(), + mappedEntity.getHierarchyDetails().getEntityIdentifier().isIdentifierMapper(), + unsavedValue, + generator + ); + } + else { + return new IdentifierProperty( + property.getAttribute().getName(), + null, + type, + mappedEntity.getHierarchyDetails().getEntityIdentifier().isEmbedded(), + unsavedValue, + generator + ); + } + } + + /** * Generates a VersionProperty representation for an entity mapping given its * version mapping Property. * * @param property The version mapping Property. * @param lazyAvailable Is property lazy loading currently available. * @return The appropriate VersionProperty definition. */ - public static VersionProperty buildVersionProperty(Property property, boolean lazyAvailable) { + public static VersionProperty buildVersionProperty( + EntityPersister persister, + SessionFactoryImplementor sessionFactory, + int attributeNumber, + Property property, + boolean lazyAvailable) { String mappedUnsavedValue = ( (KeyValue) property.getValue() ).getNullValue(); VersionValue unsavedValue = UnsavedValueFactory.getUnsavedVersionValue( - mappedUnsavedValue, + mappedUnsavedValue, getGetter( property ), (VersionType) property.getType(), getConstructor( property.getPersistentClass() ) - ); + ); boolean lazy = lazyAvailable && property.isLazy(); return new VersionProperty( + persister, + sessionFactory, + attributeNumber, property.getName(), - property.getNodeName(), property.getValue().getType(), - lazy, - property.isInsertable(), - property.isUpdateable(), - property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS, - property.getGeneration() == PropertyGeneration.ALWAYS, - property.isOptional(), - property.isUpdateable() && !lazy, - property.isOptimisticLocked(), - property.getCascadeStyle(), + new BaselineAttributeInformation.Builder() + .setLazy( lazy ) + .setInsertable( property.isInsertable() ) + .setUpdateable( property.isUpdateable() ) + .setValueGenerationStrategy( property.getValueGenerationStrategy() ) + .setNullable( property.isOptional() ) + .setDirtyCheckable( property.isUpdateable() && !lazy ) + .setVersionable( property.isOptimisticLocked() ) + .setCascadeStyle( property.getCascadeStyle() ) + .createInformation(), unsavedValue ); } /** - * Generate a "standard" (i.e., non-identifier and non-version) based on the given - * mapped property. + * Generates a VersionProperty representation for an entity mapping given its + * version mapping Property. * + * @param property The version mapping Property. + * @param lazyAvailable Is property lazy loading currently available. + * @return The appropriate VersionProperty definition. + */ + public static VersionProperty buildVersionProperty( + EntityPersister persister, + BasicAttributeBinding property, + boolean lazyAvailable) { + throw new NotYetImplementedException(); + } + + public static enum NonIdentifierAttributeNature { + BASIC, + COMPOSITE, + ANY, + ENTITY, + COLLECTION + } + + /** + * Generate a non-identifier (and non-version) attribute based on the given mapped property from the given entity + * * @param property The mapped property. * @param lazyAvailable Is property lazy loading currently available. - * @return The appropriate StandardProperty definition. + * @return The appropriate NonIdentifierProperty definition. */ - public static StandardProperty buildStandardProperty(Property property, boolean lazyAvailable) { - + public static NonIdentifierAttribute buildEntityBasedAttribute( + EntityPersister persister, + SessionFactoryImplementor sessionFactory, + int attributeNumber, + Property property, + boolean lazyAvailable) { final Type type = property.getValue().getType(); - + + final NonIdentifierAttributeNature nature = decode( type ); + // we need to dirty check collections, since they can cause an owner // version number increment @@ -152,23 +257,211 @@ boolean alwaysDirtyCheck = type.isAssociationType() && ( (AssociationType) type ).isAlwaysDirtyChecked(); + switch ( nature ) { + case BASIC: { + return new EntityBasedBasicAttribute( + persister, + sessionFactory, + attributeNumber, + property.getName(), + type, + new BaselineAttributeInformation.Builder() + .setLazy( lazyAvailable && property.isLazy() ) + .setInsertable( property.isInsertable() ) + .setUpdateable( property.isUpdateable() ) + .setValueGenerationStrategy( property.getValueGenerationStrategy() ) + .setNullable( property.isOptional() ) + .setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() ) + .setVersionable( property.isOptimisticLocked() ) + .setCascadeStyle( property.getCascadeStyle() ) + .setFetchMode( property.getValue().getFetchMode() ) + .createInformation() + ); + } + case COMPOSITE: { + return new EntityBasedCompositionAttribute( + persister, + sessionFactory, + attributeNumber, + property.getName(), + (CompositeType) type, + new BaselineAttributeInformation.Builder() + .setLazy( lazyAvailable && property.isLazy() ) + .setInsertable( property.isInsertable() ) + .setUpdateable( property.isUpdateable() ) + .setValueGenerationStrategy( property.getValueGenerationStrategy() ) + .setNullable( property.isOptional() ) + .setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() ) + .setVersionable( property.isOptimisticLocked() ) + .setCascadeStyle( property.getCascadeStyle() ) + .setFetchMode( property.getValue().getFetchMode() ) + .createInformation() + ); + } + case ENTITY: + case ANY: + case COLLECTION: { + return new EntityBasedAssociationAttribute( + persister, + sessionFactory, + attributeNumber, + property.getName(), + (AssociationType) type, + new BaselineAttributeInformation.Builder() + .setLazy( lazyAvailable && property.isLazy() ) + .setInsertable( property.isInsertable() ) + .setUpdateable( property.isUpdateable() ) + .setValueGenerationStrategy( property.getValueGenerationStrategy() ) + .setNullable( property.isOptional() ) + .setDirtyCheckable( alwaysDirtyCheck || property.isUpdateable() ) + .setVersionable( property.isOptimisticLocked() ) + .setCascadeStyle( property.getCascadeStyle() ) + .setFetchMode( property.getValue().getFetchMode() ) + .createInformation() + ); + } + default: { + throw new HibernateException( "Internal error" ); + } + } + } + + private static NonIdentifierAttributeNature decode(Type type) { + if ( type.isAssociationType() ) { + AssociationType associationType = (AssociationType) type; + + if ( type.isComponentType() ) { + // an any type is both an association and a composite... + return NonIdentifierAttributeNature.ANY; + } + + return type.isCollectionType() + ? NonIdentifierAttributeNature.COLLECTION + : NonIdentifierAttributeNature.ENTITY; + } + else { + if ( type.isComponentType() ) { + return NonIdentifierAttributeNature.COMPOSITE; + } + + return NonIdentifierAttributeNature.BASIC; + } + } + + @Deprecated + public static StandardProperty buildStandardProperty(Property property, boolean lazyAvailable) { + final Type type = property.getValue().getType(); + + // we need to dirty check collections, since they can cause an owner + // version number increment + + // we need to dirty check many-to-ones with not-found="ignore" in order + // to update the cache (not the database), since in this case a null + // entity reference can lose information + + boolean alwaysDirtyCheck = type.isAssociationType() && + ( (AssociationType) type ).isAlwaysDirtyChecked(); + return new StandardProperty( property.getName(), - property.getNodeName(), type, lazyAvailable && property.isLazy(), property.isInsertable(), property.isUpdateable(), - property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS, - property.getGeneration() == PropertyGeneration.ALWAYS, + property.getValueGenerationStrategy(), property.isOptional(), alwaysDirtyCheck || property.isUpdateable(), property.isOptimisticLocked(), property.getCascadeStyle(), - property.getValue().getFetchMode() + property.getValue().getFetchMode() + ); + } + + + /** + * Generate a "standard" (i.e., non-identifier and non-version) based on the given + * mapped property. + * + * @param property The mapped property. + * @param lazyAvailable Is property lazy loading currently available. + * @return The appropriate NonIdentifierProperty definition. + */ + public static StandardProperty buildStandardProperty(AttributeBinding property, boolean lazyAvailable) { + + final Type type = property.getHibernateTypeDescriptor().getResolvedTypeMapping(); + + // we need to dirty check collections, since they can cause an owner + // version number increment + + // we need to dirty check many-to-ones with not-found="ignore" in order + // to update the cache (not the database), since in this case a null + // entity reference can lose information + + final boolean alwaysDirtyCheck = type.isAssociationType() && ( (AssociationType) type ).isAlwaysDirtyChecked(); + + if ( property.getAttribute().isSingular() ) { + final SingularAttributeBinding singularAttributeBinding = ( SingularAttributeBinding ) property; + final CascadeStyle cascadeStyle = singularAttributeBinding.isAssociation() + ? ( (AssociationAttributeBinding) singularAttributeBinding ).getCascadeStyle() + : CascadeStyles.NONE; + final FetchMode fetchMode = singularAttributeBinding.isAssociation() + ? ( (AssociationAttributeBinding) singularAttributeBinding ).getFetchMode() + : FetchMode.DEFAULT; + + return new StandardProperty( + singularAttributeBinding.getAttribute().getName(), + type, + lazyAvailable && singularAttributeBinding.isLazy(), + true, // insertable + true, // updatable + null, + singularAttributeBinding.isNullable(), + alwaysDirtyCheck || areAllValuesIncludedInUpdate( singularAttributeBinding ), + singularAttributeBinding.isIncludedInOptimisticLocking(), + cascadeStyle, + fetchMode ); + } + else { + final AbstractPluralAttributeBinding pluralAttributeBinding = (AbstractPluralAttributeBinding) property; + final CascadeStyle cascadeStyle = pluralAttributeBinding.isAssociation() + ? pluralAttributeBinding.getCascadeStyle() + : CascadeStyles.NONE; + final FetchMode fetchMode = pluralAttributeBinding.isAssociation() + ? pluralAttributeBinding.getFetchMode() + : FetchMode.DEFAULT; + + return new StandardProperty( + pluralAttributeBinding.getAttribute().getName(), + type, + lazyAvailable && pluralAttributeBinding.isLazy(), + // TODO: fix this when HHH-6356 is fixed; for now assume AbstractPluralAttributeBinding is updatable and insertable + true, // pluralAttributeBinding.isInsertable(), + true, //pluralAttributeBinding.isUpdatable(), + null, + false, // nullable - not sure what that means for a collection + // TODO: fix this when HHH-6356 is fixed; for now assume AbstractPluralAttributeBinding is updatable and insertable + //alwaysDirtyCheck || pluralAttributeBinding.isUpdatable(), + true, + pluralAttributeBinding.isIncludedInOptimisticLocking(), + cascadeStyle, + fetchMode + ); + } } + private static boolean areAllValuesIncludedInUpdate(SingularAttributeBinding attributeBinding) { + if ( attributeBinding.hasDerivedValue() ) { + return false; + } + for ( SimpleValueBinding valueBinding : attributeBinding.getSimpleValueBindings() ) { + if ( ! valueBinding.isIncludeInUpdate() ) { + return false; + } + } + return true; + } + private static Constructor getConstructor(PersistentClass persistentClass) { if ( persistentClass == null || !persistentClass.hasPojoRepresentation() ) { return null; @@ -182,6 +475,19 @@ } } + private static Constructor getConstructor(EntityBinding entityBinding) { + if ( entityBinding == null || entityBinding.getEntity() == null ) { + return null; + } + + try { + return ReflectHelper.getDefaultConstructor( entityBinding.getEntity().getClassReference() ); + } + catch( Throwable t ) { + return null; + } + } + private static Getter getGetter(Property mappingProperty) { if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) { return null; @@ -191,4 +497,17 @@ return pa.getGetter( mappingProperty.getPersistentClass().getMappedClass(), mappingProperty.getName() ); } + private static Getter getGetter(AttributeBinding mappingProperty) { + if ( mappingProperty == null || mappingProperty.getContainer().getClassReference() == null ) { + return null; + } + + PropertyAccessor pa = PropertyAccessorFactory.getPropertyAccessor( mappingProperty, EntityMode.POJO ); + return pa.getGetter( + mappingProperty.getContainer().getClassReference(), + mappingProperty.getAttribute().getName() + ); + } + + } Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/StandardProperty.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/StandardProperty.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/StandardProperty.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/StandardProperty.java 30 Jul 2014 15:52:21 -0000 1.1.2.1 @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008, 2013, 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,119 +20,66 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ package org.hibernate.tuple; -import org.hibernate.engine.CascadeStyle; -import org.hibernate.type.Type; import org.hibernate.FetchMode; +import org.hibernate.engine.spi.CascadeStyle; +import org.hibernate.type.Type; /** - * Represents a basic property within the Hibernate runtime-metamodel. + * Represents a non-identifier property within the Hibernate runtime-metamodel. * * @author Steve Ebersole */ -public class StandardProperty extends Property { +@Deprecated +public class StandardProperty extends AbstractNonIdentifierAttribute implements NonIdentifierAttribute { - private final boolean lazy; - private final boolean insertable; - private final boolean updateable; - private final boolean insertGenerated; - private final boolean updateGenerated; - private final boolean nullable; - private final boolean dirtyCheckable; - private final boolean versionable; - private final CascadeStyle cascadeStyle; - private final FetchMode fetchMode; - - /** - * Constructs StandardProperty instances. - * - * @param name The name by which the property can be referenced within - * its owner. - * @param node The node name to use for XML-based representation of this - * property. - * @param type The Hibernate Type of this property. - * @param lazy Should this property be handled lazily? - * @param insertable Is this property an insertable value? - * @param updateable Is this property an updateable value? - * @param insertGenerated Is this property generated in the database on insert? - * @param updateGenerated Is this property generated in the database on update? - * @param nullable Is this property a nullable value? - * @param checkable Is this property a checkable value? - * @param versionable Is this property a versionable value? - * @param cascadeStyle The cascade style for this property's value. - * @param fetchMode Any fetch mode defined for this property - */ - public StandardProperty( - String name, - String node, - Type type, - boolean lazy, - boolean insertable, - boolean updateable, - boolean insertGenerated, - boolean updateGenerated, - boolean nullable, - boolean checkable, - boolean versionable, - CascadeStyle cascadeStyle, - FetchMode fetchMode) { - super(name, node, type); - this.lazy = lazy; - this.insertable = insertable; - this.updateable = updateable; - this.insertGenerated = insertGenerated; - this.updateGenerated = updateGenerated; - this.nullable = nullable; - this.dirtyCheckable = checkable; - this.versionable = versionable; - this.cascadeStyle = cascadeStyle; - this.fetchMode = fetchMode; - } - - public boolean isLazy() { - return lazy; - } - - public boolean isInsertable() { - return insertable; - } - - public boolean isUpdateable() { - return updateable; - } - - public boolean isInsertGenerated() { - return insertGenerated; + /** + * Constructs NonIdentifierProperty instances. + * + * @param name The name by which the property can be referenced within + * its owner. + * @param type The Hibernate Type of this property. + * @param lazy Should this property be handled lazily? + * @param insertable Is this property an insertable value? + * @param updateable Is this property an updateable value? + * @param valueGenerationStrategy How (if) values for this attribute are generated + * @param nullable Is this property a nullable value? + * @param checkable Is this property a checkable value? + * @param versionable Is this property a versionable value? + * @param cascadeStyle The cascade style for this property's value. + * @param fetchMode Any fetch mode defined for this property + */ + public StandardProperty( + String name, + Type type, + boolean lazy, + boolean insertable, + boolean updateable, + ValueGeneration valueGenerationStrategy, + boolean nullable, + boolean checkable, + boolean versionable, + CascadeStyle cascadeStyle, + FetchMode fetchMode) { + super( + null, + null, + -1, + name, + type, + new BaselineAttributeInformation.Builder() + .setLazy( lazy ) + .setInsertable( insertable ) + .setUpdateable( updateable ) + .setValueGenerationStrategy( valueGenerationStrategy ) + .setNullable( nullable ) + .setDirtyCheckable( checkable ) + .setVersionable( versionable ) + .setCascadeStyle( cascadeStyle ) + .setFetchMode( fetchMode ) + .createInformation() + ); } - - public boolean isUpdateGenerated() { - return updateGenerated; - } - - public boolean isNullable() { - return nullable; - } - - public boolean isDirtyCheckable(boolean hasUninitializedProperties) { - return isDirtyCheckable() && ( !hasUninitializedProperties || !isLazy() ); - } - - public boolean isDirtyCheckable() { - return dirtyCheckable; - } - - public boolean isVersionable() { - return versionable; - } - - public CascadeStyle getCascadeStyle() { - return cascadeStyle; - } - - public FetchMode getFetchMode() { - return fetchMode; - } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/TimestampGenerators.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/Tuplizer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/Tuplizer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/Tuplizer.java 17 Aug 2012 14:36:24 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/Tuplizer.java 30 Jul 2014 15:52:22 -0000 1.1.2.1 @@ -23,9 +23,8 @@ * */ package org.hibernate.tuple; +import org.hibernate.property.Getter; -import org.hibernate.HibernateException; - /** * A tuplizer defines the contract for things which know how to manage * a particular representation of a piece of data, given that @@ -56,42 +55,37 @@ * @author Steve Ebersole */ public interface Tuplizer { - /** * Extract the current values contained on the given entity. * * @param entity The entity from which to extract values. * @return The current property values. - * @throws HibernateException */ - public Object[] getPropertyValues(Object entity) throws HibernateException; + public Object[] getPropertyValues(Object entity); /** * Inject the given values into the given entity. * * @param entity The entity. * @param values The values to be injected. - * @throws HibernateException */ - public void setPropertyValues(Object entity, Object[] values) throws HibernateException; + public void setPropertyValues(Object entity, Object[] values); /** * Extract the value of a particular property from the given entity. * * @param entity The entity from which to extract the property value. * @param i The index of the property for which to extract the value. * @return The current value of the given property on the given entity. - * @throws HibernateException */ - public Object getPropertyValue(Object entity, int i) throws HibernateException; + public Object getPropertyValue(Object entity, int i); /** * Generate a new, empty entity. * * @return The new, empty entity instance. - * @throws HibernateException */ - public Object instantiate() throws HibernateException; + public Object instantiate(); /** * Is the given object considered an instance of the the entity (acconting @@ -115,4 +109,11 @@ */ public Class getMappedClass(); + /** + * Retrieve the getter for the specified property. + * + * @param i The property index. + * @return The property getter. + */ + public Getter getGetter(int i); } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/UpdateTimestampGeneration.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/ValueGeneration.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/ValueGenerator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/VersionProperty.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/VmValueGeneration.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/AbstractComponentTuplizer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/component/AbstractComponentTuplizer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/AbstractComponentTuplizer.java 17 Aug 2012 14:36:54 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/AbstractComponentTuplizer.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -23,17 +23,16 @@ * */ package org.hibernate.tuple.component; - import java.lang.reflect.Method; import java.util.Iterator; import org.hibernate.HibernateException; -import org.hibernate.tuple.Instantiator; -import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; import org.hibernate.property.Getter; import org.hibernate.property.Setter; +import org.hibernate.tuple.Instantiator; /** * Support for tuplizers relating to components. @@ -42,7 +41,6 @@ * @author Steve Ebersole */ public abstract class AbstractComponentTuplizer implements ComponentTuplizer { - protected final Getter[] getters; protected final Setter[] setters; protected final int propertySpan; @@ -71,15 +69,6 @@ i++; } hasCustomAccessors = foundCustomAccessor; - - String[] getterNames = new String[propertySpan]; - String[] setterNames = new String[propertySpan]; - Class[] propTypes = new Class[propertySpan]; - for ( int j = 0; j < propertySpan; j++ ) { - getterNames[j] = getters[j].getMethodName(); - setterNames[j] = setters[j].getMethodName(); - propTypes[j] = getters[j].getReturnType(); - } instantiator = buildInstantiator( component ); } @@ -128,4 +117,7 @@ throw new UnsupportedOperationException(); } + public Getter getGetter(int i) { + return getters[i]; + } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/component/AbstractCompositionAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentEntityModeToTuplizerMapping.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentMetamodel.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentMetamodel.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentMetamodel.java 17 Aug 2012 14:36:54 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentMetamodel.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -24,17 +24,18 @@ */ package org.hibernate.tuple.component; -import org.hibernate.mapping.Component; -import org.hibernate.mapping.Property; -import org.hibernate.HibernateException; -import org.hibernate.tuple.StandardProperty; -import org.hibernate.tuple.PropertyFactory; - import java.io.Serializable; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.HashMap; +import org.hibernate.EntityMode; +import org.hibernate.HibernateException; +import org.hibernate.mapping.Component; +import org.hibernate.mapping.Property; +import org.hibernate.tuple.PropertyFactory; +import org.hibernate.tuple.StandardProperty; + /** * Centralizes metamodel information about a component. * @@ -48,8 +49,10 @@ private final String role; private final boolean isKey; private final StandardProperty[] properties; - private final ComponentEntityModeToTuplizerMapping tuplizerMapping; + private final EntityMode entityMode; + private final ComponentTuplizer componentTuplizer; + // cached for efficiency... private final int propertySpan; private final Map propertyIndexes = new HashMap(); @@ -66,11 +69,19 @@ while ( itr.hasNext() ) { Property property = ( Property ) itr.next(); properties[i] = PropertyFactory.buildStandardProperty( property, false ); - propertyIndexes.put( property.getName(), new Integer( i ) ); + propertyIndexes.put( property.getName(), i ); i++; } - tuplizerMapping = new ComponentEntityModeToTuplizerMapping( component ); + entityMode = component.hasPojoRepresentation() ? EntityMode.POJO : EntityMode.MAP; + + // todo : move this to SF per HHH-3517; also see HHH-1907 and ComponentMetamodel + final ComponentTuplizerFactory componentTuplizerFactory = new ComponentTuplizerFactory(); + final String tuplizerClassName = component.getTuplizerImplClassName( entityMode ); + this.componentTuplizer = tuplizerClassName == null ? componentTuplizerFactory.constructDefaultTuplizer( + entityMode, + component + ) : componentTuplizerFactory.constructTuplizer( tuplizerClassName, component ); } public boolean isKey() { @@ -97,15 +108,19 @@ if ( index == null ) { throw new HibernateException( "component does not contain such a property [" + propertyName + "]" ); } - return index.intValue(); + return index; } public StandardProperty getProperty(String propertyName) { return getProperty( getPropertyIndex( propertyName ) ); } - public ComponentEntityModeToTuplizerMapping getTuplizerMapping() { - return tuplizerMapping; + public EntityMode getEntityMode() { + return entityMode; } + public ComponentTuplizer getComponentTuplizer() { + return componentTuplizer; + } + } Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentTuplizer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentTuplizer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentTuplizer.java 17 Aug 2012 14:36:54 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentTuplizer.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -23,15 +23,14 @@ * */ package org.hibernate.tuple.component; - import java.io.Serializable; import java.lang.reflect.Method; -import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.tuple.Tuplizer; /** - * Defines further responsibilities reagarding tuplization based on + * Defines further responsibilities regarding tuplization based on * a mapped components. *

* ComponentTuplizer implementations should have the following constructor signature: Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/component/ComponentTuplizerFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/component/CompositeBasedAssociationAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/component/CompositeBasedBasicAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/component/Dom4jComponentTuplizer.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java 17 Aug 2012 14:36:54 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -23,7 +23,6 @@ * */ package org.hibernate.tuple.component; - import java.util.Map; import org.hibernate.mapping.Component; @@ -32,8 +31,8 @@ import org.hibernate.property.PropertyAccessor; import org.hibernate.property.PropertyAccessorFactory; import org.hibernate.property.Setter; -import org.hibernate.tuple.Instantiator; import org.hibernate.tuple.DynamicMapInstantiator; +import org.hibernate.tuple.Instantiator; /** * A {@link ComponentTuplizer} specific to the dynamic-map entity mode. Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/PojoComponentTuplizer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/component/PojoComponentTuplizer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/PojoComponentTuplizer.java 17 Aug 2012 14:36:54 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/component/PojoComponentTuplizer.java 30 Jul 2014 15:52:03 -0000 1.1.2.1 @@ -23,16 +23,16 @@ * */ package org.hibernate.tuple.component; - import java.io.Serializable; import java.lang.reflect.Method; import org.hibernate.AssertionFailure; import org.hibernate.HibernateException; -import org.hibernate.bytecode.BasicProxyFactory; -import org.hibernate.bytecode.ReflectionOptimizer; +import org.hibernate.bytecode.spi.BasicProxyFactory; +import org.hibernate.bytecode.spi.ReflectionOptimizer; import org.hibernate.cfg.Environment; -import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.internal.util.ReflectHelper; import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; import org.hibernate.property.BackrefPropertyAccessor; @@ -42,7 +42,6 @@ import org.hibernate.property.Setter; import org.hibernate.tuple.Instantiator; import org.hibernate.tuple.PojoInstantiator; -import org.hibernate.util.ReflectHelper; /** * A {@link ComponentTuplizer} specific to the pojo entity mode. @@ -51,7 +50,6 @@ * @author Steve Ebersole */ public class PojoComponentTuplizer extends AbstractComponentTuplizer { - private final Class componentClass; private ReflectionOptimizer optimizer; private final Getter parentGetter; @@ -100,44 +98,45 @@ public Object[] getPropertyValues(Object component) throws HibernateException { if ( component == BackrefPropertyAccessor.UNKNOWN ) { - return new Object[ propertySpan ]; + return new Object[propertySpan]; } - if ( optimizer != null && optimizer.getAccessOptimizer() != null ) { + else if ( optimizer != null && optimizer.getAccessOptimizer() != null ) { return optimizer.getAccessOptimizer().getPropertyValues( component ); } else { - return super.getPropertyValues(component); + return super.getPropertyValues( component ); } } public void setPropertyValues(Object component, Object[] values) throws HibernateException { if ( optimizer != null && optimizer.getAccessOptimizer() != null ) { - optimizer.getAccessOptimizer().setPropertyValues( component, values ); + optimizer.getAccessOptimizer().setPropertyValues( component, values ); } else { - super.setPropertyValues(component, values); + super.setPropertyValues( component, values ); } - } public Object getParent(Object component) { return parentGetter.get( component ); } public boolean hasParentProperty() { - return parentGetter!=null; + return parentGetter != null; } public boolean isMethodOf(Method method) { - for ( int i=0; i persistEventListeners = persistEventListeners( session ); + final PersistenceContext persistenceContext = session.getPersistenceContext(); + final int length = subTypes.length; + for ( int i = 0 ; i < length; i++ ) { + if ( propertyValues[i] == null ) { + throw new HibernateException( "No part of a composite identifier may be null" ); + } + //JPA 2 @MapsId + @IdClass points to the pk of the entity + if ( subTypes[i].isAssociationType() && ! copierSubTypes[i].isAssociationType() ) { + // we need a session to handle this use case + if ( session == null ) { + throw new AssertionError( + "Deprecated version of getIdentifier (no session) was used but session was required" + ); + } + final Object subId; + if ( HibernateProxy.class.isInstance( propertyValues[i] ) ) { + subId = ( (HibernateProxy) propertyValues[i] ).getHibernateLazyInitializer().getIdentifier(); + } + else { + EntityEntry pcEntry = session.getPersistenceContext().getEntry( propertyValues[i] ); + if ( pcEntry != null ) { + subId = pcEntry.getId(); + } + else { + LOG.debug( "Performing implicit derived identity cascade" ); + final PersistEvent event = new PersistEvent( null, propertyValues[i], (EventSource) session ); + for ( PersistEventListener listener : persistEventListeners ) { + listener.onPersist( event ); + } + pcEntry = persistenceContext.getEntry( propertyValues[i] ); + if ( pcEntry == null || pcEntry.getId() == null ) { + throw new HibernateException( "Unable to process implicit derived identity cascade" ); + } + else { + subId = pcEntry.getId(); + } + } + } + propertyValues[i] = subId; + } + } + mappedIdentifierType.setPropertyValues( id, propertyValues, entityMode ); + return id; + } + + @Override + public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SessionImplementor session) { + final Object[] extractedValues = mappedIdentifierType.getPropertyValues( id, entityMode ); + final Object[] injectionValues = new Object[ extractedValues.length ]; + final PersistenceContext persistenceContext = session.getPersistenceContext(); + for ( int i = 0; i < virtualIdComponent.getSubtypes().length; i++ ) { + final Type virtualPropertyType = virtualIdComponent.getSubtypes()[i]; + final Type idClassPropertyType = mappedIdentifierType.getSubtypes()[i]; + if ( virtualPropertyType.isEntityType() && ! idClassPropertyType.isEntityType() ) { + if ( session == null ) { + throw new AssertionError( + "Deprecated version of getIdentifier (no session) was used but session was required" + ); + } + final String associatedEntityName = ( (EntityType) virtualPropertyType ).getAssociatedEntityName(); + final EntityKey entityKey = session.generateEntityKey( + (Serializable) extractedValues[i], + session.getFactory().getEntityPersister( associatedEntityName ) + ); + // it is conceivable there is a proxy, so check that first + Object association = persistenceContext.getProxy( entityKey ); + if ( association == null ) { + // otherwise look for an initialized version + association = persistenceContext.getEntity( entityKey ); + } + injectionValues[i] = association; + } + else { + injectionValues[i] = extractedValues[i]; + } + } + virtualIdComponent.setPropertyValues( entity, injectionValues, entityMode ); + } + } + + private static Iterable persistEventListeners(SessionImplementor session) { + return session + .getFactory() + .getServiceRegistry() + .getService( EventListenerRegistry.class ) + .getEventListenerGroup( EventType.PERSIST ) + .listeners(); + } + + @Override public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion) { + // 99% of the time the session is not needed. Its only needed for certain brain-dead + // interpretations of JPA 2 "derived identity" support + resetIdentifier( entity, currentId, currentVersion, null ); + } + + @Override + public void resetIdentifier( + Object entity, + Serializable currentId, + Object currentVersion, + SessionImplementor session) { if ( entityMetamodel.getIdentifierProperty().getIdentifierGenerator() instanceof Assigned ) { - //return currentId; } else { //reset the id Serializable result = entityMetamodel.getIdentifierProperty() .getUnsavedValue() .getDefaultValue( currentId ); - setIdentifier( entity, result ); + setIdentifier( entity, result, session ); //reset the version VersionProperty versionProperty = entityMetamodel.getVersionProperty(); if ( entityMetamodel.isVersioned() ) { setPropertyValue( entity, entityMetamodel.getVersionPropertyIndex(), versionProperty.getUnsavedValue().getDefaultValue( currentVersion ) - ); + ); } - //return the id, so we can use it to reset the proxy id - //return result; } } + @Override public Object getVersion(Object entity) throws HibernateException { if ( !entityMetamodel.isVersioned() ) return null; return getters[ entityMetamodel.getVersionPropertyIndex() ].get( entity ); @@ -268,13 +596,14 @@ return !hasUninitializedLazyProperties( entity ); } + @Override public Object[] getPropertyValues(Object entity) throws HibernateException { boolean getAll = shouldGetAllProperties( entity ); final int span = entityMetamodel.getPropertySpan(); final Object[] result = new Object[span]; for ( int j = 0; j < span; j++ ) { - StandardProperty property = entityMetamodel.getProperties()[j]; + NonIdentifierAttribute property = entityMetamodel.getProperties()[j]; if ( getAll || !property.isLazy() ) { result[j] = getters[j].get( entity ); } @@ -285,8 +614,9 @@ return result; } - public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) - throws HibernateException { + @Override + public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) + throws HibernateException { final int span = entityMetamodel.getPropertySpan(); final Object[] result = new Object[span]; @@ -296,22 +626,38 @@ return result; } + @Override public Object getPropertyValue(Object entity, int i) throws HibernateException { return getters[i].get( entity ); } + @Override public Object getPropertyValue(Object entity, String propertyPath) throws HibernateException { - int loc = propertyPath.indexOf('.'); - String basePropertyName = loc>0 ? - propertyPath.substring(0, loc) : propertyPath; - - int index = entityMetamodel.getPropertyIndex( basePropertyName ); - Object baseValue = getPropertyValue( entity, index ); - if ( loc>0 ) { - ComponentType type = (ComponentType) entityMetamodel.getPropertyTypes()[index]; - return getComponentValue( type, baseValue, propertyPath.substring(loc+1) ); + String basePropertyName = loc > 0 + ? propertyPath.substring( 0, loc ) + : propertyPath; + //final int index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); + Integer index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); + if (index == null) { + propertyPath = PropertyPath.IDENTIFIER_MAPPER_PROPERTY + "." + propertyPath; + loc = propertyPath.indexOf('.'); + basePropertyName = loc > 0 + ? propertyPath.substring( 0, loc ) + : propertyPath; } + index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); + final Object baseValue = getPropertyValue( entity, index ); + if ( loc > 0 ) { + if ( baseValue == null ) { + return null; + } + return getComponentValue( + (ComponentType) entityMetamodel.getPropertyTypes()[index], + baseValue, + propertyPath.substring(loc+1) + ); + } else { return baseValue; } @@ -326,32 +672,39 @@ * @return The property value extracted. */ protected Object getComponentValue(ComponentType type, Object component, String propertyPath) { - - int loc = propertyPath.indexOf('.'); - String basePropertyName = loc>0 ? - propertyPath.substring(0, loc) : propertyPath; - - String[] propertyNames = type.getPropertyNames(); - int index=0; - for ( ; index 0 + ? propertyPath.substring( 0, loc ) + : propertyPath; + final int index = findSubPropertyIndex( type, basePropertyName ); + final Object baseValue = type.getPropertyValue( component, index ); + if ( loc > 0 ) { + if ( baseValue == null ) { + return null; + } + return getComponentValue( + (ComponentType) type.getSubtypes()[index], + baseValue, + propertyPath.substring(loc+1) + ); } - if (index==propertyNames.length) { - throw new MappingException( "component property not found: " + basePropertyName ); - } - - Object baseValue = type.getPropertyValue( component, index, getEntityMode() ); - - if ( loc>0 ) { - ComponentType subtype = (ComponentType) type.getSubtypes()[index]; - return getComponentValue( subtype, baseValue, propertyPath.substring(loc+1) ); - } else { return baseValue; } - + } + private int findSubPropertyIndex(ComponentType type, String subPropertyName) { + final String[] propertyNames = type.getPropertyNames(); + for ( int index = 0; index propertyIndexes = new HashMap(); private final boolean hasCollections; private final boolean hasMutableProperties; private final boolean hasLazyProperties; private final boolean hasNonIdentifierPropertyNamedId; private final int[] naturalIdPropertyNumbers; private final boolean hasImmutableNaturalId; + private final boolean hasCacheableNaturalId; private boolean lazy; //not final because proxy factory creation can fail private final boolean hasCascades; @@ -114,57 +135,52 @@ private final boolean selectBeforeUpdate; private final boolean dynamicUpdate; private final boolean dynamicInsert; - private final int optimisticLockMode; + private final OptimisticLockStyle optimisticLockStyle; private final boolean polymorphic; private final String superclass; // superclass entity-name private final boolean explicitPolymorphism; private final boolean inherited; private final boolean hasSubclasses; private final Set subclassEntityNames = new HashSet(); + private final Map entityNameByInheritenceClassMap = new HashMap(); - private final EntityEntityModeToTuplizerMapping tuplizerMapping; + private final EntityMode entityMode; + private final EntityTuplizer entityTuplizer; + private final EntityInstrumentationMetadata instrumentationMetadata; - public EntityTuplizer getTuplizer(EntityMode entityMode) { - return (EntityTuplizer) tuplizerMapping.getTuplizer( entityMode ); - } - - public EntityTuplizer getTuplizerOrNull(EntityMode entityMode) { - return ( EntityTuplizer ) tuplizerMapping.getTuplizerOrNull( entityMode ); - } - - public EntityMode guessEntityMode(Object object) { - return tuplizerMapping.guessEntityMode( object ); - } - - public EntityMetamodel(PersistentClass persistentClass, SessionFactoryImplementor sessionFactory) { + public EntityMetamodel( + PersistentClass persistentClass, + AbstractEntityPersister persister, + SessionFactoryImplementor sessionFactory) { this.sessionFactory = sessionFactory; + this.persister = persister; name = persistentClass.getEntityName(); rootName = persistentClass.getRootClass().getEntityName(); - entityType = TypeFactory.manyToOne( name ); + entityType = sessionFactory.getTypeResolver().getTypeFactory().manyToOne( name ); - identifierProperty = PropertyFactory.buildIdentifierProperty( - persistentClass, - sessionFactory.getIdentifierGenerator( rootName ) - ); + identifierAttribute = PropertyFactory.buildIdentifierAttribute( + persistentClass, + sessionFactory.getIdentifierGenerator( rootName ) + ); versioned = persistentClass.isVersioned(); - boolean lazyAvailable = persistentClass.hasPojoRepresentation() && - FieldInterceptionHelper.isInstrumented( persistentClass.getMappedClass() ); + instrumentationMetadata = persistentClass.hasPojoRepresentation() + ? Environment.getBytecodeProvider().getEntityInstrumentationMetadata( persistentClass.getMappedClass() ) + : new NonPojoInstrumentationMetadata( persistentClass.getEntityName() ); + boolean hasLazy = false; propertySpan = persistentClass.getPropertyClosureSpan(); - properties = new StandardProperty[propertySpan]; - List naturalIdNumbers = new ArrayList(); + properties = new NonIdentifierAttribute[propertySpan]; + List naturalIdNumbers = new ArrayList(); // temporary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ propertyNames = new String[propertySpan]; propertyTypes = new Type[propertySpan]; propertyUpdateability = new boolean[propertySpan]; propertyInsertability = new boolean[propertySpan]; - insertInclusions = new ValueInclusion[propertySpan]; - updateInclusions = new ValueInclusion[propertySpan]; nonlazyPropertyUpdateability = new boolean[propertySpan]; propertyCheckability = new boolean[propertySpan]; propertyNullability = new boolean[propertySpan]; @@ -173,7 +189,16 @@ cascadeStyles = new CascadeStyle[propertySpan]; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // generated value strategies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + this.inMemoryValueGenerationStrategies = new InMemoryValueGenerationStrategy[propertySpan]; + this.inDatabaseValueGenerationStrategies = new InDatabaseValueGenerationStrategy[propertySpan]; + boolean foundPreInsertGeneratedValues = false; + boolean foundPreUpdateGeneratedValues = false; + boolean foundPostInsertGeneratedValues = false; + boolean foundPostUpdateGeneratedValues = false; + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Iterator iter = persistentClass.getPropertyClosureIterator(); int i = 0; int tempVersionProperty = NO_VERSION_INDX; @@ -190,14 +215,26 @@ if ( prop == persistentClass.getVersion() ) { tempVersionProperty = i; - properties[i] = PropertyFactory.buildVersionProperty( prop, lazyAvailable ); + properties[i] = PropertyFactory.buildVersionProperty( + persister, + sessionFactory, + i, + prop, + instrumentationMetadata.isInstrumented() + ); } else { - properties[i] = PropertyFactory.buildStandardProperty( prop, lazyAvailable ); + properties[i] = PropertyFactory.buildEntityBasedAttribute( + persister, + sessionFactory, + i, + prop, + instrumentationMetadata.isInstrumented() + ); } if ( prop.isNaturalIdentifier() ) { - naturalIdNumbers.add( new Integer(i) ); + naturalIdNumbers.add( i ); if ( prop.isUpdateable() ) { foundUpdateableNaturalIdProperty = true; } @@ -208,7 +245,7 @@ } // temporary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - boolean lazy = prop.isLazy() && lazyAvailable; + boolean lazy = prop.isLazy() && instrumentationMetadata.isInstrumented(); if ( lazy ) hasLazy = true; propertyLaziness[i] = lazy; @@ -217,8 +254,6 @@ propertyNullability[i] = properties[i].isNullable(); propertyUpdateability[i] = properties[i].isUpdateable(); propertyInsertability[i] = properties[i].isInsertable(); - insertInclusions[i] = determineInsertValueGenerationType( prop, properties[i] ); - updateInclusions[i] = determineUpdateValueGenerationType( prop, properties[i] ); propertyVersionability[i] = properties[i].isVersionable(); nonlazyPropertyUpdateability[i] = properties[i].isUpdateable() && !lazy; propertyCheckability[i] = propertyUpdateability[i] || @@ -227,11 +262,44 @@ cascadeStyles[i] = properties[i].getCascadeStyle(); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // generated value strategies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + GenerationStrategyPair pair = buildGenerationStrategyPair( sessionFactory, prop ); + inMemoryValueGenerationStrategies[i] = pair.getInMemoryStrategy(); + inDatabaseValueGenerationStrategies[i] = pair.getInDatabaseStrategy(); + + if ( pair.getInMemoryStrategy() != null ) { + final GenerationTiming timing = pair.getInMemoryStrategy().getGenerationTiming(); + if ( timing != GenerationTiming.NEVER ) { + final ValueGenerator generator = pair.getInMemoryStrategy().getValueGenerator(); + if ( generator != null ) { + // we have some level of generation indicated + if ( timing == GenerationTiming.INSERT ) { + foundPreInsertGeneratedValues = true; + } + else if ( timing == GenerationTiming.ALWAYS ) { + foundPreInsertGeneratedValues = true; + foundPreUpdateGeneratedValues = true; + } + } + } + } + if ( pair.getInDatabaseStrategy() != null ) { + final GenerationTiming timing = pair.getInDatabaseStrategy().getGenerationTiming(); + if ( timing == GenerationTiming.INSERT ) { + foundPostInsertGeneratedValues = true; + } + else if ( timing == GenerationTiming.ALWAYS ) { + foundPostInsertGeneratedValues = true; + foundPostUpdateGeneratedValues = true; + } + } + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + if ( properties[i].isLazy() ) { hasLazy = true; } - if ( properties[i].getCascadeStyle() != CascadeStyle.NONE ) { + if ( properties[i].getCascadeStyle() != CascadeStyles.NONE ) { foundCascade = true; } @@ -243,37 +311,31 @@ foundMutable = true; } - if ( insertInclusions[i] != ValueInclusion.NONE ) { - foundInsertGeneratedValue = true; - } - - if ( updateInclusions[i] != ValueInclusion.NONE ) { - foundUpdateGeneratedValue = true; - } - mapPropertyToIndex(prop, i); i++; } if (naturalIdNumbers.size()==0) { naturalIdPropertyNumbers = null; hasImmutableNaturalId = false; + hasCacheableNaturalId = false; } else { naturalIdPropertyNumbers = ArrayHelper.toIntArray(naturalIdNumbers); hasImmutableNaturalId = !foundUpdateableNaturalIdProperty; + hasCacheableNaturalId = persistentClass.getNaturalIdCacheRegionName() != null; } - hasInsertGeneratedValues = foundInsertGeneratedValue; - hasUpdateGeneratedValues = foundUpdateGeneratedValue; + this.hasPreInsertGeneratedValues = foundPreInsertGeneratedValues; + this.hasPreUpdateGeneratedValues = foundPreUpdateGeneratedValues; + this.hasInsertGeneratedValues = foundPostInsertGeneratedValues; + this.hasUpdateGeneratedValues = foundPostUpdateGeneratedValues; hasCascades = foundCascade; hasNonIdentifierPropertyNamedId = foundNonIdentifierPropertyNamedId; versionPropertyIndex = tempVersionProperty; hasLazyProperties = hasLazy; - if ( hasLazyProperties ) { - log.info( "lazy property fetching available for: " + name ); - } + if (hasLazyProperties) LOG.lazyPropertyFetchingAvailable(name); lazy = persistentClass.isLazy() && ( // TODO: this disables laziness even in non-pojo entity modes: @@ -290,7 +352,7 @@ isAbstract = persistentClass.isAbstract().booleanValue(); if ( !isAbstract && persistentClass.hasPojoRepresentation() && ReflectHelper.isAbstractClass( persistentClass.getMappedClass() ) ) { - log.warn( "entity [" + name + "] is abstract-class/interface explicitly mapped as non-abstract; be sure to supply entity-names" ); + LOG.entityMappedAsNonAbstract(name); } } selectBeforeUpdate = persistentClass.hasSelectBeforeUpdate(); @@ -305,11 +367,14 @@ null; hasSubclasses = persistentClass.hasSubclasses(); - optimisticLockMode = persistentClass.getOptimisticLockMode(); - if ( optimisticLockMode > Versioning.OPTIMISTIC_LOCK_VERSION && !dynamicUpdate ) { + optimisticLockStyle = persistentClass.getOptimisticLockStyle(); + final boolean isAllOrDirty = + optimisticLockStyle == OptimisticLockStyle.ALL + || optimisticLockStyle == OptimisticLockStyle.DIRTY; + if ( isAllOrDirty && !dynamicUpdate ) { throw new MappingException( "optimistic-lock=all|dirty requires dynamic-update=\"true\": " + name ); } - if ( versionPropertyIndex != NO_VERSION_INDX && optimisticLockMode > Versioning.OPTIMISTIC_LOCK_VERSION ) { + if ( versionPropertyIndex != NO_VERSION_INDX && isAllOrDirty ) { throw new MappingException( "version and optimistic-lock=all|dirty are not a valid combination : " + name ); } @@ -322,11 +387,369 @@ } subclassEntityNames.add( name ); - tuplizerMapping = new EntityEntityModeToTuplizerMapping( persistentClass, this ); + if ( persistentClass.hasPojoRepresentation() ) { + entityNameByInheritenceClassMap.put( persistentClass.getMappedClass(), persistentClass.getEntityName() ); + iter = persistentClass.getSubclassIterator(); + while ( iter.hasNext() ) { + final PersistentClass pc = ( PersistentClass ) iter.next(); + entityNameByInheritenceClassMap.put( pc.getMappedClass(), pc.getEntityName() ); + } + } + + entityMode = persistentClass.hasPojoRepresentation() ? EntityMode.POJO : EntityMode.MAP; + final EntityTuplizerFactory entityTuplizerFactory = sessionFactory.getSettings().getEntityTuplizerFactory(); + final String tuplizerClassName = persistentClass.getTuplizerImplClassName( entityMode ); + if ( tuplizerClassName == null ) { + entityTuplizer = entityTuplizerFactory.constructDefaultTuplizer( entityMode, this, persistentClass ); + } + else { + entityTuplizer = entityTuplizerFactory.constructTuplizer( tuplizerClassName, this, persistentClass ); + } } - private ValueInclusion determineInsertValueGenerationType(Property mappingProperty, StandardProperty runtimeProperty) { - if ( runtimeProperty.isInsertGenerated() ) { + private static GenerationStrategyPair buildGenerationStrategyPair( + final SessionFactoryImplementor sessionFactory, + final Property mappingProperty) { + final ValueGeneration valueGeneration = mappingProperty.getValueGenerationStrategy(); + if ( valueGeneration != null && valueGeneration.getGenerationTiming() != GenerationTiming.NEVER ) { + // the property is generated in full. build the generation strategy pair. + if ( valueGeneration.getValueGenerator() != null ) { + // in-memory generation + return new GenerationStrategyPair( + FullInMemoryValueGenerationStrategy.create( valueGeneration ) + ); + } + else { + // in-db generation + return new GenerationStrategyPair( + create( + sessionFactory, + mappingProperty, + valueGeneration + ) + ); + } + } + else if ( mappingProperty.getValue() instanceof Component ) { + final CompositeGenerationStrategyPairBuilder builder = new CompositeGenerationStrategyPairBuilder( mappingProperty ); + interpretPartialCompositeValueGeneration( sessionFactory, (Component) mappingProperty.getValue(), builder ); + return builder.buildPair(); + } + + return NO_GEN_PAIR; + } + + private static final GenerationStrategyPair NO_GEN_PAIR = new GenerationStrategyPair(); + + private static void interpretPartialCompositeValueGeneration( + SessionFactoryImplementor sessionFactory, + Component composite, + CompositeGenerationStrategyPairBuilder builder) { + Iterator subProperties = composite.getPropertyIterator(); + while ( subProperties.hasNext() ) { + final Property subProperty = (Property) subProperties.next(); + builder.addPair( buildGenerationStrategyPair( sessionFactory, subProperty ) ); + } + } + + public static InDatabaseValueGenerationStrategyImpl create( + SessionFactoryImplementor sessionFactoryImplementor, + Property mappingProperty, + ValueGeneration valueGeneration) { + final int numberOfMappedColumns = mappingProperty.getType().getColumnSpan( sessionFactoryImplementor ); + if ( numberOfMappedColumns == 1 ) { + return new InDatabaseValueGenerationStrategyImpl( + valueGeneration.getGenerationTiming(), + valueGeneration.referenceColumnInSql(), + new String[] { valueGeneration.getDatabaseGeneratedReferencedColumnValue() } + + ); + } + else { + if ( valueGeneration.getDatabaseGeneratedReferencedColumnValue() != null ) { + LOG.debugf( + "Value generator specified column value in reference to multi-column attribute [%s -> %s]; ignoring", + mappingProperty.getPersistentClass(), + mappingProperty.getName() + ); + } + return new InDatabaseValueGenerationStrategyImpl( + valueGeneration.getGenerationTiming(), + valueGeneration.referenceColumnInSql(), + new String[numberOfMappedColumns] + ); + } + } + + public static class GenerationStrategyPair { + private final InMemoryValueGenerationStrategy inMemoryStrategy; + private final InDatabaseValueGenerationStrategy inDatabaseStrategy; + + public GenerationStrategyPair() { + this( NoInMemoryValueGenerationStrategy.INSTANCE, NoInDatabaseValueGenerationStrategy.INSTANCE ); + } + + public GenerationStrategyPair(FullInMemoryValueGenerationStrategy inMemoryStrategy) { + this( inMemoryStrategy, NoInDatabaseValueGenerationStrategy.INSTANCE ); + } + + public GenerationStrategyPair(InDatabaseValueGenerationStrategyImpl inDatabaseStrategy) { + this( NoInMemoryValueGenerationStrategy.INSTANCE, inDatabaseStrategy ); + } + + public GenerationStrategyPair( + InMemoryValueGenerationStrategy inMemoryStrategy, + InDatabaseValueGenerationStrategy inDatabaseStrategy) { + // perform some normalization. Also check that only one (if any) strategy is specified + if ( inMemoryStrategy == null ) { + inMemoryStrategy = NoInMemoryValueGenerationStrategy.INSTANCE; + } + if ( inDatabaseStrategy == null ) { + inDatabaseStrategy = NoInDatabaseValueGenerationStrategy.INSTANCE; + } + + if ( inMemoryStrategy.getGenerationTiming() != GenerationTiming.NEVER + && inDatabaseStrategy.getGenerationTiming() != GenerationTiming.NEVER ) { + throw new ValueGenerationStrategyException( + "in-memory and in-database value generation are mutually exclusive" + ); + } + + this.inMemoryStrategy = inMemoryStrategy; + this.inDatabaseStrategy = inDatabaseStrategy; + } + + public InMemoryValueGenerationStrategy getInMemoryStrategy() { + return inMemoryStrategy; + } + + public InDatabaseValueGenerationStrategy getInDatabaseStrategy() { + return inDatabaseStrategy; + } + } + + public static class ValueGenerationStrategyException extends HibernateException { + public ValueGenerationStrategyException(String message) { + super( message ); + } + + public ValueGenerationStrategyException(String message, Throwable cause) { + super( message, cause ); + } + } + + private static class CompositeGenerationStrategyPairBuilder { + private final Property mappingProperty; + + private boolean hadInMemoryGeneration; + private boolean hadInDatabaseGeneration; + + private List inMemoryStrategies; + private List inDatabaseStrategies; + + public CompositeGenerationStrategyPairBuilder(Property mappingProperty) { + this.mappingProperty = mappingProperty; + } + + public void addPair(GenerationStrategyPair generationStrategyPair) { + add( generationStrategyPair.getInMemoryStrategy() ); + add( generationStrategyPair.getInDatabaseStrategy() ); + } + + private void add(InMemoryValueGenerationStrategy inMemoryStrategy) { + if ( inMemoryStrategies == null ) { + inMemoryStrategies = new ArrayList(); + } + inMemoryStrategies.add( inMemoryStrategy ); + + if ( inMemoryStrategy.getGenerationTiming() != GenerationTiming.NEVER ) { + hadInMemoryGeneration = true; + } + } + + private void add(InDatabaseValueGenerationStrategy inDatabaseStrategy) { + if ( inDatabaseStrategies == null ) { + inDatabaseStrategies = new ArrayList(); + } + inDatabaseStrategies.add( inDatabaseStrategy ); + + if ( inDatabaseStrategy.getGenerationTiming() != GenerationTiming.NEVER ) { + hadInDatabaseGeneration = true; + } + } + + public GenerationStrategyPair buildPair() { + if ( hadInMemoryGeneration && hadInDatabaseGeneration ) { + throw new ValueGenerationStrategyException( + "Composite attribute [" + mappingProperty.getName() + "] contained both in-memory" + + " and in-database value generation" + ); + } + else if ( hadInMemoryGeneration ) { + throw new NotYetImplementedException( "Still need to wire in composite in-memory value generation" ); + + } + else if ( hadInDatabaseGeneration ) { + final Component composite = (Component) mappingProperty.getValue(); + + // we need the numbers to match up so we can properly handle 'referenced sql column values' + if ( inDatabaseStrategies.size() != composite.getPropertySpan() ) { + throw new ValueGenerationStrategyException( + "Internal error : mismatch between number of collected in-db generation strategies" + + " and number of attributes for composite attribute : " + mappingProperty.getName() + ); + } + + // the base-line values for the aggregated InDatabaseValueGenerationStrategy we will build here. + GenerationTiming timing = GenerationTiming.INSERT; + boolean referenceColumns = false; + String[] columnValues = new String[ composite.getColumnSpan() ]; + + // start building the aggregate values + int propertyIndex = -1; + int columnIndex = 0; + Iterator subProperties = composite.getPropertyIterator(); + while ( subProperties.hasNext() ) { + propertyIndex++; + final Property subProperty = (Property) subProperties.next(); + final InDatabaseValueGenerationStrategy subStrategy = inDatabaseStrategies.get( propertyIndex ); + + if ( subStrategy.getGenerationTiming() == GenerationTiming.ALWAYS ) { + // override the base-line to the more often "ALWAYS"... + timing = GenerationTiming.ALWAYS; + + } + if ( subStrategy.referenceColumnsInSql() ) { + // override base-line value + referenceColumns = true; + } + if ( subStrategy.getReferencedColumnValues() != null ) { + if ( subStrategy.getReferencedColumnValues().length != subProperty.getColumnSpan() ) { + throw new ValueGenerationStrategyException( + "Internal error : mismatch between number of collected 'referenced column values'" + + " and number of columns for composite attribute : " + mappingProperty.getName() + + '.' + subProperty.getName() + ); + } + System.arraycopy( + subStrategy.getReferencedColumnValues(), + 0, + columnValues, + columnIndex, + subProperty.getColumnSpan() + ); + } + } + + // then use the aggregated values to build the InDatabaseValueGenerationStrategy + return new GenerationStrategyPair( + new InDatabaseValueGenerationStrategyImpl( timing, referenceColumns, columnValues ) + ); + } + else { + return NO_GEN_PAIR; + } + } + } + + private static class NoInMemoryValueGenerationStrategy implements InMemoryValueGenerationStrategy { + /** + * Singleton access + */ + public static final NoInMemoryValueGenerationStrategy INSTANCE = new NoInMemoryValueGenerationStrategy(); + + @Override + public GenerationTiming getGenerationTiming() { + return GenerationTiming.NEVER; + } + + @Override + public ValueGenerator getValueGenerator() { + return null; + } + } + + private static class FullInMemoryValueGenerationStrategy implements InMemoryValueGenerationStrategy { + private final GenerationTiming timing; + private final ValueGenerator generator; + + private FullInMemoryValueGenerationStrategy(GenerationTiming timing, ValueGenerator generator) { + this.timing = timing; + this.generator = generator; + } + + public static FullInMemoryValueGenerationStrategy create(ValueGeneration valueGeneration) { + return new FullInMemoryValueGenerationStrategy( + valueGeneration.getGenerationTiming(), + valueGeneration.getValueGenerator() + ); + } + + @Override + public GenerationTiming getGenerationTiming() { + return timing; + } + + @Override + public ValueGenerator getValueGenerator() { + return generator; + } + } + + private static class NoInDatabaseValueGenerationStrategy implements InDatabaseValueGenerationStrategy { + /** + * Singleton access + */ + public static final NoInDatabaseValueGenerationStrategy INSTANCE = new NoInDatabaseValueGenerationStrategy(); + + @Override + public GenerationTiming getGenerationTiming() { + return GenerationTiming.NEVER; + } + + @Override + public boolean referenceColumnsInSql() { + return true; + } + + @Override + public String[] getReferencedColumnValues() { + return null; + } + } + + private static class InDatabaseValueGenerationStrategyImpl implements InDatabaseValueGenerationStrategy { + private final GenerationTiming timing; + private final boolean referenceColumnInSql; + private final String[] referencedColumnValues; + + private InDatabaseValueGenerationStrategyImpl( + GenerationTiming timing, + boolean referenceColumnInSql, + String[] referencedColumnValues) { + this.timing = timing; + this.referenceColumnInSql = referenceColumnInSql; + this.referencedColumnValues = referencedColumnValues; + } + + @Override + public GenerationTiming getGenerationTiming() { + return timing; + } + + @Override + public boolean referenceColumnsInSql() { + return referenceColumnInSql; + } + + @Override + public String[] getReferencedColumnValues() { + return referencedColumnValues; + } + } + + private ValueInclusion determineInsertValueGenerationType(Property mappingProperty, NonIdentifierAttribute runtimeProperty) { + if ( isInsertGenerated( runtimeProperty ) ) { return ValueInclusion.FULL; } else if ( mappingProperty.getValue() instanceof Component ) { @@ -337,24 +760,280 @@ return ValueInclusion.NONE; } + private boolean isInsertGenerated(NonIdentifierAttribute property) { + return property.getValueGenerationStrategy() != null + && property.getValueGenerationStrategy().getGenerationTiming() != GenerationTiming.NEVER; + } + + private boolean isInsertGenerated(Property property) { + return property.getValueGenerationStrategy() != null + && property.getValueGenerationStrategy().getGenerationTiming() != GenerationTiming.NEVER; + } + + public EntityMetamodel( + EntityBinding entityBinding, + AbstractEntityPersister persister, + SessionFactoryImplementor sessionFactory) { + this.sessionFactory = sessionFactory; + this.persister = persister; + + name = entityBinding.getEntity().getName(); + + rootName = entityBinding.getHierarchyDetails().getRootEntityBinding().getEntity().getName(); + entityType = sessionFactory.getTypeResolver().getTypeFactory().manyToOne( name ); + + identifierAttribute = PropertyFactory.buildIdentifierProperty( + entityBinding, + sessionFactory.getIdentifierGenerator( rootName ) + ); + + versioned = entityBinding.isVersioned(); + + boolean hasPojoRepresentation = false; + Class mappedClass = null; + Class proxyInterfaceClass = null; + if ( entityBinding.getEntity().getClassReferenceUnresolved() != null ) { + hasPojoRepresentation = true; + mappedClass = entityBinding.getEntity().getClassReference(); + proxyInterfaceClass = entityBinding.getProxyInterfaceType().getValue(); + } + instrumentationMetadata = Environment.getBytecodeProvider().getEntityInstrumentationMetadata( mappedClass ); + + boolean hasLazy = false; + + // TODO: Fix after HHH-6337 is fixed; for now assume entityBinding is the root binding + BasicAttributeBinding rootEntityIdentifier = entityBinding.getHierarchyDetails().getEntityIdentifier().getValueBinding(); + // entityBinding.getAttributeClosureSpan() includes the identifier binding; + // "properties" here excludes the ID, so subtract 1 if the identifier binding is non-null + propertySpan = rootEntityIdentifier == null ? + entityBinding.getAttributeBindingClosureSpan() : + entityBinding.getAttributeBindingClosureSpan() - 1; + + properties = new NonIdentifierAttribute[propertySpan]; + List naturalIdNumbers = new ArrayList(); + // temporary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + propertyNames = new String[propertySpan]; + propertyTypes = new Type[propertySpan]; + propertyUpdateability = new boolean[propertySpan]; + propertyInsertability = new boolean[propertySpan]; + nonlazyPropertyUpdateability = new boolean[propertySpan]; + propertyCheckability = new boolean[propertySpan]; + propertyNullability = new boolean[propertySpan]; + propertyVersionability = new boolean[propertySpan]; + propertyLaziness = new boolean[propertySpan]; + cascadeStyles = new CascadeStyle[propertySpan]; + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + // todo : handle value generations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + this.hasPreInsertGeneratedValues = false; + this.hasPreUpdateGeneratedValues = false; + this.hasInsertGeneratedValues = false; + this.hasUpdateGeneratedValues = false; + this.inMemoryValueGenerationStrategies = new InMemoryValueGenerationStrategy[propertySpan]; + Arrays.fill( this.inMemoryValueGenerationStrategies, NoInMemoryValueGenerationStrategy.INSTANCE ); + this.inDatabaseValueGenerationStrategies = new InDatabaseValueGenerationStrategy[propertySpan]; + Arrays.fill( this.inDatabaseValueGenerationStrategies, NoInDatabaseValueGenerationStrategy.INSTANCE ); + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + int i = 0; + int tempVersionProperty = NO_VERSION_INDX; + boolean foundCascade = false; + boolean foundCollection = false; + boolean foundMutable = false; + boolean foundNonIdentifierPropertyNamedId = false; + boolean foundInsertGeneratedValue = false; + boolean foundUpdateGeneratedValue = false; + boolean foundUpdateableNaturalIdProperty = false; + + for ( AttributeBinding attributeBinding : entityBinding.getAttributeBindingClosure() ) { + if ( attributeBinding == rootEntityIdentifier ) { + // skip the identifier attribute binding + continue; + } + + if ( attributeBinding == entityBinding.getHierarchyDetails().getVersioningAttributeBinding() ) { + tempVersionProperty = i; + properties[i] = PropertyFactory.buildVersionProperty( + persister, + entityBinding.getHierarchyDetails().getVersioningAttributeBinding(), + instrumentationMetadata.isInstrumented() + ); + } + else { + properties[i] = PropertyFactory.buildStandardProperty( attributeBinding, instrumentationMetadata.isInstrumented() ); + } + + // TODO: fix when natural IDs are added (HHH-6354) + //if ( attributeBinding.isNaturalIdentifier() ) { + // naturalIdNumbers.add( i ); + // if ( attributeBinding.isUpdateable() ) { + // foundUpdateableNaturalIdProperty = true; + // } + //} + + if ( "id".equals( attributeBinding.getAttribute().getName() ) ) { + foundNonIdentifierPropertyNamedId = true; + } + + // temporary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + boolean lazy = attributeBinding.isLazy() && instrumentationMetadata.isInstrumented(); + if ( lazy ) hasLazy = true; + propertyLaziness[i] = lazy; + + propertyNames[i] = properties[i].getName(); + propertyTypes[i] = properties[i].getType(); + propertyNullability[i] = properties[i].isNullable(); + propertyUpdateability[i] = properties[i].isUpdateable(); + propertyInsertability[i] = properties[i].isInsertable(); + propertyVersionability[i] = properties[i].isVersionable(); + nonlazyPropertyUpdateability[i] = properties[i].isUpdateable() && !lazy; + propertyCheckability[i] = propertyUpdateability[i] || + ( propertyTypes[i].isAssociationType() && ( (AssociationType) propertyTypes[i] ).isAlwaysDirtyChecked() ); + + cascadeStyles[i] = properties[i].getCascadeStyle(); + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + if ( properties[i].isLazy() ) { + hasLazy = true; + } + + if ( properties[i].getCascadeStyle() != CascadeStyles.NONE ) { + foundCascade = true; + } + + if ( indicatesCollection( properties[i].getType() ) ) { + foundCollection = true; + } + + if ( propertyTypes[i].isMutable() && propertyCheckability[i] ) { + foundMutable = true; + } + + mapPropertyToIndex(attributeBinding.getAttribute(), i); + i++; + } + + if (naturalIdNumbers.size()==0) { + naturalIdPropertyNumbers = null; + hasImmutableNaturalId = false; + hasCacheableNaturalId = false; + } + else { + naturalIdPropertyNumbers = ArrayHelper.toIntArray(naturalIdNumbers); + hasImmutableNaturalId = !foundUpdateableNaturalIdProperty; + hasCacheableNaturalId = false; //See previous TODO and HHH-6354 + } + + hasCascades = foundCascade; + hasNonIdentifierPropertyNamedId = foundNonIdentifierPropertyNamedId; + versionPropertyIndex = tempVersionProperty; + hasLazyProperties = hasLazy; + if (hasLazyProperties) { + LOG.lazyPropertyFetchingAvailable( name ); + } + + lazy = entityBinding.isLazy() && ( + // TODO: this disables laziness even in non-pojo entity modes: + ! hasPojoRepresentation || + ! ReflectHelper.isFinalClass( proxyInterfaceClass ) + ); + mutable = entityBinding.isMutable(); + if ( entityBinding.isAbstract() == null ) { + // legacy behavior (with no abstract attribute specified) + isAbstract = hasPojoRepresentation && + ReflectHelper.isAbstractClass( mappedClass ); + } + else { + isAbstract = entityBinding.isAbstract().booleanValue(); + if ( !isAbstract && hasPojoRepresentation && + ReflectHelper.isAbstractClass( mappedClass ) ) { + LOG.entityMappedAsNonAbstract(name); + } + } + selectBeforeUpdate = entityBinding.isSelectBeforeUpdate(); + dynamicUpdate = entityBinding.isDynamicUpdate(); + dynamicInsert = entityBinding.isDynamicInsert(); + + hasSubclasses = entityBinding.hasSubEntityBindings(); + polymorphic = entityBinding.isPolymorphic(); + + explicitPolymorphism = entityBinding.getHierarchyDetails().isExplicitPolymorphism(); + inherited = ! entityBinding.isRoot(); + superclass = inherited ? + entityBinding.getEntity().getSuperType().getName() : + null; + + optimisticLockStyle = entityBinding.getHierarchyDetails().getOptimisticLockStyle(); + final boolean isAllOrDirty = + optimisticLockStyle == OptimisticLockStyle.ALL + || optimisticLockStyle == OptimisticLockStyle.DIRTY; + if ( isAllOrDirty && !dynamicUpdate ) { + throw new MappingException( "optimistic-lock=all|dirty requires dynamic-update=\"true\": " + name ); + } + if ( versionPropertyIndex != NO_VERSION_INDX && isAllOrDirty ) { + throw new MappingException( "version and optimistic-lock=all|dirty are not a valid combination : " + name ); + } + + hasCollections = foundCollection; + hasMutableProperties = foundMutable; + + for ( EntityBinding subEntityBinding : entityBinding.getPostOrderSubEntityBindingClosure() ) { + subclassEntityNames.add( subEntityBinding.getEntity().getName() ); + if ( subEntityBinding.getEntity().getClassReference() != null ) { + entityNameByInheritenceClassMap.put( + subEntityBinding.getEntity().getClassReference(), + subEntityBinding.getEntity().getName() ); + } + } + subclassEntityNames.add( name ); + if ( mappedClass != null ) { + entityNameByInheritenceClassMap.put( mappedClass, name ); + } + + entityMode = hasPojoRepresentation ? EntityMode.POJO : EntityMode.MAP; + final EntityTuplizerFactory entityTuplizerFactory = sessionFactory.getSettings().getEntityTuplizerFactory(); + Class tuplizerClass = entityBinding.getCustomEntityTuplizerClass(); + + if ( tuplizerClass == null ) { + entityTuplizer = entityTuplizerFactory.constructDefaultTuplizer( entityMode, this, entityBinding ); + } + else { + entityTuplizer = entityTuplizerFactory.constructTuplizer( tuplizerClass, this, entityBinding ); + } + } + + private ValueInclusion determineInsertValueGenerationType(AttributeBinding mappingProperty, NonIdentifierAttribute runtimeProperty) { + if ( isInsertGenerated( runtimeProperty ) ) { + return ValueInclusion.FULL; + } + // TODO: fix the following when components are working (HHH-6173) + //else if ( mappingProperty.getValue() instanceof ComponentAttributeBinding ) { + // if ( hasPartialInsertComponentGeneration( ( ComponentAttributeBinding ) mappingProperty.getValue() ) ) { + // return ValueInclusion.PARTIAL; + // } + //} + return ValueInclusion.NONE; + } + private boolean hasPartialInsertComponentGeneration(Component component) { Iterator subProperties = component.getPropertyIterator(); while ( subProperties.hasNext() ) { - Property prop = ( Property ) subProperties.next(); - if ( prop.getGeneration() == PropertyGeneration.ALWAYS || prop.getGeneration() == PropertyGeneration.INSERT ) { + final Property prop = ( Property ) subProperties.next(); + if ( isInsertGenerated( prop ) ) { return true; } else if ( prop.getValue() instanceof Component ) { - if ( hasPartialInsertComponentGeneration( ( Component ) prop.getValue() ) ) { + if ( hasPartialInsertComponentGeneration( (Component) prop.getValue() ) ) { return true; } } } return false; } - private ValueInclusion determineUpdateValueGenerationType(Property mappingProperty, StandardProperty runtimeProperty) { - if ( runtimeProperty.isUpdateGenerated() ) { + private ValueInclusion determineUpdateValueGenerationType(Property mappingProperty, NonIdentifierAttribute runtimeProperty) { + if ( isUpdateGenerated( runtimeProperty ) ) { return ValueInclusion.FULL; } else if ( mappingProperty.getValue() instanceof Component ) { @@ -365,11 +1044,34 @@ return ValueInclusion.NONE; } + private static boolean isUpdateGenerated(Property property) { + return property.getValueGenerationStrategy() != null + && property.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.ALWAYS; + } + + private static boolean isUpdateGenerated(NonIdentifierAttribute property) { + return property.getValueGenerationStrategy() != null + && property.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.ALWAYS; + } + + private ValueInclusion determineUpdateValueGenerationType(AttributeBinding mappingProperty, NonIdentifierAttribute runtimeProperty) { + if ( isUpdateGenerated( runtimeProperty ) ) { + return ValueInclusion.FULL; + } + // TODO: fix the following when components are working (HHH-6173) + //else if ( mappingProperty.getValue() instanceof ComponentAttributeBinding ) { + // if ( hasPartialUpdateComponentGeneration( ( ComponentAttributeBinding ) mappingProperty.getValue() ) ) { + // return ValueInclusion.PARTIAL; + // } + //} + return ValueInclusion.NONE; + } + private boolean hasPartialUpdateComponentGeneration(Component component) { Iterator subProperties = component.getPropertyIterator(); while ( subProperties.hasNext() ) { - Property prop = ( Property ) subProperties.next(); - if ( prop.getGeneration() == PropertyGeneration.ALWAYS ) { + Property prop = (Property) subProperties.next(); + if ( isUpdateGenerated( prop ) ) { return true; } else if ( prop.getValue() instanceof Component ) { @@ -382,26 +1084,66 @@ } private void mapPropertyToIndex(Property prop, int i) { - propertyIndexes.put( prop.getName(), new Integer(i) ); + propertyIndexes.put( prop.getName(), i ); if ( prop.getValue() instanceof Component ) { Iterator iter = ( (Component) prop.getValue() ).getPropertyIterator(); while ( iter.hasNext() ) { Property subprop = (Property) iter.next(); propertyIndexes.put( prop.getName() + '.' + subprop.getName(), - new Integer(i) + i ); } } } + private void mapPropertyToIndex(Attribute attribute, int i) { + propertyIndexes.put( attribute.getName(), i ); + if ( attribute.isSingular() && + ( ( SingularAttribute ) attribute ).getSingularAttributeType().isComponent() ) { + org.hibernate.metamodel.domain.Component component = + ( org.hibernate.metamodel.domain.Component ) ( ( SingularAttribute ) attribute ).getSingularAttributeType(); + for ( Attribute subAttribute : component.attributes() ) { + propertyIndexes.put( + attribute.getName() + '.' + subAttribute.getName(), + i + ); + } + } + } + + public EntityTuplizer getTuplizer() { + return entityTuplizer; + } + + public boolean isNaturalIdentifierInsertGenerated() { + // the intention is for this call to replace the usage of the old ValueInclusion stuff (as exposed from + // persister) in SelectGenerator to determine if it is safe to use the natural identifier to find the + // insert-generated identifier. That wont work if the natural-id is also insert-generated. + // + // Assumptions: + // * That code checks that there is a natural identifier before making this call, so we assume the same here + // * That code assumes a non-composite natural-id, so we assume the same here + final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ naturalIdPropertyNumbers[0] ]; + return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER; + } + + public boolean isVersionGenerated() { + final InDatabaseValueGenerationStrategy strategy = inDatabaseValueGenerationStrategies[ versionPropertyIndex ]; + return strategy != null && strategy.getGenerationTiming() != GenerationTiming.NEVER; + } + public int[] getNaturalIdentifierProperties() { return naturalIdPropertyNumbers; } public boolean hasNaturalIdentifier() { return naturalIdPropertyNumbers!=null; } + + public boolean isNaturalIdentifierCached() { + return hasNaturalIdentifier() && hasCacheableNaturalId; + } public boolean hasImmutableNaturalId() { return hasImmutableNaturalId; @@ -416,7 +1158,7 @@ return true; } else if ( type.isComponentType() ) { - Type[] subtypes = ( ( AbstractComponentType ) type ).getSubtypes(); + Type[] subtypes = ( (CompositeType) type ).getSubtypes(); for ( int i = 0; i < subtypes.length; i++ ) { if ( indicatesCollection( subtypes[i] ) ) { return true; @@ -443,7 +1185,7 @@ } public IdentifierProperty getIdentifierProperty() { - return identifierProperty; + return identifierAttribute; } public int getPropertySpan() { @@ -463,7 +1205,7 @@ } } - public StandardProperty[] getProperties() { + public NonIdentifierAttribute[] getProperties() { return properties; } @@ -472,11 +1214,11 @@ if ( index == null ) { throw new HibernateException("Unable to resolve property: " + propertyName); } - return index.intValue(); + return index; } public Integer getPropertyIndexOrNull(String propertyName) { - return (Integer) propertyIndexes.get( propertyName ); + return propertyIndexes.get( propertyName ); } public boolean hasCollections() { @@ -515,8 +1257,8 @@ return dynamicInsert; } - public int getOptimisticLockMode() { - return optimisticLockMode; + public OptimisticLockStyle getOptimisticLockStyle() { + return optimisticLockStyle; } public boolean isPolymorphic() { @@ -555,7 +1297,18 @@ return isAbstract; } - public String toString() { + /** + * Return the entity-name mapped to the given class within our inheritance hierarchy, if any. + * + * @param inheritenceClass The class for which to resolve the entity-name. + * @return The mapped entity-name, or null if no such mapping was found. + */ + public String findEntityNameByEntityClass(Class inheritenceClass) { + return ( String ) entityNameByInheritenceClassMap.get( inheritenceClass ); + } + + @Override + public String toString() { return "EntityMetamodel(" + name + ':' + ArrayHelper.toString(properties) + ')'; } @@ -588,14 +1341,6 @@ return propertyInsertability; } - public ValueInclusion[] getPropertyInsertGenerationInclusions() { - return insertInclusions; - } - - public ValueInclusion[] getPropertyUpdateGenerationInclusions() { - return updateInclusions; - } - public boolean[] getPropertyNullability() { return propertyNullability; } @@ -608,6 +1353,14 @@ return cascadeStyles; } + public boolean hasPreInsertGeneratedValues() { + return hasPreInsertGeneratedValues; + } + + public boolean hasPreUpdateGeneratedValues() { + return hasPreUpdateGeneratedValues; + } + public boolean hasInsertGeneratedValues() { return hasInsertGeneratedValues; } @@ -616,5 +1369,26 @@ return hasUpdateGeneratedValues; } - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + public InMemoryValueGenerationStrategy[] getInMemoryValueGenerationStrategies() { + return inMemoryValueGenerationStrategies; + } + + public InDatabaseValueGenerationStrategy[] getInDatabaseValueGenerationStrategies() { + return inDatabaseValueGenerationStrategies; + } + + public EntityMode getEntityMode() { + return entityMode; + } + + /** + * Whether or not this class can be lazy (ie intercepted) + */ + public boolean isInstrumented() { + return instrumentationMetadata.isInstrumented(); + } + + public EntityInstrumentationMetadata getInstrumentationMetadata() { + return instrumentationMetadata; + } } Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/EntityTuplizer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/EntityTuplizer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/EntityTuplizer.java 17 Aug 2012 14:36:52 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/EntityTuplizer.java 30 Jul 2014 15:52:26 -0000 1.1.2.1 @@ -23,71 +23,136 @@ * */ package org.hibernate.tuple.entity; - import java.io.Serializable; import java.util.Map; +import org.hibernate.EntityMode; +import org.hibernate.EntityNameResolver; import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.property.Getter; import org.hibernate.tuple.Tuplizer; -import org.hibernate.engine.SessionImplementor; /** * Defines further responsibilities reagarding tuplization based on * a mapped entity. *

- * EntityTuplizer implementations should have the following constructor signature: + * EntityTuplizer implementations should have the following constructor signatures: * (org.hibernate.tuple.entity.EntityMetamodel, org.hibernate.mapping.PersistentClass) + * (org.hibernate.tuple.entity.EntityMetamodel, org.hibernate.metamodel.binding.EntityBinding) * * @author Gavin King * @author Steve Ebersole */ public interface EntityTuplizer extends Tuplizer { + /** + * Return the entity-mode handled by this tuplizer instance. + * + * @return The entity-mode + */ + public EntityMode getEntityMode(); /** * Create an entity instance initialized with the given identifier. * * @param id The identifier value for the entity to be instantiated. * @return The instantiated entity. * @throws HibernateException + * + * @deprecated Use {@link #instantiate(Serializable, SessionImplementor)} instead. */ + @SuppressWarnings( {"JavaDoc"}) public Object instantiate(Serializable id) throws HibernateException; /** + * Create an entity instance initialized with the given identifier. + * + * @param id The identifier value for the entity to be instantiated. + * @param session The session from which is requests originates + * + * @return The instantiated entity. + */ + public Object instantiate(Serializable id, SessionImplementor session); + + /** * Extract the identifier value from the given entity. * * @param entity The entity from which to extract the identifier value. + * * @return The identifier value. + * * @throws HibernateException If the entity does not define an identifier property, or an - * error occurrs accessing its value. + * error occurs accessing its value. + * + * @deprecated Use {@link #getIdentifier(Object,SessionImplementor)} instead. */ public Serializable getIdentifier(Object entity) throws HibernateException; /** + * Extract the identifier value from the given entity. + * + * @param entity The entity from which to extract the identifier value. + * @param session The session from which is requests originates + * + * @return The identifier value. + */ + public Serializable getIdentifier(Object entity, SessionImplementor session); + + /** * Inject the identifier value into the given entity. *

* Has no effect if the entity does not define an identifier property * * @param entity The entity to inject with the identifier value. * @param id The value to be injected as the identifier. - * @throws HibernateException + * + * @deprecated Use {@link #setIdentifier(Object, Serializable, SessionImplementor)} instead. */ + @SuppressWarnings( {"JavaDoc"}) public void setIdentifier(Object entity, Serializable id) throws HibernateException; + /** + * Inject the identifier value into the given entity. + *

+ * Has no effect if the entity does not define an identifier property + * + * @param entity The entity to inject with the identifier value. + * @param id The value to be injected as the identifier. + * @param session The session from which is requests originates + */ + public void setIdentifier(Object entity, Serializable id, SessionImplementor session); + /** * Inject the given identifier and version into the entity, in order to * "roll back" to their original values. * + * @param entity The entity for which to reset the id/version values * @param currentId The identifier value to inject into the entity. * @param currentVersion The version value to inject into the entity. + * + * @deprecated Use {@link #resetIdentifier(Object, Serializable, Object, SessionImplementor)} instead */ + @SuppressWarnings( {"UnusedDeclaration"}) public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion); + /** + * Inject the given identifier and version into the entity, in order to + * "roll back" to their original values. + * + * @param entity The entity for which to reset the id/version values + * @param currentId The identifier value to inject into the entity. + * @param currentVersion The version value to inject into the entity. + * @param session The session from which the request originated + */ + public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, SessionImplementor session); + /** * Extract the value of the version property from the given entity. * * @param entity The entity from which to extract the version value. * @return The value of the version property, or null if not versioned. - * @throws HibernateException + * @throws HibernateException Indicates a problem accessing the version property */ public Object getVersion(Object entity) throws HibernateException; @@ -97,7 +162,7 @@ * @param entity The entity into which to inject the value. * @param i The property's index. * @param value The property value to inject. - * @throws HibernateException + * @throws HibernateException Indicates a problem access the property */ public void setPropertyValue(Object entity, int i, Object value) throws HibernateException; @@ -107,7 +172,7 @@ * @param entity The entity into which to inject the value. * @param propertyName The name of the property. * @param value The property value to inject. - * @throws HibernateException + * @throws HibernateException Indicates a problem access the property */ public void setPropertyValue(Object entity, String propertyName, Object value) throws HibernateException; @@ -118,7 +183,7 @@ * @param mergeMap a map of instances being merged to merged instances * @param session The session in which the resuest is being made. * @return The insertable property values. - * @throws HibernateException + * @throws HibernateException Indicates a problem access the properties */ public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) throws HibernateException; @@ -129,7 +194,7 @@ * @param entity The entity from which to extract the property value. * @param propertyName The name of the property for which to extract the value. * @return The current value of the given property on the given entity. - * @throws HibernateException + * @throws HibernateException Indicates a problem access the property */ public Object getPropertyValue(Object entity, String propertyName) throws HibernateException; @@ -169,18 +234,10 @@ public boolean isLifecycleImplementor(); /** - * Does the {@link #getMappedClass() class} managed by this tuplizer implement - * the {@link org.hibernate.classic.Validatable} interface. - * - * @return True if the Validatable interface is implemented; false otherwise. - */ - public boolean isValidatableImplementor(); - - // TODO: getConcreteProxyClass() is solely used (externally) to perform narrowProxy() - // would be great to fully encapsulate that narrowProxy() functionality within the - // Tuplizer, itself, with a Tuplizer.narrowProxy(..., PersistentContext) method - /** * Returns the java class to which generated proxies will be typed. + *

+ * todo : look at fully encapsulating {@link org.hibernate.engine.spi.PersistenceContext#narrowProxy} here, + * since that is the only external use of this method * * @return The java class to which generated proxies will be typed */ @@ -196,6 +253,53 @@ /** * Is it an instrumented POJO? + * + * @return {@code true} if the entity class is instrumented; {@code false} otherwise. */ public boolean isInstrumented(); + + /** + * Get any {@link EntityNameResolver EntityNameResolvers} associated with this {@link Tuplizer}. + * + * @return The associated resolvers. May be null or empty. + */ + public EntityNameResolver[] getEntityNameResolvers(); + + /** + * Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it. + * This is called in situations where we already know an entity name for the given entityInstance; we are being + * asked to determine if there is a more appropriate entity-name to use, specifically within an inheritence + * hierarchy. + *

+ * For example, consider a case where a user calls session.update( "Animal", cat );. Here, the + * user has explicitly provided Animal as the entity-name. However, they have passed in an instance + * of Cat which is a subclass of Animal. In this case, we would return Cat as the + * entity-name. + *

+ * null may be returned from calls to this method. The meaining of null in that case is assumed + * to be that we should use whatever explicit entity-name the user provided (Animal rather than Cat + * in the example above). + * + * @param entityInstance The entity instance. + * @param factory Reference to the SessionFactory. + * + * @return The most appropriate entity name to use. + * + * @throws HibernateException If we are unable to determine an entity-name within the inheritence hierarchy. + */ + public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory); + + /** + * Retrieve the getter for the identifier property. May return null. + * + * @return The getter for the identifier property. + */ + public Getter getIdentifierGetter(); + + /** + * Retrieve the getter for the version property. May return null. + * + * @return The getter for the version property. + */ + public Getter getVersionGetter(); } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/EntityTuplizerFactory.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/NonPojoInstrumentationMetadata.java'. Fisheye: No comparison available. Pass `N' to diff? Index: 3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/PojoEntityTuplizer.java =================================================================== RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/PojoEntityTuplizer.java,v diff -u -r1.1 -r1.1.2.1 --- 3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/PojoEntityTuplizer.java 17 Aug 2012 14:36:52 -0000 1.1 +++ 3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/PojoEntityTuplizer.java 30 Jul 2014 15:52:27 -0000 1.1.2.1 @@ -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.tuple.entity; @@ -31,29 +30,35 @@ import java.util.Map; import java.util.Set; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.hibernate.EntityMode; +import org.hibernate.EntityNameResolver; import org.hibernate.HibernateException; import org.hibernate.MappingException; -import org.hibernate.tuple.Instantiator; -import org.hibernate.tuple.PojoInstantiator; -import org.hibernate.bytecode.ReflectionOptimizer; +import org.hibernate.PropertyNotFoundException; +import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper; +import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor; +import org.hibernate.bytecode.spi.ReflectionOptimizer; import org.hibernate.cfg.Environment; import org.hibernate.classic.Lifecycle; -import org.hibernate.classic.Validatable; -import org.hibernate.engine.SessionImplementor; -import org.hibernate.intercept.FieldInterceptor; -import org.hibernate.intercept.FieldInterceptionHelper; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.internal.CoreLogging; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.ReflectHelper; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.Subclass; +import org.hibernate.metamodel.binding.AttributeBinding; +import org.hibernate.metamodel.binding.EntityBinding; import org.hibernate.property.Getter; +import org.hibernate.property.PropertyAccessor; +import org.hibernate.property.PropertyAccessorFactory; import org.hibernate.property.Setter; import org.hibernate.proxy.HibernateProxy; import org.hibernate.proxy.ProxyFactory; -import org.hibernate.type.AbstractComponentType; -import org.hibernate.util.ReflectHelper; +import org.hibernate.tuple.Instantiator; +import org.hibernate.tuple.PojoInstantiator; +import org.hibernate.type.CompositeType; /** * An {@link EntityTuplizer} specific to the pojo entity mode. @@ -62,22 +67,21 @@ * @author Gavin King */ public class PojoEntityTuplizer extends AbstractEntityTuplizer { + private static final CoreMessageLogger LOG = CoreLogging.messageLogger( PojoEntityTuplizer.class ); - static final Logger log = LoggerFactory.getLogger( PojoEntityTuplizer.class ); - private final Class mappedClass; private final Class proxyInterface; private final boolean lifecycleImplementor; - private final boolean validatableImplementor; private final Set lazyPropertyNames = new HashSet(); - private ReflectionOptimizer optimizer; + private final ReflectionOptimizer optimizer; + private final boolean isInstrumented; public PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) { super( entityMetamodel, mappedEntity ); this.mappedClass = mappedEntity.getMappedClass(); this.proxyInterface = mappedEntity.getProxyInterface(); this.lifecycleImplementor = Lifecycle.class.isAssignableFrom( mappedClass ); - this.validatableImplementor = Validatable.class.isAssignableFrom( mappedClass ); + this.isInstrumented = entityMetamodel.isInstrumented(); Iterator iter = mappedEntity.getPropertyClosureIterator(); while ( iter.hasNext() ) { @@ -106,24 +110,66 @@ // mappedClass, getterNames, setterNames, propTypes // ); } - + } - protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) { + public PojoEntityTuplizer(EntityMetamodel entityMetamodel, EntityBinding mappedEntity) { + super( entityMetamodel, mappedEntity ); + this.mappedClass = mappedEntity.getEntity().getClassReference(); + this.proxyInterface = mappedEntity.getProxyInterfaceType().getValue(); + this.lifecycleImplementor = Lifecycle.class.isAssignableFrom( mappedClass ); + this.isInstrumented = entityMetamodel.isInstrumented(); + + for ( AttributeBinding property : mappedEntity.getAttributeBindingClosure() ) { + if ( property.isLazy() ) { + lazyPropertyNames.add( property.getAttribute().getName() ); + } + } + + String[] getterNames = new String[propertySpan]; + String[] setterNames = new String[propertySpan]; + Class[] propTypes = new Class[propertySpan]; + for ( int i = 0; i < propertySpan; i++ ) { + getterNames[i] = getters[ i ].getMethodName(); + setterNames[i] = setters[ i ].getMethodName(); + propTypes[i] = getters[ i ].getReturnType(); + } + + if ( hasCustomAccessors || ! Environment.useReflectionOptimizer() ) { + optimizer = null; + } + else { + // todo : YUCK!!! + optimizer = Environment.getBytecodeProvider().getReflectionOptimizer( + mappedClass, getterNames, setterNames, propTypes + ); +// optimizer = getFactory().getSettings().getBytecodeProvider().getReflectionOptimizer( +// mappedClass, getterNames, setterNames, propTypes +// ); + } + } + + @Override + protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) { // determine the id getter and setter methods from the proxy interface (if any) // determine all interfaces needed by the resulting proxy - HashSet proxyInterfaces = new HashSet(); - proxyInterfaces.add( HibernateProxy.class ); + /* + * We need to preserve the order of the interfaces they were put into the set, since javassist will choose the + * first one's class-loader to construct the proxy class with. This is also the reason why HibernateProxy.class + * should be the last one in the order (on JBossAS7 its class-loader will be org.hibernate module's class- + * loader, which will not see the classes inside deployed apps. See HHH-3078 + */ + Set proxyInterfaces = new java.util.LinkedHashSet(); + Class mappedClass = persistentClass.getMappedClass(); Class proxyInterface = persistentClass.getProxyInterface(); if ( proxyInterface!=null && !mappedClass.equals( proxyInterface ) ) { if ( !proxyInterface.isInterface() ) { throw new MappingException( - "proxy must be either an interface, or the class itself: " + - getEntityName() - ); + "proxy must be either an interface, or the class itself: " + getEntityName() + ); } proxyInterfaces.add( proxyInterface ); } @@ -132,49 +178,44 @@ proxyInterfaces.add( mappedClass ); } - Iterator iter = persistentClass.getSubclassIterator(); - while ( iter.hasNext() ) { - Subclass subclass = ( Subclass ) iter.next(); - Class subclassProxy = subclass.getProxyInterface(); - Class subclassClass = subclass.getMappedClass(); + Iterator subclasses = persistentClass.getSubclassIterator(); + while ( subclasses.hasNext() ) { + final Subclass subclass = ( Subclass ) subclasses.next(); + final Class subclassProxy = subclass.getProxyInterface(); + final Class subclassClass = subclass.getMappedClass(); if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) { - if ( !proxyInterface.isInterface() ) { + if ( !subclassProxy.isInterface() ) { throw new MappingException( - "proxy must be either an interface, or the class itself: " + - subclass.getEntityName() + "proxy must be either an interface, or the class itself: " + subclass.getEntityName() ); } proxyInterfaces.add( subclassProxy ); } } + proxyInterfaces.add( HibernateProxy.class ); + Iterator properties = persistentClass.getPropertyIterator(); Class clazz = persistentClass.getMappedClass(); while ( properties.hasNext() ) { Property property = (Property) properties.next(); Method method = property.getGetter(clazz).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { - log.error( - "Getters of lazy classes cannot be final: " + persistentClass.getEntityName() + - "." + property.getName() - ); + LOG.gettersOfLazyClassesCannotBeFinal(persistentClass.getEntityName(), property.getName()); } method = property.getSetter(clazz).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { - log.error( - "Setters of lazy classes cannot be final: " + persistentClass.getEntityName() + - "." + property.getName() - ); + LOG.settersOfLazyClassesCannotBeFinal(persistentClass.getEntityName(), property.getName()); } } Method idGetterMethod = idGetter==null ? null : idGetter.getMethod(); Method idSetterMethod = idSetter==null ? null : idSetter.getMethod(); - Method proxyGetIdentifierMethod = idGetterMethod==null || proxyInterface==null ? + Method proxyGetIdentifierMethod = idGetterMethod==null || proxyInterface==null ? null : ReflectHelper.getMethod(proxyInterface, idGetterMethod); - Method proxySetIdentifierMethod = idSetterMethod==null || proxyInterface==null ? + Method proxySetIdentifierMethod = idSetterMethod==null || proxyInterface==null ? null : ReflectHelper.getMethod(proxyInterface, idSetterMethod); @@ -187,24 +228,25 @@ proxyGetIdentifierMethod, proxySetIdentifierMethod, persistentClass.hasEmbeddedIdentifier() ? - (AbstractComponentType) persistentClass.getIdentifier().getType() : + (CompositeType) persistentClass.getIdentifier().getType() : null ); } catch ( HibernateException he ) { - log.warn( "could not create proxy factory for:" + getEntityName(), he ); + LOG.unableToCreateProxyFactory(getEntityName(), he); pf = null; } return pf; } protected ProxyFactory buildProxyFactoryInternal(PersistentClass persistentClass, Getter idGetter, Setter idSetter) { - // TODO : YUCK!!! finx after HHH-1907 is complete + // TODO : YUCK!!! fix after HHH-1907 is complete return Environment.getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory(); // return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory(); } - protected Instantiator buildInstantiator(PersistentClass persistentClass) { + @Override + protected Instantiator buildInstantiator(PersistentClass persistentClass) { if ( optimizer == null ) { return new PojoInstantiator( persistentClass, null ); } @@ -213,7 +255,106 @@ } } - public void setPropertyValues(Object entity, Object[] values) throws HibernateException { + @Override + protected ProxyFactory buildProxyFactory(EntityBinding entityBinding, Getter idGetter, Setter idSetter) { + // determine the id getter and setter methods from the proxy interface (if any) + // determine all interfaces needed by the resulting proxy + HashSet proxyInterfaces = new HashSet(); + proxyInterfaces.add( HibernateProxy.class ); + + Class mappedClass = entityBinding.getEntity().getClassReference(); + Class proxyInterface = entityBinding.getProxyInterfaceType().getValue(); + + if ( proxyInterface!=null && !mappedClass.equals( proxyInterface ) ) { + if ( ! proxyInterface.isInterface() ) { + throw new MappingException( + "proxy must be either an interface, or the class itself: " + getEntityName() + ); + } + proxyInterfaces.add( proxyInterface ); + } + + if ( mappedClass.isInterface() ) { + proxyInterfaces.add( mappedClass ); + } + + for ( EntityBinding subEntityBinding : entityBinding.getPostOrderSubEntityBindingClosure() ) { + final Class subclassProxy = subEntityBinding.getProxyInterfaceType().getValue(); + final Class subclassClass = subEntityBinding.getClassReference(); + if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) { + if ( ! subclassProxy.isInterface() ) { + throw new MappingException( + "proxy must be either an interface, or the class itself: " + subEntityBinding.getEntity().getName() + ); + } + proxyInterfaces.add( subclassProxy ); + } + } + + for ( AttributeBinding property : entityBinding.attributeBindings() ) { + Method method = getGetter( property ).getMethod(); + if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { + LOG.gettersOfLazyClassesCannotBeFinal(entityBinding.getEntity().getName(), property.getAttribute().getName()); + } + method = getSetter( property ).getMethod(); + if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { + LOG.settersOfLazyClassesCannotBeFinal(entityBinding.getEntity().getName(), property.getAttribute().getName()); + } + } + + Method idGetterMethod = idGetter==null ? null : idGetter.getMethod(); + Method idSetterMethod = idSetter==null ? null : idSetter.getMethod(); + + Method proxyGetIdentifierMethod = idGetterMethod==null || proxyInterface==null ? + null : + ReflectHelper.getMethod(proxyInterface, idGetterMethod); + Method proxySetIdentifierMethod = idSetterMethod==null || proxyInterface==null ? + null : + ReflectHelper.getMethod(proxyInterface, idSetterMethod); + + ProxyFactory pf = buildProxyFactoryInternal( entityBinding, idGetter, idSetter ); + try { + pf.postInstantiate( + getEntityName(), + mappedClass, + proxyInterfaces, + proxyGetIdentifierMethod, + proxySetIdentifierMethod, + entityBinding.getHierarchyDetails().getEntityIdentifier().isEmbedded() + ? ( CompositeType ) entityBinding + .getHierarchyDetails() + .getEntityIdentifier() + .getValueBinding() + .getHibernateTypeDescriptor() + .getResolvedTypeMapping() + : null + ); + } + catch ( HibernateException he ) { + LOG.unableToCreateProxyFactory(getEntityName(), he); + pf = null; + } + return pf; + } + + protected ProxyFactory buildProxyFactoryInternal(EntityBinding entityBinding, Getter idGetter, Setter idSetter) { + // TODO : YUCK!!! fix after HHH-1907 is complete + return Environment.getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory(); +// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory(); + } + + @Override + protected Instantiator buildInstantiator(EntityBinding entityBinding) { + if ( optimizer == null ) { + return new PojoInstantiator( entityBinding, null ); + } + else { + return new PojoInstantiator( entityBinding, optimizer.getInstantiationOptimizer() ); + } + } + + @Override + public void setPropertyValues(Object entity, Object[] values) throws HibernateException { if ( !getEntityMetamodel().hasLazyProperties() && optimizer != null && optimizer.getAccessOptimizer() != null ) { setPropertyValuesWithOptimizer( entity, values ); } @@ -222,7 +363,8 @@ } } - public Object[] getPropertyValues(Object entity) throws HibernateException { + @Override + public Object[] getPropertyValues(Object entity) throws HibernateException { if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) { return getPropertyValuesWithOptimizer( entity ); } @@ -231,7 +373,8 @@ } } - public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) throws HibernateException { + @Override + public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) throws HibernateException { if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) { return getPropertyValuesWithOptimizer( entity ); } @@ -248,47 +391,88 @@ return optimizer.getAccessOptimizer().getPropertyValues( object ); } + @Override public EntityMode getEntityMode() { return EntityMode.POJO; } + @Override public Class getMappedClass() { return mappedClass; } - public boolean isLifecycleImplementor() { + @Override + public boolean isLifecycleImplementor() { return lifecycleImplementor; } - public boolean isValidatableImplementor() { - return validatableImplementor; - } - - protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) { + @Override + protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) { return mappedProperty.getGetter( mappedEntity.getMappedClass() ); } - protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) { + @Override + protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) { return mappedProperty.getSetter( mappedEntity.getMappedClass() ); } + @Override + protected Getter buildPropertyGetter(AttributeBinding mappedProperty) { + return getGetter( mappedProperty ); + } + + @Override + protected Setter buildPropertySetter(AttributeBinding mappedProperty) { + return getSetter( mappedProperty ); + } + + private Getter getGetter(AttributeBinding mappedProperty) throws PropertyNotFoundException, MappingException { + return getPropertyAccessor( mappedProperty ).getGetter( + mappedProperty.getContainer().getClassReference(), + mappedProperty.getAttribute().getName() + ); + } + + private Setter getSetter(AttributeBinding mappedProperty) throws PropertyNotFoundException, MappingException { + return getPropertyAccessor( mappedProperty ).getSetter( + mappedProperty.getContainer().getClassReference(), + mappedProperty.getAttribute().getName() + ); + } + + private PropertyAccessor getPropertyAccessor(AttributeBinding mappedProperty) throws MappingException { + // TODO: Fix this then backrefs are working in new metamodel + return PropertyAccessorFactory.getPropertyAccessor( + mappedProperty.getContainer().getClassReference(), + mappedProperty.getPropertyAccessorName() + ); + } + + @Override public Class getConcreteProxyClass() { return proxyInterface; } //TODO: need to make the majority of this functionality into a top-level support class for custom impl support - public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) { + @Override + public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) { if ( isInstrumented() ) { Set lazyProps = lazyPropertiesAreUnfetched && getEntityMetamodel().hasLazyProperties() ? lazyPropertyNames : null; //TODO: if we support multiple fetch groups, we would need // to clone the set of lazy properties! FieldInterceptionHelper.injectFieldInterceptor( entity, getEntityName(), lazyProps, session ); + + //also clear the fields that are marked as dirty in the dirtyness tracker + if(entity instanceof org.hibernate.engine.spi.SelfDirtinessTracker) { + ((org.hibernate.engine.spi.SelfDirtinessTracker) entity).$$_hibernate_clearDirtyAttributes(); + } } } - public boolean hasUninitializedLazyProperties(Object entity) { + @Override + public boolean hasUninitializedLazyProperties(Object entity) { if ( getEntityMetamodel().hasLazyProperties() ) { FieldInterceptor callback = FieldInterceptionHelper.extractFieldInterceptor( entity ); return callback != null && !callback.isInitialized(); @@ -298,8 +482,31 @@ } } + @Override public boolean isInstrumented() { - return FieldInterceptionHelper.isInstrumented( getMappedClass() ); + return isInstrumented; } + @Override + public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) { + final Class concreteEntityClass = entityInstance.getClass(); + if ( concreteEntityClass == getMappedClass() ) { + return getEntityName(); + } + else { + String entityName = getEntityMetamodel().findEntityNameByEntityClass( concreteEntityClass ); + if ( entityName == null ) { + throw new HibernateException( + "Unable to resolve entity name from Class [" + concreteEntityClass.getName() + "]" + + " expected instance/subclass of [" + getEntityName() + "]" + ); + } + return entityName; + } + } + + @Override + public EntityNameResolver[] getEntityNameResolvers() { + return null; + } } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/tuple/entity/VersionProperty.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/ArrayHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/BytesHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/CalendarComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/Cloneable.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/CollectionHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/ComparableComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/ConfigHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/DTDEntityResolver.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/EmptyIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/EqualsHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/ExternalSessionFactoryConfig.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/FastHashMap.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/FilterHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/IdentityMap.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/IdentitySet.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/JDBCExceptionReporter.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/JTAHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/JoinedIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/LazyIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/MarkerObject.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/NamingHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/PropertiesHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/ReflectHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/SerializationHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/SimpleMRUCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/SingletonIterator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/SoftLimitMRUCache.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/StringHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/XMLHelper.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/util/package.html'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_eadventure/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_eadventure/.classpath,v diff -u -r1.8.2.2 -r1.8.2.3 --- lams_tool_eadventure/.classpath 30 Jul 2014 14:23:27 -0000 1.8.2.2 +++ lams_tool_eadventure/.classpath 30 Jul 2014 15:52:45 -0000 1.8.2.3 @@ -15,9 +15,9 @@ - + - + Index: lams_tool_images/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/.classpath,v diff -u -r1.6.2.1 -r1.6.2.2 --- lams_tool_images/.classpath 30 Jul 2014 14:22:55 -0000 1.6.2.1 +++ lams_tool_images/.classpath 30 Jul 2014 15:52:46 -0000 1.6.2.2 @@ -10,9 +10,9 @@ - + - + Index: lams_tool_larsrc/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_larsrc/.classpath,v diff -u -r1.13.2.1 -r1.13.2.2 --- lams_tool_larsrc/.classpath 30 Jul 2014 14:22:56 -0000 1.13.2.1 +++ lams_tool_larsrc/.classpath 30 Jul 2014 15:52:50 -0000 1.13.2.2 @@ -3,9 +3,9 @@ - + - + Index: lams_tool_leader/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_leader/.classpath,v diff -u -r1.1.2.1 -r1.1.2.2 --- lams_tool_leader/.classpath 30 Jul 2014 14:22:52 -0000 1.1.2.1 +++ lams_tool_leader/.classpath 30 Jul 2014 15:52:47 -0000 1.1.2.2 @@ -4,9 +4,9 @@ - + - + Index: lams_tool_mindmap/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_mindmap/.classpath,v diff -u -r1.4.2.1 -r1.4.2.2 --- lams_tool_mindmap/.classpath 30 Jul 2014 14:22:54 -0000 1.4.2.1 +++ lams_tool_mindmap/.classpath 30 Jul 2014 15:52:48 -0000 1.4.2.2 @@ -12,9 +12,9 @@ - + - + Index: lams_tool_wookie/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wookie/.classpath,v diff -u -r1.3.2.1 -r1.3.2.2 --- lams_tool_wookie/.classpath 30 Jul 2014 14:23:07 -0000 1.3.2.1 +++ lams_tool_wookie/.classpath 30 Jul 2014 15:52:49 -0000 1.3.2.2 @@ -4,9 +4,9 @@ - + - +