Index: 3rdParty_sources/versions.txt
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/versions.txt,v
diff -u -r1.11.2.1 -r1.11.2.2
--- 3rdParty_sources/versions.txt 30 Jul 2014 08:37:35 -0000 1.11.2.1
+++ 3rdParty_sources/versions.txt 30 Jul 2014 16:17:10 -0000 1.11.2.2
@@ -19,7 +19,7 @@
gson 2.2.4
-Hibernate Core 3.3.1 GA
+Hibernate Core 4.3.5
httpunit 1.7
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/AnnotationException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/AssertionFailure.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/AssertionFailure.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/AssertionFailure.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/AssertionFailure.java 30 Jul 2014 16:16: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) 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,36 +20,44 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
-import org.hibernate.exception.NestableRuntimeException;
+import org.hibernate.internal.CoreMessageLogger;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.jboss.logging.Logger;
/**
* Indicates failure of an assertion: a possible bug in Hibernate.
*
* @author Gavin King
*/
-public class AssertionFailure extends NestableRuntimeException {
+public class AssertionFailure extends RuntimeException {
+ private static final long serialVersionUID = 1L;
- private static final Logger log = LoggerFactory.getLogger( AssertionFailure.class );
+ private static final CoreMessageLogger LOG = Logger.getMessageLogger(
+ CoreMessageLogger.class,
+ AssertionFailure.class.getName()
+ );
- private static final String MESSAGE = "an assertion failure occured" +
- " (this may indicate a bug in Hibernate, but is more likely due" +
- " to unsafe use of the session)";
-
- public AssertionFailure(String s) {
- super( s );
- log.error( MESSAGE, this );
+ /**
+ * Creates an instance of AssertionFailure using the given message.
+ *
+ * @param message The message explaining the reason for the exception
+ */
+ public AssertionFailure(String message) {
+ super( message );
+ LOG.failed( this );
}
- public AssertionFailure(String s, Throwable t) {
- super( s, t );
- log.error( MESSAGE, t );
+ /**
+ * Creates an instance of AssertionFailure using the given message and underlying cause.
+ *
+ * @param message The message explaining the reason for the exception
+ * @param cause The underlying cause.
+ */
+ public AssertionFailure(String message, Throwable cause) {
+ super( message, cause );
+ LOG.failed( cause );
}
-
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/BaseSessionEventListener.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/BasicQueryContract.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/CallbackException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/CallbackException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/CallbackException.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/CallbackException.java 30 Jul 2014 16:16: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) 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,37 +20,44 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
/**
- * Should be thrown by persistent objects from Lifecycle
- * or Interceptor callbacks.
+ * Intended to be thrown from {@link org.hibernate.classic.Lifecycle} and {@link Interceptor} callbacks.
+ *
+ * IMPL NOTE : This is a legacy exception type from back in the day before Hibernate moved to a untyped (runtime)
+ * exception strategy.
*
- * @see org.hibernate.classic.Lifecycle
- * @see Interceptor
* @author Gavin King
*/
-
public class CallbackException extends HibernateException {
-
- public CallbackException(Exception root) {
- super("An exception occurred in a callback", root);
+ /**
+ * Creates a CallbackException using the given underlying cause.
+ *
+ * @param cause The underlying cause
+ */
+ public CallbackException(Exception cause) {
+ this( "An exception occurred in a callback", cause );
}
+ /**
+ * Creates a CallbackException using the given message.
+ *
+ * @param message The message explaining the reason for the exception
+ */
public CallbackException(String message) {
- super(message);
+ super( message );
}
- public CallbackException(String message, Exception e) {
- super(message, e);
+ /**
+ * Creates a CallbackException using the given message and underlying cause.
+ *
+ * @param message The message explaining the reason for the exception
+ * @param cause The underlying cause
+ */
+ public CallbackException(String message, Exception cause) {
+ super( message, cause );
}
}
-
-
-
-
-
-
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/CustomEntityDirtinessStrategy.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/EmptyInterceptor.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/EmptyInterceptor.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/EmptyInterceptor.java 17 Aug 2012 14:36:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/EmptyInterceptor.java 30 Jul 2014 16:16: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) 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,24 +29,28 @@
import org.hibernate.type.Type;
/**
- * An interceptor that does nothing. May be used as a base class
- * for application-defined custom interceptors.
+ * An interceptor that does nothing. May be used as a base class for application-defined custom interceptors.
*
* @author Gavin King
*/
public class EmptyInterceptor implements Interceptor, Serializable {
-
+ /**
+ * The singleton reference.
+ */
public static final Interceptor INSTANCE = new EmptyInterceptor();
-
- protected EmptyInterceptor() {}
+ protected EmptyInterceptor() {
+ }
+
+ @Override
public void onDelete(
Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
Type[] types) {}
+ @Override
public boolean onFlushDirty(
Object entity,
Serializable id,
@@ -58,6 +61,7 @@
return false;
}
+ @Override
public boolean onLoad(
Object entity,
Serializable id,
@@ -67,6 +71,7 @@
return false;
}
+ @Override
public boolean onSave(
Object entity,
Serializable id,
@@ -76,18 +81,27 @@
return false;
}
- public void postFlush(Iterator entities) {}
- public void preFlush(Iterator entities) {}
+ @Override
+ public void postFlush(Iterator entities) {
+ }
+ @Override
+ public void preFlush(Iterator entities) {
+ }
+
+ @Override
public Boolean isTransient(Object entity) {
return null;
}
+ @Override
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) {
return null;
}
- public int[] findDirty(Object entity,
+ @Override
+ public int[] findDirty(
+ Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
@@ -96,26 +110,43 @@
return null;
}
+ @Override
public String getEntityName(Object object) {
return null;
}
+ @Override
public Object getEntity(String entityName, Serializable id) {
return null;
}
- public void afterTransactionBegin(Transaction tx) {}
- public void afterTransactionCompletion(Transaction tx) {}
- public void beforeTransactionCompletion(Transaction tx) {}
+ @Override
+ public void afterTransactionBegin(Transaction tx) {
+ }
+ @Override
+ public void afterTransactionCompletion(Transaction tx) {
+ }
+
+ @Override
+ public void beforeTransactionCompletion(Transaction tx) {
+ }
+
+ @Override
public String onPrepareStatement(String sql) {
return sql;
}
- public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {}
+ @Override
+ public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {
+ }
- public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {}
+ @Override
+ public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {
+ }
- public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {}
+ @Override
+ public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {
+ }
-}
\ No newline at end of file
+}
Index: 3rdParty_sources/hibernate-core/org/hibernate/FetchMode.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/FetchMode.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/FetchMode.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/FetchMode.java 30 Jul 2014 16:16: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) 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,9 @@
* 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;
-
/**
* Represents an association fetching strategy. This is used
* together with the Criteria API to specify runtime
@@ -36,58 +31,37 @@
* For HQL queries, use the FETCH keyword instead.
*
* @see Criteria#setFetchMode(java.lang.String, FetchMode)
+ *
* @author Gavin King
*/
-public final class FetchMode implements Serializable {
- private final String name;
- private static final Map INSTANCES = new HashMap();
-
- private FetchMode(String name) {
- this.name=name;
- }
- public String toString() {
- return name;
- }
+public enum FetchMode {
/**
* Default to the setting configured in the mapping file.
*/
- public static final FetchMode DEFAULT = new FetchMode("DEFAULT");
+ DEFAULT,
/**
* Fetch using an outer join. Equivalent to fetch="join".
*/
- public static final FetchMode JOIN = new FetchMode("JOIN");
+ JOIN,
/**
* Fetch eagerly, using a separate select. Equivalent to
* fetch="select".
*/
- public static final FetchMode SELECT = new FetchMode("SELECT");
+ SELECT;
/**
* Fetch lazily. Equivalent to outer-join="false".
+ *
* @deprecated use FetchMode.SELECT
*/
+ @Deprecated
public static final FetchMode LAZY = SELECT;
/**
- * Fetch eagerly, using an outer join. Equivalent to
- * outer-join="true".
+ * Fetch eagerly, using an outer join. Equivalent to outer-join="true".
+ *
* @deprecated use FetchMode.JOIN
*/
+ @Deprecated
public static final FetchMode EAGER = JOIN;
-
- static {
- INSTANCES.put( JOIN.name, JOIN );
- INSTANCES.put( SELECT.name, SELECT );
- INSTANCES.put( DEFAULT.name, DEFAULT );
- }
-
- private Object readResolve() {
- return INSTANCES.get(name);
- }
-
}
-
-
-
-
-
Index: 3rdParty_sources/hibernate-core/org/hibernate/FlushMode.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/FlushMode.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/FlushMode.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/FlushMode.java 30 Jul 2014 16:16: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) 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,14 +20,9 @@
* 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;
-
/**
* Represents a flushing strategy. The flush process synchronizes
* database state with session state by detecting state changes
@@ -39,77 +34,95 @@
*
* @author Gavin King
*/
-public final class FlushMode implements Serializable {
- private static final Map INSTANCES = new HashMap();
-
- private final int level;
- private final String name;
-
- private FlushMode(int level, String name) {
- this.level = level;
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-
+public enum FlushMode {
/**
* The {@link Session} is never flushed unless {@link Session#flush}
* is explicitly called by the application. This mode is very
* efficient for read only transactions.
*
* @deprecated use {@link #MANUAL} instead.
*/
- public static final FlushMode NEVER = new FlushMode( 0, "NEVER" );
+ @Deprecated
+ NEVER ( 0 ),
/**
* The {@link Session} is only ever flushed when {@link Session#flush}
* is explicitly called by the application. This mode is very
* efficient for read only transactions.
*/
- public static final FlushMode MANUAL = new FlushMode( 0, "MANUAL" );
+ MANUAL( 0 ),
/**
* The {@link Session} is flushed when {@link Transaction#commit}
* is called.
*/
- public static final FlushMode COMMIT = new FlushMode(5, "COMMIT");
+ COMMIT(5 ),
/**
* The {@link Session} is sometimes flushed before query execution
* in order to ensure that queries never return stale state. This
* is the default flush mode.
*/
- public static final FlushMode AUTO = new FlushMode(10, "AUTO");
+ AUTO(10 ),
/**
* The {@link Session} is flushed before every query. This is
* almost always unnecessary and inefficient.
*/
- public static final FlushMode ALWAYS = new FlushMode(20, "ALWAYS");
-
- public boolean lessThan(FlushMode other) {
- return this.level
+ *
* Inspection occurs before property values are written and after they are read
- * from the database.
- *
+ * from the database.
+ *
* There might be a single instance of Interceptor for a SessionFactory, or a new instance
* might be specified for each Session. Whichever approach is used, the interceptor must be
* serializable if the Session is to be serializable. This means that SessionFactory-scoped
- * interceptors should implement readResolve().
- *
+ * interceptors should implement readResolve().
+ *
* The Session may not be invoked from a callback (nor may a callback cause a collection or proxy to
- * be lazily initialized).
- *
+ * be lazily initialized).
+ *
* Instead of implementing this interface directly, it is usually better to extend EmptyInterceptor
* and override only the callback methods of interest.
*
- * @see SessionFactory#openSession(Interceptor)
+ * @see SessionBuilder#interceptor(Interceptor)
+ * @see SharedSessionBuilder#interceptor()
* @see org.hibernate.cfg.Configuration#setInterceptor(Interceptor)
* @see EmptyInterceptor
+ *
* @author Gavin King
*/
public interface Interceptor {
/**
* Called just before an object is initialized. The interceptor may change the state, which will
* be propagated to the persistent object. Note that when this method is called, entity will be
* an empty uninitialized instance of the class.
+ *
+ * NOTE: The indexes across the state, propertyNames and types arrays match.
*
- * @return true if the user modified the state in any way.
+ * @param entity The entity instance being loaded
+ * @param id The identifier value being loaded
+ * @param state The entity state (which will be pushed into the entity instance)
+ * @param propertyNames The names of the entity properties, corresponding to the state.
+ * @param types The types of the entity properties, corresponding to the state.
+ *
+ * @return {@code true} if the user modified the state in any way.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
+
/**
* Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected
* currentState, which will be propagated to both the database and the persistent object.
* Note that not all flushes end in actual synchronization with the database, in which case the
* new currentState will be propagated to the object, but not necessarily (immediately) to
* the database. It is strongly recommended that the interceptor not modify the previousState.
+ *
+ * NOTE: The indexes across the currentState, previousState, propertyNames and
+ * types arrays match.
*
- * @return true if the user modified the currentState in any way.
+ * @param entity The entity instance detected as being dirty and being flushed
+ * @param id The identifier of the entity
+ * @param currentState The entity's current state
+ * @param previousState The entity's previous (load time) state.
+ * @param propertyNames The names of the entity properties
+ * @param types The types of the entity properties
+ *
+ * @return {@code true} if the user modified the currentState in any way.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException;
+
/**
* Called before an object is saved. The interceptor may modify the state, which will be used for
* the SQL INSERT and propagated to the persistent object.
*
+ * @param entity The entity instance whose state is being inserted
+ * @param id The identifier of the entity
+ * @param state The state of the entity which will be inserted
+ * @param propertyNames The names of the entity properties.
+ * @param types The types of the entity properties
+ *
* @return true if the user modified the state in any way.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
+
/**
* Called before an object is deleted. It is not recommended that the interceptor modify the state.
+ *
+ * @param entity The entity instance being deleted
+ * @param id The identifier of the entity
+ * @param state The state of the entity
+ * @param propertyNames The names of the entity properties.
+ * @param types The types of the entity properties
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
+
/**
* Called before a collection is (re)created.
+ *
+ * @param collection The collection instance.
+ * @param key The collection key value.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException;
+
/**
* Called before a collection is deleted.
+ *
+ * @param collection The collection instance.
+ * @param key The collection key value.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException;
+
/**
* Called before a collection is updated.
+ *
+ * @param collection The collection instance.
+ * @param key The collection key value.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException;
+
/**
- * Called before a flush
+ * Called before a flush.
+ *
+ * @param entities The entities to be flushed.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public void preFlush(Iterator entities) throws CallbackException;
+
/**
* Called after a flush that actually ends in execution of the SQL statements required to synchronize
* in-memory state with the database.
+ *
+ * @param entities The entities that were flushed.
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public void postFlush(Iterator entities) throws CallbackException;
+
/**
* Called to distinguish between transient and detached entities. The return value determines the
* state of the entity with respect to the current session.
@@ -115,15 +186,25 @@
* @return Boolean or null to choose default behaviour
*/
public Boolean isTransient(Object entity);
+
/**
* Called from flush(). The return value determines whether the entity is updated
*
*
an array of property indices - the entity is dirty
*
an empty array - the entity is not dirty
*
null - use Hibernate's default dirty-checking algorithm
*
- * @param entity a persistent entity
- * @return array of dirty property indices or null to choose default behaviour
+ *
+ * @param entity The entity for which to find dirty properties.
+ * @param id The identifier of the entity
+ * @param currentState The current entity state as taken from the entity instance
+ * @param previousState The state of the entity when it was last synchronized (generally when it was loaded)
+ * @param propertyNames The names of the entity properties.
+ * @param types The types of the entity properties
+ *
+ * @return array of dirty property indices or {@code null} to indicate Hibernate should perform default behaviour
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types);
/**
@@ -134,38 +215,56 @@
* @param entityName the name of the entity
* @param entityMode The type of entity instance to be returned.
* @param id the identifier of the new instance
+ *
* @return an instance of the class, or null to choose default behaviour
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException;
/**
- * Get the entity name for a persistent or transient instance
+ * Get the entity name for a persistent or transient instance.
+ *
* @param object an entity instance
+ *
* @return the name of the entity
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public String getEntityName(Object object) throws CallbackException;
/**
- * Get a fully loaded entity instance that is cached externally
+ * Get a fully loaded entity instance that is cached externally.
+ *
* @param entityName the name of the entity
* @param id the instance identifier
+ *
* @return a fully initialized entity
- * @throws CallbackException
+ *
+ * @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
*/
public Object getEntity(String entityName, Serializable id) throws CallbackException;
/**
* Called when a Hibernate transaction is begun via the Hibernate Transaction
* API. Will not be called if transactions are being controlled via some other
* mechanism (CMT, for example).
+ *
+ * @param tx The Hibernate transaction facade object
*/
public void afterTransactionBegin(Transaction tx);
+
/**
* Called before a transaction is committed (but not before rollback).
+ *
+ * @param tx The Hibernate transaction facade object
*/
public void beforeTransactionCompletion(Transaction tx);
+
/**
* Called after a transaction is committed or rolled back.
+ *
+ * @param tx The Hibernate transaction facade object
*/
public void afterTransactionCompletion(Transaction tx);
Index: 3rdParty_sources/hibernate-core/org/hibernate/InvalidMappingException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/InvalidMappingException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/InvalidMappingException.java 17 Aug 2012 14:36:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/InvalidMappingException.java 30 Jul 2014 16:16: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) 20082011, 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,42 +20,125 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
+import org.hibernate.internal.jaxb.Origin;
+import org.hibernate.internal.util.xml.XmlDocument;
+
/**
* Thrown when a mapping is found to be invalid.
- * Similar to MappingException, but this contains more info about the path and type of mapping (e.g. file, resource or url)
+ *
+ * Similar to MappingException, but this contains more info about the path and type of
+ * mapping (e.g. file, resource or url)
*
* @author Max Rydahl Andersen
- *
+ * @author Steve Ebersole
*/
public class InvalidMappingException extends MappingException {
-
private final String path;
private final String type;
+ /**
+ * Constructs an InvalidMappingException using the given information.
+ *
+ * @param customMessage The custom message explaining the exception condition
+ * @param type The type of invalid mapping document
+ * @param path The path (type specific) of the invalid mapping document
+ * @param cause The underlying cause
+ */
public InvalidMappingException(String customMessage, String type, String path, Throwable cause) {
- super(customMessage, cause);
- this.type=type;
- this.path=path;
+ super( customMessage, cause );
+ this.type = type;
+ this.path = path;
}
-
+
+ /**
+ * Constructs an InvalidMappingException using the given information.
+ *
+ * @param customMessage The custom message explaining the exception condition
+ * @param type The type of invalid mapping document
+ * @param path The path (type specific) of the invalid mapping document
+ */
public InvalidMappingException(String customMessage, String type, String path) {
- super(customMessage);
+ super( customMessage );
this.type=type;
this.path=path;
}
-
+
+ /**
+ * Constructs an InvalidMappingException using the given information.
+ *
+ * @param customMessage The custom message explaining the exception condition
+ * @param xmlDocument The document that was invalid
+ * @param cause The underlying cause
+ */
+ public InvalidMappingException(String customMessage, XmlDocument xmlDocument, Throwable cause) {
+ this( customMessage, xmlDocument.getOrigin().getType(), xmlDocument.getOrigin().getName(), cause );
+ }
+
+ /**
+ * Constructs an InvalidMappingException using the given information.
+ *
+ * @param customMessage The custom message explaining the exception condition
+ * @param xmlDocument The document that was invalid
+ */
+ public InvalidMappingException(String customMessage, XmlDocument xmlDocument) {
+ this( customMessage, xmlDocument.getOrigin().getType(), xmlDocument.getOrigin().getName() );
+ }
+
+ /**
+ * Constructs an InvalidMappingException using the given information.
+ *
+ * @param customMessage The custom message explaining the exception condition
+ * @param origin The origin of the invalid mapping document
+ */
+ public InvalidMappingException(String customMessage, Origin origin) {
+ this( customMessage, origin.getType().toString(), origin.getName() );
+ }
+
+ /**
+ * Constructs an InvalidMappingException using the given information and a standard message.
+ *
+ * @param type The type of invalid mapping document
+ * @param path The path (type specific) of the invalid mapping document
+ */
public InvalidMappingException(String type, String path) {
- this("Could not parse mapping document from " + type + (path==null?"":" " + path), type, path);
+ this( "Could not parse mapping document from " + type + (path==null?"":" " + path), type, path );
}
+ /**
+ * Constructs an InvalidMappingException using the given information and a standard message.
+ *
+ * @param type The type of invalid mapping document
+ * @param path The path (type specific) of the invalid mapping document
+ * @param cause The underlying cause
+ */
public InvalidMappingException(String type, String path, Throwable cause) {
- this("Could not parse mapping document from " + type + (path==null?"":" " + path), type, path, cause);
+ this( "Could not parse mapping document from " + type + (path==null?"":" " + path), type, path, cause );
}
+ /**
+ * Constructs an InvalidMappingException using the given information.
+ *
+ * @param customMessage The custom message explaining the exception condition
+ * @param origin The origin of the invalid mapping document
+ * @param cause The underlying cause
+ */
+ public InvalidMappingException(String customMessage, org.hibernate.internal.util.xml.Origin origin, Exception cause) {
+ this( customMessage, origin.getType(), origin.getName(), cause );
+ }
+
+ /**
+ * Constructs an InvalidMappingException using the given information.
+ *
+ * @param customMessage The custom message explaining the exception condition
+ * @param origin The origin of the invalid mapping document
+ */
+ public InvalidMappingException(String customMessage, org.hibernate.internal.util.xml.Origin origin) {
+ this( customMessage, origin, null );
+ }
+
public String getType() {
return type;
}
Index: 3rdParty_sources/hibernate-core/org/hibernate/JDBCException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/JDBCException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/JDBCException.java 17 Aug 2012 14:36:38 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/JDBCException.java 30 Jul 2014 16:16: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) 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,64 +20,80 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
import java.sql.SQLException;
-
/**
- * Wraps an SQLException. Indicates that an exception
- * occurred during a JDBC call.
+ * Wraps a {@link SQLException}. Indicates that an exception occurred during a JDBC call.
*
- * @see java.sql.SQLException
* @author Gavin King
+ *
+ * @see java.sql.SQLException
*/
public class JDBCException extends HibernateException {
+ private final SQLException sqlException;
+ private final String sql;
- private SQLException sqle;
- private String sql;
-
- public JDBCException(String string, SQLException root) {
- super(string, root);
- sqle=root;
+ /**
+ * Constructs a JDBCException using the given information.
+ *
+ * @param message The message explaining the exception condition
+ * @param cause The underlying cause
+ */
+ public JDBCException(String message, SQLException cause) {
+ this( message, cause, null );
}
- public JDBCException(String string, SQLException root, String sql) {
- this(string, root);
+ /**
+ * Constructs a JDBCException using the given information.
+ *
+ * @param message The message explaining the exception condition
+ * @param cause The underlying cause
+ * @param sql The sql being executed when the exception occurred
+ */
+ public JDBCException(String message, SQLException cause, String sql) {
+ super( message, cause );
+ this.sqlException = cause;
this.sql = sql;
}
/**
- * Get the SQLState of the underlying SQLException.
- * @see java.sql.SQLException
- * @return String
+ * Get the X/Open or ANSI SQL SQLState error code from the underlying {@link SQLException}.
+ *
+ * @return The X/Open or ANSI SQL SQLState error code; may return null.
+ *
+ * @see java.sql.SQLException#getSQLState()
*/
public String getSQLState() {
- return sqle.getSQLState();
+ return sqlException.getSQLState();
}
/**
- * Get the errorCode of the underlying SQLException.
- * @see java.sql.SQLException
- * @return int the error code
+ * Get the vendor specific error code from the underlying {@link SQLException}.
+ *
+ * @return The vendor specific error code
+ *
+ * @see java.sql.SQLException#getErrorCode()
*/
public int getErrorCode() {
- return sqle.getErrorCode();
+ return sqlException.getErrorCode();
}
/**
- * Get the underlying SQLException.
- * @return SQLException
+ * Get the underlying {@link SQLException}.
+ *
+ * @return The SQLException
*/
public SQLException getSQLException() {
- return sqle;
+ return sqlException;
}
/**
- * Get the actual SQL statement that caused the exception
- * (may be null)
+ * Get the actual SQL statement being executed when the exception occurred.
+ *
+ * @return The SQL statement; may return null.
*/
public String getSQL() {
return sql;
Index: 3rdParty_sources/hibernate-core/org/hibernate/LazyInitializationException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/LazyInitializationException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/LazyInitializationException.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/LazyInitializationException.java 30 Jul 2014 16:16: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) 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,32 +20,37 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
-import org.slf4j.LoggerFactory;
+import org.hibernate.internal.CoreMessageLogger;
+import org.jboss.logging.Logger;
+
/**
- * Indicates access to unfetched data outside of a session context.
- * For example, when an uninitialized proxy or collection is accessed
- * after the session was closed.
+ * Indicates an attempt to access not-yet-fetched data outside of a session context.
*
+ * For example, when an uninitialized proxy or collection is accessed after the session was closed.
+ *
* @see Hibernate#initialize(java.lang.Object)
* @see Hibernate#isInitialized(java.lang.Object)
* @author Gavin King
*/
public class LazyInitializationException extends HibernateException {
- public LazyInitializationException(String msg) {
- super(msg);
- LoggerFactory.getLogger( LazyInitializationException.class ).error( msg, this );
+ private static final CoreMessageLogger LOG = Logger.getMessageLogger(
+ CoreMessageLogger.class,
+ LazyInitializationException.class.getName()
+ );
+
+ /**
+ * Constructs a LazyInitializationException using the given message.
+ *
+ * @param message A message explaining the exception condition
+ */
+ public LazyInitializationException(String message) {
+ super( message );
+ LOG.trace( message, this );
}
}
-
-
-
-
-
-
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/LobHelper.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/LockMode.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/LockMode.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/LockMode.java 17 Aug 2012 14:36:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/LockMode.java 30 Jul 2014 16:16:04 -0000 1.1.2.1
@@ -24,10 +24,6 @@
*/
package org.hibernate;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Instances represent a lock mode for a row of a relational
* database table. It is not intended that users spend much
@@ -36,94 +32,123 @@
* Some "advanced" users may wish to explicitly specify lock
* levels.
*
- * @see Session#lock(Object,LockMode)
* @author Gavin King
+ * @see Session#lock(Object, LockMode)
*/
-public final class LockMode implements Serializable {
- private final int level;
- private final String name;
- private static final Map INSTANCES = new HashMap();
-
- private LockMode(int level, String name) {
- this.level=level;
- this.name=name;
- }
- public String toString() {
- return name;
- }
+public enum LockMode {
/**
- * Check if this lock mode is more restrictive than the given lock mode.
- *
- * @param mode LockMode to check
- * @return true if this lock mode is more restrictive than given lock mode
- */
- public boolean greaterThan(LockMode mode) {
- return level > mode.level;
- }
- /**
- * Check if this lock mode is less restrictive than the given lock mode.
- *
- * @param mode LockMode to check
- * @return true if this lock mode is less restrictive than given lock mode
- */
- public boolean lessThan(LockMode mode) {
- return level < mode.level;
- }
- /**
* No lock required. If an object is requested with this lock
* mode, a READ lock will be obtained if it is
* necessary to actually read the state from the database,
* rather than pull it from a cache.
*
* This is the "default" lock mode.
*/
- public static final LockMode NONE = new LockMode(0, "NONE");
+ NONE( 0 ),
/**
* A shared lock. Objects in this lock mode were read from
* the database in the current transaction, rather than being
* pulled from a cache.
*/
- public static final LockMode READ = new LockMode(5, "READ");
+ READ( 5 ),
/**
* An upgrade lock. Objects loaded in this lock mode are
* materialized using an SQL select ... for update.
+ *
+ * @deprecated instead use PESSIMISTIC_WRITE
*/
- public static final LockMode UPGRADE = new LockMode(10, "UPGRADE");
+ @Deprecated
+ UPGRADE( 10 ),
/**
* Attempt to obtain an upgrade lock, using an Oracle-style
* select for update nowait. The semantics of
* this lock mode, once obtained, are the same as
* UPGRADE.
*/
- public static final LockMode UPGRADE_NOWAIT = new LockMode(10, "UPGRADE_NOWAIT");
+ UPGRADE_NOWAIT( 10 ),
+
/**
+ * Attempt to obtain an upgrade lock, using an Oracle-style
+ * select for update skip locked. The semantics of
+ * this lock mode, once obtained, are the same as
+ * UPGRADE.
+ */
+ UPGRADE_SKIPLOCKED( 10 ),
+
+ /**
* A WRITE lock is obtained when an object is updated
* or inserted. This lock mode is for internal use only and is
* not a valid mode for load() or lock() (both
* of which throw exceptions if WRITE is specified).
*/
- public static final LockMode WRITE = new LockMode(10, "WRITE");
+ WRITE( 10 ),
/**
- * Similiar to {@link #UPGRADE} except that, for versioned entities,
+ * Similar to {@link #UPGRADE} except that, for versioned entities,
* it results in a forced version increment.
+ *
+ * @deprecated instead use PESSIMISTIC_FORCE_INCREMENT
*/
- public static final LockMode FORCE = new LockMode( 15, "FORCE" );
+ @Deprecated
+ FORCE( 15 ),
- static {
- INSTANCES.put( NONE.name, NONE );
- INSTANCES.put( READ.name, READ );
- INSTANCES.put( UPGRADE.name, UPGRADE );
- INSTANCES.put( UPGRADE_NOWAIT.name, UPGRADE_NOWAIT );
- INSTANCES.put( WRITE.name, WRITE );
- INSTANCES.put( FORCE.name, FORCE );
+ /**
+ * start of javax.persistence.LockModeType equivalent modes
+ */
+
+ /**
+ * Optimistically assume that transaction will not experience contention for
+ * entities. The entity version will be verified near the transaction end.
+ */
+ OPTIMISTIC( 6 ),
+
+ /**
+ * Optimistically assume that transaction will not experience contention for
+ * entities. The entity version will be verified and incremented near the transaction end.
+ */
+ OPTIMISTIC_FORCE_INCREMENT( 7 ),
+
+ /**
+ * Implemented as PESSIMISTIC_WRITE.
+ * TODO: introduce separate support for PESSIMISTIC_READ
+ */
+ PESSIMISTIC_READ( 12 ),
+
+ /**
+ * Transaction will obtain a database lock immediately.
+ * TODO: add PESSIMISTIC_WRITE_NOWAIT
+ */
+ PESSIMISTIC_WRITE( 13 ),
+
+ /**
+ * Transaction will immediately increment the entity version.
+ */
+ PESSIMISTIC_FORCE_INCREMENT( 17 );
+ private final int level;
+
+ private LockMode(int level) {
+ this.level = level;
}
- private Object readResolve() {
- return parse( name );
+ /**
+ * Check if this lock mode is more restrictive than the given lock mode.
+ *
+ * @param mode LockMode to check
+ *
+ * @return true if this lock mode is more restrictive than given lock mode
+ */
+ public boolean greaterThan(LockMode mode) {
+ return level > mode.level;
}
- public static LockMode parse(String name) {
- return ( LockMode ) INSTANCES.get(name);
+ /**
+ * Check if this lock mode is less restrictive than the given lock mode.
+ *
+ * @param mode LockMode to check
+ *
+ * @return true if this lock mode is less restrictive than given lock mode
+ */
+ public boolean lessThan(LockMode mode) {
+ return level < mode.level;
}
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/LockOptions.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/MappingNotFoundException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/MappingNotFoundException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/MappingNotFoundException.java 17 Aug 2012 14:36:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/MappingNotFoundException.java 30 Jul 2014 16:16: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) 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,28 +29,55 @@
* @author Max Rydahl Andersen
*/
public class MappingNotFoundException extends MappingException {
-
private final String path;
private final String type;
+ /**
+ * Constructs a MappingNotFoundException using the given information.
+ *
+ * @param customMessage A message explaining the exception condition
+ * @param type The type of mapping that could not be found
+ * @param path The path (type specific) of the mapping that could not be found
+ * @param cause The underlying cause
+ */
public MappingNotFoundException(String customMessage, String type, String path, Throwable cause) {
- super(customMessage, cause);
- this.type=type;
- this.path=path;
+ super( customMessage, cause );
+ this.type = type;
+ this.path = path;
}
-
+
+ /**
+ * Constructs a MappingNotFoundException using the given information.
+ *
+ * @param customMessage A message explaining the exception condition
+ * @param type The type of mapping that could not be found
+ * @param path The path (type specific) of the mapping that could not be found
+ */
public MappingNotFoundException(String customMessage, String type, String path) {
- super(customMessage);
- this.type=type;
- this.path=path;
+ super( customMessage );
+ this.type = type;
+ this.path = path;
}
-
+
+ /**
+ * Constructs a MappingNotFoundException using the given information, using a standard message.
+ *
+ * @param type The type of mapping that could not be found
+ * @param path The path (type specific) of the mapping that could not be found
+ */
public MappingNotFoundException(String type, String path) {
- this(type + ": " + path + " not found", type, path);
+ this( type + ": " + path + " not found", type, path );
}
+ /**
+ * Constructs a MappingNotFoundException using the given information, using a standard message.
+ *
+ * @param type The type of mapping that could not be found
+ * @param path The path (type specific) of the mapping that could not be found
+ * @param cause The underlying cause
+ */
public MappingNotFoundException(String type, String path, Throwable cause) {
- this(type + ": " + path + " not found", type, path, cause);
+ this( type + ": " + path + " not found", type, path, cause );
}
public String getType() {
Index: 3rdParty_sources/hibernate-core/org/hibernate/NonUniqueObjectException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/NonUniqueObjectException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/NonUniqueObjectException.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/NonUniqueObjectException.java 30 Jul 2014 16:16: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) 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;
@@ -29,39 +28,53 @@
import org.hibernate.pretty.MessageHelper;
/**
- * This exception is thrown when an operation would
- * break session-scoped identity. This occurs if the
- * user tries to associate two different instances of
- * the same Java class with a particular identifier,
- * in the scope of a single Session.
+ * This exception is thrown when an operation would break session-scoped identity. This occurs if the
+ * user tries to associate two different instances of the same Java class with a particular identifier,
+ * in the scope of a single Session.
*
* @author Gavin King
*/
public class NonUniqueObjectException extends HibernateException {
private final Serializable identifier;
private final String entityName;
- public NonUniqueObjectException(String message, Serializable id, String clazz) {
- super(message);
- this.entityName = clazz;
- this.identifier = id;
+ /**
+ * Constructs a NonUniqueObjectException using the given information.
+ *
+ * @param message A message explaining the exception condition
+ * @param entityId The identifier of the entity
+ * @param entityName The name of the entity
+ */
+ public NonUniqueObjectException(String message, Serializable entityId, String entityName) {
+ super( message );
+ this.entityName = entityName;
+ this.identifier = entityId;
}
- public NonUniqueObjectException(Serializable id, String clazz) {
- this("a different object with the same identifier value was already associated with the session", id, clazz);
+ /**
+ * Constructs a NonUniqueObjectException using the given information, using a standard message.
+ *
+ * @param entityId The identifier of the entity
+ * @param entityName The name of the entity
+ */
+ public NonUniqueObjectException(Serializable entityId, String entityName) {
+ this(
+ "A different object with the same identifier value was already associated with the session",
+ entityId,
+ entityName
+ );
}
+ public String getEntityName() {
+ return entityName;
+ }
+
public Serializable getIdentifier() {
return identifier;
}
+ @Override
public String getMessage() {
- return super.getMessage() + ": " +
- MessageHelper.infoString(entityName, identifier);
+ return super.getMessage() + " : " + MessageHelper.infoString( entityName, identifier );
}
-
- public String getEntityName() {
- return entityName;
- }
-
}
Index: 3rdParty_sources/hibernate-core/org/hibernate/ObjectDeletedException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/ObjectDeletedException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/ObjectDeletedException.java 17 Aug 2012 14:36:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/ObjectDeletedException.java 30 Jul 2014 16:16: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) 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,26 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
import java.io.Serializable;
/**
- * Thrown when the user tries to do something illegal with a deleted
- * object.
+ * Thrown when the user tries to do something illegal with a deleted object.
*
* @author Gavin King
*/
public class ObjectDeletedException extends UnresolvableObjectException {
-
- public ObjectDeletedException(String message, Serializable identifier, String clazz) {
- super(message, identifier, clazz);
+ /**
+ * Constructs an ObjectDeletedException using the given information.
+ *
+ * @param message A message explaining the exception condition
+ * @param identifier The identifier of the entity
+ * @param entityName The name of the entity
+ */
+ public ObjectDeletedException(String message, Serializable identifier, String entityName) {
+ super( message, identifier, entityName );
}
}
Index: 3rdParty_sources/hibernate-core/org/hibernate/ObjectNotFoundException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/ObjectNotFoundException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/ObjectNotFoundException.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/ObjectNotFoundException.java 30 Jul 2014 16:16: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) 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;
@@ -40,8 +39,13 @@
* @author Gavin King
*/
public class ObjectNotFoundException extends UnresolvableObjectException {
-
- public ObjectNotFoundException(Serializable identifier, String clazz) {
- super(identifier, clazz);
+ /**
+ * Constructs a ObjectNotFoundException using the given information.
+ *
+ * @param identifier The identifier of the entity
+ * @param entityName The name of the entity
+ */
+ public ObjectNotFoundException(Serializable identifier, String entityName) {
+ super( identifier, entityName );
}
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/OptimisticLockException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/PropertyNotFoundException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/PropertyNotFoundException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/PropertyNotFoundException.java 17 Aug 2012 14:36:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/PropertyNotFoundException.java 30 Jul 2014 16:16: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,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
@@ -31,9 +30,12 @@
* @author Gavin King
*/
public class PropertyNotFoundException extends MappingException {
-
- public PropertyNotFoundException(String s) {
- super(s);
+ /**
+ * Constructs a PropertyNotFoundException given the specified message.
+ *
+ * @param message A message explaining the exception condition
+ */
+ public PropertyNotFoundException(String message) {
+ super( message );
}
-
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/PropertySetterAccessException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/QueryException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/QueryException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/QueryException.java 17 Aug 2012 14:36:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/QueryException.java 30 Jul 2014 16:16: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,52 +20,120 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
/**
- * A problem occurred translating a Hibernate query to SQL
- * due to invalid query syntax, etc.
+ * A problem occurred translating a Hibernate query to SQL due to invalid query syntax, etc.
*/
public class QueryException extends HibernateException {
+ private final String queryString;
- private String queryString;
-
+ /**
+ * Constructs a QueryException using the specified exception message.
+ *
+ * @param message A message explaining the exception condition
+ */
public QueryException(String message) {
- super(message);
+ this( message, null, null );
}
- public QueryException(String message, Throwable e) {
- super(message, e);
+
+ /**
+ * Constructs a QueryException using the specified exception message and cause.
+ *
+ * @param message A message explaining the exception condition
+ * @param cause The underlying cause
+ */
+ public QueryException(String message, Exception cause) {
+ this( message, null, cause );
}
+ /**
+ * Constructs a QueryException using the specified exception message and query-string.
+ *
+ * @param message A message explaining the exception condition
+ * @param queryString The query being evaluated when the exception occurred
+ */
public QueryException(String message, String queryString) {
- super(message);
+ this( message, queryString, null );
+ }
+
+ /**
+ * Constructs a QueryException using the specified exception message and query-string.
+ *
+ * @param message A message explaining the exception condition
+ * @param queryString The query being evaluated when the exception occurred
+ * @param cause The underlying cause
+ */
+ public QueryException(String message, String queryString, Exception cause) {
+ super( message, cause );
this.queryString = queryString;
}
- public QueryException(Exception e) {
- super(e);
+ /**
+ * Constructs a QueryException using the specified cause.
+ *
+ * @param cause The underlying cause
+ */
+ public QueryException(Exception cause) {
+ this( "A query exception occurred", null, cause );
}
+
+ /**
+ * Retrieve the query being evaluated when the exception occurred. May be null, but generally should not.
+ *
+ * @return The query string
+ */
public String getQueryString() {
return queryString;
}
- public void setQueryString(String queryString) {
- this.queryString = queryString;
- }
-
+ @Override
public String getMessage() {
- String msg = super.getMessage();
- if ( queryString!=null ) msg += " [" + queryString + ']';
+ String msg = getOriginalMessage();
+ if ( queryString != null ) {
+ msg += " [" + queryString + ']';
+ }
return msg;
}
-}
+ protected final String getOriginalMessage() {
+ return super.getMessage();
+ }
+ /**
+ * Wraps this exception with another, of same kind, with the specified queryString. If this exception already
+ * has a queryString defined, the same exception ({@code this}) is returned. Otherwise the protected
+ * {@link #generateQueryException(String)} is called, to allow subclasses to properly create the correct
+ * subclass for return.
+ *
+ * @param queryString The query string that led to the QueryException
+ *
+ * @return {@code this}, if {@code this} has {@code null} for {@link #getQueryString()}; otherwise a new
+ * QueryException (or subclass) is returned.
+ */
+ public final QueryException wrapWithQueryString(String queryString) {
+ if ( this.getQueryString() != null ) {
+ return this;
+ }
+ return generateQueryException( queryString );
+ }
-
-
-
-
+ /**
+ * Called from {@link #wrapWithQueryString(String)} when we really need to generate a new QueryException
+ * (or subclass).
+ *
+ * NOTE : implementors should take care to use {@link #getOriginalMessage()} for the message, not
+ * {@link #getMessage()}
+ *
+ * @param queryString The query string
+ *
+ * @return The generated QueryException (or subclass)
+ *
+ * @see #getOriginalMessage()
+ */
+ protected QueryException generateQueryException(String queryString) {
+ return new QueryException( getOriginalMessage(), queryString, this );
+ }
+}
Index: 3rdParty_sources/hibernate-core/org/hibernate/ReplicationMode.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/ReplicationMode.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/ReplicationMode.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/ReplicationMode.java 30 Jul 2014 16:16: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) 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,78 +20,69 @@
* 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;
-
import org.hibernate.type.VersionType;
/**
* Represents a replication strategy.
*
- * @see Session#replicate(Object, ReplicationMode)
* @author Gavin King
+ * @see Session#replicate(Object, ReplicationMode)
*/
-public abstract class ReplicationMode implements Serializable {
- private final String name;
- private static final Map INSTANCES = new HashMap();
-
- public ReplicationMode(String name) {
- this.name=name;
- }
- public String toString() {
- return name;
- }
- public abstract boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType);
+public enum ReplicationMode {
/**
* Throw an exception when a row already exists.
*/
- public static final ReplicationMode EXCEPTION = new ReplicationMode("EXCEPTION") {
+ EXCEPTION {
+ @Override
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
- throw new AssertionFailure("should not be called");
+ throw new AssertionFailure( "should not be called" );
}
- };
+ },
/**
* Ignore replicated entities when a row already exists.
*/
- public static final ReplicationMode IGNORE = new ReplicationMode("IGNORE") {
+ IGNORE {
+ @Override
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
return false;
}
- };
+ },
/**
* Overwrite existing rows when a row already exists.
*/
- public static final ReplicationMode OVERWRITE = new ReplicationMode("OVERWRITE") {
+ OVERWRITE {
+ @Override
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
return true;
}
- };
+ },
/**
* When a row already exists, choose the latest version.
*/
- public static final ReplicationMode LATEST_VERSION = new ReplicationMode("LATEST_VERSION") {
+ LATEST_VERSION {
+ @Override
+ @SuppressWarnings("unchecked")
public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
- if (versionType==null) return true; //always overwrite nonversioned data
- return versionType.getComparator().compare(currentVersion, newVersion) <= 0;
+ // always overwrite non-versioned data (because we don't know which is newer)
+ return versionType == null || versionType.getComparator().compare( currentVersion, newVersion ) <= 0;
}
};
- static {
- INSTANCES.put( LATEST_VERSION.name, LATEST_VERSION );
- INSTANCES.put( IGNORE.name, IGNORE );
- INSTANCES.put( OVERWRITE.name, OVERWRITE );
- INSTANCES.put( EXCEPTION.name, EXCEPTION );
- }
+ /**
+ * Determine whether the mode dictates that the data being replicated should overwrite the data found.
+ *
+ * @param entity The entity being replicated
+ * @param currentVersion The version currently on the target database table.
+ * @param newVersion The replicating version
+ * @param versionType The version type
+ *
+ * @return {@code true} indicates the data should be overwritten; {@code false} indicates it should not.
+ */
+ public abstract boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType);
- private Object readResolve() {
- return INSTANCES.get(name);
- }
-
}
Index: 3rdParty_sources/hibernate-core/org/hibernate/ScrollMode.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/ScrollMode.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/ScrollMode.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/ScrollMode.java 30 Jul 2014 16:16:05 -0000 1.1.2.1
@@ -24,74 +24,63 @@
*/
package org.hibernate;
-import java.io.Serializable;
import java.sql.ResultSet;
-import java.util.HashMap;
-import java.util.Map;
/**
- * Specifies the type of JDBC scrollable result set to use
- * underneath a ScrollableResults
+ * Specifies the type of JDBC scrollable result set to use underneath a {@link ScrollableResults}.
*
- * @see Query#scroll(ScrollMode)
- * @see ScrollableResults
* @author Gavin King
*/
-public final class ScrollMode implements Serializable {
+public enum ScrollMode {
+ /**
+ * Requests a scrollable result that is only scrollable forwards.
+ *
+ * @see java.sql.ResultSet#TYPE_FORWARD_ONLY
+ */
+ FORWARD_ONLY( ResultSet.TYPE_FORWARD_ONLY ),
+
+ /**
+ * Requests a scrollable result which is sensitive to changes in the underlying data.
+ *
+ * @see java.sql.ResultSet#TYPE_SCROLL_SENSITIVE
+ */
+ SCROLL_SENSITIVE( ResultSet.TYPE_SCROLL_SENSITIVE ),
+
+ /**
+ * Requests a scrollable result which is insensitive to changes in the underlying data.
+ *
+ * Note that since the Hibernate session acts as a cache, you
+ * might need to explicitly evict objects, if you need to see
+ * changes made by other transactions.
+ *
+ * @see java.sql.ResultSet#TYPE_SCROLL_INSENSITIVE
+ */
+ SCROLL_INSENSITIVE( ResultSet.TYPE_SCROLL_INSENSITIVE );
+
private final int resultSetType;
- private final String name;
- private static final Map INSTANCES = new HashMap();
- private ScrollMode(int level, String name) {
- this.resultSetType=level;
- this.name=name;
+ private ScrollMode(int level) {
+ this.resultSetType = level;
}
-
- public String toString() {
- return name;
- }
-
+
/**
+ * Get the corresponding JDBC scroll type code constant value.
+ *
* @return the JDBC result set type code
*/
public int toResultSetType() {
return resultSetType;
}
-
+
/**
- * @see java.sql.ResultSet.TYPE_FORWARD_ONLY
+ * Determine if {@code this} mode is "less than" the provided mode.
+ *
+ * @param other The provided mode
+ *
+ * @return {@code true} if this mode is less than the other.
*/
- public static final ScrollMode FORWARD_ONLY = new ScrollMode(ResultSet.TYPE_FORWARD_ONLY, "FORWARD_ONLY");
- /**
- * @see java.sql.ResultSet.TYPE_SCROLL_SENSITIVE
- */
- public static final ScrollMode SCROLL_SENSITIVE = new ScrollMode(ResultSet.TYPE_SCROLL_SENSITIVE, "SCROLL_SENSITIVE");
- /**
- * Note that since the Hibernate session acts as a cache, you
- * might need to expicitly evict objects, if you need to see
- * changes made by other transactions.
- * @see java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE
- */
- public static final ScrollMode SCROLL_INSENSITIVE = new ScrollMode(ResultSet.TYPE_SCROLL_INSENSITIVE, "SCROLL_INSENSITIVE");
-
public boolean lessThan(ScrollMode other) {
- return this.resultSetTypeSessions. Usually an application has a single SessionFactory.
- * Threads servicing client requests obtain Sessions from the factory.
- *
- * Implementors must be threadsafe.
- *
- * SessionFactorys are immutable. The behaviour of a SessionFactory is
- * controlled by properties supplied at configuration time. These properties are defined
- * on Environment.
+ * The main contract here is the creation of {@link Session} instances. Usually
+ * an application has a single {@link SessionFactory} instance and threads
+ * servicing client requests obtain {@link Session} instances from this factory.
+ *
+ * The internal state of a {@link SessionFactory} is immutable. Once it is created
+ * this internal state is set. This internal state includes all of the metadata
+ * about Object/Relational Mapping.
+ *
+ * Implementors must be threadsafe.
*
- * @see Session
- * @see org.hibernate.cfg.Environment
* @see org.hibernate.cfg.Configuration
- * @see org.hibernate.connection.ConnectionProvider
- * @see org.hibernate.transaction.TransactionFactory
+ *
* @author Gavin King
+ * @author Steve Ebersole
*/
public interface SessionFactory extends Referenceable, Serializable {
-
/**
- * Open a Session on the given connection.
- *
- * Note that the second-level cache will be disabled if you
- * supply a JDBC connection. Hibernate will not be able to track
- * any statements you might have executed in the same transaction.
- * Consider implementing your own ConnectionProvider.
- *
- * @param connection a connection provided by the application.
- * @return Session
+ * Aggregator of special options used to build the SessionFactory.
*/
- public org.hibernate.classic.Session openSession(Connection connection);
+ public interface SessionFactoryOptions {
+ /**
+ * The service registry to use in building the factory.
+ *
+ * @return The service registry to use.
+ */
+ public StandardServiceRegistry getServiceRegistry();
+ /**
+ * Get the interceptor to use by default for all sessions opened from this factory.
+ *
+ * @return The interceptor to use factory wide. May be {@code null}
+ */
+ public Interceptor getInterceptor();
+
+ /**
+ * Get the delegate for handling entity-not-found exception conditions.
+ *
+ * @return The specific EntityNotFoundDelegate to use, May be {@code null}
+ */
+ public EntityNotFoundDelegate getEntityNotFoundDelegate();
+ }
+
/**
- * Create database connection and open a Session on it, specifying an
- * interceptor.
+ * Get the special options used to build the factory.
*
- * @param interceptor a session-scoped interceptor
- * @return Session
- * @throws HibernateException
+ * @return The special options used to build the factory.
*/
- public org.hibernate.classic.Session openSession(Interceptor interceptor) throws HibernateException;
+ public SessionFactoryOptions getSessionFactoryOptions();
/**
- * Open a Session on the given connection, specifying an interceptor.
- *
- * Note that the second-level cache will be disabled if you
- * supply a JDBC connection. Hibernate will not be able to track
- * any statements you might have executed in the same transaction.
- * Consider implementing your own ConnectionProvider.
+ * Obtain a {@link Session} builder.
*
- * @param connection a connection provided by the application.
- * @param interceptor a session-scoped interceptor
- * @return Session
+ * @return The session builder
*/
- public org.hibernate.classic.Session openSession(Connection connection, Interceptor interceptor);
+ public SessionBuilder withOptions();
/**
- * Create database connection and open a Session on it.
+ * Open a {@link Session}.
+ *
+ * JDBC {@link Connection connection(s} will be obtained from the
+ * configured {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider} as needed
+ * to perform requested work.
*
- * @return Session
- * @throws HibernateException
+ * @return The created session.
+ *
+ * @throws HibernateException Indicates a problem opening the session; pretty rare here.
*/
- public org.hibernate.classic.Session openSession() throws HibernateException;
+ public Session openSession() throws HibernateException;
/**
* Obtains the current session. The definition of what exactly "current"
- * means controlled by the {@link org.hibernate.context.CurrentSessionContext} impl configured
+ * means controlled by the {@link org.hibernate.context.spi.CurrentSessionContext} impl configured
* for use.
*
- * Note that for backwards compatibility, if a {@link org.hibernate.context.CurrentSessionContext}
- * is not configured but a JTA {@link org.hibernate.transaction.TransactionManagerLookup}
- * is configured this will default to the {@link org.hibernate.context.JTASessionContext}
+ * Note that for backwards compatibility, if a {@link org.hibernate.context.spi.CurrentSessionContext}
+ * is not configured but JTA is configured this will default to the {@link org.hibernate.context.internal.JTASessionContext}
* impl.
*
* @return The current session.
+ *
* @throws HibernateException Indicates an issue locating a suitable current session.
*/
- public org.hibernate.classic.Session getCurrentSession() throws HibernateException;
+ public Session getCurrentSession() throws HibernateException;
/**
- * Get the ClassMetadata associated with the given entity class
+ * Obtain a {@link StatelessSession} builder.
*
- * @see org.hibernate.metadata.ClassMetadata
+ * @return The stateless session builder
*/
- public ClassMetadata getClassMetadata(Class persistentClass) throws HibernateException;
+ public StatelessSessionBuilder withStatelessOptions();
/**
- * Get the ClassMetadata associated with the given entity name
+ * Open a new stateless session.
*
- * @see org.hibernate.metadata.ClassMetadata
- * @since 3.0
+ * @return The created stateless session.
*/
- public ClassMetadata getClassMetadata(String entityName) throws HibernateException;
+ public StatelessSession openStatelessSession();
/**
- * Get the CollectionMetadata associated with the named collection role
+ * Open a new stateless session, utilizing the specified JDBC
+ * {@link Connection}.
*
- * @see org.hibernate.metadata.CollectionMetadata
+ * @param connection Connection provided by the application.
+ *
+ * @return The created stateless session.
*/
- public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException;
+ public StatelessSession openStatelessSession(Connection connection);
+ /**
+ * Retrieve the {@link ClassMetadata} associated with the given entity class.
+ *
+ * @param entityClass The entity class
+ *
+ * @return The metadata associated with the given entity; may be null if no such
+ * entity was mapped.
+ *
+ * @throws HibernateException Generally null is returned instead of throwing.
+ */
+ public ClassMetadata getClassMetadata(Class entityClass);
/**
- * Get all ClassMetadata as a Map from entityname String
- * to metadata object
+ * Retrieve the {@link ClassMetadata} associated with the given entity class.
*
- * @see org.hibernate.metadata.ClassMetadata
- * @return a map from String an entity name to ClassMetaData
- * @since 3.0 changed key from Class to String
+ * @param entityName The entity class
+ *
+ * @return The metadata associated with the given entity; may be null if no such
+ * entity was mapped.
+ *
+ * @throws HibernateException Generally null is returned instead of throwing.
+ * @since 3.0
*/
- public Map getAllClassMetadata() throws HibernateException;
+ public ClassMetadata getClassMetadata(String entityName);
/**
- * Get all CollectionMetadata as a Map from role name
- * to metadata object
+ * Get the {@link CollectionMetadata} associated with the named collection role.
*
- * @see org.hibernate.metadata.CollectionMetadata
+ * @param roleName The collection role (in form [owning-entity-name].[collection-property-name]).
+ *
+ * @return The metadata associated with the given collection; may be null if no such
+ * collection was mapped.
+ *
+ * @throws HibernateException Generally null is returned instead of throwing.
+ */
+ public CollectionMetadata getCollectionMetadata(String roleName);
+
+ /**
+ * Retrieve the {@link ClassMetadata} for all mapped entities.
+ *
+ * @return A map containing all {@link ClassMetadata} keyed by the
+ * corresponding {@link String} entity-name.
+ *
+ * @throws HibernateException Generally empty map is returned instead of throwing.
+ *
+ * @since 3.0 changed key from {@link Class} to {@link String}.
+ */
+ public Map getAllClassMetadata();
+
+ /**
+ * Get the {@link CollectionMetadata} for all mapped collections.
+ *
* @return a map from String to CollectionMetadata
+ *
+ * @throws HibernateException Generally empty map is returned instead of throwing.
*/
- public Map getAllCollectionMetadata() throws HibernateException;
+ public Map getAllCollectionMetadata();
/**
- * Get the statistics for this session factory
+ * Retrieve the statistics fopr this factory.
+ *
+ * @return The statistics.
*/
public Statistics getStatistics();
/**
* Destroy this SessionFactory and release all resources (caches,
- * connection pools, etc). It is the responsibility of the application
- * to ensure that there are no open Sessions before calling
- * close().
+ * connection pools, etc).
+ *
+ * It is the responsibility of the application to ensure that there are no
+ * open {@link Session sessions} before calling this method as the impact
+ * on those {@link Session sessions} is indeterminate.
+ *
+ * No-ops if already {@link #isClosed closed}.
+ *
+ * @throws HibernateException Indicates an issue closing the factory.
*/
public void close() throws HibernateException;
/**
- * Was this SessionFactory already closed?
+ * Is this factory already closed?
+ *
+ * @return True if this factory is already closed; false otherwise.
*/
public boolean isClosed();
/**
+ * Obtain direct access to the underlying cache regions.
+ *
+ * @return The direct cache access API.
+ */
+ public Cache getCache();
+
+ /**
* Evict all entries from the second-level cache. This method occurs outside
* of any transaction; it performs an immediate "hard" remove, so does not respect
* any transaction isolation semantics of the usage strategy. Use with care.
+ *
+ * @param persistentClass The entity class for which to evict data.
+ *
+ * @throws HibernateException Generally will mean that either that
+ * 'persisttentClass' did not name a mapped entity or a problem
+ * communicating with underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#evictEntityRegion(Class)} accessed through
+ * {@link #getCache()} instead.
*/
+ @Deprecated
public void evict(Class persistentClass) throws HibernateException;
+
/**
* Evict an entry from the second-level cache. This method occurs outside
* of any transaction; it performs an immediate "hard" remove, so does not respect
* any transaction isolation semantics of the usage strategy. Use with care.
+ *
+ * @param persistentClass The entity class for which to evict data.
+ * @param id The entity id
+ *
+ * @throws HibernateException Generally will mean that either that
+ * 'persisttentClass' did not name a mapped entity or a problem
+ * communicating with underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#containsEntity(Class, Serializable)} accessed through
+ * {@link #getCache()} instead.
*/
+ @Deprecated
public void evict(Class persistentClass, Serializable id) throws HibernateException;
+
/**
* Evict all entries from the second-level cache. This method occurs outside
* of any transaction; it performs an immediate "hard" remove, so does not respect
* any transaction isolation semantics of the usage strategy. Use with care.
+ *
+ * @param entityName The entity name for which to evict data.
+ *
+ * @throws HibernateException Generally will mean that either that
+ * 'persisttentClass' did not name a mapped entity or a problem
+ * communicating with underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#evictEntityRegion(String)} accessed through
+ * {@link #getCache()} instead.
*/
+ @Deprecated
public void evictEntity(String entityName) throws HibernateException;
+
/**
* Evict an entry from the second-level cache. This method occurs outside
* of any transaction; it performs an immediate "hard" remove, so does not respect
* any transaction isolation semantics of the usage strategy. Use with care.
+ *
+ * @param entityName The entity name for which to evict data.
+ * @param id The entity id
+ *
+ * @throws HibernateException Generally will mean that either that
+ * 'persisttentClass' did not name a mapped entity or a problem
+ * communicating with underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#evictEntity(String,Serializable)} accessed through
+ * {@link #getCache()} instead.
*/
+ @Deprecated
public void evictEntity(String entityName, Serializable id) throws HibernateException;
+
/**
* Evict all entries from the second-level cache. This method occurs outside
* of any transaction; it performs an immediate "hard" remove, so does not respect
* any transaction isolation semantics of the usage strategy. Use with care.
+ *
+ * @param roleName The name of the collection role whose regions should be evicted
+ *
+ * @throws HibernateException Generally will mean that either that
+ * 'roleName' did not name a mapped collection or a problem
+ * communicating with underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#evictCollectionRegion(String)} accessed through
+ * {@link #getCache()} instead.
*/
+ @Deprecated
public void evictCollection(String roleName) throws HibernateException;
+
/**
* Evict an entry from the second-level cache. This method occurs outside
* of any transaction; it performs an immediate "hard" remove, so does not respect
* any transaction isolation semantics of the usage strategy. Use with care.
+ *
+ * @param roleName The name of the collection role
+ * @param id The id of the collection owner
+ *
+ * @throws HibernateException Generally will mean that either that
+ * 'roleName' did not name a mapped collection or a problem
+ * communicating with underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#evictCollection(String,Serializable)} accessed through
+ * {@link #getCache()} instead.
*/
+ @Deprecated
public void evictCollection(String roleName, Serializable id) throws HibernateException;
/**
- * Evict any query result sets cached in the default query cache region.
- */
- public void evictQueries() throws HibernateException;
- /**
* Evict any query result sets cached in the named query cache region.
+ *
+ * @param cacheRegion The named query cache region from which to evict.
+ *
+ * @throws HibernateException Since a not-found 'cacheRegion' simply no-ops,
+ * this should indicate a problem communicating with underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#evictQueryRegion(String)} accessed through
+ * {@link #getCache()} instead.
*/
+ @Deprecated
public void evictQueries(String cacheRegion) throws HibernateException;
+
/**
- * Get a new stateless session.
+ * Evict any query result sets cached in the default query cache region.
+ *
+ * @throws HibernateException Indicate a problem communicating with
+ * underlying cache impl.
+ *
+ * @deprecated Use {@link Cache#evictQueryRegions} accessed through
+ * {@link #getCache()} instead.
*/
- public StatelessSession openStatelessSession();
- /**
- * Get a new stateless session for the given JDBC connection.
- */
- public StatelessSession openStatelessSession(Connection connection);
+ @Deprecated
+ public void evictQueries() throws HibernateException;
/**
* Obtain a set of the names of all filters defined on this SessionFactory.
@@ -244,4 +384,20 @@
* @throws HibernateException If no filter defined with the given name.
*/
public FilterDefinition getFilterDefinition(String filterName) throws HibernateException;
+
+ /**
+ * Determine if this session factory contains a fetch profile definition
+ * registered under the given name.
+ *
+ * @param name The name to check
+ * @return True if there is such a fetch profile; false otherwise.
+ */
+ public boolean containsFetchProfileDefinition(String name);
+
+ /**
+ * Retrieve this factory's {@link TypeHelper}.
+ *
+ * @return The factory's {@link TypeHelper}
+ */
+ public TypeHelper getTypeHelper();
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/SharedSessionBuilder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/SharedSessionContract.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/SimpleNaturalIdLoadAccess.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/StaleObjectStateException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/StaleObjectStateException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/StaleObjectStateException.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/StaleObjectStateException.java 30 Jul 2014 16:16: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,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
@@ -29,19 +28,24 @@
import org.hibernate.pretty.MessageHelper;
/**
- * A StaleStateException that carries information
- * about a particular entity instance that was the source
- * of the failure.
+ * A specialized StaleStateException that carries information about the particular entity
+ * instance that was the source of the failure.
*
* @author Gavin King
*/
public class StaleObjectStateException extends StaleStateException {
private final String entityName;
private final Serializable identifier;
- public StaleObjectStateException(String persistentClass, Serializable identifier) {
- super("Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)");
- this.entityName = persistentClass;
+ /**
+ * Constructs a StaleObjectStateException using the supplied information.
+ *
+ * @param entityName The name of the entity
+ * @param identifier The identifier of the entity
+ */
+ public StaleObjectStateException(String entityName, Serializable identifier) {
+ super( "Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)" );
+ this.entityName = entityName;
this.identifier = identifier;
}
@@ -54,8 +58,7 @@
}
public String getMessage() {
- return super.getMessage() + ": " +
- MessageHelper.infoString(entityName, identifier);
+ return super.getMessage() + " : " + MessageHelper.infoString( entityName, identifier );
}
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/StatelessSessionBuilder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/TypeMismatchException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/TypeMismatchException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/TypeMismatchException.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/TypeMismatchException.java 30 Jul 2014 16:16: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,25 +20,21 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
/**
- * Used when a user provided type does not match the expected one
+ * Used when a user provided type does not match the expected one.
*
* @author Emmanuel Bernard
*/
public class TypeMismatchException extends HibernateException {
- public TypeMismatchException(Throwable root) {
- super( root );
+ /**
+ * Constructs a TypeMismatchException using the supplied message.
+ *
+ * @param message The message explaining the exception condition
+ */
+ public TypeMismatchException(String message) {
+ super( message );
}
-
- public TypeMismatchException(String s) {
- super( s );
- }
-
- public TypeMismatchException(String string, Throwable root) {
- super( string, root );
- }
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/Version.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/WrongClassException.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/WrongClassException.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/WrongClassException.java 17 Aug 2012 14:36:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/WrongClassException.java 30 Jul 2014 16:16: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,51 +20,47 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate;
import java.io.Serializable;
/**
- * Thrown when Session.load() selects a row with
- * the given primary key (identifier value) but the row's
- * discriminator value specifies a subclass that is not
- * assignable to the class requested by the user.
+ * Thrown when loading an entity (by identifier) results in a value that cannot be treated as the subclass
+ * type requested by the caller.
*
* @author Gavin King
*/
public class WrongClassException extends HibernateException {
-
private final Serializable identifier;
private final String entityName;
- public WrongClassException(String msg, Serializable identifier, String clazz) {
- super(msg);
+ /**
+ * Constructs a WrongClassException using the supplied information.
+ *
+ * @param message A message explaining the exception condition
+ * @param identifier The identifier of the entity
+ * @param entityName The entity-type requested
+ */
+ public WrongClassException(String message, Serializable identifier, String entityName) {
+ super(
+ String.format(
+ "Object [id=%s] was not of the specified subclass [%s] : %s",
+ identifier,
+ entityName,
+ message
+ )
+ );
this.identifier = identifier;
- this.entityName = clazz;
+ this.entityName = entityName;
}
- public Serializable getIdentifier() {
- return identifier;
- }
- public String getMessage() {
- return "Object with id: " +
- identifier +
- " was not of the specified subclass: " +
- entityName +
- " (" + super.getMessage() + ")" ;
- }
-
public String getEntityName() {
return entityName;
}
+ public Serializable getIdentifier() {
+ return identifier;
+ }
}
-
-
-
-
-
-
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hibernate-configuration-3.0.dtd'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/hibernate-mapping-3.0.dtd'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/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/annotations/Any.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/AnyMetaDef.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/AnyMetaDefs.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/AttributeAccessor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/BatchSize.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Cache.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/CacheConcurrencyStrategy.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/CacheModeType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/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/annotations/CascadeType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Check.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/CollectionId.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/CollectionType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ColumnDefault.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ColumnTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ColumnTransformers.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Columns.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/CreationTimestamp.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/DiscriminatorFormula.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/DiscriminatorOptions.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/DynamicInsert.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/DynamicUpdate.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Entity.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/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/annotations/FetchMode.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/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/annotations/FetchProfiles.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Filter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/FilterDef.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/FilterDefs.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/FilterJoinTable.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/FilterJoinTables.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Filters.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/FlushModeType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ForeignKey.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Formula.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Generated.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/GenerationTime.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/GeneratorType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/GenericGenerator.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/GenericGenerators.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Immutable.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Index.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/IndexColumn.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/JoinColumnOrFormula.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/JoinColumnsOrFormulas.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/JoinFormula.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/LazyCollection.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/LazyCollectionOption.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/LazyToOne.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/LazyToOneOption.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ListIndexBase.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Loader.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ManyToAny.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/MapKeyType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/MetaValue.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NamedNativeQueries.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NamedNativeQuery.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NamedQueries.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NamedQuery.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Nationalized.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NaturalId.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NaturalIdCache.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NotFound.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/NotFoundAction.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/OnDelete.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/OnDeleteAction.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/OptimisticLock.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/OptimisticLockType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/OptimisticLocking.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/OrderBy.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ParamDef.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Parameter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Parent.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Persister.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Polymorphism.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/PolymorphismType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Proxy.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/QueryHints.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ResultCheckStyle.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/RowId.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SQLDelete.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SQLDeleteAll.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SQLInsert.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SQLUpdate.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SelectBeforeUpdate.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Sort.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SortComparator.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SortNatural.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SortType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Source.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SourceType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/SqlFragmentAlias.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Subselect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Synchronize.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Table.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Tables.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Target.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Tuplizer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Tuplizers.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Type.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/TypeDef.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/TypeDefs.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/UpdateTimestamp.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/ValueGenerationType.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/Where.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/WhereJoinTable.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/annotations/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/bytecode/AbstractClassTransformerImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/BasicProxyFactory.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/BytecodeProvider.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/ClassTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/InstrumentedClassLoader.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/ProxyFactoryFactory.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/ReflectionOptimizer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/bytecode/package.html
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/bytecode/package.html,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/bytecode/package.html 17 Aug 2012 14:33:54 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/bytecode/package.html 30 Jul 2014 16:16:33 -0000 1.1.2.1
@@ -1,10 +1,10 @@
@@ -46,9 +45,6 @@
- Currently, both CGLIB and Javassist are supported out-of-the-box.
-
-
Note that for field-level interception, simply plugging in a new {@link BytecodeProvider}
is not enough for Hibernate to be able to recognize new providers. You would additionally
need to make appropriate code changes to the {@link org.hibernate.intercept.Helper}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/internal/JavassistInstrumenter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/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/bytecode/buildtime/spi/AbstractInstrumenter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/spi/BasicClassFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/spi/ClassDescriptor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/spi/ClassFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/spi/ExecutionException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/spi/FieldFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/spi/Instrumenter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/spi/Logger.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/buildtime/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/bytecode/cglib/AccessOptimizerAdapter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/cglib/BytecodeProviderImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/cglib/CglibClassTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/cglib/InstantiationOptimizerAdapter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/cglib/ProxyFactoryFactoryImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/cglib/ReflectionOptimizerImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/enhance/EnhancementException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/enhance/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/bytecode/enhance/spi/CollectionTracker.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/enhance/spi/CompositeOwnerTracker.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/enhance/spi/EnhancementContext.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/enhance/spi/Enhancer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/enhance/spi/EnhancerConstants.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/enhance/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/bytecode/instrumentation/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/bytecode/instrumentation/internal/FieldInterceptionHelper.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/instrumentation/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/bytecode/instrumentation/internal/javassist/FieldInterceptorImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/instrumentation/internal/javassist/JavassistHelper.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/instrumentation/internal/javassist/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/bytecode/instrumentation/spi/AbstractFieldInterceptor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/instrumentation/spi/FieldInterceptor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/instrumentation/spi/LazyPropertyInitializer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/instrumentation/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/bytecode/internal/javassist/AccessOptimizerAdapter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/BulkAccessor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/BulkAccessorException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/BulkAccessorFactory.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/BytecodeProviderImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/FastClass.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/FieldFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/FieldHandled.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/FieldHandler.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/FieldTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/InstantiationOptimizerAdapter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/JavassistClassTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/ProxyFactoryFactoryImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/ReflectionOptimizerImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/TransformingClassLoader.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/internal/javassist/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/bytecode/javassist/AccessOptimizerAdapter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/BulkAccessor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/BulkAccessorException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/BulkAccessorFactory.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/BytecodeProviderImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/FastClass.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/FieldFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/FieldHandled.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/FieldHandler.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/FieldTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/InstantiationOptimizerAdapter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/JavassistClassTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/ProxyFactoryFactoryImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/ReflectionOptimizerImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/javassist/TransformingClassLoader.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/AbstractClassTransformerImpl.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/BasicProxyFactory.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/ByteCodeHelper.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/BytecodeProvider.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/ClassTransformer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/EntityInstrumentationMetadata.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/InstrumentedClassLoader.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/NotInstrumentedException.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/ProxyFactoryFactory.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/spi/ReflectionOptimizer.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/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/bytecode/util/BasicClassFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/util/ByteCodeHelper.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/util/ClassDescriptor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/util/ClassFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/bytecode/util/FieldFilter.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/classic/Lifecycle.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/classic/Lifecycle.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/classic/Lifecycle.java 17 Aug 2012 14:34:03 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/classic/Lifecycle.java 30 Jul 2014 16:16:48 -0000 1.1.2.1
@@ -23,7 +23,6 @@
*
*/
package org.hibernate.classic;
-
import java.io.Serializable;
import org.hibernate.CallbackException;
@@ -76,7 +75,7 @@
* Called when an entity is saved.
* @param s the session
* @return true to veto save
- * @throws CallbackException
+ * @throws CallbackException Indicates a problem happened during callback
*/
public boolean onSave(Session s) throws CallbackException;
@@ -86,15 +85,15 @@
* state is persisted during a flush.
* @param s the session
* @return true to veto update
- * @throws CallbackException
+ * @throws CallbackException Indicates a problem happened during callback
*/
public boolean onUpdate(Session s) throws CallbackException;
/**
* Called when an entity is deleted.
* @param s the session
* @return true to veto delete
- * @throws CallbackException
+ * @throws CallbackException Indicates a problem happened during callback
*/
public boolean onDelete(Session s) throws CallbackException;
@@ -109,9 +108,3 @@
*/
public void onLoad(Session s, Serializable id);
}
-
-
-
-
-
-
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/classic/Session.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/classic/Validatable.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/classic/ValidationFailure.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/AbstractPersistentCollection.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentArrayHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentBag.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentCollection.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentIdentifierBag.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentIndexedElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentList.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentListElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentMap.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentMapElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentSet.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentSortedMap.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/PersistentSortedSet.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/AbstractPersistentCollection.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentArrayHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentBag.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentIdentifierBag.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentIndexedElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentList.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentListElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentMap.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentMapElementHolder.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentSet.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentSortedMap.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/internal/PersistentSortedSet.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/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/collection/spi/PersistentCollection.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/collection/spi/package-info.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/MatchMode.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/MatchMode.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/criterion/MatchMode.java 17 Aug 2012 14:33:50 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/MatchMode.java 30 Jul 2014 16:17: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) 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,80 +20,63 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.criterion;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Represents an strategy for matching strings using "like".
*
- * @see Example#enableLike(MatchMode)
* @author Gavin King
+ * @see Example#enableLike(MatchMode)
*/
-public abstract class MatchMode implements Serializable {
- private final String name;
- private static final Map INSTANCES = new HashMap();
+public enum MatchMode {
- protected MatchMode(String name) {
- this.name=name;
- }
- public String toString() {
- return name;
- }
-
/**
* Match the entire string to the pattern
*/
- public static final MatchMode EXACT = new MatchMode("EXACT") {
+ EXACT {
+ @Override
public String toMatchString(String pattern) {
return pattern;
}
- };
+ },
/**
* Match the start of the string to the pattern
*/
- public static final MatchMode START = new MatchMode("START") {
+ START {
+ @Override
public String toMatchString(String pattern) {
return pattern + '%';
}
- };
+ },
/**
* Match the end of the string to the pattern
*/
- public static final MatchMode END = new MatchMode("END") {
+ END {
+ @Override
public String toMatchString(String pattern) {
return '%' + pattern;
}
- };
+ },
/**
* Match the pattern anywhere in the string
*/
- public static final MatchMode ANYWHERE = new MatchMode("ANYWHERE") {
+ ANYWHERE {
+ @Override
public String toMatchString(String pattern) {
return '%' + pattern + '%';
}
};
- static {
- INSTANCES.put( EXACT.name, EXACT );
- INSTANCES.put( END.name, END );
- INSTANCES.put( START.name, START );
- INSTANCES.put( ANYWHERE.name, ANYWHERE );
- }
-
- private Object readResolve() {
- return INSTANCES.get(name);
- }
-
/**
- * convert the pattern, by appending/prepending "%"
+ * Convert the pattern, by appending/prepending "%"
+ *
+ * @param pattern The pattern for convert according to the mode
+ *
+ * @return The converted pattern
*/
public abstract String toMatchString(String pattern);
Index: 3rdParty_sources/hibernate-core/org/hibernate/criterion/Order.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/criterion/Order.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/criterion/Order.java 17 Aug 2012 14:33:48 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/criterion/Order.java 30 Jul 2014 16:17: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) 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,87 +20,153 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.criterion;
import java.io.Serializable;
import java.sql.Types;
import org.hibernate.Criteria;
-import org.hibernate.HibernateException;
-import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.NullPrecedence;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.type.Type;
/**
- * Represents an order imposed upon a Criteria result set
+ * Represents an ordering imposed upon the results of a Criteria
+ *
* @author Gavin King
+ * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
*/
public class Order implements Serializable {
-
private boolean ascending;
private boolean ignoreCase;
private String propertyName;
-
- public String toString() {
- return propertyName + ' ' + (ascending?"asc":"desc");
+ private NullPrecedence nullPrecedence;
+
+ /**
+ * Ascending order
+ *
+ * @param propertyName The property to order on
+ *
+ * @return The build Order instance
+ */
+ public static Order asc(String propertyName) {
+ return new Order( propertyName, true );
}
-
- public Order ignoreCase() {
- ignoreCase = true;
- return this;
+
+ /**
+ * Descending order.
+ *
+ * @param propertyName The property to order on
+ *
+ * @return The build Order instance
+ */
+ public static Order desc(String propertyName) {
+ return new Order( propertyName, false );
}
/**
- * Constructor for Order.
+ * Constructor for Order. Order instances are generally created by factory methods.
+ *
+ * @see #asc
+ * @see #desc
*/
protected Order(String propertyName, boolean ascending) {
this.propertyName = propertyName;
this.ascending = ascending;
}
/**
- * Render the SQL fragment
+ * Should this ordering ignore case? Has no effect on non-character properties.
*
+ * @return {@code this}, for method chaining
*/
- public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
- throws HibernateException {
- String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
- Type type = criteriaQuery.getTypeUsingProjection(criteria, propertyName);
- StringBuffer fragment = new StringBuffer();
- for ( int i=0; i
- *
- * Compatible with Cach� 2007.1.
- *
- *
- * Caché and Hibernate
- *
- *
- *
Caché and Hibernate
+ * Caché 2007.1 dialect.
+ *
+ * This class is required in order to use Hibernate with Intersystems Caché SQL. Compatible with
+ * Caché 2007.1.
+ *
*
PREREQUISITES
* These setup instructions assume that both Caché and Hibernate are installed and operational.
*
@@ -141,11 +140,9 @@
*
*
*
- *
- *
Note 1
- *
Please contact your administrator for the userid and password you should use when attempting access via JDBC.
- * By default, these are chosen to be "_SYSTEM" and "SYS" respectively as noted in the SQL standard.
- *
+ * NOTE: Please contact your administrator for the userid and password you should use when
+ * attempting access via JDBC. By default, these are chosen to be "_SYSTEM" and "SYS" respectively
+ * as noted in the SQL standard.
*
*
CACHÉ VERSION URL
* This is the standard URL for the JDBC driver.
@@ -212,8 +209,8 @@
public class Cache71Dialect extends Dialect {
/**
- * Creates new Cach�71Dialect instance. Sets up the JDBC /
- * Cach� type mappings.
+ * Creates new Cache71Dialect instance. Sets up the JDBC /
+ * Caché type mappings.
*/
public Cache71Dialect() {
super();
@@ -236,283 +233,292 @@
registerColumnType( Types.DOUBLE, "double" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.INTEGER, "integer" );
- registerColumnType( Types.LONGVARBINARY, "longvarbinary" ); // binary %Stream
- registerColumnType( Types.LONGVARCHAR, "longvarchar" ); // character %Stream
+ registerColumnType( Types.LONGVARBINARY, "longvarbinary" );
+ registerColumnType( Types.LONGVARCHAR, "longvarchar" );
registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
registerColumnType( Types.REAL, "real" );
registerColumnType( Types.SMALLINT, "smallint" );
registerColumnType( Types.TIMESTAMP, "timestamp" );
registerColumnType( Types.TIME, "time" );
registerColumnType( Types.TINYINT, "tinyint" );
- // TBD should this be varbinary($1)?
- // registerColumnType(Types.VARBINARY, "binary($1)");
registerColumnType( Types.VARBINARY, "longvarbinary" );
registerColumnType( Types.VARCHAR, "varchar($l)" );
registerColumnType( Types.BLOB, "longvarbinary" );
registerColumnType( Types.CLOB, "longvarchar" );
getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "false" );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
- //getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
getDefaultProperties().setProperty( Environment.USE_SQL_COMMENTS, "false" );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
- registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", Hibernate.DOUBLE ) );
- registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", Hibernate.STRING ) );
- registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.STRING ) );
- registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", Hibernate.DOUBLE ) );
- registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", Hibernate.DOUBLE ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "($length(?1)*8)" ) );
- // hibernate impelemnts cast in Dialect.java
- registerFunction( "ceiling", new StandardSQLFunction( "ceiling", Hibernate.INTEGER ) );
- registerFunction( "char", new StandardJDBCEscapeFunction( "char", Hibernate.CHARACTER ) );
- registerFunction( "character_length", new StandardSQLFunction( "character_length", Hibernate.INTEGER ) );
- registerFunction( "char_length", new StandardSQLFunction( "char_length", Hibernate.INTEGER ) );
- registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", Hibernate.DOUBLE ) );
- registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", Hibernate.DOUBLE ) );
+ registerFunction( "acos", new StandardJDBCEscapeFunction( "acos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "%alphaup", new StandardSQLFunction( "%alphaup", StandardBasicTypes.STRING ) );
+ registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.STRING ) );
+ registerFunction( "asin", new StandardJDBCEscapeFunction( "asin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan", new StandardJDBCEscapeFunction( "atan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "($length(?1)*8)" ) );
+ registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char", new StandardJDBCEscapeFunction( "char", StandardBasicTypes.CHARACTER ) );
+ registerFunction( "character_length", new StandardSQLFunction( "character_length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char_length", new StandardSQLFunction( "char_length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "cos", new StandardJDBCEscapeFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cot", new StandardJDBCEscapeFunction( "cot", StandardBasicTypes.DOUBLE ) );
registerFunction( "coalesce", new VarArgsSQLFunction( "coalesce(", ",", ")" ) );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "", "||", "" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "||", "" ) );
registerFunction( "convert", new ConvertFunction() );
- registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", Hibernate.DATE ) );
- registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
- registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
+ registerFunction( "curdate", new StandardJDBCEscapeFunction( "curdate", StandardBasicTypes.DATE ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME, false ) );
registerFunction(
- "current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", Hibernate.TIMESTAMP )
+ "current_timestamp", new ConditionalParenthesisFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP )
);
- registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", Hibernate.TIME ) );
- registerFunction( "database", new StandardJDBCEscapeFunction( "database", Hibernate.STRING ) );
- registerFunction( "dateadd", new VarArgsSQLFunction( Hibernate.TIMESTAMP, "dateadd(", ",", ")" ) );
- registerFunction( "datediff", new VarArgsSQLFunction( Hibernate.INTEGER, "datediff(", ",", ")" ) );
- registerFunction( "datename", new VarArgsSQLFunction( Hibernate.STRING, "datename(", ",", ")" ) );
- registerFunction( "datepart", new VarArgsSQLFunction( Hibernate.INTEGER, "datepart(", ",", ")" ) );
- registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
- registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", Hibernate.STRING ) );
- registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", Hibernate.INTEGER ) );
- registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", Hibernate.INTEGER ) );
- registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", Hibernate.INTEGER ) );
+ registerFunction( "curtime", new StandardJDBCEscapeFunction( "curtime", StandardBasicTypes.TIME ) );
+ registerFunction( "database", new StandardJDBCEscapeFunction( "database", StandardBasicTypes.STRING ) );
+ registerFunction( "dateadd", new VarArgsSQLFunction( StandardBasicTypes.TIMESTAMP, "dateadd(", ",", ")" ) );
+ registerFunction( "datediff", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "datediff(", ",", ")" ) );
+ registerFunction( "datename", new VarArgsSQLFunction( StandardBasicTypes.STRING, "datename(", ",", ")" ) );
+ registerFunction( "datepart", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "datepart(", ",", ")" ) );
+ registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayname", new StandardJDBCEscapeFunction( "dayname", StandardBasicTypes.STRING ) );
+ registerFunction( "dayofmonth", new StandardJDBCEscapeFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofweek", new StandardJDBCEscapeFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofyear", new StandardJDBCEscapeFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
// is it necessary to register %exact since it can only appear in a where clause?
- registerFunction( "%exact", new StandardSQLFunction( "%exact", Hibernate.STRING ) );
- registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", Hibernate.DOUBLE ) );
- registerFunction( "%external", new StandardSQLFunction( "%external", Hibernate.STRING ) );
- registerFunction( "$extract", new VarArgsSQLFunction( Hibernate.INTEGER, "$extract(", ",", ")" ) );
- registerFunction( "$find", new VarArgsSQLFunction( Hibernate.INTEGER, "$find(", ",", ")" ) );
- registerFunction( "floor", new StandardSQLFunction( "floor", Hibernate.INTEGER ) );
- registerFunction( "getdate", new StandardSQLFunction( "getdate", Hibernate.TIMESTAMP ) );
- registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", Hibernate.INTEGER ) );
+ registerFunction( "%exact", new StandardSQLFunction( "%exact", StandardBasicTypes.STRING ) );
+ registerFunction( "exp", new StandardJDBCEscapeFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "%external", new StandardSQLFunction( "%external", StandardBasicTypes.STRING ) );
+ registerFunction( "$extract", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "$extract(", ",", ")" ) );
+ registerFunction( "$find", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "$find(", ",", ")" ) );
+ registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.INTEGER ) );
+ registerFunction( "getdate", new StandardSQLFunction( "getdate", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "hour", new StandardJDBCEscapeFunction( "hour", StandardBasicTypes.INTEGER ) );
registerFunction( "ifnull", new VarArgsSQLFunction( "ifnull(", ",", ")" ) );
registerFunction( "%internal", new StandardSQLFunction( "%internal" ) );
registerFunction( "isnull", new VarArgsSQLFunction( "isnull(", ",", ")" ) );
- registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", Hibernate.INTEGER ) );
- registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", Hibernate.STRING ) );
- registerFunction( "left", new StandardJDBCEscapeFunction( "left", Hibernate.STRING ) );
- registerFunction( "len", new StandardSQLFunction( "len", Hibernate.INTEGER ) );
- registerFunction( "length", new StandardSQLFunction( "length", Hibernate.INTEGER ) );
+ registerFunction( "isnumeric", new StandardSQLFunction( "isnumeric", StandardBasicTypes.INTEGER ) );
+ registerFunction( "lcase", new StandardJDBCEscapeFunction( "lcase", StandardBasicTypes.STRING ) );
+ registerFunction( "left", new StandardJDBCEscapeFunction( "left", StandardBasicTypes.STRING ) );
+ registerFunction( "len", new StandardSQLFunction( "len", StandardBasicTypes.INTEGER ) );
registerFunction( "$length", new VarArgsSQLFunction( "$length(", ",", ")" ) );
- // aggregate functions shouldn't be registered, right?
- //registerFunction( "list", new StandardSQLFunction("list",Hibernate.STRING) );
- // stopped on $list
registerFunction( "$list", new VarArgsSQLFunction( "$list(", ",", ")" ) );
registerFunction( "$listdata", new VarArgsSQLFunction( "$listdata(", ",", ")" ) );
registerFunction( "$listfind", new VarArgsSQLFunction( "$listfind(", ",", ")" ) );
registerFunction( "$listget", new VarArgsSQLFunction( "$listget(", ",", ")" ) );
- registerFunction( "$listlength", new StandardSQLFunction( "$listlength", Hibernate.INTEGER ) );
- registerFunction( "locate", new StandardSQLFunction( "$FIND", Hibernate.INTEGER ) );
- registerFunction( "log", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
- registerFunction( "log10", new StandardJDBCEscapeFunction( "log", Hibernate.DOUBLE ) );
+ registerFunction( "$listlength", new StandardSQLFunction( "$listlength", StandardBasicTypes.INTEGER ) );
+ registerFunction( "locate", new StandardSQLFunction( "$FIND", StandardBasicTypes.INTEGER ) );
+ registerFunction( "log", new StandardJDBCEscapeFunction( "log", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log10", new StandardJDBCEscapeFunction( "log", StandardBasicTypes.DOUBLE ) );
registerFunction( "lower", new StandardSQLFunction( "lower" ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
- registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", Hibernate.INTEGER ) );
- registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", Hibernate.DOUBLE ) );
- registerFunction( "month", new StandardJDBCEscapeFunction( "month", Hibernate.INTEGER ) );
- registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", Hibernate.STRING ) );
- registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", Hibernate.TIMESTAMP ) );
+ registerFunction( "minute", new StandardJDBCEscapeFunction( "minute", StandardBasicTypes.INTEGER ) );
+ registerFunction( "mod", new StandardJDBCEscapeFunction( "mod", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "month", new StandardJDBCEscapeFunction( "month", StandardBasicTypes.INTEGER ) );
+ registerFunction( "monthname", new StandardJDBCEscapeFunction( "monthname", StandardBasicTypes.STRING ) );
+ registerFunction( "now", new StandardJDBCEscapeFunction( "monthname", StandardBasicTypes.TIMESTAMP ) );
registerFunction( "nullif", new VarArgsSQLFunction( "nullif(", ",", ")" ) );
registerFunction( "nvl", new NvlFunction() );
registerFunction( "%odbcin", new StandardSQLFunction( "%odbcin" ) );
registerFunction( "%odbcout", new StandardSQLFunction( "%odbcin" ) );
- registerFunction( "%pattern", new VarArgsSQLFunction( Hibernate.STRING, "", "%pattern", "" ) );
- registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", Hibernate.DOUBLE ) );
- registerFunction( "$piece", new VarArgsSQLFunction( Hibernate.STRING, "$piece(", ",", ")" ) );
- registerFunction( "position", new VarArgsSQLFunction( Hibernate.INTEGER, "position(", " in ", ")" ) );
- registerFunction( "power", new VarArgsSQLFunction( Hibernate.STRING, "power(", ",", ")" ) );
- registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", Hibernate.INTEGER ) );
- registerFunction( "repeat", new VarArgsSQLFunction( Hibernate.STRING, "repeat(", ",", ")" ) );
- registerFunction( "replicate", new VarArgsSQLFunction( Hibernate.STRING, "replicate(", ",", ")" ) );
- registerFunction( "right", new StandardJDBCEscapeFunction( "right", Hibernate.STRING ) );
- registerFunction( "round", new VarArgsSQLFunction( Hibernate.FLOAT, "round(", ",", ")" ) );
- registerFunction( "rtrim", new StandardSQLFunction( "rtrim", Hibernate.STRING ) );
- registerFunction( "second", new StandardJDBCEscapeFunction( "second", Hibernate.INTEGER ) );
- registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
- registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", Hibernate.DOUBLE ) );
- registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
- registerFunction( "%sqlstring", new VarArgsSQLFunction( Hibernate.STRING, "%sqlstring(", ",", ")" ) );
- registerFunction( "%sqlupper", new VarArgsSQLFunction( Hibernate.STRING, "%sqlupper(", ",", ")" ) );
- registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", Hibernate.DOUBLE ) );
- registerFunction( "%startswith", new VarArgsSQLFunction( Hibernate.STRING, "", "%startswith", "" ) );
+ registerFunction( "%pattern", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "%pattern", "" ) );
+ registerFunction( "pi", new StandardJDBCEscapeFunction( "pi", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "$piece", new VarArgsSQLFunction( StandardBasicTypes.STRING, "$piece(", ",", ")" ) );
+ registerFunction( "position", new VarArgsSQLFunction( StandardBasicTypes.INTEGER, "position(", " in ", ")" ) );
+ registerFunction( "power", new VarArgsSQLFunction( StandardBasicTypes.STRING, "power(", ",", ")" ) );
+ registerFunction( "quarter", new StandardJDBCEscapeFunction( "quarter", StandardBasicTypes.INTEGER ) );
+ registerFunction( "repeat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "repeat(", ",", ")" ) );
+ registerFunction( "replicate", new VarArgsSQLFunction( StandardBasicTypes.STRING, "replicate(", ",", ")" ) );
+ registerFunction( "right", new StandardJDBCEscapeFunction( "right", StandardBasicTypes.STRING ) );
+ registerFunction( "round", new VarArgsSQLFunction( StandardBasicTypes.FLOAT, "round(", ",", ")" ) );
+ registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
+ registerFunction( "second", new StandardJDBCEscapeFunction( "second", StandardBasicTypes.INTEGER ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
+ registerFunction( "sin", new StandardJDBCEscapeFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
+ registerFunction( "%sqlstring", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%sqlstring(", ",", ")" ) );
+ registerFunction( "%sqlupper", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%sqlupper(", ",", ")" ) );
+ registerFunction( "sqrt", new StandardJDBCEscapeFunction( "SQRT", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "%startswith", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "%startswith", "" ) );
// below is for Cache' that don't have str in 2007.1 there is str and we register str directly
- registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "cast(?1 as char varying)" ) );
- registerFunction( "string", new VarArgsSQLFunction( Hibernate.STRING, "string(", ",", ")" ) );
+ registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as char varying)" ) );
+ registerFunction( "string", new VarArgsSQLFunction( StandardBasicTypes.STRING, "string(", ",", ")" ) );
// note that %string is deprecated
- registerFunction( "%string", new VarArgsSQLFunction( Hibernate.STRING, "%string(", ",", ")" ) );
- registerFunction( "substr", new VarArgsSQLFunction( Hibernate.STRING, "substr(", ",", ")" ) );
- registerFunction( "substring", new VarArgsSQLFunction( Hibernate.STRING, "substring(", ",", ")" ) );
- registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", Hibernate.TIMESTAMP, false ) );
- registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", Hibernate.DOUBLE ) );
- registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", Hibernate.DOUBLE ) );
- registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", Hibernate.DOUBLE ) );
- registerFunction( "tochar", new VarArgsSQLFunction( Hibernate.STRING, "tochar(", ",", ")" ) );
- registerFunction( "to_char", new VarArgsSQLFunction( Hibernate.STRING, "to_char(", ",", ")" ) );
- registerFunction( "todate", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
- registerFunction( "to_date", new VarArgsSQLFunction( Hibernate.STRING, "todate(", ",", ")" ) );
+ registerFunction( "%string", new VarArgsSQLFunction( StandardBasicTypes.STRING, "%string(", ",", ")" ) );
+ registerFunction( "substr", new VarArgsSQLFunction( StandardBasicTypes.STRING, "substr(", ",", ")" ) );
+ registerFunction( "substring", new VarArgsSQLFunction( StandardBasicTypes.STRING, "substring(", ",", ")" ) );
+ registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.TIMESTAMP, false ) );
+ registerFunction( "tan", new StandardJDBCEscapeFunction( "tan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "timestampadd", new StandardJDBCEscapeFunction( "timestampadd", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "timestampdiff", new StandardJDBCEscapeFunction( "timestampdiff", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "tochar", new VarArgsSQLFunction( StandardBasicTypes.STRING, "tochar(", ",", ")" ) );
+ registerFunction( "to_char", new VarArgsSQLFunction( StandardBasicTypes.STRING, "to_char(", ",", ")" ) );
+ registerFunction( "todate", new VarArgsSQLFunction( StandardBasicTypes.STRING, "todate(", ",", ")" ) );
+ registerFunction( "to_date", new VarArgsSQLFunction( StandardBasicTypes.STRING, "todate(", ",", ")" ) );
registerFunction( "tonumber", new StandardSQLFunction( "tonumber" ) );
registerFunction( "to_number", new StandardSQLFunction( "tonumber" ) );
// TRIM(end_keyword string-expression-1 FROM string-expression-2)
// use Hibernate implementation "From" is one of the parameters they pass in position ?3
- //registerFunction( "trim", new SQLFunctionTemplate(Hibernate.STRING, "trim(?1 ?2 from ?3)") );
- registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", Hibernate.STRING ) );
- registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", Hibernate.STRING ) );
+ //registerFunction( "trim", new SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(?1 ?2 from ?3)") );
+ registerFunction( "truncate", new StandardJDBCEscapeFunction( "truncate", StandardBasicTypes.STRING ) );
+ registerFunction( "ucase", new StandardJDBCEscapeFunction( "ucase", StandardBasicTypes.STRING ) );
registerFunction( "upper", new StandardSQLFunction( "upper" ) );
// %upper is deprecated
registerFunction( "%upper", new StandardSQLFunction( "%upper" ) );
- registerFunction( "user", new StandardJDBCEscapeFunction( "user", Hibernate.STRING ) );
- registerFunction( "week", new StandardJDBCEscapeFunction( "user", Hibernate.INTEGER ) );
- registerFunction( "xmlconcat", new VarArgsSQLFunction( Hibernate.STRING, "xmlconcat(", ",", ")" ) );
- registerFunction( "xmlelement", new VarArgsSQLFunction( Hibernate.STRING, "xmlelement(", ",", ")" ) );
+ registerFunction( "user", new StandardJDBCEscapeFunction( "user", StandardBasicTypes.STRING ) );
+ registerFunction( "week", new StandardJDBCEscapeFunction( "user", StandardBasicTypes.INTEGER ) );
+ registerFunction( "xmlconcat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "xmlconcat(", ",", ")" ) );
+ registerFunction( "xmlelement", new VarArgsSQLFunction( StandardBasicTypes.STRING, "xmlelement(", ",", ")" ) );
// xmlforest requires a new kind of function constructor
- registerFunction( "year", new StandardJDBCEscapeFunction( "year", Hibernate.INTEGER ) );
+ registerFunction( "year", new StandardJDBCEscapeFunction( "year", StandardBasicTypes.INTEGER ) );
}
protected final void register71Functions() {
- this.registerFunction( "str", new VarArgsSQLFunction( Hibernate.STRING, "str(", ",", ")" ) );
+ this.registerFunction( "str", new VarArgsSQLFunction( StandardBasicTypes.STRING, "str(", ",", ")" ) );
}
// DDL support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean hasAlterTable() {
// Does this dialect support the ALTER TABLE syntax?
return true;
}
+ @Override
public boolean qualifyIndexName() {
// Do we need to qualify index names with the schema name?
return false;
}
- public boolean supportsUnique() {
- // Does this dialect support the UNIQUE column syntax?
- return true;
- }
-
- /**
- * The syntax used to add a foreign key constraint to a table.
- *
- * @return String
- */
+ @Override
+ @SuppressWarnings("StringBufferReplaceableByString")
public String getAddForeignKeyConstraintString(
String constraintName,
String[] foreignKey,
String referencedTable,
String[] primaryKey,
boolean referencesPrimaryKey) {
// The syntax used to add a foreign key constraint to a table.
- return new StringBuffer( 300 )
+ return new StringBuilder( 300 )
.append( " ADD CONSTRAINT " )
.append( constraintName )
.append( " FOREIGN KEY " )
.append( constraintName )
.append( " (" )
- .append( StringHelper.join( ", ", foreignKey ) ) // identifier-commalist
+ .append( StringHelper.join( ", ", foreignKey ) )
.append( ") REFERENCES " )
.append( referencedTable )
.append( " (" )
- .append( StringHelper.join( ", ", primaryKey ) ) // identifier-commalist
+ .append( StringHelper.join( ", ", primaryKey ) )
.append( ") " )
.toString();
}
+ /**
+ * Does this dialect support check constraints?
+ *
+ * @return {@code false} (Cache does not support check constraints)
+ */
+ @SuppressWarnings("UnusedDeclaration")
public boolean supportsCheck() {
- // Does this dialect support check constraints?
return false;
}
+ @Override
public String getAddColumnString() {
// The syntax used to add a column to a table
return " add column";
}
+ @Override
public String getCascadeConstraintsString() {
// Completely optional cascading drop clause.
return "";
}
+ @Override
public boolean dropConstraints() {
// Do we need to drop constraints before dropping tables in this dialect?
return true;
}
+ @Override
public boolean supportsCascadeDelete() {
return true;
}
+ @Override
public boolean hasSelfReferentialForeignKeyBug() {
return true;
}
+
// temporary table support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsTemporaryTables() {
return true;
}
+ @Override
public String generateTemporaryTableName(String baseTableName) {
- String name = super.generateTemporaryTableName( baseTableName );
+ final String name = super.generateTemporaryTableName( baseTableName );
return name.length() > 25 ? name.substring( 1, 25 ) : name;
}
+ @Override
public String getCreateTemporaryTableString() {
return "create global temporary table";
}
+ @Override
public Boolean performTemporaryTableDDLInIsolation() {
return Boolean.FALSE;
}
+ @Override
public String getCreateTemporaryTablePostfix() {
return "";
}
+ @Override
public boolean dropTemporaryTableAfterUse() {
return true;
}
// IDENTITY support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsIdentityColumns() {
return true;
}
+ @Override
public Class getNativeIdentifierGeneratorClass() {
return IdentityGenerator.class;
}
+ @Override
public boolean hasDataTypeInIdentityColumn() {
// Whether this dialect has an Identity clause added to the data type or a completely seperate identity
// data type
return true;
}
+ @Override
public String getIdentityColumnString() throws MappingException {
// The keyword used to specify an identity column, if identity column key generation is supported.
return "identity";
}
+ @Override
public String getIdentitySelectString() {
return "SELECT LAST_IDENTITY() FROM %TSQL_sys.snf";
}
// SEQUENCE support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsSequences() {
return false;
}
@@ -542,29 +548,31 @@
// lock acquisition support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- public boolean supportsForUpdate() {
- // Does this dialect support the FOR UPDATE syntax?
- return false;
- }
-
- public boolean supportsForUpdateOf() {
- // Does this dialect support FOR UPDATE OF, allowing particular rows to be locked?
- return false;
- }
-
- public boolean supportsForUpdateNowait() {
- // Does this dialect support the Oracle-style FOR UPDATE NOWAIT syntax?
- return false;
- }
-
+ @Override
public boolean supportsOuterJoinForUpdate() {
return false;
}
+ @Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
// InterSystems Cache' does not current support "SELECT ... FOR UPDATE" syntax...
// Set your transaction mode to READ_COMMITTED before using
- if ( lockMode.greaterThan( LockMode.READ ) ) {
+ if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
+ return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.PESSIMISTIC_WRITE) {
+ return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.PESSIMISTIC_READ) {
+ return new PessimisticReadUpdateLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.OPTIMISTIC) {
+ return new OptimisticLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
+ return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode.greaterThan( LockMode.READ ) ) {
return new UpdateLockingStrategy( lockable, lockMode );
}
else {
@@ -574,88 +582,110 @@
// LIMIT support (ala TOP) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
+ @SuppressWarnings("deprecation")
public boolean supportsLimit() {
return true;
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean supportsLimitOffset() {
return false;
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean supportsVariableLimit() {
return true;
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean bindLimitParametersFirst() {
// Does the LIMIT clause come at the start of the SELECT statement, rather than at the end?
return true;
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean useMaxForLimit() {
// Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows?
return true;
}
+ @Override
+ @SuppressWarnings("deprecation")
public String getLimitString(String sql, boolean hasOffset) {
if ( hasOffset ) {
- throw new UnsupportedOperationException( "An offset may not be specified to in Cache SQL" );
+ throw new UnsupportedOperationException( "query result offset is not supported" );
}
// This does not support the Cache SQL 'DISTINCT BY (comma-list)' extensions,
// but this extension is not supported through Hibernate anyway.
- int insertionPoint = sql.startsWith( "select distinct" ) ? 15 : 6;
+ final int insertionPoint = sql.startsWith( "select distinct" ) ? 15 : 6;
- return new StringBuffer( sql.length() + 8 )
+ return new StringBuilder( sql.length() + 8 )
.append( sql )
.insert( insertionPoint, " TOP ? " )
.toString();
}
// callable statement support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
return col;
}
+ @Override
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
ps.execute();
- return ( ResultSet ) ps.getObject( 1 );
+ return (ResultSet) ps.getObject( 1 );
}
// miscellaneous support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public String getLowercaseFunction() {
// The name of the SQL function that transforms a string to lowercase
return "lower";
}
+ @Override
public String getNullColumnString() {
// The keyword used to specify a nullable column.
return " null";
}
+ @Override
public JoinFragment createOuterJoinFragment() {
// Create an OuterJoinGenerator for this dialect.
return new CacheJoinFragment();
}
+ @Override
public String getNoColumnsInsertString() {
// The keyword used to insert a row without specifying
// any column values
return " default values";
}
- public SQLExceptionConverter buildSQLExceptionConverter() {
- return new CacheSQLStateConverter( EXTRACTER );
+ @Override
+ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {
+ return new CacheSQLExceptionConversionDelegate( this );
}
+ @Override
+ public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
+ return EXTRACTER;
+ }
+
+ /**
+ * The Cache ViolatedConstraintNameExtracter.
+ */
public static final ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() {
- /**
- * Extract the name of the violated constraint from the given SQLException.
- *
- * @param sqle The exception that was the result of the constraint violation.
- * @return The extracted constraint name.
- */
+ @Override
public String extractConstraintName(SQLException sqle) {
return extractUsingTemplate( "constraint (", ") violated", sqle.getMessage() );
}
@@ -664,14 +694,17 @@
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsEmptyInList() {
return false;
}
+ @Override
public boolean areStringComparisonsCaseInsensitive() {
return true;
}
+ @Override
public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
return false;
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/ColumnAliasExtractor.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2390Dialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2390Dialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2390Dialect.java 17 Aug 2012 14:33:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2390Dialect.java 30 Jul 2014 16:15:52 -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,49 +20,57 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
+
/**
* An SQL dialect for DB2/390. This class provides support for
* DB2 Universal Database for OS/390, also known as DB2/390.
*
* @author Kristoffer Dyrkorn
*/
public class DB2390Dialect extends DB2Dialect {
-
+ @Override
public boolean supportsSequences() {
return false;
}
+ @Override
public String getIdentitySelectString() {
return "select identity_val_local() from sysibm.sysdummy1";
}
+ @Override
public boolean supportsLimit() {
return true;
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean supportsLimitOffset() {
return false;
}
- public String getLimitString(String sql, int offset, int limit) {
- return new StringBuffer(sql.length() + 40)
- .append(sql)
- .append(" fetch first ")
- .append(limit)
- .append(" rows only ")
- .toString();
- }
-
+ @Override
public boolean useMaxForLimit() {
return true;
}
+ @Override
public boolean supportsVariableLimit() {
return false;
}
-}
\ No newline at end of file
+ @Override
+ public String getLimitString(String sql, int offset, int limit) {
+ if ( offset > 0 ) {
+ throw new UnsupportedOperationException( "query result offset is not supported" );
+ }
+ if ( limit == 0 ) {
+ return sql;
+ }
+ return sql + " fetch first " + limit + " rows only ";
+ }
+
+}
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2400Dialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2400Dialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2400Dialect.java 17 Aug 2012 14:33:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2400Dialect.java 30 Jul 2014 16:15:51 -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,49 +20,60 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
/**
-* An SQL dialect for DB2/400
-* @author Peter DeGregorio (pdegregorio)
-* This class provides support for DB2 Universal Database for iSeries,
-* also known as DB2/400.
-*/
+ * An SQL dialect for DB2/400. This class provides support for DB2 Universal Database for iSeries,
+ * also known as DB2/400.
+ *
+ * @author Peter DeGregorio (pdegregorio)
+ */
public class DB2400Dialect extends DB2Dialect {
-
+ @Override
public boolean supportsSequences() {
return false;
}
+ @Override
public String getIdentitySelectString() {
return "select identity_val_local() from sysibm.sysdummy1";
}
+ @Override
public boolean supportsLimit() {
return true;
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean supportsLimitOffset() {
return false;
}
- public String getLimitString(String sql, int offset, int limit) {
- return new StringBuffer(sql.length() + 40)
- .append(sql)
- .append(" fetch first ")
- .append(limit)
- .append(" rows only ")
- .toString();
- }
-
+ @Override
public boolean useMaxForLimit() {
return true;
}
+ @Override
public boolean supportsVariableLimit() {
return false;
}
-}
\ No newline at end of file
+ @Override
+ public String getLimitString(String sql, int offset, int limit) {
+ if ( offset > 0 ) {
+ throw new UnsupportedOperationException( "query result offset is not supported" );
+ }
+ if ( limit == 0 ) {
+ return sql;
+ }
+ return sql + " fetch first " + limit + " rows only ";
+ }
+
+ @Override
+ public String getForUpdateString() {
+ return " for update with rs";
+ }
+}
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2Dialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2Dialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2Dialect.java 17 Aug 2012 14:33:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/DB2Dialect.java 30 Jul 2014 16:15:52 -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.dialect;
@@ -29,20 +28,33 @@
import java.sql.SQLException;
import java.sql.Types;
-import org.hibernate.Hibernate;
+import org.hibernate.JDBCException;
import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
-import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
+import org.hibernate.dialect.unique.DB2UniqueDelegate;
+import org.hibernate.dialect.unique.UniqueDelegate;
+import org.hibernate.exception.LockTimeoutException;
+import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
+import org.hibernate.internal.util.JdbcExceptionHelper;
+import org.hibernate.type.StandardBasicTypes;
+import org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor;
+import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
/**
* An SQL dialect for DB2.
+ *
* @author Gavin King
*/
public class DB2Dialect extends Dialect {
+ private final UniqueDelegate uniqueDelegate;
+ /**
+ * Constructs a DB2Dialect
+ */
public DB2Dialect() {
super();
registerColumnType( Types.BIT, "smallint" );
@@ -61,241 +73,251 @@
registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
registerColumnType( Types.BLOB, "blob($l)" );
registerColumnType( Types.CLOB, "clob($l)" );
+ registerColumnType( Types.LONGVARCHAR, "long varchar" );
+ registerColumnType( Types.LONGVARBINARY, "long varchar for bit data" );
+ registerColumnType( Types.BINARY, "varchar($l) for bit data" );
+ registerColumnType( Types.BINARY, 254, "char($l) for bit data" );
+ registerColumnType( Types.BOOLEAN, "smallint" );
- registerFunction("abs", new StandardSQLFunction("abs") );
- registerFunction("absval", new StandardSQLFunction("absval") );
- registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
+ registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) );
- registerFunction("ceiling", new StandardSQLFunction("ceiling") );
- registerFunction("ceil", new StandardSQLFunction("ceil") );
- registerFunction("floor", new StandardSQLFunction("floor") );
- registerFunction("round", new StandardSQLFunction("round") );
+ registerFunction( "abs", new StandardSQLFunction( "abs" ) );
+ registerFunction( "absval", new StandardSQLFunction( "absval" ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
- registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE) );
- registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE) );
- registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE) );
- registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE) );
- registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE) );
- registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE) );
- registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE) );
- registerFunction("float", new StandardSQLFunction("float", Hibernate.DOUBLE) );
- registerFunction("hex", new StandardSQLFunction("hex", Hibernate.STRING) );
- registerFunction("ln", new StandardSQLFunction("ln", Hibernate.DOUBLE) );
- registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE) );
- registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE) );
- registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE) );
- registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE) );
- registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE) );
- registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING) );
- registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE) );
- registerFunction("stddev", new StandardSQLFunction("stddev", Hibernate.DOUBLE) );
- registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE) );
- registerFunction("variance", new StandardSQLFunction("variance", Hibernate.DOUBLE) );
+ registerFunction( "ceiling", new StandardSQLFunction( "ceiling" ) );
+ registerFunction( "ceil", new StandardSQLFunction( "ceil" ) );
+ registerFunction( "floor", new StandardSQLFunction( "floor" ) );
+ registerFunction( "round", new StandardSQLFunction( "round" ) );
- registerFunction("julian_day", new StandardSQLFunction("julian_day", Hibernate.INTEGER) );
- registerFunction("microsecond", new StandardSQLFunction("microsecond", Hibernate.INTEGER) );
- registerFunction("midnight_seconds", new StandardSQLFunction("midnight_seconds", Hibernate.INTEGER) );
- registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER) );
- registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER) );
- registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING) );
- registerFunction("quarter", new StandardSQLFunction("quarter", Hibernate.INTEGER) );
- registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER) );
- registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER) );
- registerFunction("current_date", new NoArgSQLFunction("current date", Hibernate.DATE, false) );
- registerFunction("date", new StandardSQLFunction("date", Hibernate.DATE) );
- registerFunction("day", new StandardSQLFunction("day", Hibernate.INTEGER) );
- registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING) );
- registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER) );
- registerFunction("dayofweek_iso", new StandardSQLFunction("dayofweek_iso", Hibernate.INTEGER) );
- registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER) );
- registerFunction("days", new StandardSQLFunction("days", Hibernate.LONG) );
- registerFunction("current_time", new NoArgSQLFunction("current time", Hibernate.TIME, false) );
- registerFunction("time", new StandardSQLFunction("time", Hibernate.TIME) );
- registerFunction("current_timestamp", new NoArgSQLFunction("current timestamp", Hibernate.TIMESTAMP, false) );
- registerFunction("timestamp", new StandardSQLFunction("timestamp", Hibernate.TIMESTAMP) );
- registerFunction("timestamp_iso", new StandardSQLFunction("timestamp_iso", Hibernate.TIMESTAMP) );
- registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER) );
- registerFunction("week_iso", new StandardSQLFunction("week_iso", Hibernate.INTEGER) );
- registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER) );
+ registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "float", new StandardSQLFunction( "float", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "hex", new StandardSQLFunction( "hex", StandardBasicTypes.STRING ) );
+ registerFunction( "ln", new StandardSQLFunction( "ln", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "rand", new NoArgSQLFunction( "rand", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
+ registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "stddev", new StandardSQLFunction( "stddev", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "variance", new StandardSQLFunction( "variance", StandardBasicTypes.DOUBLE ) );
- registerFunction("double", new StandardSQLFunction("double", Hibernate.DOUBLE) );
- registerFunction("varchar", new StandardSQLFunction("varchar", Hibernate.STRING) );
- registerFunction("real", new StandardSQLFunction("real", Hibernate.FLOAT) );
- registerFunction("bigint", new StandardSQLFunction("bigint", Hibernate.LONG) );
- registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER) );
- registerFunction("integer", new StandardSQLFunction("integer", Hibernate.INTEGER) );
- registerFunction("smallint", new StandardSQLFunction("smallint", Hibernate.SHORT) );
+ registerFunction( "julian_day", new StandardSQLFunction( "julian_day", StandardBasicTypes.INTEGER ) );
+ registerFunction( "microsecond", new StandardSQLFunction( "microsecond", StandardBasicTypes.INTEGER ) );
+ registerFunction(
+ "midnight_seconds",
+ new StandardSQLFunction( "midnight_seconds", StandardBasicTypes.INTEGER )
+ );
+ registerFunction( "minute", new StandardSQLFunction( "minute", StandardBasicTypes.INTEGER ) );
+ registerFunction( "month", new StandardSQLFunction( "month", StandardBasicTypes.INTEGER ) );
+ registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
+ registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) );
+ registerFunction( "hour", new StandardSQLFunction( "hour", StandardBasicTypes.INTEGER ) );
+ registerFunction( "second", new StandardSQLFunction( "second", StandardBasicTypes.INTEGER ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "current date", StandardBasicTypes.DATE, false ) );
+ registerFunction( "date", new StandardSQLFunction( "date", StandardBasicTypes.DATE ) );
+ registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
+ registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofweek_iso", new StandardSQLFunction( "dayofweek_iso", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
+ registerFunction( "days", new StandardSQLFunction( "days", StandardBasicTypes.LONG ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "current time", StandardBasicTypes.TIME, false ) );
+ registerFunction( "time", new StandardSQLFunction( "time", StandardBasicTypes.TIME ) );
+ registerFunction(
+ "current_timestamp",
+ new NoArgSQLFunction( "current timestamp", StandardBasicTypes.TIMESTAMP, false )
+ );
+ registerFunction( "timestamp", new StandardSQLFunction( "timestamp", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "timestamp_iso", new StandardSQLFunction( "timestamp_iso", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) );
+ registerFunction( "week_iso", new StandardSQLFunction( "week_iso", StandardBasicTypes.INTEGER ) );
+ registerFunction( "year", new StandardSQLFunction( "year", StandardBasicTypes.INTEGER ) );
- registerFunction("digits", new StandardSQLFunction("digits", Hibernate.STRING) );
- registerFunction("chr", new StandardSQLFunction("chr", Hibernate.CHARACTER) );
- registerFunction("upper", new StandardSQLFunction("upper") );
- registerFunction("lower", new StandardSQLFunction("lower") );
- registerFunction("ucase", new StandardSQLFunction("ucase") );
- registerFunction("lcase", new StandardSQLFunction("lcase") );
- registerFunction("length", new StandardSQLFunction("length", Hibernate.LONG) );
- registerFunction("ltrim", new StandardSQLFunction("ltrim") );
- registerFunction("rtrim", new StandardSQLFunction("rtrim") );
- registerFunction( "substr", new StandardSQLFunction( "substr", Hibernate.STRING ) );
- registerFunction( "posstr", new StandardSQLFunction( "posstr", Hibernate.INTEGER ) );
+ registerFunction( "double", new StandardSQLFunction( "double", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "varchar", new StandardSQLFunction( "varchar", StandardBasicTypes.STRING ) );
+ registerFunction( "real", new StandardSQLFunction( "real", StandardBasicTypes.FLOAT ) );
+ registerFunction( "bigint", new StandardSQLFunction( "bigint", StandardBasicTypes.LONG ) );
+ registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
+ registerFunction( "integer", new StandardSQLFunction( "integer", StandardBasicTypes.INTEGER ) );
+ registerFunction( "smallint", new StandardSQLFunction( "smallint", StandardBasicTypes.SHORT ) );
- registerFunction( "substring", new StandardSQLFunction( "substr", Hibernate.STRING ) );
- registerFunction( "bit_length", new SQLFunctionTemplate( Hibernate.INTEGER, "length(?1)*8" ) );
- registerFunction( "trim", new AnsiTrimEmulationFunction() );
+ registerFunction( "digits", new StandardSQLFunction( "digits", StandardBasicTypes.STRING ) );
+ registerFunction( "chr", new StandardSQLFunction( "chr", StandardBasicTypes.CHARACTER ) );
+ registerFunction( "upper", new StandardSQLFunction( "upper" ) );
+ registerFunction( "lower", new StandardSQLFunction( "lower" ) );
+ registerFunction( "ucase", new StandardSQLFunction( "ucase" ) );
+ registerFunction( "lcase", new StandardSQLFunction( "lcase" ) );
+ registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
+ registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
+ registerFunction( "substr", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
+ registerFunction( "posstr", new StandardSQLFunction( "posstr", StandardBasicTypes.INTEGER ) );
- registerFunction( "concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", "") );
+ registerFunction( "substring", new StandardSQLFunction( "substr", StandardBasicTypes.STRING ) );
+ registerFunction( "bit_length", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "length(?1)*8" ) );
+ registerFunction( "trim", new SQLFunctionTemplate( StandardBasicTypes.STRING, "trim(?1 ?2 ?3 ?4)" ) );
- registerFunction( "str", new SQLFunctionTemplate( Hibernate.STRING, "rtrim(char(?1))" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "", "||", "" ) );
- registerKeyword("current");
- registerKeyword("date");
- registerKeyword("time");
- registerKeyword("timestamp");
- registerKeyword("fetch");
- registerKeyword("first");
- registerKeyword("rows");
- registerKeyword("only");
+ registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "rtrim(char(?1))" ) );
- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH);
+ registerKeyword( "current" );
+ registerKeyword( "date" );
+ registerKeyword( "time" );
+ registerKeyword( "timestamp" );
+ registerKeyword( "fetch" );
+ registerKeyword( "first" );
+ registerKeyword( "rows" );
+ registerKeyword( "only" );
+
+ getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, NO_BATCH );
+
+ uniqueDelegate = new DB2UniqueDelegate( this );
}
+ @Override
public String getLowercaseFunction() {
return "lcase";
}
+ @Override
public String getAddColumnString() {
return "add column";
}
+
+ @Override
public boolean dropConstraints() {
return false;
}
+
+ @Override
public boolean supportsIdentityColumns() {
return true;
}
+
+ @Override
public String getIdentitySelectString() {
return "values identity_val_local()";
}
+
+ @Override
public String getIdentityColumnString() {
- return "generated by default as identity"; //not null ... (start with 1) is implicit
+ return "generated by default as identity";
}
+
+ @Override
public String getIdentityInsertString() {
return "default";
}
+ @Override
public String getSequenceNextValString(String sequenceName) {
return "values nextval for " + sequenceName;
}
+
+ @Override
public String getCreateSequenceString(String sequenceName) {
return "create sequence " + sequenceName;
}
+
+ @Override
public String getDropSequenceString(String sequenceName) {
return "drop sequence " + sequenceName + " restrict";
}
+ @Override
public boolean supportsSequences() {
return true;
}
+ @Override
+ public boolean supportsPooledSequences() {
+ return true;
+ }
+
+ @Override
public String getQuerySequencesString() {
return "select seqname from sysibm.syssequences";
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean supportsLimit() {
return true;
}
- /*public String getLimitString(String sql, boolean hasOffset) {
- StringBuffer rownumber = new StringBuffer(50)
- .append(" rownumber() over(");
- int orderByIndex = sql.toLowerCase().indexOf("order by");
- if (orderByIndex>0) rownumber.append( sql.substring(orderByIndex) );
- rownumber.append(") as row_,");
- StringBuffer pagingSelect = new StringBuffer( sql.length()+100 )
- .append("select * from ( ")
- .append(sql)
- .insert( getAfterSelectInsertPoint(sql)+16, rownumber.toString() )
- .append(" ) as temp_ where row_ ");
- if (hasOffset) {
- pagingSelect.append("between ?+1 and ?");
- }
- else {
- pagingSelect.append("<= ?");
- }
- return pagingSelect.toString();
- }*/
-
- /**
- * Render the rownumber() over ( .... ) as rownumber_,
- * bit, that goes in the select list
- */
- private String getRowNumber(String sql) {
- StringBuffer rownumber = new StringBuffer(50)
- .append("rownumber() over(");
-
- int orderByIndex = sql.toLowerCase().indexOf("order by");
-
- if ( orderByIndex>0 && !hasDistinct(sql) ) {
- rownumber.append( sql.substring(orderByIndex) );
- }
-
- rownumber.append(") as rownumber_,");
-
- return rownumber.toString();
+ @Override
+ @SuppressWarnings("deprecation")
+ public boolean supportsVariableLimit() {
+ return false;
}
- public String getLimitString(String sql, boolean hasOffset) {
-
- int startOfSelect = sql.toLowerCase().indexOf("select");
-
- StringBuffer pagingSelect = new StringBuffer( sql.length()+100 )
- .append( sql.substring(0, startOfSelect) ) //add the comment
- .append("select * from ( select ") //nest the main query in an outer select
- .append( getRowNumber(sql) ); //add the rownnumber bit into the outer query select list
-
- if ( hasDistinct(sql) ) {
- pagingSelect.append(" row_.* from ( ") //add another (inner) nested select
- .append( sql.substring(startOfSelect) ) //add the main query
- .append(" ) as row_"); //close off the inner nested select
+ @Override
+ @SuppressWarnings("deprecation")
+ public String getLimitString(String sql, int offset, int limit) {
+ if ( offset == 0 ) {
+ return sql + " fetch first " + limit + " rows only";
}
- else {
- pagingSelect.append( sql.substring( startOfSelect + 6 ) ); //add the main query
- }
-
- pagingSelect.append(" ) as temp_ where rownumber_ ");
-
- //add the restriction to the outer select
- if (hasOffset) {
- pagingSelect.append("between ?+1 and ?");
- }
- else {
- pagingSelect.append("<= ?");
- }
-
- return pagingSelect.toString();
+ //nest the main query in an outer select
+ return "select * from ( select inner2_.*, rownumber() over(order by order of inner2_) as rownumber_ from ( "
+ + sql + " fetch first " + limit + " rows only ) as inner2_ ) as inner1_ where rownumber_ > "
+ + offset + " order by rownumber_";
}
- private static boolean hasDistinct(String sql) {
- return sql.toLowerCase().indexOf("select distinct")>=0;
+ /**
+ * {@inheritDoc}
+ *
+ *
+ * DB2 does have a one-based offset, however this was actually already handled in the limit string building
+ * (the '?+1' bit). To not mess up inheritors, I'll leave that part alone and not touch the offset here.
+ */
+ @Override
+ @SuppressWarnings("deprecation")
+ public int convertToFirstRowValue(int zeroBasedFirstResult) {
+ return zeroBasedFirstResult;
}
+ @Override
+ @SuppressWarnings("deprecation")
public String getForUpdateString() {
- return " for read only with rs";
+ return " for read only with rs use and keep update locks";
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean useMaxForLimit() {
return true;
}
+ @Override
public boolean supportsOuterJoinForUpdate() {
return false;
}
- public boolean supportsNotNullUnique() {
+ @Override
+ public boolean supportsExistsInSelect() {
return false;
}
+ @Override
+ public boolean supportsLockTimeouts() {
+ //as far as I know, DB2 doesn't support this
+ return false;
+ }
+
+ @Override
public String getSelectClauseNullString(int sqlType) {
String literal;
- switch(sqlType) {
+ switch ( sqlType ) {
case Types.VARCHAR:
case Types.CHAR:
literal = "'x'";
@@ -315,78 +337,152 @@
return "nullif(" + literal + ',' + literal + ')';
}
- public static void main(String[] args) {
- System.out.println( new DB2Dialect().getLimitString("/*foo*/ select * from foos", true) );
- System.out.println( new DB2Dialect().getLimitString("/*foo*/ select distinct * from foos", true) );
- System.out.println( new DB2Dialect().getLimitString("/*foo*/ select * from foos foo order by foo.bar, foo.baz", true) );
- System.out.println( new DB2Dialect().getLimitString("/*foo*/ select distinct * from foos foo order by foo.bar, foo.baz", true) );
- }
-
+ @Override
public boolean supportsUnionAll() {
return true;
}
+ @Override
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
return col;
}
+ @Override
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
boolean isResultSet = ps.execute();
// This assumes you will want to ignore any update counts
- while (!isResultSet && ps.getUpdateCount() != -1) {
- isResultSet = ps.getMoreResults();
+ while ( !isResultSet && ps.getUpdateCount() != -1 ) {
+ isResultSet = ps.getMoreResults();
}
- ResultSet rs = ps.getResultSet();
- // You may still have other ResultSets or update counts left to process here
- // but you can't do it now or the ResultSet you just got will be closed
- return rs;
+
+ return ps.getResultSet();
}
+ @Override
public boolean supportsCommentOn() {
return true;
}
+ @Override
public boolean supportsTemporaryTables() {
return true;
}
+ @Override
public String getCreateTemporaryTableString() {
return "declare global temporary table";
}
+ @Override
public String getCreateTemporaryTablePostfix() {
return "not logged";
}
+ @Override
public String generateTemporaryTableName(String baseTableName) {
- return "session." + super.generateTemporaryTableName(baseTableName);
+ return "session." + super.generateTemporaryTableName( baseTableName );
}
+ @Override
public boolean supportsCurrentTimestampSelection() {
return true;
}
+ @Override
public String getCurrentTimestampSelectString() {
return "values current timestamp";
}
+ @Override
public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
+ /**
+ * {@inheritDoc}
+ *
+ * NOTE : DB2 is know to support parameters in the SELECT clause, but only in casted form
+ * (see {@link #requiresCastingOfParametersInSelectClause()}).
+ */
+ @Override
public boolean supportsParametersInInsertSelect() {
- // DB2 known to not support parameters within the select
- // clause of an SQL INSERT ... SELECT ... statement
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * DB2 in fact does require that parameters appearing in the select clause be wrapped in cast() calls
+ * to tell the DB parser the type of the select value.
+ */
+ @Override
+ public boolean requiresCastingOfParametersInSelectClause() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {
return false;
}
+ @Override
+ public String getCrossJoinSeparator() {
+ //DB2 v9.1 doesn't support 'cross join' syntax
+ return ", ";
+ }
+
+
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsEmptyInList() {
return false;
}
+ @Override
public boolean supportsLobValueChangePropogation() {
return false;
}
+
+ @Override
+ public boolean doesReadCommittedCauseWritersToBlockReaders() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsTupleDistinctCounts() {
+ return false;
+ }
+
+ @Override
+ protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
+ return sqlCode == Types.BOOLEAN ? SmallIntTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride( sqlCode );
+ }
+
+ @Override
+ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {
+ return new SQLExceptionConversionDelegate() {
+ @Override
+ public JDBCException convert(SQLException sqlException, String message, String sql) {
+ final String sqlState = JdbcExceptionHelper.extractSqlState( sqlException );
+ final int errorCode = JdbcExceptionHelper.extractErrorCode( sqlException );
+
+ if( -952 == errorCode && "57014".equals( sqlState )){
+ throw new LockTimeoutException( message, sqlException, sql );
+ }
+ return null;
+ }
+ };
+ }
+
+ @Override
+ public UniqueDelegate getUniqueDelegate() {
+ return uniqueDelegate;
+ }
+
+ @Override
+ public String getNotExpression( String expression ) {
+ return "not (" + expression + ")";
+ }
+
}
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/DataDirectOracle9Dialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/DataDirectOracle9Dialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/DataDirectOracle9Dialect.java 17 Aug 2012 14:33:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/DataDirectOracle9Dialect.java 30 Jul 2014 16:15:51 -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,31 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+/**
+ * A Dialect for accessing Oracle through DataDirect driver
+ */
+@SuppressWarnings("deprecation")
public class DataDirectOracle9Dialect extends Oracle9Dialect {
-
+ @Override
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
- return col; // sql server just returns automatically
+ return col;
}
-
+
+ @Override
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
- boolean isResultSet = ps.execute();
-// This assumes you will want to ignore any update counts
+ boolean isResultSet = ps.execute();
+ // This assumes you will want to ignore any update counts
while (!isResultSet && ps.getUpdateCount() != -1) {
- isResultSet = ps.getMoreResults();
- }
- ResultSet rs = ps.getResultSet();
-// You may still have other ResultSets or update counts left to process here
-// but you can't do it now or the ResultSet you just got will be closed
- return rs;
- }
+ isResultSet = ps.getMoreResults();
+ }
+ return ps.getResultSet();
+ }
}
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/DerbyDialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/DerbyDialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/DerbyDialect.java 17 Aug 2012 14:33:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/DerbyDialect.java 30 Jul 2014 16:15:54 -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,202 +20,241 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
-import org.hibernate.Hibernate;
-import org.hibernate.QueryException;
-import org.hibernate.HibernateException;
-import org.hibernate.engine.Mapping;
-import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.type.Type;
-import org.hibernate.dialect.function.SQLFunction;
-import org.hibernate.dialect.function.SQLFunctionTemplate;
+import java.lang.reflect.Method;
+import java.sql.Types;
+
+import org.hibernate.MappingException;
+import org.hibernate.dialect.function.AnsiTrimFunction;
import org.hibernate.dialect.function.DerbyConcatFunction;
-import org.hibernate.id.TableHiLoGenerator;
+import org.hibernate.internal.CoreMessageLogger;
+import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.sql.CaseFragment;
import org.hibernate.sql.DerbyCaseFragment;
-import java.util.List;
-import java.util.ArrayList;
+import org.jboss.logging.Logger;
/**
- * Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an
+ * Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an
* override for the identity column generator as well as for the case statement
* issue documented at:
* http://www.jroller.com/comments/kenlars99/Weblog/cloudscape_soon_to_be_derby
*
* @author Simon Johnston
+ *
+ * @deprecated HHH-6073
*/
+@Deprecated
public class DerbyDialect extends DB2Dialect {
+ @SuppressWarnings("deprecation")
+ private static final CoreMessageLogger LOG = Logger.getMessageLogger(
+ CoreMessageLogger.class,
+ DerbyDialect.class.getName()
+ );
+ private int driverVersionMajor;
+ private int driverVersionMinor;
+
+ /**
+ * Constructs a DerbyDialect
+ */
+ @SuppressWarnings("deprecation")
public DerbyDialect() {
super();
+ if ( this.getClass() == DerbyDialect.class ) {
+ LOG.deprecatedDerbyDialect();
+ }
+
registerFunction( "concat", new DerbyConcatFunction() );
- registerFunction( "trim", new DerbyTrimFunctionEmulation() );
+ registerFunction( "trim", new AnsiTrimFunction() );
+ registerColumnType( Types.BLOB, "blob" );
+ determineDriverVersion();
+
+ if ( driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 7 ) ) {
+ registerColumnType( Types.BOOLEAN, "boolean" );
+ }
}
- /**
- * This is different in Cloudscape to DB2.
- */
- public String getIdentityColumnString() {
- return "not null generated always as identity"; //$NON-NLS-1
+ private void determineDriverVersion() {
+ try {
+ // locate the derby sysinfo class and query its version info
+ final Class sysinfoClass = ReflectHelper.classForName( "org.apache.derby.tools.sysinfo", this.getClass() );
+ final Method majorVersionGetter = sysinfoClass.getMethod( "getMajorVersion", ReflectHelper.NO_PARAM_SIGNATURE );
+ final Method minorVersionGetter = sysinfoClass.getMethod( "getMinorVersion", ReflectHelper.NO_PARAM_SIGNATURE );
+ driverVersionMajor = (Integer) majorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS );
+ driverVersionMinor = (Integer) minorVersionGetter.invoke( null, ReflectHelper.NO_PARAMS );
+ }
+ catch ( Exception e ) {
+ LOG.unableToLoadDerbyDriver( e.getMessage() );
+ driverVersionMajor = -1;
+ driverVersionMinor = -1;
+ }
}
- /**
- * Return the case statement modified for Cloudscape.
- */
+ private boolean isTenPointFiveReleaseOrNewer() {
+ return driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 5 );
+ }
+
+ @Override
+ public String getCrossJoinSeparator() {
+ return ", ";
+ }
+
+ @Override
public CaseFragment createCaseFragment() {
return new DerbyCaseFragment();
}
+ @Override
public boolean dropConstraints() {
- return true;
+ return true;
}
- public Class getNativeIdentifierGeneratorClass() {
- return TableHiLoGenerator.class;
+ @Override
+ public boolean supportsSequences() {
+ // technically sequence support was added in 10.6.1.0...
+ //
+ // The problem though is that I am not exactly sure how to differentiate 10.6.1.0 from any other 10.6.x release.
+ //
+ // http://db.apache.org/derby/docs/10.0/publishedapi/org/apache/derby/tools/sysinfo.html seems incorrect. It
+ // states that derby's versioning scheme is major.minor.maintenance, but obviously 10.6.1.0 has 4 components
+ // to it, not 3.
+ //
+ // Let alone the fact that it states that versions with the matching major.minor are 'feature
+ // compatible' which is clearly not the case here (sequence support is a new feature...)
+ return driverVersionMajor > 10 || ( driverVersionMajor == 10 && driverVersionMinor >= 6 );
}
- public boolean supportsSequences() {
- return false;
+ @Override
+ public String getSequenceNextValString(String sequenceName) {
+ if ( supportsSequences() ) {
+ return "values next value for " + sequenceName;
+ }
+ else {
+ throw new MappingException( "Derby does not support sequence prior to release 10.6.1.0" );
+ }
}
+ @Override
public boolean supportsLimit() {
+ return isTenPointFiveReleaseOrNewer();
+ }
+
+ @Override
+ public boolean supportsCommentOn() {
+ //HHH-4531
return false;
}
+ @Override
+ @SuppressWarnings("deprecation")
public boolean supportsLimitOffset() {
- return false;
+ return isTenPointFiveReleaseOrNewer();
}
- public String getQuerySequencesString() {
- return null ;
+ @Override
+ public String getForUpdateString() {
+ return " for update with rs";
}
+ @Override
+ public String getWriteLockString(int timeout) {
+ return " for update with rs";
+ }
+
+ @Override
+ public String getReadLockString(int timeout) {
+ return " for read only with rs";
+ }
+
+
/**
- * A specialized function template to emulate the ANSI trim function on Derby DB
- * since it does not support the full trim specification. However, we cannot even
- * fully emulate it because there is not standard 'replace' function either. :(
+ * {@inheritDoc}
+ *
+ * From Derby 10.5 Docs:
+ *
*/
- public static class DerbyTrimFunctionEmulation implements SQLFunction {
- private static final SQLFunction LEADING_SPACE_TRIM = new SQLFunctionTemplate( Hibernate.STRING, "ltrim( ?1 )");
- private static final SQLFunction TRAILING_SPACE_TRIM = new SQLFunctionTemplate( Hibernate.STRING, "rtrim( ?1 )");
- private static final SQLFunction BOTH_SPACE_TRIM = new SQLFunctionTemplate( Hibernate.STRING, "ltrim( rtrim( ?1 ) )");
- private static final SQLFunction BOTH_SPACE_TRIM_FROM = new SQLFunctionTemplate( Hibernate.STRING, "ltrim( rtrim( ?2 ) )");
+ @Override
+ public String getLimitString(String query, final int offset, final int limit) {
+ final StringBuilder sb = new StringBuilder(query.length() + 50);
+ final String normalizedSelect = query.toLowerCase().trim();
+ final int forUpdateIndex = normalizedSelect.lastIndexOf( "for update") ;
- public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {
- return Hibernate.STRING;
+ if ( hasForUpdateClause( forUpdateIndex ) ) {
+ sb.append( query.substring( 0, forUpdateIndex-1 ) );
}
-
- public boolean hasArguments() {
- return true;
+ else if ( hasWithClause( normalizedSelect ) ) {
+ sb.append( query.substring( 0, getWithIndex( query ) - 1 ) );
}
+ else {
+ sb.append( query );
+ }
- public boolean hasParenthesesIfNoArguments() {
- return false;
+ if ( offset == 0 ) {
+ sb.append( " fetch first " );
}
+ else {
+ sb.append( " offset " ).append( offset ).append( " rows fetch next " );
+ }
- public String render(List args, SessionFactoryImplementor factory) throws QueryException {
- // according to both the ANSI-SQL and EJB3 specs, trim can either take
- // exactly one parameter or a variable number of parameters between 1 and 4.
- // from the SQL spec:
- //
- // ::=
- // TRIM
- //
- // ::=
- // [ [ ] [ ] FROM ]
- //
- // ::=
- // LEADING
- // | TRAILING
- // | BOTH
- //
- // If only is omitted, BOTH is assumed;
- // if is omitted, space is assumed
- if ( args.size() == 1 ) {
- // we have the form: trim(trimSource)
- // so we trim leading and trailing spaces
- return BOTH_SPACE_TRIM.render( args, factory );
- }
- else if ( "from".equalsIgnoreCase( ( String ) args.get( 0 ) ) ) {
- // we have the form: trim(from trimSource).
- // This is functionally equivalent to trim(trimSource)
- return BOTH_SPACE_TRIM_FROM.render( args, factory );
- }
- else {
- // otherwise, a trim-specification and/or a trim-character
- // have been specified; we need to decide which options
- // are present and "do the right thing"
- boolean leading = true; // should leading trim-characters be trimmed?
- boolean trailing = true; // should trailing trim-characters be trimmed?
- String trimCharacter; // the trim-character
- String trimSource; // the trim-source
+ sb.append( limit ).append( " rows only" );
- // potentialTrimCharacterArgIndex = 1 assumes that a
- // trim-specification has been specified. we handle the
- // exception to that explicitly
- int potentialTrimCharacterArgIndex = 1;
- String firstArg = ( String ) args.get( 0 );
- if ( "leading".equalsIgnoreCase( firstArg ) ) {
- trailing = false;
- }
- else if ( "trailing".equalsIgnoreCase( firstArg ) ) {
- leading = false;
- }
- else if ( "both".equalsIgnoreCase( firstArg ) ) {
- }
- else {
- potentialTrimCharacterArgIndex = 0;
- }
+ if ( hasForUpdateClause( forUpdateIndex ) ) {
+ sb.append( ' ' );
+ sb.append( query.substring( forUpdateIndex ) );
+ }
+ else if ( hasWithClause( normalizedSelect ) ) {
+ sb.append( ' ' ).append( query.substring( getWithIndex( query ) ) );
+ }
+ return sb.toString();
+ }
- String potentialTrimCharacter = ( String ) args.get( potentialTrimCharacterArgIndex );
- if ( "from".equalsIgnoreCase( potentialTrimCharacter ) ) {
- trimCharacter = "' '";
- trimSource = ( String ) args.get( potentialTrimCharacterArgIndex + 1 );
- }
- else if ( potentialTrimCharacterArgIndex + 1 >= args.size() ) {
- trimCharacter = "' '";
- trimSource = potentialTrimCharacter;
- }
- else {
- trimCharacter = potentialTrimCharacter;
- if ( "from".equalsIgnoreCase( ( String ) args.get( potentialTrimCharacterArgIndex + 1 ) ) ) {
- trimSource = ( String ) args.get( potentialTrimCharacterArgIndex + 2 );
- }
- else {
- trimSource = ( String ) args.get( potentialTrimCharacterArgIndex + 1 );
- }
- }
+ @Override
+ public boolean supportsVariableLimit() {
+ // we bind the limit and offset values directly into the sql...
+ return false;
+ }
- List argsToUse = new ArrayList();
- argsToUse.add( trimSource );
- argsToUse.add( trimCharacter );
+ private boolean hasForUpdateClause(int forUpdateIndex) {
+ return forUpdateIndex >= 0;
+ }
- if ( trimCharacter.equals( "' '" ) ) {
- if ( leading && trailing ) {
- return BOTH_SPACE_TRIM.render( argsToUse, factory );
- }
- else if ( leading ) {
- return LEADING_SPACE_TRIM.render( argsToUse, factory );
- }
- else {
- return TRAILING_SPACE_TRIM.render( argsToUse, factory );
- }
- }
- else {
- throw new HibernateException( "cannot specify trim character when using Derby as Derby does not support the ANSI trim function, not does it support a replace function to properly emmulate it" );
- }
- }
+ private boolean hasWithClause(String normalizedSelect){
+ return normalizedSelect.startsWith( "with ", normalizedSelect.length()-7 );
+ }
+
+ private int getWithIndex(String querySelect) {
+ int i = querySelect.lastIndexOf( "with " );
+ if ( i < 0 ) {
+ i = querySelect.lastIndexOf( "WITH " );
}
+ return i;
}
+ @Override
+ public String getQuerySequencesString() {
+ return null ;
+ }
+
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsLobValueChangePropogation() {
return false;
}
+
+ @Override
+ public boolean supportsUnboundedLobLocatorMaterialization() {
+ return false;
+ }
}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/DerbyTenFiveDialect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/DerbyTenSevenDialect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/DerbyTenSixDialect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/Dialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/Dialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/Dialect.java 17 Aug 2012 14:33:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/Dialect.java 30 Jul 2014 16:15:54 -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,207 +20,213 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Blob;
import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.NClob;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
+import org.hibernate.LockOptions;
import org.hibernate.MappingException;
-import org.hibernate.QueryException;
+import org.hibernate.NullPrecedence;
+import org.hibernate.ScrollMode;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.CastFunction;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
+import org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.lock.LockingStrategy;
+import org.hibernate.dialect.lock.OptimisticForceIncrementLockingStrategy;
+import org.hibernate.dialect.lock.OptimisticLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticForceIncrementLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticReadSelectLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticWriteSelectLockingStrategy;
import org.hibernate.dialect.lock.SelectLockingStrategy;
-import org.hibernate.engine.Mapping;
-import org.hibernate.exception.SQLExceptionConverter;
-import org.hibernate.exception.SQLStateConverter;
-import org.hibernate.exception.ViolatedConstraintNameExtracter;
+import org.hibernate.dialect.pagination.LegacyLimitHandler;
+import org.hibernate.dialect.pagination.LimitHandler;
+import org.hibernate.dialect.unique.DefaultUniqueDelegate;
+import org.hibernate.dialect.unique.UniqueDelegate;
+import org.hibernate.engine.jdbc.LobCreator;
+import org.hibernate.engine.spi.RowSelection;
+import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.exception.spi.ConversionContext;
+import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
+import org.hibernate.exception.spi.SQLExceptionConverter;
+import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
import org.hibernate.id.IdentityGenerator;
import org.hibernate.id.SequenceGenerator;
import org.hibernate.id.TableHiLoGenerator;
+import org.hibernate.internal.CoreMessageLogger;
+import org.hibernate.internal.util.ReflectHelper;
+import org.hibernate.internal.util.StringHelper;
+import org.hibernate.internal.util.collections.ArrayHelper;
+import org.hibernate.internal.util.io.StreamCopier;
import org.hibernate.mapping.Column;
+import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.persister.entity.Lockable;
+import org.hibernate.procedure.internal.StandardCallableStatementSupport;
+import org.hibernate.procedure.spi.CallableStatementSupport;
+import org.hibernate.service.ServiceRegistry;
import org.hibernate.sql.ANSICaseFragment;
import org.hibernate.sql.ANSIJoinFragment;
import org.hibernate.sql.CaseFragment;
-import org.hibernate.sql.JoinFragment;
import org.hibernate.sql.ForUpdateFragment;
-import org.hibernate.type.Type;
-import org.hibernate.util.ReflectHelper;
-import org.hibernate.util.StringHelper;
+import org.hibernate.sql.JoinFragment;
+import org.hibernate.type.StandardBasicTypes;
+import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
+import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
+import org.jboss.logging.Logger;
+
/**
- * Represents a dialect of SQL implemented by a particular RDBMS.
- * Subclasses implement Hibernate compatibility with different systems.
- *
- * Subclasses should provide a public default constructor that register()
- * a set of type mappings and default Hibernate properties.
- *
- * Subclasses should be immutable.
+ * Represents a dialect of SQL implemented by a particular RDBMS. Subclasses implement Hibernate compatibility
+ * with different systems. Subclasses should provide a public default constructor that register a set of type
+ * mappings and default Hibernate properties. Subclasses should be immutable.
*
* @author Gavin King, David Channon
*/
-public abstract class Dialect {
+@SuppressWarnings("deprecation")
+public abstract class Dialect implements ConversionContext {
+ private static final CoreMessageLogger LOG = Logger.getMessageLogger(
+ CoreMessageLogger.class,
+ Dialect.class.getName()
+ );
- private static final Logger log = LoggerFactory.getLogger( Dialect.class );
-
+ /**
+ * Defines a default batch size constant
+ */
public static final String DEFAULT_BATCH_SIZE = "15";
+
+ /**
+ * Defines a "no batching" batch size constant
+ */
public static final String NO_BATCH = "0";
/**
- * Characters used for quoting SQL identifiers
+ * Characters used as opening for quoting SQL identifiers
*/
public static final String QUOTE = "`\"[";
+
+ /**
+ * Characters used as closing for quoting SQL identifiers
+ */
public static final String CLOSED_QUOTE = "`\"]";
-
- // build the map of standard ANSI SQL aggregation functions ~~~~~~~~~~~~~~~
-
- private static final Map STANDARD_AGGREGATE_FUNCTIONS = new HashMap();
- static {
- STANDARD_AGGREGATE_FUNCTIONS.put( "count", new StandardSQLFunction("count") {
- public Type getReturnType(Type columnType, Mapping mapping) {
- return Hibernate.LONG;
- }
- } );
-
- STANDARD_AGGREGATE_FUNCTIONS.put( "avg", new StandardSQLFunction("avg") {
- public Type getReturnType(Type columnType, Mapping mapping) throws QueryException {
- int[] sqlTypes;
- try {
- sqlTypes = columnType.sqlTypes( mapping );
- }
- catch ( MappingException me ) {
- throw new QueryException( me );
- }
- if ( sqlTypes.length != 1 ) throw new QueryException( "multi-column type in avg()" );
- return Hibernate.DOUBLE;
- }
- } );
-
- STANDARD_AGGREGATE_FUNCTIONS.put( "max", new StandardSQLFunction("max") );
- STANDARD_AGGREGATE_FUNCTIONS.put( "min", new StandardSQLFunction("min") );
- STANDARD_AGGREGATE_FUNCTIONS.put( "sum", new StandardSQLFunction("sum") {
- public Type getReturnType(Type columnType, Mapping mapping) {
- //pre H3.2 behavior: super.getReturnType(ct, m);
- int[] sqlTypes;
- try {
- sqlTypes = columnType.sqlTypes( mapping );
- }
- catch ( MappingException me ) {
- throw new QueryException( me );
- }
- if ( sqlTypes.length != 1 ) throw new QueryException( "multi-column type in sum()" );
- int sqlType = sqlTypes[0];
-
- // First allow the actual type to control the return value. (the actual underlying sqltype could actually be different)
- if ( columnType == Hibernate.BIG_INTEGER ) {
- return Hibernate.BIG_INTEGER;
- }
- else if ( columnType == Hibernate.BIG_DECIMAL ) {
- return Hibernate.BIG_DECIMAL;
- }
- else if ( columnType == Hibernate.LONG || columnType == Hibernate.SHORT || columnType == Hibernate.INTEGER) {
- return Hibernate.LONG;
- }
- else if ( columnType == Hibernate.FLOAT || columnType == Hibernate.DOUBLE) {
- return Hibernate.DOUBLE;
- }
-
- // finally use the sqltype if == on Hibernate types did not find a match.
- if ( sqlType == Types.NUMERIC ) {
- return columnType; //because numeric can be anything
- }
- else if ( sqlType == Types.FLOAT || sqlType == Types.DOUBLE || sqlType == Types.DECIMAL || sqlType == Types.REAL) {
- return Hibernate.DOUBLE;
- }
- else if ( sqlType == Types.BIGINT || sqlType == Types.INTEGER || sqlType == Types.SMALLINT || sqlType == Types.TINYINT ) {
- return Hibernate.LONG;
- }
- else {
- return columnType;
- }
- }
- });
- }
-
private final TypeNames typeNames = new TypeNames();
private final TypeNames hibernateTypeNames = new TypeNames();
private final Properties properties = new Properties();
- private final Map sqlFunctions = new HashMap();
- private final Set sqlKeywords = new HashSet();
+ private final Map sqlFunctions = new HashMap();
+ private final Set sqlKeywords = new HashSet();
+ private final UniqueDelegate uniqueDelegate;
+
// constructors and factory methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
protected Dialect() {
- log.info( "Using dialect: " + this );
- sqlFunctions.putAll( STANDARD_AGGREGATE_FUNCTIONS );
+ LOG.usingDialect( this );
+ StandardAnsiSqlAggregationFunctions.primeFunctionMap( sqlFunctions );
// standard sql92 functions (can be overridden by subclasses)
- registerFunction( "substring", new SQLFunctionTemplate( Hibernate.STRING, "substring(?1, ?2, ?3)" ) );
- registerFunction( "locate", new SQLFunctionTemplate( Hibernate.INTEGER, "locate(?1, ?2, ?3)" ) );
- registerFunction( "trim", new SQLFunctionTemplate( Hibernate.STRING, "trim(?1 ?2 ?3 ?4)" ) );
- registerFunction( "length", new StandardSQLFunction( "length", Hibernate.INTEGER ) );
- registerFunction( "bit_length", new StandardSQLFunction( "bit_length", Hibernate.INTEGER ) );
+ registerFunction( "substring", new SQLFunctionTemplate( StandardBasicTypes.STRING, "substring(?1, ?2, ?3)" ) );
+ registerFunction( "locate", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "locate(?1, ?2, ?3)" ) );
+ registerFunction( "trim", new SQLFunctionTemplate( StandardBasicTypes.STRING, "trim(?1 ?2 ?3 ?4)" ) );
+ registerFunction( "length", new StandardSQLFunction( "length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "bit_length", new StandardSQLFunction( "bit_length", StandardBasicTypes.INTEGER ) );
registerFunction( "coalesce", new StandardSQLFunction( "coalesce" ) );
registerFunction( "nullif", new StandardSQLFunction( "nullif" ) );
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
- registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER) );
- registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE) );
+ registerFunction( "mod", new StandardSQLFunction( "mod", StandardBasicTypes.INTEGER) );
+ registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE) );
registerFunction( "upper", new StandardSQLFunction("upper") );
registerFunction( "lower", new StandardSQLFunction("lower") );
registerFunction( "cast", new CastFunction() );
- registerFunction( "extract", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(?1 ?2 ?3)") );
+ registerFunction( "extract", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(?1 ?2 ?3)") );
//map second/minute/hour/day/month/year to ANSI extract(), override on subclasses
- registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(second from ?1)") );
- registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(minute from ?1)") );
- registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(hour from ?1)") );
- registerFunction( "day", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(day from ?1)") );
- registerFunction( "month", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(month from ?1)") );
- registerFunction( "year", new SQLFunctionTemplate(Hibernate.INTEGER, "extract(year from ?1)") );
+ registerFunction( "second", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(second from ?1)") );
+ registerFunction( "minute", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(minute from ?1)") );
+ registerFunction( "hour", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(hour from ?1)") );
+ registerFunction( "day", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(day from ?1)") );
+ registerFunction( "month", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(month from ?1)") );
+ registerFunction( "year", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "extract(year from ?1)") );
- registerFunction( "str", new SQLFunctionTemplate(Hibernate.STRING, "cast(?1 as char)") );
+ registerFunction( "str", new SQLFunctionTemplate(StandardBasicTypes.STRING, "cast(?1 as char)") );
- // register hibernate types for default use in scalar sqlquery type auto detection
- registerHibernateType( Types.BIGINT, Hibernate.BIG_INTEGER.getName() );
- registerHibernateType( Types.BINARY, Hibernate.BINARY.getName() );
- registerHibernateType( Types.BIT, Hibernate.BOOLEAN.getName() );
- registerHibernateType( Types.CHAR, Hibernate.CHARACTER.getName() );
- registerHibernateType( Types.DATE, Hibernate.DATE.getName() );
- registerHibernateType( Types.DOUBLE, Hibernate.DOUBLE.getName() );
- registerHibernateType( Types.FLOAT, Hibernate.FLOAT.getName() );
- registerHibernateType( Types.INTEGER, Hibernate.INTEGER.getName() );
- registerHibernateType( Types.SMALLINT, Hibernate.SHORT.getName() );
- registerHibernateType( Types.TINYINT, Hibernate.BYTE.getName() );
- registerHibernateType( Types.TIME, Hibernate.TIME.getName() );
- registerHibernateType( Types.TIMESTAMP, Hibernate.TIMESTAMP.getName() );
- registerHibernateType( Types.VARCHAR, Hibernate.STRING.getName() );
- registerHibernateType( Types.VARBINARY, Hibernate.BINARY.getName() );
- registerHibernateType( Types.NUMERIC, Hibernate.BIG_DECIMAL.getName() );
- registerHibernateType( Types.DECIMAL, Hibernate.BIG_DECIMAL.getName() );
- registerHibernateType( Types.BLOB, Hibernate.BLOB.getName() );
- registerHibernateType( Types.CLOB, Hibernate.CLOB.getName() );
- registerHibernateType( Types.REAL, Hibernate.FLOAT.getName() );
+ registerColumnType( Types.BIT, "bit" );
+ registerColumnType( Types.BOOLEAN, "boolean" );
+ registerColumnType( Types.TINYINT, "tinyint" );
+ registerColumnType( Types.SMALLINT, "smallint" );
+ registerColumnType( Types.INTEGER, "integer" );
+ registerColumnType( Types.BIGINT, "bigint" );
+ registerColumnType( Types.FLOAT, "float($p)" );
+ registerColumnType( Types.DOUBLE, "double precision" );
+ registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
+ registerColumnType( Types.REAL, "real" );
+
+ registerColumnType( Types.DATE, "date" );
+ registerColumnType( Types.TIME, "time" );
+ registerColumnType( Types.TIMESTAMP, "timestamp" );
+
+ registerColumnType( Types.VARBINARY, "bit varying($l)" );
+ registerColumnType( Types.LONGVARBINARY, "bit varying($l)" );
+ registerColumnType( Types.BLOB, "blob" );
+
+ registerColumnType( Types.CHAR, "char($l)" );
+ registerColumnType( Types.VARCHAR, "varchar($l)" );
+ registerColumnType( Types.LONGVARCHAR, "varchar($l)" );
+ registerColumnType( Types.CLOB, "clob" );
+
+ registerColumnType( Types.NCHAR, "nchar($l)" );
+ registerColumnType( Types.NVARCHAR, "nvarchar($l)" );
+ registerColumnType( Types.LONGNVARCHAR, "nvarchar($l)" );
+ registerColumnType( Types.NCLOB, "nclob" );
+
+ // register hibernate types for default use in scalar sqlquery type auto detection
+ registerHibernateType( Types.BIGINT, StandardBasicTypes.BIG_INTEGER.getName() );
+ registerHibernateType( Types.BINARY, StandardBasicTypes.BINARY.getName() );
+ registerHibernateType( Types.BIT, StandardBasicTypes.BOOLEAN.getName() );
+ registerHibernateType( Types.BOOLEAN, StandardBasicTypes.BOOLEAN.getName() );
+ registerHibernateType( Types.CHAR, StandardBasicTypes.CHARACTER.getName() );
+ registerHibernateType( Types.CHAR, 1, StandardBasicTypes.CHARACTER.getName() );
+ registerHibernateType( Types.CHAR, 255, StandardBasicTypes.STRING.getName() );
+ registerHibernateType( Types.DATE, StandardBasicTypes.DATE.getName() );
+ registerHibernateType( Types.DOUBLE, StandardBasicTypes.DOUBLE.getName() );
+ registerHibernateType( Types.FLOAT, StandardBasicTypes.FLOAT.getName() );
+ registerHibernateType( Types.INTEGER, StandardBasicTypes.INTEGER.getName() );
+ registerHibernateType( Types.SMALLINT, StandardBasicTypes.SHORT.getName() );
+ registerHibernateType( Types.TINYINT, StandardBasicTypes.BYTE.getName() );
+ registerHibernateType( Types.TIME, StandardBasicTypes.TIME.getName() );
+ registerHibernateType( Types.TIMESTAMP, StandardBasicTypes.TIMESTAMP.getName() );
+ registerHibernateType( Types.VARCHAR, StandardBasicTypes.STRING.getName() );
+ registerHibernateType( Types.VARBINARY, StandardBasicTypes.BINARY.getName() );
+ registerHibernateType( Types.LONGVARCHAR, StandardBasicTypes.TEXT.getName() );
+ registerHibernateType( Types.LONGVARBINARY, StandardBasicTypes.IMAGE.getName() );
+ registerHibernateType( Types.NUMERIC, StandardBasicTypes.BIG_DECIMAL.getName() );
+ registerHibernateType( Types.DECIMAL, StandardBasicTypes.BIG_DECIMAL.getName() );
+ registerHibernateType( Types.BLOB, StandardBasicTypes.BLOB.getName() );
+ registerHibernateType( Types.CLOB, StandardBasicTypes.CLOB.getName() );
+ registerHibernateType( Types.REAL, StandardBasicTypes.FLOAT.getName() );
+
+ uniqueDelegate = new DefaultUniqueDelegate( this );
}
/**
@@ -230,8 +236,7 @@
* @throws HibernateException If no dialect was specified, or if it could not be instantiated.
*/
public static Dialect getDialect() throws HibernateException {
- String dialectName = Environment.getProperties().getProperty( Environment.DIALECT );
- return instantiateDialect( dialectName );
+ return instantiateDialect( Environment.getProperties().getProperty( Environment.DIALECT ) );
}
@@ -244,7 +249,7 @@
* @throws HibernateException If no dialect was specified, or if it could not be instantiated.
*/
public static Dialect getDialect(Properties props) throws HibernateException {
- String dialectName = props.getProperty( Environment.DIALECT );
+ final String dialectName = props.getProperty( Environment.DIALECT );
if ( dialectName == null ) {
return getDialect();
}
@@ -256,13 +261,13 @@
throw new HibernateException( "The dialect was not set. Set the property hibernate.dialect." );
}
try {
- return ( Dialect ) ReflectHelper.classForName( dialectName ).newInstance();
+ return (Dialect) ReflectHelper.classForName( dialectName ).newInstance();
}
catch ( ClassNotFoundException cnfe ) {
throw new HibernateException( "Dialect class not found: " + dialectName );
}
catch ( Exception e ) {
- throw new HibernateException( "Could not instantiate dialect class", e );
+ throw new HibernateException( "Could not instantiate given dialect class: " + dialectName, e );
}
}
@@ -275,6 +280,7 @@
return properties;
}
+ @Override
public String toString() {
return getClass().getName();
}
@@ -283,6 +289,16 @@
// database type mapping support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
+ * Allows the Dialect to contribute additional types
+ *
+ * @param typeContributions Callback to contribute the types
+ * @param serviceRegistry The service registry
+ */
+ public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
+ // by default, nothing to do
+ }
+
+ /**
* Get the name of the database type associated with the given
* {@link java.sql.Types} typecode.
*
@@ -291,7 +307,7 @@
* @throws HibernateException If no mapping was specified for that type.
*/
public String getTypeName(int code) throws HibernateException {
- String result = typeNames.get( code );
+ final String result = typeNames.get( code );
if ( result == null ) {
throw new HibernateException( "No default type mapping for (java.sql.Types) " + code );
}
@@ -310,14 +326,11 @@
* @return the database type name
* @throws HibernateException If no mapping was specified for that type.
*/
- public String getTypeName(int code, int length, int precision, int scale) throws HibernateException {
- String result = typeNames.get( code, length, precision, scale );
+ public String getTypeName(int code, long length, int precision, int scale) throws HibernateException {
+ final String result = typeNames.get( code, length, precision, scale );
if ( result == null ) {
throw new HibernateException(
- "No type mapping for java.sql.Types code: " +
- code +
- ", length: " +
- length
+ String.format( "No type mapping for java.sql.Types code: %s, length: %s", code, length )
);
}
return result;
@@ -335,6 +348,56 @@
}
/**
+ * Return an expression casting the value to the specified type
+ *
+ * @param value The value to cast
+ * @param jdbcTypeCode The JDBC type code to cast to
+ * @param length The type length
+ * @param precision The type precision
+ * @param scale The type scale
+ *
+ * @return The cast expression
+ */
+ public String cast(String value, int jdbcTypeCode, int length, int precision, int scale) {
+ if ( jdbcTypeCode == Types.CHAR ) {
+ return "cast(" + value + " as char(" + length + "))";
+ }
+ else {
+ return "cast(" + value + "as " + getTypeName( jdbcTypeCode, length, precision, scale ) + ")";
+ }
+ }
+
+ /**
+ * Return an expression casting the value to the specified type. Simply calls
+ * {@link #cast(String, int, int, int, int)} passing {@link Column#DEFAULT_PRECISION} and
+ * {@link Column#DEFAULT_SCALE} as the precision/scale.
+ *
+ * @param value The value to cast
+ * @param jdbcTypeCode The JDBC type code to cast to
+ * @param length The type length
+ *
+ * @return The cast expression
+ */
+ public String cast(String value, int jdbcTypeCode, int length) {
+ return cast( value, jdbcTypeCode, length, Column.DEFAULT_PRECISION, Column.DEFAULT_SCALE );
+ }
+
+ /**
+ * Return an expression casting the value to the specified type. Simply calls
+ * {@link #cast(String, int, int, int, int)} passing {@link Column#DEFAULT_LENGTH} as the length
+ *
+ * @param value The value to cast
+ * @param jdbcTypeCode The JDBC type code to cast to
+ * @param precision The type precision
+ * @param scale The type scale
+ *
+ * @return The cast expression
+ */
+ public String cast(String value, int jdbcTypeCode, int precision, int scale) {
+ return cast( value, jdbcTypeCode, Column.DEFAULT_LENGTH, precision, scale );
+ }
+
+ /**
* Subclasses register a type name for the given type code and maximum
* column length. $l in the type name with be replaced by the
* column length (if appropriate).
@@ -343,7 +406,7 @@
* @param capacity The maximum length of database type
* @param name The database type name
*/
- protected void registerColumnType(int code, int capacity, String name) {
+ protected void registerColumnType(int code, long capacity, String name) {
typeNames.put( code, capacity, name );
}
@@ -358,19 +421,216 @@
typeNames.put( code, name );
}
+ /**
+ * Allows the dialect to override a {@link SqlTypeDescriptor}.
+ *
+ * If the passed {@code sqlTypeDescriptor} allows itself to be remapped (per
+ * {@link org.hibernate.type.descriptor.sql.SqlTypeDescriptor#canBeRemapped()}), then this method uses
+ * {@link #getSqlTypeDescriptorOverride} to get an optional override based on the SQL code returned by
+ * {@link SqlTypeDescriptor#getSqlType()}.
+ *
+ * If this dialect does not provide an override or if the {@code sqlTypeDescriptor} doe not allow itself to be
+ * remapped, then this method simply returns the original passed {@code sqlTypeDescriptor}
+ *
+ * @param sqlTypeDescriptor The {@link SqlTypeDescriptor} to override
+ * @return The {@link SqlTypeDescriptor} that should be used for this dialect;
+ * if there is no override, then original {@code sqlTypeDescriptor} is returned.
+ * @throws IllegalArgumentException if {@code sqlTypeDescriptor} is null.
+ *
+ * @see #getSqlTypeDescriptorOverride
+ */
+ public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
+ if ( sqlTypeDescriptor == null ) {
+ throw new IllegalArgumentException( "sqlTypeDescriptor is null" );
+ }
+ if ( ! sqlTypeDescriptor.canBeRemapped() ) {
+ return sqlTypeDescriptor;
+ }
+ final SqlTypeDescriptor overridden = getSqlTypeDescriptorOverride( sqlTypeDescriptor.getSqlType() );
+ return overridden == null ? sqlTypeDescriptor : overridden;
+ }
+
+ /**
+ * Returns the {@link SqlTypeDescriptor} that should be used to handle the given JDBC type code. Returns
+ * {@code null} if there is no override.
+ *
+ * @param sqlCode A {@link Types} constant indicating the SQL column type
+ * @return The {@link SqlTypeDescriptor} to use as an override, or {@code null} if there is no override.
+ */
+ protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
+ SqlTypeDescriptor descriptor;
+ switch ( sqlCode ) {
+ case Types.CLOB: {
+ descriptor = useInputStreamToInsertBlob() ? ClobTypeDescriptor.STREAM_BINDING : null;
+ break;
+ }
+ default: {
+ descriptor = null;
+ break;
+ }
+ }
+ return descriptor;
+ }
+
+ /**
+ * The legacy behavior of Hibernate. LOBs are not processed by merge
+ */
+ @SuppressWarnings( {"UnusedDeclaration"})
+ protected static final LobMergeStrategy LEGACY_LOB_MERGE_STRATEGY = new LobMergeStrategy() {
+ @Override
+ public Blob mergeBlob(Blob original, Blob target, SessionImplementor session) {
+ return target;
+ }
+
+ @Override
+ public Clob mergeClob(Clob original, Clob target, SessionImplementor session) {
+ return target;
+ }
+
+ @Override
+ public NClob mergeNClob(NClob original, NClob target, SessionImplementor session) {
+ return target;
+ }
+ };
+
+ /**
+ * Merge strategy based on transferring contents based on streams.
+ */
+ @SuppressWarnings( {"UnusedDeclaration"})
+ protected static final LobMergeStrategy STREAM_XFER_LOB_MERGE_STRATEGY = new LobMergeStrategy() {
+ @Override
+ public Blob mergeBlob(Blob original, Blob target, SessionImplementor session) {
+ if ( original != target ) {
+ try {
+ // the BLOB just read during the load phase of merge
+ final OutputStream connectedStream = target.setBinaryStream( 1L );
+ // the BLOB from the detached state
+ final InputStream detachedStream = original.getBinaryStream();
+ StreamCopier.copy( detachedStream, connectedStream );
+ return target;
+ }
+ catch (SQLException e ) {
+ throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge BLOB data" );
+ }
+ }
+ else {
+ return NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeBlob( original, target, session );
+ }
+ }
+
+ @Override
+ public Clob mergeClob(Clob original, Clob target, SessionImplementor session) {
+ if ( original != target ) {
+ try {
+ // the CLOB just read during the load phase of merge
+ final OutputStream connectedStream = target.setAsciiStream( 1L );
+ // the CLOB from the detached state
+ final InputStream detachedStream = original.getAsciiStream();
+ StreamCopier.copy( detachedStream, connectedStream );
+ return target;
+ }
+ catch (SQLException e ) {
+ throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" );
+ }
+ }
+ else {
+ return NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeClob( original, target, session );
+ }
+ }
+
+ @Override
+ public NClob mergeNClob(NClob original, NClob target, SessionImplementor session) {
+ if ( original != target ) {
+ try {
+ // the NCLOB just read during the load phase of merge
+ final OutputStream connectedStream = target.setAsciiStream( 1L );
+ // the NCLOB from the detached state
+ final InputStream detachedStream = original.getAsciiStream();
+ StreamCopier.copy( detachedStream, connectedStream );
+ return target;
+ }
+ catch (SQLException e ) {
+ throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge NCLOB data" );
+ }
+ }
+ else {
+ return NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeNClob( original, target, session );
+ }
+ }
+ };
+
+ /**
+ * Merge strategy based on creating a new LOB locator.
+ */
+ protected static final LobMergeStrategy NEW_LOCATOR_LOB_MERGE_STRATEGY = new LobMergeStrategy() {
+ @Override
+ public Blob mergeBlob(Blob original, Blob target, SessionImplementor session) {
+ if ( original == null && target == null ) {
+ return null;
+ }
+ try {
+ final LobCreator lobCreator = session.getFactory().getJdbcServices().getLobCreator( session );
+ return original == null
+ ? lobCreator.createBlob( ArrayHelper.EMPTY_BYTE_ARRAY )
+ : lobCreator.createBlob( original.getBinaryStream(), original.length() );
+ }
+ catch (SQLException e) {
+ throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge BLOB data" );
+ }
+ }
+
+ @Override
+ public Clob mergeClob(Clob original, Clob target, SessionImplementor session) {
+ if ( original == null && target == null ) {
+ return null;
+ }
+ try {
+ final LobCreator lobCreator = session.getFactory().getJdbcServices().getLobCreator( session );
+ return original == null
+ ? lobCreator.createClob( "" )
+ : lobCreator.createClob( original.getCharacterStream(), original.length() );
+ }
+ catch (SQLException e) {
+ throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" );
+ }
+ }
+
+ @Override
+ public NClob mergeNClob(NClob original, NClob target, SessionImplementor session) {
+ if ( original == null && target == null ) {
+ return null;
+ }
+ try {
+ final LobCreator lobCreator = session.getFactory().getJdbcServices().getLobCreator( session );
+ return original == null
+ ? lobCreator.createNClob( "" )
+ : lobCreator.createNClob( original.getCharacterStream(), original.length() );
+ }
+ catch (SQLException e) {
+ throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge NCLOB data" );
+ }
+ }
+ };
+
+ public LobMergeStrategy getLobMergeStrategy() {
+ return NEW_LOCATOR_LOB_MERGE_STRATEGY;
+ }
+
+
// hibernate type mapping support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
- * Get the name of the Hibernate {@link org.hibernate.type.Type} associated with th given
- * {@link java.sql.Types} typecode.
+ * Get the name of the Hibernate {@link org.hibernate.type.Type} associated with the given
+ * {@link java.sql.Types} type code.
*
- * @param code The {@link java.sql.Types} typecode
+ * @param code The {@link java.sql.Types} type code
* @return The Hibernate {@link org.hibernate.type.Type} name.
* @throws HibernateException If no mapping was specified for that type.
*/
+ @SuppressWarnings( {"UnusedDeclaration"})
public String getHibernateTypeName(int code) throws HibernateException {
- String result = hibernateTypeNames.get( code );
+ final String result = hibernateTypeNames.get( code );
if ( result == null ) {
throw new HibernateException( "No Hibernate type mapping for java.sql.Types code: " + code );
}
@@ -390,13 +650,14 @@
* @throws HibernateException If no mapping was specified for that type.
*/
public String getHibernateTypeName(int code, int length, int precision, int scale) throws HibernateException {
- String result = hibernateTypeNames.get( code, length, precision, scale );
+ final String result = hibernateTypeNames.get( code, length, precision, scale );
if ( result == null ) {
throw new HibernateException(
- "No Hibernate type mapping for java.sql.Types code: " +
- code +
- ", length: " +
- length
+ String.format(
+ "No Hibernate type mapping for type [code=%s, length=%s]",
+ code,
+ length
+ )
);
}
return result;
@@ -410,7 +671,7 @@
* @param capacity The maximum length of database type
* @param name The Hibernate {@link org.hibernate.type.Type} name
*/
- protected void registerHibernateType(int code, int capacity, String name) {
+ protected void registerHibernateType(int code, long capacity, String name) {
hibernateTypeNames.put( code, capacity, name);
}
@@ -429,32 +690,34 @@
// function support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
protected void registerFunction(String name, SQLFunction function) {
- sqlFunctions.put( name, function );
+ // HHH-7721: SQLFunctionRegistry expects all lowercase. Enforce,
+ // just in case a user's customer dialect uses mixed cases.
+ sqlFunctions.put( name.toLowerCase(), function );
}
/**
- * Retrieves a map of the dialect's registered fucntions
+ * Retrieves a map of the dialect's registered functions
* (functionName => {@link org.hibernate.dialect.function.SQLFunction}).
*
* @return The map of registered functions.
*/
- public final Map getFunctions() {
+ public final Map getFunctions() {
return sqlFunctions;
}
// keyword support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
protected void registerKeyword(String word) {
- sqlKeywords.add(word);
+ sqlKeywords.add( word );
}
- public Set getKeywords() {
+ public Set getKeywords() {
return sqlKeywords;
}
- // native identifier generatiion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // native identifier generation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* The class (which implements {@link org.hibernate.id.IdentifierGenerator})
@@ -501,7 +764,7 @@
/**
* Whether this dialect have an Identity clause added to the data type or a
- * completely seperate identity data type
+ * completely separate identity data type
*
* @return boolean
*/
@@ -510,7 +773,7 @@
}
/**
- * Provided we {@link #supportsInsertSelectIdentity}, then attch the
+ * Provided we {@link #supportsInsertSelectIdentity}, then attach the
* "select identity" clause to the insert statement.
*
* Note, if {@link #supportsInsertSelectIdentity} == false then
@@ -526,7 +789,7 @@
/**
* Get the select command to use to retrieve the last generated IDENTITY
- * value for a particuar table
+ * value for a particular table
*
* @param table The table into which the insert was done
* @param column The PK column.
@@ -546,7 +809,7 @@
* @throws MappingException If IDENTITY generation is not supported.
*/
protected String getIdentitySelectString() throws MappingException {
- throw new MappingException( "Dialect does not support identity key generation" );
+ throw new MappingException( getClass().getName() + " does not support identity key generation" );
}
/**
@@ -568,7 +831,7 @@
* @throws MappingException If IDENTITY generation is not supported.
*/
protected String getIdentityColumnString() throws MappingException {
- throw new MappingException( "Dialect does not support identity key generation" );
+ throw new MappingException( getClass().getName() + " does not support identity key generation" );
}
/**
@@ -606,7 +869,7 @@
}
/**
- * Generate the appropriate select statement to to retreive the next value
+ * Generate the appropriate select statement to to retrieve the next value
* of a sequence.
*
* This should be a "stand alone" select statement.
@@ -616,11 +879,11 @@
* @throws MappingException If sequences are not supported.
*/
public String getSequenceNextValString(String sequenceName) throws MappingException {
- throw new MappingException( "Dialect does not support sequences" );
+ throw new MappingException( getClass().getName() + " does not support sequences" );
}
/**
- * Generate the select expression fragment that will retreive the next
+ * Generate the select expression fragment that will retrieve the next
* value of a sequence as part of another (typically DML) statement.
*
* This differs from {@link #getSequenceNextValString(String)} in that this
@@ -631,7 +894,7 @@
* @throws MappingException If sequences are not supported.
*/
public String getSelectSequenceNextValString(String sequenceName) throws MappingException {
- throw new MappingException( "Dialect does not support sequences" );
+ throw new MappingException( getClass().getName() + " does not support sequences" );
}
/**
@@ -642,6 +905,7 @@
* @throws MappingException If sequences are not supported.
* @deprecated Use {@link #getCreateSequenceString(String, int, int)} instead
*/
+ @Deprecated
public String[] getCreateSequenceStrings(String sequenceName) throws MappingException {
return new String[] { getCreateSequenceString( sequenceName ) };
}
@@ -674,7 +938,7 @@
* @throws MappingException If sequences are not supported.
*/
protected String getCreateSequenceString(String sequenceName) throws MappingException {
- throw new MappingException( "Dialect does not support sequences" );
+ throw new MappingException( getClass().getName() + " does not support sequences" );
}
/**
@@ -698,7 +962,7 @@
if ( supportsPooledSequences() ) {
return getCreateSequenceString( sequenceName ) + " start with " + initialValue + " increment by " + incrementSize;
}
- throw new MappingException( "Dialect does not support pooled sequences" );
+ throw new MappingException( getClass().getName() + " does not support pooled sequences" );
}
/**
@@ -727,7 +991,7 @@
* @throws MappingException If sequences are not supported.
*/
protected String getDropSequenceString(String sequenceName) throws MappingException {
- throw new MappingException( "Dialect does not support sequences" );
+ throw new MappingException( getClass().getName() + " does not support sequences" );
}
/**
@@ -751,7 +1015,7 @@
* @return The appropriate command.
*/
public String getSelectGUIDString() {
- throw new UnsupportedOperationException( "dialect does not support GUIDs" );
+ throw new UnsupportedOperationException( getClass().getName() + " does not support GUIDs" );
}
@@ -762,7 +1026,9 @@
* via a SQL clause?
*
* @return True if this dialect supports some form of LIMIT.
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
public boolean supportsLimit() {
return false;
}
@@ -772,17 +1038,21 @@
* support specifying an offset?
*
* @return True if the dialect supports an offset within the limit support.
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
public boolean supportsLimitOffset() {
return supportsLimit();
}
/**
- * Does this dialect support bind variables (i.e., prepared statememnt
+ * Does this dialect support bind variables (i.e., prepared statement
* parameters) for its limit/offset?
*
* @return True if bind variables can be used; false otherwise.
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
public boolean supportsVariableLimit() {
return supportsLimit();
}
@@ -792,7 +1062,9 @@
* Does this dialect require us to bind the parameters in reverse order?
*
* @return true if the correct order is limit, offset
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
public boolean bindLimitParametersInReverseOrder() {
return false;
}
@@ -802,7 +1074,9 @@
* SELECT statement, rather than at the end?
*
* @return true if limit parameters should come before other parameters
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
public boolean bindLimitParametersFirst() {
return false;
}
@@ -822,28 +1096,44 @@
* So essentially, is limit relative from offset? Or is limit absolute?
*
* @return True if limit is relative from offset; false otherwise.
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
public boolean useMaxForLimit() {
return false;
}
/**
+ * Generally, if there is no limit applied to a Hibernate query we do not apply any limits
+ * to the SQL query. This option forces that the limit be written to the SQL query.
+ *
+ * @return True to force limit into SQL query even if none specified in Hibernate query; false otherwise.
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
+ */
+ @Deprecated
+ public boolean forceLimitUsage() {
+ return false;
+ }
+
+ /**
* Given a limit and an offset, apply the limit clause to the query.
*
* @param query The query to which to apply the limit.
* @param offset The offset of the limit
* @param limit The limit of the limit ;)
* @return The modified query statement with the limit applied.
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
public String getLimitString(String query, int offset, int limit) {
- return getLimitString( query, offset > 0 );
+ return getLimitString( query, ( offset > 0 || forceLimitUsage() ) );
}
/**
* Apply s limit clause to the query.
*
* Typically dialects utilize {@link #supportsVariableLimit() variable}
- * limit caluses when they support limits. Thus, when building the
+ * limit clauses when they support limits. Thus, when building the
* select command we do not actually need to know the limit or the offest
* since we will just be using placeholders.
*
@@ -855,15 +1145,75 @@
* @param query The query to which to apply the limit.
* @param hasOffset Is the query requesting an offset?
* @return the modified SQL
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
*/
+ @Deprecated
protected String getLimitString(String query, boolean hasOffset) {
- throw new UnsupportedOperationException( "paged queries not supported" );
+ throw new UnsupportedOperationException( "Paged queries not supported by " + getClass().getName());
}
+ /**
+ * Hibernate APIs explicitly state that setFirstResult() should be a zero-based offset. Here we allow the
+ * Dialect a chance to convert that value based on what the underlying db or driver will expect.
+ *
+ * NOTE: what gets passed into {@link #getLimitString(String,int,int)} is the zero-based offset. Dialects which
+ * do not {@link #supportsVariableLimit} should take care to perform any needed first-row-conversion calls prior
+ * to injecting the limit values into the SQL string.
+ *
+ * @param zeroBasedFirstResult The user-supplied, zero-based first row offset.
+ * @return The corresponding db/dialect specific offset.
+ * @see org.hibernate.Query#setFirstResult
+ * @see org.hibernate.Criteria#setFirstResult
+ * @deprecated {@link #buildLimitHandler(String, RowSelection)} should be overridden instead.
+ */
+ @Deprecated
+ public int convertToFirstRowValue(int zeroBasedFirstResult) {
+ return zeroBasedFirstResult;
+ }
+ /**
+ * Build delegate managing LIMIT clause.
+ *
+ * @param sql SQL query.
+ * @param selection Selection criteria. {@code null} in case of unlimited number of rows.
+ * @return LIMIT clause delegate.
+ */
+ public LimitHandler buildLimitHandler(String sql, RowSelection selection) {
+ return new LegacyLimitHandler( this, sql, selection );
+ }
+
+
// lock acquisition support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
+ * Informational metadata about whether this dialect is known to support
+ * specifying timeouts for requested lock acquisitions.
+ *
+ * @return True is this dialect supports specifying lock timeouts.
+ */
+ public boolean supportsLockTimeouts() {
+ return true;
+
+ }
+
+ /**
+ * If this dialect supports specifying lock timeouts, are those timeouts
+ * rendered into the SQL string as parameters. The implication
+ * is that Hibernate will need to bind the timeout value as a parameter
+ * in the {@link java.sql.PreparedStatement}. If true, the param position
+ * is always handled as the last parameter; if the dialect specifies the
+ * lock timeout elsewhere in the SQL statement then the timeout
+ * value should be directly rendered into the statement and this method
+ * should return false.
+ *
+ * @return True if the lock timeout is rendered into the SQL
+ * string as a parameter; false otherwise.
+ */
+ public boolean isLockTimeoutParameterized() {
+ return false;
+ }
+
+ /**
* Get a strategy instance which knows how to acquire a database-level lock
* of the specified mode for this dialect.
*
@@ -873,28 +1223,61 @@
* @since 3.2
*/
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
- return new SelectLockingStrategy( lockable, lockMode );
+ switch ( lockMode ) {
+ case PESSIMISTIC_FORCE_INCREMENT:
+ return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
+ case PESSIMISTIC_WRITE:
+ return new PessimisticWriteSelectLockingStrategy( lockable, lockMode );
+ case PESSIMISTIC_READ:
+ return new PessimisticReadSelectLockingStrategy( lockable, lockMode );
+ case OPTIMISTIC:
+ return new OptimisticLockingStrategy( lockable, lockMode );
+ case OPTIMISTIC_FORCE_INCREMENT:
+ return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
+ default:
+ return new SelectLockingStrategy( lockable, lockMode );
+ }
}
/**
+ * Given LockOptions (lockMode, timeout), determine the appropriate for update fragment to use.
+ *
+ * @param lockOptions contains the lock mode to apply.
+ * @return The appropriate for update fragment.
+ */
+ public String getForUpdateString(LockOptions lockOptions) {
+ final LockMode lockMode = lockOptions.getLockMode();
+ return getForUpdateString( lockMode, lockOptions.getTimeOut() );
+ }
+
+ @SuppressWarnings( {"deprecation"})
+ private String getForUpdateString(LockMode lockMode, int timeout){
+ switch ( lockMode ) {
+ case UPGRADE:
+ return getForUpdateString();
+ case PESSIMISTIC_READ:
+ return getReadLockString( timeout );
+ case PESSIMISTIC_WRITE:
+ return getWriteLockString( timeout );
+ case UPGRADE_NOWAIT:
+ case FORCE:
+ case PESSIMISTIC_FORCE_INCREMENT:
+ return getForUpdateNowaitString();
+ case UPGRADE_SKIPLOCKED:
+ return getForUpdateSkipLockedString();
+ default:
+ return "";
+ }
+ }
+
+ /**
* Given a lock mode, determine the appropriate for update fragment to use.
*
* @param lockMode The lock mode to apply.
* @return The appropriate for update fragment.
*/
public String getForUpdateString(LockMode lockMode) {
- if ( lockMode==LockMode.UPGRADE ) {
- return getForUpdateString();
- }
- else if ( lockMode==LockMode.UPGRADE_NOWAIT ) {
- return getForUpdateNowaitString();
- }
- else if ( lockMode==LockMode.FORCE ) {
- return getForUpdateNowaitString();
- }
- else {
- return "";
- }
+ return getForUpdateString( lockMode, LockOptions.WAIT_FOREVER );
}
/**
@@ -908,6 +1291,31 @@
}
/**
+ * Get the string to append to SELECT statements to acquire WRITE locks
+ * for this dialect. Location of the of the returned string is treated
+ * the same as getForUpdateString.
+ *
+ * @param timeout in milliseconds, -1 for indefinite wait and 0 for no wait.
+ * @return The appropriate LOCK clause string.
+ */
+ public String getWriteLockString(int timeout) {
+ return getForUpdateString();
+ }
+
+ /**
+ * Get the string to append to SELECT statements to acquire WRITE locks
+ * for this dialect. Location of the of the returned string is treated
+ * the same as getForUpdateString.
+ *
+ * @param timeout in milliseconds, -1 for indefinite wait and 0 for no wait.
+ * @return The appropriate LOCK clause string.
+ */
+ public String getReadLockString(int timeout) {
+ return getForUpdateString();
+ }
+
+
+ /**
* Is FOR UPDATE OF syntax supported?
*
* @return True if the database supports FOR UPDATE OF syntax;
@@ -942,6 +1350,30 @@
}
/**
+ * Get the FOR UPDATE OF column_list fragment appropriate for this
+ * dialect given the aliases of the columns to be write locked.
+ *
+ * @param aliases The columns to be write locked.
+ * @param lockOptions the lock options to apply
+ * @return The appropriate FOR UPDATE OF column_list clause string.
+ */
+ @SuppressWarnings({"unchecked", "UnusedParameters"})
+ public String getForUpdateString(String aliases, LockOptions lockOptions) {
+ LockMode lockMode = lockOptions.getLockMode();
+ final Iterator> itr = lockOptions.getAliasLockIterator();
+ while ( itr.hasNext() ) {
+ // seek the highest lock mode
+ final Map.Entryentry = itr.next();
+ final LockMode lm = entry.getValue();
+ if ( lm.greaterThan( lockMode ) ) {
+ lockMode = lm;
+ }
+ }
+ lockOptions.setLockMode( lockMode );
+ return getForUpdateString( lockOptions );
+ }
+
+ /**
* Retrieves the FOR UPDATE NOWAIT syntax specific to this dialect.
*
* @return The appropriate FOR UPDATE NOWAIT clause string.
@@ -952,17 +1384,38 @@
}
/**
+ * Retrieves the FOR UPDATE SKIP LOCKED syntax specific to this dialect.
+ *
+ * @return The appropriate FOR UPDATE SKIP LOCKED clause string.
+ */
+ public String getForUpdateSkipLockedString() {
+ // by default we report no support for SKIP_LOCKED lock semantics
+ return getForUpdateString();
+ }
+
+ /**
* Get the FOR UPDATE OF column_list NOWAIT fragment appropriate
* for this dialect given the aliases of the columns to be write locked.
*
* @param aliases The columns to be write locked.
- * @return The appropriate FOR UPDATE colunm_list NOWAIT clause string.
+ * @return The appropriate FOR UPDATE OF colunm_list NOWAIT clause string.
*/
public String getForUpdateNowaitString(String aliases) {
return getForUpdateString( aliases );
}
/**
+ * Get the FOR UPDATE OF column_list SKIP LOCKED fragment appropriate
+ * for this dialect given the aliases of the columns to be write locked.
+ *
+ * @param aliases The columns to be write locked.
+ * @return The appropriate FOR UPDATE colunm_list SKIP LOCKED clause string.
+ */
+ public String getForUpdateSkipLockedString(String aliases) {
+ return getForUpdateString( aliases );
+ }
+
+ /**
* Some dialects support an alternative means to SELECT FOR UPDATE,
* whereby a "lock hint" is appends to the table name in the from clause.
*
@@ -971,8 +1424,23 @@
* @param mode The lock mode to apply
* @param tableName The name of the table to which to apply the lock hint.
* @return The table with any required lock hints.
+ * @deprecated use {@code appendLockHint(LockOptions,String)} instead
*/
+ @Deprecated
public String appendLockHint(LockMode mode, String tableName) {
+ return appendLockHint( new LockOptions( mode ), tableName );
+ }
+ /**
+ * Some dialects support an alternative means to SELECT FOR UPDATE,
+ * whereby a "lock hint" is appends to the table name in the from clause.
+ *
+ * contributed by Helge Schulz
+ *
+ * @param lockOptions The lock options to apply
+ * @param tableName The name of the table to which to apply the lock hint.
+ * @return The table with any required lock hints.
+ */
+ public String appendLockHint(LockOptions lockOptions, String tableName){
return tableName;
}
@@ -985,12 +1453,12 @@
* SELECT FOR UPDATE to achieve this in their own fashion.
*
* @param sql the SQL string to modify
- * @param aliasedLockModes a map of lock modes indexed by aliased table names.
+ * @param aliasedLockOptions lock options indexed by aliased table names.
* @param keyColumnNames a map of key columns indexed by aliased table names.
* @return the modified SQL string.
*/
- public String applyLocksToSql(String sql, Map aliasedLockModes, Map keyColumnNames) {
- return sql + new ForUpdateFragment( this, aliasedLockModes, keyColumnNames ).toFragmentString();
+ public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map keyColumnNames) {
+ return sql + new ForUpdateFragment( this, aliasedLockOptions, keyColumnNames ).toFragmentString();
}
@@ -1032,7 +1500,7 @@
}
/**
- * Generate a temporary table name given the bas table.
+ * Generate a temporary table name given the base table.
*
* @param baseTableName The table name from which to base the temp table name.
* @return The generated temp table name.
@@ -1061,6 +1529,15 @@
}
/**
+ * Command used to drop a temporary table.
+ *
+ * @return The command used to drop a temporary table.
+ */
+ public String getDropTemporaryTableString() {
+ return "drop table";
+ }
+
+ /**
* Does the dialect require that temporary table DDL statements occur in
* isolation from other statements? This would be the case if the creation
* would cause any current transaction to get committed implicitly.
@@ -1080,7 +1557,7 @@
*
null - defer to the JDBC driver response in regards to
* {@link java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()}
*
- *
+ *
* @return see the result matrix above.
*/
public Boolean performTemporaryTableDDLInIsolation() {
@@ -1100,23 +1577,45 @@
// callable statement support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
- * Registers an OUT parameter which will be returing a
- * {@link java.sql.ResultSet}. How this is accomplished varies greatly
- * from DB to DB, hence its inclusion (along with {@link #getResultSet}) here.
+ * Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
+ * returning {@link java.sql.ResultSet} *by position*. Pre-Java 8, registering such ResultSet-returning
+ * parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.
*
* @param statement The callable statement.
- * @param position The bind position at which to register the OUT param.
+ * @param position The bind position at which to register the output param.
+ *
* @return The number of (contiguous) bind positions used.
- * @throws SQLException Indicates problems registering the OUT param.
+ *
+ * @throws SQLException Indicates problems registering the param.
*/
public int registerResultSetOutParameter(CallableStatement statement, int position) throws SQLException {
throw new UnsupportedOperationException(
getClass().getName() +
- " does not support resultsets via stored procedures"
- );
+ " does not support resultsets via stored procedures"
+ );
}
/**
+ * Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
+ * returning {@link java.sql.ResultSet} *by name*. Pre-Java 8, registering such ResultSet-returning
+ * parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.
+ *
+ * @param statement The callable statement.
+ * @param name The parameter name (for drivers which support named parameters).
+ *
+ * @return The number of (contiguous) bind positions used.
+ *
+ * @throws SQLException Indicates problems registering the param.
+ */
+ @SuppressWarnings("UnusedParameters")
+ public int registerResultSetOutParameter(CallableStatement statement, String name) throws SQLException {
+ throw new UnsupportedOperationException(
+ getClass().getName() +
+ " does not support resultsets via stored procedures"
+ );
+ }
+
+ /**
* Given a callable statement previously processed by {@link #registerResultSetOutParameter},
* extract the {@link java.sql.ResultSet} from the OUT parameter.
*
@@ -1126,11 +1625,46 @@
*/
public ResultSet getResultSet(CallableStatement statement) throws SQLException {
throw new UnsupportedOperationException(
- getClass().getName() +
- " does not support resultsets via stored procedures"
- );
+ getClass().getName() + " does not support resultsets via stored procedures"
+ );
}
+ /**
+ * Given a callable statement previously processed by {@link #registerResultSetOutParameter},
+ * extract the {@link java.sql.ResultSet}.
+ *
+ * @param statement The callable statement.
+ * @param position The bind position at which to register the output param.
+ *
+ * @return The extracted result set.
+ *
+ * @throws SQLException Indicates problems extracting the result set.
+ */
+ @SuppressWarnings("UnusedParameters")
+ public ResultSet getResultSet(CallableStatement statement, int position) throws SQLException {
+ throw new UnsupportedOperationException(
+ getClass().getName() + " does not support resultsets via stored procedures"
+ );
+ }
+
+ /**
+ * Given a callable statement previously processed by {@link #registerResultSetOutParameter},
+ * extract the {@link java.sql.ResultSet} from the OUT parameter.
+ *
+ * @param statement The callable statement.
+ * @param name The parameter name (for drivers which support named parameters).
+ *
+ * @return The extracted result set.
+ *
+ * @throws SQLException Indicates problems extracting the result set.
+ */
+ @SuppressWarnings("UnusedParameters")
+ public ResultSet getResultSet(CallableStatement statement, String name) throws SQLException {
+ throw new UnsupportedOperationException(
+ getClass().getName() + " does not support resultsets via stored procedures"
+ );
+ }
+
// current timestamp support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
@@ -1146,7 +1680,7 @@
/**
* Should the value returned by {@link #getCurrentTimestampSelectString}
* be treated as callable. Typically this indicates that JDBC escape
- * sytnax is being used...
+ * syntax is being used...
*
* @return True if the {@link #getCurrentTimestampSelectString} return
* is callable; false otherwise.
@@ -1156,7 +1690,7 @@
}
/**
- * Retrieve the command used to retrieve the current timestammp from the
+ * Retrieve the command used to retrieve the current timestamp from the
* database.
*
* @return The command.
@@ -1181,21 +1715,66 @@
/**
* Build an instance of the SQLExceptionConverter preferred by this dialect for
- * converting SQLExceptions into Hibernate's JDBCException hierarchy. The default
- * Dialect implementation simply returns a converter based on X/Open SQLState codes.
+ * converting SQLExceptions into Hibernate's JDBCException hierarchy.
*
+ * The preferred method is to not override this method; if possible,
+ * {@link #buildSQLExceptionConversionDelegate()} should be overridden
+ * instead.
+ *
+ * If this method is not overridden, the default SQLExceptionConverter
+ * implementation executes 3 SQLException converter delegates:
+ *
+ *
a "static" delegate based on the JDBC 4 defined SQLException hierarchy;
+ *
the vendor-specific delegate returned by {@link #buildSQLExceptionConversionDelegate()};
+ * (it is strongly recommended that specific Dialect implementations
+ * override {@link #buildSQLExceptionConversionDelegate()})
+ *
a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes,
+ * depending on java.sql.DatabaseMetaData#getSQLStateType
+ *
+ *
+ * If this method is overridden, it is strongly recommended that the
+ * returned {@link SQLExceptionConverter} interpret SQL errors based on
+ * vendor-specific error codes rather than the SQLState since the
+ * interpretation is more accurate when using vendor-specific ErrorCodes.
+ *
+ * @return The Dialect's preferred SQLExceptionConverter, or null to
+ * indicate that the default {@link SQLExceptionConverter} should be used.
+ *
+ * @see {@link #buildSQLExceptionConversionDelegate()}
+ * @deprecated {@link #buildSQLExceptionConversionDelegate()} should be
+ * overridden instead.
+ */
+ @Deprecated
+ public SQLExceptionConverter buildSQLExceptionConverter() {
+ return null;
+ }
+
+ /**
+ * Build an instance of a {@link SQLExceptionConversionDelegate} for
+ * interpreting dialect-specific error or SQLState codes.
+ *
+ * When {@link #buildSQLExceptionConverter} returns null, the default
+ * {@link SQLExceptionConverter} is used to interpret SQLState and
+ * error codes. If this method is overridden to return a non-null value,
+ * the default {@link SQLExceptionConverter} will use the returned
+ * {@link SQLExceptionConversionDelegate} in addition to the following
+ * standard delegates:
+ *
+ *
a "static" delegate based on the JDBC 4 defined SQLException hierarchy;
+ *
a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes,
+ * depending on java.sql.DatabaseMetaData#getSQLStateType
+ *
+ *
* It is strongly recommended that specific Dialect implementations override this
* method, since interpretation of a SQL error is much more accurate when based on
- * the ErrorCode rather than the SQLState. Unfortunately, the ErrorCode is a vendor-
- * specific approach.
+ * the a vendor-specific ErrorCode rather than the SQLState.
+ *
+ * Specific Dialects may override to return whatever is most appropriate for that vendor.
*
- * @return The Dialect's preferred SQLExceptionConverter.
+ * @return The SQLExceptionConversionDelegate for this dialect
*/
- public SQLExceptionConverter buildSQLExceptionConverter() {
- // The default SQLExceptionConverter for all dialects is based on SQLState
- // since SQLErrorCode is extremely vendor-specific. Specific Dialects
- // may override to return whatever is most appropriate for that vendor.
- return new SQLStateConverter( getViolatedConstraintNameExtracter() );
+ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {
+ return null;
}
private static final ViolatedConstraintNameExtracter EXTRACTER = new ViolatedConstraintNameExtracter() {
@@ -1282,6 +1861,25 @@
}
/**
+ * The name of the SQL function that can do case insensitive like comparison.
+ *
+ * @return The dialect-specific "case insensitive" like function.
+ */
+ public String getCaseInsensitiveLike(){
+ return "like";
+ }
+
+ /**
+ * Does this dialect support case insensitive LIKE restrictions?
+ *
+ * @return {@code true} if the underlying database supports case insensitive like comparison,
+ * {@code false} otherwise. The default is {@code false}.
+ */
+ public boolean supportsCaseInsensitiveLike(){
+ return false;
+ }
+
+ /**
* Meant as a means for end users to affect the select strings being sent
* to the database and perhaps manipulate them in some fashion.
*
@@ -1297,6 +1895,11 @@
/**
* What is the maximum length Hibernate can use for generated aliases?
+ *
+ * The maximum here should account for the fact that Hibernate often needs to append "uniqueing" information
+ * to the end of generated aliases. That "uniqueing" information will be added to the end of a identifier
+ * generated to the length specified here; so be sure to leave some room (generally speaking 5 positions will
+ * suffice).
*
* @return The maximum length.
*/
@@ -1341,24 +1944,50 @@
* By default, the incoming value is checked to see if its first character
* is the back-tick (`). If so, the dialect specific quoting is applied.
*
- * @param column The value to be quoted.
+ * @param name The value to be quoted.
* @return The quoted (or unmodified, if not starting with back-tick) value.
* @see #openQuote()
* @see #closeQuote()
*/
- public final String quote(String column) {
- if ( column.charAt( 0 ) == '`' ) {
- return openQuote() + column.substring( 1, column.length() - 1 ) + closeQuote();
+ public final String quote(String name) {
+ if ( name == null ) {
+ return null;
}
+
+ if ( name.charAt( 0 ) == '`' ) {
+ return openQuote() + name.substring( 1, name.length() - 1 ) + closeQuote();
+ }
else {
- return column;
+ return name;
}
}
// DDL support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
+ * Get the SQL command used to create the named schema
+ *
+ * @param schemaName The name of the schema to be created.
+ *
+ * @return The creation command
+ */
+ public String getCreateSchemaCommand(String schemaName) {
+ return "create schema " + schemaName;
+ }
+
+ /**
+ * Get the SQL command used to drop the named schema
+ *
+ * @param schemaName The name of the schema to be dropped.
+ *
+ * @return The drop command
+ */
+ public String getDropSchemaCommand(String schemaName) {
+ return "drop schema " + schemaName;
+ }
+
+ /**
* Does this dialect support the ALTER TABLE syntax?
*
* @return True if we support altering of tables; false otherwise.
@@ -1387,29 +2016,21 @@
}
/**
- * Does this dialect support the UNIQUE column syntax?
+ * The syntax used to add a column to a table (optional).
*
- * @return boolean
+ * @return The "add column" fragment.
*/
- public boolean supportsUnique() {
- return true;
+ public String getAddColumnString() {
+ throw new UnsupportedOperationException( "No add column syntax supported by " + getClass().getName() );
}
- /**
- * Does this dialect support adding Unique constraints via create and alter table ?
- * @return boolean
- */
- public boolean supportsUniqueConstraintInCreateAlterTable() {
- return true;
- }
-
/**
- * The syntax used to add a column to a table (optional).
+ * The syntax for the suffix used to add a column to a table (optional).
*
- * @return The "add column" fragment.
+ * @return The suffix "add column" fragment.
*/
- public String getAddColumnString() {
- throw new UnsupportedOperationException( "No add column syntax supported by Dialect" );
+ public String getAddColumnSuffixString() {
+ return "";
}
public String getDropForeignKeyString() {
@@ -1440,10 +2061,10 @@
String referencedTable,
String[] primaryKey,
boolean referencesPrimaryKey) {
- StringBuffer res = new StringBuffer( 30 );
+ final StringBuilder res = new StringBuilder( 30 );
res.append( " add constraint " )
- .append( constraintName )
+ .append( quote( constraintName ) )
.append( " foreign key (" )
.append( StringHelper.join( ", ", foreignKey ) )
.append( ") references " )
@@ -1468,6 +2089,11 @@
return " add constraint " + constraintName + " primary key ";
}
+ /**
+ * Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?
+ *
+ * @return {@code true} if the database/driver has this bug
+ */
public boolean hasSelfReferentialForeignKeyBug() {
return false;
}
@@ -1481,27 +2107,101 @@
return "";
}
+ /**
+ * Does this dialect/database support commenting on tables, columns, etc?
+ *
+ * @return {@code true} if commenting is supported
+ */
public boolean supportsCommentOn() {
return false;
}
+ /**
+ * Get the comment into a form supported for table definition.
+ *
+ * @param comment The comment to apply
+ *
+ * @return The comment fragment
+ */
public String getTableComment(String comment) {
return "";
}
+ /**
+ * Get the comment into a form supported for column definition.
+ *
+ * @param comment The comment to apply
+ *
+ * @return The comment fragment
+ */
public String getColumnComment(String comment) {
return "";
}
+ /**
+ * For dropping a table, can the phrase "if exists" be applied before the table name?
+ *
+ * NOTE : Only one or the other (or neither) of this and {@link #supportsIfExistsAfterTableName} should return true
+ *
+ * @return {@code true} if the "if exists" can be applied before the table name
+ */
public boolean supportsIfExistsBeforeTableName() {
return false;
}
+ /**
+ * For dropping a table, can the phrase "if exists" be applied after the table name?
+ *
+ * NOTE : Only one or the other (or neither) of this and {@link #supportsIfExistsBeforeTableName} should return true
+ *
+ * @return {@code true} if the "if exists" can be applied after the table name
+ */
public boolean supportsIfExistsAfterTableName() {
return false;
}
/**
+ * For dropping a constraint with an "alter table", can the phrase "if exists" be applied before the constraint name?
+ *
+ * NOTE : Only one or the other (or neither) of this and {@link #supportsIfExistsAfterConstraintName} should return true
+ *
+ * @return {@code true} if the "if exists" can be applied before the constraint name
+ */
+ public boolean supportsIfExistsBeforeConstraintName() {
+ return false;
+ }
+
+ /**
+ * For dropping a constraint with an "alter table", can the phrase "if exists" be applied after the constraint name?
+ *
+ * NOTE : Only one or the other (or neither) of this and {@link #supportsIfExistsBeforeConstraintName} should return true
+ *
+ * @return {@code true} if the "if exists" can be applied after the constraint name
+ */
+ public boolean supportsIfExistsAfterConstraintName() {
+ return false;
+ }
+
+ /**
+ * Generate a DROP TABLE statement
+ *
+ * @param tableName The name of the table to drop
+ *
+ * @return The DROP TABLE command
+ */
+ public String getDropTableString(String tableName) {
+ final StringBuilder buf = new StringBuilder( "drop table " );
+ if ( supportsIfExistsBeforeTableName() ) {
+ buf.append( "if exists " );
+ }
+ buf.append( tableName ).append( getCascadeConstraintsString() );
+ if ( supportsIfExistsAfterTableName() ) {
+ buf.append( " if exists" );
+ }
+ return buf.toString();
+ }
+
+ /**
* Does this dialect support column-level check constraints?
*
* @return True if column-level CHECK constraints are supported; false
@@ -1521,14 +2221,15 @@
return true;
}
+ /**
+ * Does this dialect support cascaded delete on foreign key definitions?
+ *
+ * @return {@code true} indicates that the dialect does support cascaded delete on foreign keys.
+ */
public boolean supportsCascadeDelete() {
return true;
}
- public boolean supportsNotNullUnique() {
- return true;
- }
-
/**
* Completely optional cascading drop clause
*
@@ -1538,7 +2239,24 @@
return "";
}
+ /**
+ * Returns the separator to use for defining cross joins when translating HQL queries.
+ *
+ * Typically this will be either [ cross join ] or [, ]
+ *
+ * Note that the spaces are important!
+ *
+ * @return The cross join separator
+ */
+ public String getCrossJoinSeparator() {
+ return " cross join ";
+ }
+ public ColumnAliasExtractor getColumnAliasExtractor() {
+ return ColumnAliasExtractor.COLUMN_LABEL_EXTRACTOR;
+ }
+
+
// Informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
@@ -1607,8 +2325,8 @@
}
/**
- * Does this dialect support parameters within the select clause of
- * INSERT ... SELECT ... statements?
+ * Does this dialect support parameters within the SELECT clause of
+ * INSERT ... SELECT ... statements?
*
* @return True if this is supported; false otherwise.
* @since 3.2
@@ -1618,6 +2336,57 @@
}
/**
+ * Does this dialect require that references to result variables
+ * (i.e, select expresssion aliases) in an ORDER BY clause be
+ * replaced by column positions (1-origin) as defined
+ * by the select clause?
+
+ * @return true if result variable references in the ORDER BY
+ * clause should be replaced by column positions;
+ * false otherwise.
+ */
+ public boolean replaceResultVariableInOrderByClauseWithPosition() {
+ return false;
+ }
+
+ /**
+ * Renders an ordering fragment
+ *
+ * @param expression The SQL order expression. In case of {@code @OrderBy} annotation user receives property placeholder
+ * (e.g. attribute name enclosed in '{' and '}' signs).
+ * @param collation Collation string in format {@code collate IDENTIFIER}, or {@code null}
+ * if expression has not been explicitly specified.
+ * @param order Order direction. Possible values: {@code asc}, {@code desc}, or {@code null}
+ * if expression has not been explicitly specified.
+ * @param nulls Nulls precedence. Default value: {@link NullPrecedence#NONE}.
+ * @return Renders single element of {@code ORDER BY} clause.
+ */
+ public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nulls) {
+ final StringBuilder orderByElement = new StringBuilder( expression );
+ if ( collation != null ) {
+ orderByElement.append( " " ).append( collation );
+ }
+ if ( order != null ) {
+ orderByElement.append( " " ).append( order );
+ }
+ if ( nulls != NullPrecedence.NONE ) {
+ orderByElement.append( " nulls " ).append( nulls.name().toLowerCase() );
+ }
+ return orderByElement.toString();
+ }
+
+ /**
+ * Does this dialect require that parameters appearing in the SELECT clause be wrapped in cast()
+ * calls to tell the db parser the expected type.
+ *
+ * @return True if select clause parameter must be cast()ed
+ * @since 3.2
+ */
+ public boolean requiresCastingOfParametersInSelectClause() {
+ return false;
+ }
+
+ /**
* Does this dialect support asking the result set its positioning
* information on forward only cursors. Specifically, in the case of
* scrolling fetches, Hibernate needs to use
@@ -1681,7 +2450,7 @@
}
/**
- * Does the dialect support propogating changes to LOB
+ * Does the dialect support propagating changes to LOB
* values back to the database? Talking about mutating the
* internal value of the locator as opposed to supplying a new
* locator instance...
@@ -1703,11 +2472,12 @@
* databases which (1) are not part of the cruise control process
* or (2) do not {@link #supportsExpectedLobUsagePattern}.
*
- * @return True if the changes are propogated back to the
+ * @return True if the changes are propagated back to the
* database; false otherwise.
* @since 3.2
*/
public boolean supportsLobValueChangePropogation() {
+ // todo : pretty sure this is the same as the java.sql.DatabaseMetaData.locatorsUpdateCopy method added in JDBC 4, see HHH-6046
return true;
}
@@ -1779,9 +2549,178 @@
* Does this dialect support using a JDBC bind parameter as an argument
* to a function or procedure call?
*
- * @return True if the database supports accepting bind params as args; false otherwise.
+ * @return Returns {@code true} if the database supports accepting bind params as args, {@code false} otherwise. The
+ * default is {@code true}.
*/
+ @SuppressWarnings( {"UnusedDeclaration"})
public boolean supportsBindAsCallableArgument() {
return true;
}
+
+ /**
+ * Does this dialect support `count(a,b)`?
+ *
+ * @return True if the database supports counting tuples; false otherwise.
+ */
+ public boolean supportsTupleCounts() {
+ return false;
+ }
+
+ /**
+ * Does this dialect support `count(distinct a,b)`?
+ *
+ * @return True if the database supports counting distinct tuples; false otherwise.
+ */
+ public boolean supportsTupleDistinctCounts() {
+ // oddly most database in fact seem to, so true is the default.
+ return true;
+ }
+
+ /**
+ * If {@link #supportsTupleDistinctCounts()} is true, does the Dialect require the tuple to be wrapped with parens?
+ *
+ * @return boolean
+ */
+ public boolean requiresParensForTupleDistinctCounts() {
+ return false;
+ }
+
+ /**
+ * Return the limit that the underlying database places on the number elements in an {@code IN} predicate.
+ * If the database defines no such limits, simply return zero or less-than-zero.
+ *
+ * @return int The limit, or zero-or-less to indicate no limit.
+ */
+ public int getInExpressionCountLimit() {
+ return 0;
+ }
+
+ /**
+ * HHH-4635
+ * Oracle expects all Lob values to be last in inserts and updates.
+ *
+ * @return boolean True of Lob values should be last, false if it
+ * does not matter.
+ */
+ public boolean forceLobAsLastValue() {
+ return false;
+ }
+
+ /**
+ * Some dialects have trouble applying pessimistic locking depending upon what other query options are
+ * specified (paging, ordering, etc). This method allows these dialects to request that locking be applied
+ * by subsequent selects.
+ *
+ * @return {@code true} indicates that the dialect requests that locking be applied by subsequent select;
+ * {@code false} (the default) indicates that locking should be applied to the main SQL statement..
+ */
+ public boolean useFollowOnLocking() {
+ return false;
+ }
+
+ /**
+ * Negate an expression
+ *
+ * @param expression The expression to negate
+ *
+ * @return The negated expression
+ */
+ public String getNotExpression(String expression) {
+ return "not " + expression;
+ }
+
+ /**
+ * Get the UniqueDelegate supported by this dialect
+ *
+ * @return The UniqueDelegate
+ */
+ public UniqueDelegate getUniqueDelegate() {
+ return uniqueDelegate;
+ }
+
+ /**
+ * Does this dialect support the UNIQUE column syntax?
+ *
+ * @return boolean
+ *
+ * @deprecated {@link #getUniqueDelegate()} should be overridden instead.
+ */
+ @Deprecated
+ public boolean supportsUnique() {
+ return true;
+ }
+
+ /**
+ * Does this dialect support adding Unique constraints via create and alter table ?
+ *
+ * @return boolean
+ *
+ * @deprecated {@link #getUniqueDelegate()} should be overridden instead.
+ */
+ @Deprecated
+ public boolean supportsUniqueConstraintInCreateAlterTable() {
+ return true;
+ }
+
+ /**
+ * The syntax used to add a unique constraint to a table.
+ *
+ * @param constraintName The name of the unique constraint.
+ * @return The "add unique" fragment
+ *
+ * @deprecated {@link #getUniqueDelegate()} should be overridden instead.
+ */
+ @Deprecated
+ public String getAddUniqueConstraintString(String constraintName) {
+ return " add constraint " + constraintName + " unique ";
+ }
+
+ /**
+ * Is the combination of not-null and unique supported?
+ *
+ * @return deprecated
+ *
+ * @deprecated {@link #getUniqueDelegate()} should be overridden instead.
+ */
+ @Deprecated
+ public boolean supportsNotNullUnique() {
+ return true;
+ }
+
+ /**
+ * Apply a hint to the query. The entire query is provided, allowing the Dialect full control over the placement
+ * and syntax of the hint. By default, ignore the hint and simply return the query.
+ *
+ * @param query The query to which to apply the hint.
+ * @param hints The hints to apply
+ * @return The modified SQL
+ */
+ public String getQueryHintString(String query, List hints) {
+ return query;
+ }
+
+ /**
+ * Certain dialects support a subset of ScrollModes. Provide a default to be used by Criteria and Query.
+ *
+ * @return ScrollMode
+ */
+ public ScrollMode defaultScrollMode() {
+ return ScrollMode.SCROLL_INSENSITIVE;
+ }
+
+ /**
+ * Does this dialect support tuples in subqueries? Ex:
+ * delete from Table1 where (col1, col2) in (select col1, col2 from Table2)
+ *
+ * @return boolean
+ */
+ public boolean supportsTuplesInSubqueries() {
+ return true;
+ }
+
+ public CallableStatementSupport getCallableStatementSupport() {
+ // most databases do not support returning cursors (ref_cursor)...
+ return StandardCallableStatementSupport.NO_REF_CURSOR_INSTANCE;
+ }
+
}
Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/DialectFactory.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/FirebirdDialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/FirebirdDialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/FirebirdDialect.java 17 Aug 2012 14:33:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/FirebirdDialect.java 30 Jul 2014 16:15:55 -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,35 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
/**
* An SQL dialect for Firebird.
+ *
* @author Reha CENANI
*/
public class FirebirdDialect extends InterbaseDialect {
-
+ @Override
public String getDropSequenceString(String sequenceName) {
return "drop generator " + sequenceName;
}
+ @Override
public String getLimitString(String sql, boolean hasOffset) {
- return new StringBuffer( sql.length()+20 )
- .append(sql)
- .insert(6, hasOffset ? " first ? skip ?" : " first ?")
- .toString();
+ return new StringBuilder( sql.length() + 20 )
+ .append( sql )
+ .insert( 6, hasOffset ? " first ? skip ?" : " first ?" )
+ .toString();
}
+ @Override
public boolean bindLimitParametersFirst() {
return true;
}
+ @Override
public boolean bindLimitParametersInReverseOrder() {
return true;
}
-
-}
\ No newline at end of file
+}
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/FrontBaseDialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/FrontBaseDialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/FrontBaseDialect.java 17 Aug 2012 14:33:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/FrontBaseDialect.java 30 Jul 2014 16:15:51 -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,18 +20,21 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
+import java.sql.Types;
+import org.hibernate.LockMode;
import org.hibernate.dialect.lock.LockingStrategy;
-import org.hibernate.dialect.lock.UpdateLockingStrategy;
+import org.hibernate.dialect.lock.OptimisticForceIncrementLockingStrategy;
+import org.hibernate.dialect.lock.OptimisticLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticForceIncrementLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticReadUpdateLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticWriteUpdateLockingStrategy;
import org.hibernate.dialect.lock.SelectLockingStrategy;
+import org.hibernate.dialect.lock.UpdateLockingStrategy;
import org.hibernate.persister.entity.Lockable;
-import org.hibernate.LockMode;
-import java.sql.Types;
-
/**
* An SQL Dialect for Frontbase. Assumes you're using the latest version
* of the FrontBase JDBC driver, available from http://frontbase.com/
@@ -50,6 +53,9 @@
*/
public class FrontBaseDialect extends Dialect {
+ /**
+ * Constructs a FrontBaseDialect
+ */
public FrontBaseDialect() {
super();
@@ -71,40 +77,61 @@
registerColumnType( Types.CLOB, "clob" );
}
+ @Override
public String getAddColumnString() {
return "add column";
}
+ @Override
public String getCascadeConstraintsString() {
return " cascade";
}
+ @Override
public boolean dropConstraints() {
return false;
}
/**
- * Does this dialect support the FOR UPDATE syntax. No!
- *
- * @return false always. FrontBase doesn't support this syntax,
- * which was dropped with SQL92
+ * FrontBase doesn't support this syntax, which was dropped with SQL92.
+ *
+ * {@inheritDoc}
*/
+ @Override
public String getForUpdateString() {
return "";
}
- public String getCurrentTimestampCallString() {
+ @Override
+ public String getCurrentTimestampSelectString() {
// TODO : not sure this is correct, could not find docs on how to do this.
return "{?= call current_timestamp}";
}
+ @Override
public boolean isCurrentTimestampSelectStringCallable() {
return true;
}
+ @Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
// Frontbase has no known variation of a "SELECT ... FOR UPDATE" syntax...
- if ( lockMode.greaterThan( LockMode.READ ) ) {
+ if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
+ return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.PESSIMISTIC_WRITE) {
+ return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.PESSIMISTIC_READ) {
+ return new PessimisticReadUpdateLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.OPTIMISTIC) {
+ return new OptimisticLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
+ return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
+ }
+ else if ( lockMode.greaterThan( LockMode.READ ) ) {
return new UpdateLockingStrategy( lockable, lockMode );
}
else {
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/H2Dialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/H2Dialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/H2Dialect.java 17 Aug 2012 14:33:39 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/H2Dialect.java 30 Jul 2014 16:15:54 -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,303 +20,411 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.SQLException;
import java.sql.Types;
-import org.hibernate.Hibernate;
-import org.hibernate.cfg.Environment;
+import org.hibernate.JDBCException;
+import org.hibernate.PessimisticLockException;
+import org.hibernate.cfg.AvailableSettings;
+import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
-import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
-import org.hibernate.exception.ViolatedConstraintNameExtracter;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.exception.ConstraintViolationException;
+import org.hibernate.exception.LockAcquisitionException;
+import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
+import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
+import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
+import org.hibernate.internal.CoreMessageLogger;
+import org.hibernate.internal.util.JdbcExceptionHelper;
+import org.hibernate.internal.util.ReflectHelper;
+import org.hibernate.type.StandardBasicTypes;
+import org.jboss.logging.Logger;
+
/**
* A dialect compatible with the H2 database.
- *
- * @author Thomas Mueller
*
+ * @author Thomas Mueller
*/
public class H2Dialect extends Dialect {
+ private static final CoreMessageLogger LOG = Logger.getMessageLogger(
+ CoreMessageLogger.class,
+ H2Dialect.class.getName()
+ );
- private String querySequenceString;
- public H2Dialect() {
- super();
-
- querySequenceString = "select sequence_name from information_schema.sequences";
- try {
- // HHH-2300
- Class constants = ReflectHelper.classForName( "org.h2.engine.Constants" );
- Integer build = (Integer)constants.getDeclaredField("BUILD_ID" ).get(null);
- int buildid = build.intValue();
- if(buildid < 32) {
- querySequenceString = "select name from information_schema.sequences";
- }
- } catch(Throwable e) {
- // ignore (probably H2 not in the classpath)
- }
- registerColumnType(Types.BOOLEAN, "boolean");
- registerColumnType(Types.BIGINT, "bigint");
- registerColumnType(Types.BINARY, "binary");
- registerColumnType(Types.BIT, "bit");
- registerColumnType(Types.CHAR, "char($l)");
- registerColumnType(Types.DATE, "date");
- registerColumnType(Types.DECIMAL, "decimal($p,$s)");
- registerColumnType(Types.DOUBLE, "double");
- registerColumnType(Types.FLOAT, "float");
- registerColumnType(Types.INTEGER, "integer");
- registerColumnType(Types.LONGVARBINARY, "longvarbinary");
- registerColumnType(Types.LONGVARCHAR, "longvarchar");
- registerColumnType(Types.REAL, "real");
- registerColumnType(Types.SMALLINT, "smallint");
- registerColumnType(Types.TINYINT, "tinyint");
- registerColumnType(Types.TIME, "time");
- registerColumnType(Types.TIMESTAMP, "timestamp");
- registerColumnType(Types.VARCHAR, "varchar($l)");
- registerColumnType(Types.VARBINARY, "binary($l)");
- registerColumnType(Types.NUMERIC, "numeric");
- registerColumnType(Types.BLOB, "blob");
- registerColumnType(Types.CLOB, "clob");
-
- // select topic, syntax from information_schema.help
- // where section like 'Function%' order by section, topic
+ private final String querySequenceString;
-// registerFunction("abs", new StandardSQLFunction("abs"));
- registerFunction("acos", new StandardSQLFunction("acos", Hibernate.DOUBLE));
- registerFunction("asin", new StandardSQLFunction("asin", Hibernate.DOUBLE));
- registerFunction("atan", new StandardSQLFunction("atan", Hibernate.DOUBLE));
- registerFunction("atan2", new StandardSQLFunction("atan2", Hibernate.DOUBLE));
- registerFunction("bitand", new StandardSQLFunction("bitand", Hibernate.INTEGER));
- registerFunction("bitor", new StandardSQLFunction("bitor", Hibernate.INTEGER));
- registerFunction("bitxor", new StandardSQLFunction("bitxor", Hibernate.INTEGER));
- registerFunction("ceiling", new StandardSQLFunction("ceiling", Hibernate.DOUBLE));
- registerFunction("cos", new StandardSQLFunction("cos", Hibernate.DOUBLE));
- registerFunction("cot", new StandardSQLFunction("cot", Hibernate.DOUBLE));
- registerFunction("degrees", new StandardSQLFunction("degrees", Hibernate.DOUBLE));
- registerFunction("exp", new StandardSQLFunction("exp", Hibernate.DOUBLE));
- registerFunction("floor", new StandardSQLFunction("floor", Hibernate.DOUBLE));
- registerFunction("log", new StandardSQLFunction("log", Hibernate.DOUBLE));
- registerFunction("log10", new StandardSQLFunction("log10", Hibernate.DOUBLE));
-// registerFunction("mod", new StandardSQLFunction("mod", Hibernate.INTEGER));
- registerFunction("pi", new NoArgSQLFunction("pi", Hibernate.DOUBLE));
- registerFunction("power", new StandardSQLFunction("power", Hibernate.DOUBLE));
- registerFunction("radians", new StandardSQLFunction("radians", Hibernate.DOUBLE));
- registerFunction("rand", new NoArgSQLFunction("rand", Hibernate.DOUBLE));
- registerFunction("round", new StandardSQLFunction("round", Hibernate.DOUBLE));
- registerFunction("roundmagic", new StandardSQLFunction("roundmagic", Hibernate.DOUBLE));
- registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER));
- registerFunction("sin", new StandardSQLFunction("sin", Hibernate.DOUBLE));
-// registerFunction("sqrt", new StandardSQLFunction("sqrt", Hibernate.DOUBLE));
- registerFunction("tan", new StandardSQLFunction("tan", Hibernate.DOUBLE));
- registerFunction("truncate", new StandardSQLFunction("truncate", Hibernate.DOUBLE));
+ /**
+ * Constructs a H2Dialect
+ */
+ public H2Dialect() {
+ super();
- registerFunction("compress", new StandardSQLFunction("compress", Hibernate.BINARY));
- registerFunction("expand", new StandardSQLFunction("compress", Hibernate.BINARY));
- registerFunction("decrypt", new StandardSQLFunction("decrypt", Hibernate.BINARY));
- registerFunction("encrypt", new StandardSQLFunction("encrypt", Hibernate.BINARY));
- registerFunction("hash", new StandardSQLFunction("hash", Hibernate.BINARY));
+ String querySequenceString = "select sequence_name from information_schema.sequences";
+ try {
+ // HHH-2300
+ final Class h2ConstantsClass = ReflectHelper.classForName( "org.h2.engine.Constants" );
+ final int majorVersion = (Integer) h2ConstantsClass.getDeclaredField( "VERSION_MAJOR" ).get( null );
+ final int minorVersion = (Integer) h2ConstantsClass.getDeclaredField( "VERSION_MINOR" ).get( null );
+ final int buildId = (Integer) h2ConstantsClass.getDeclaredField( "BUILD_ID" ).get( null );
+ if ( buildId < 32 ) {
+ querySequenceString = "select name from information_schema.sequences";
+ }
+ if ( ! ( majorVersion > 1 || minorVersion > 2 || buildId >= 139 ) ) {
+ LOG.unsupportedMultiTableBulkHqlJpaql( majorVersion, minorVersion, buildId );
+ }
+ }
+ catch ( Exception e ) {
+ // probably H2 not in the classpath, though in certain app server environments it might just mean we are
+ // not using the correct classloader
+ LOG.undeterminedH2Version();
+ }
- registerFunction("ascii", new StandardSQLFunction("ascii", Hibernate.INTEGER));
-// registerFunction("bit_length", new StandardSQLFunction("bit_length", Hibernate.INTEGER));
- registerFunction("char", new StandardSQLFunction("char", Hibernate.CHARACTER));
- registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "(", "||", ")"));
- registerFunction("difference", new StandardSQLFunction("difference", Hibernate.INTEGER));
- registerFunction("hextoraw", new StandardSQLFunction("hextoraw", Hibernate.STRING));
- registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
- registerFunction("insert", new StandardSQLFunction("lower", Hibernate.STRING));
- registerFunction("left", new StandardSQLFunction("left", Hibernate.STRING));
-// registerFunction("length", new StandardSQLFunction("length", Hibernate.INTEGER));
-// registerFunction("locate", new StandardSQLFunction("locate", Hibernate.INTEGER));
-// registerFunction("lower", new StandardSQLFunction("lower", Hibernate.STRING));
- registerFunction("lcase", new StandardSQLFunction("lcase", Hibernate.STRING));
- registerFunction("ltrim", new StandardSQLFunction("ltrim", Hibernate.STRING));
- registerFunction("octet_length", new StandardSQLFunction("octet_length", Hibernate.INTEGER));
- registerFunction("position", new StandardSQLFunction("position", Hibernate.INTEGER));
- registerFunction("rawtohex", new StandardSQLFunction("rawtohex", Hibernate.STRING));
- registerFunction("repeat", new StandardSQLFunction("repeat", Hibernate.STRING));
- registerFunction("replace", new StandardSQLFunction("replace", Hibernate.STRING));
- registerFunction("right", new StandardSQLFunction("right", Hibernate.STRING));
- registerFunction("rtrim", new StandardSQLFunction("rtrim", Hibernate.STRING));
- registerFunction("soundex", new StandardSQLFunction("soundex", Hibernate.STRING));
- registerFunction("space", new StandardSQLFunction("space", Hibernate.STRING));
- registerFunction("stringencode", new StandardSQLFunction("stringencode", Hibernate.STRING));
- registerFunction("stringdecode", new StandardSQLFunction("stringdecode", Hibernate.STRING));
-// registerFunction("substring", new StandardSQLFunction("substring", Hibernate.STRING));
-// registerFunction("upper", new StandardSQLFunction("upper", Hibernate.STRING));
- registerFunction("ucase", new StandardSQLFunction("ucase", Hibernate.STRING));
+ this.querySequenceString = querySequenceString;
- registerFunction("stringtoutf8", new StandardSQLFunction("stringtoutf8", Hibernate.BINARY));
- registerFunction("utf8tostring", new StandardSQLFunction("utf8tostring", Hibernate.STRING));
+ registerColumnType( Types.BOOLEAN, "boolean" );
+ registerColumnType( Types.BIGINT, "bigint" );
+ registerColumnType( Types.BINARY, "binary" );
+ registerColumnType( Types.BIT, "boolean" );
+ registerColumnType( Types.CHAR, "char($l)" );
+ registerColumnType( Types.DATE, "date" );
+ registerColumnType( Types.DECIMAL, "decimal($p,$s)" );
+ registerColumnType( Types.NUMERIC, "decimal($p,$s)" );
+ registerColumnType( Types.DOUBLE, "double" );
+ registerColumnType( Types.FLOAT, "float" );
+ registerColumnType( Types.INTEGER, "integer" );
+ registerColumnType( Types.LONGVARBINARY, "longvarbinary" );
+ registerColumnType( Types.LONGVARCHAR, "longvarchar" );
+ registerColumnType( Types.REAL, "real" );
+ registerColumnType( Types.SMALLINT, "smallint" );
+ registerColumnType( Types.TINYINT, "tinyint" );
+ registerColumnType( Types.TIME, "time" );
+ registerColumnType( Types.TIMESTAMP, "timestamp" );
+ registerColumnType( Types.VARCHAR, "varchar($l)" );
+ registerColumnType( Types.VARBINARY, "binary($l)" );
+ registerColumnType( Types.BLOB, "blob" );
+ registerColumnType( Types.CLOB, "clob" );
- registerFunction("current_date", new NoArgSQLFunction("current_date", Hibernate.DATE));
- registerFunction("current_time", new NoArgSQLFunction("current_time", Hibernate.TIME));
- registerFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", Hibernate.TIMESTAMP));
- registerFunction("datediff", new StandardSQLFunction("datediff", Hibernate.INTEGER));
- registerFunction("dayname", new StandardSQLFunction("dayname", Hibernate.STRING));
- registerFunction("dayofmonth", new StandardSQLFunction("dayofmonth", Hibernate.INTEGER));
- registerFunction("dayofweek", new StandardSQLFunction("dayofweek", Hibernate.INTEGER));
- registerFunction("dayofyear", new StandardSQLFunction("dayofyear", Hibernate.INTEGER));
-// registerFunction("hour", new StandardSQLFunction("hour", Hibernate.INTEGER));
-// registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER));
-// registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER));
- registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING));
- registerFunction("quater", new StandardSQLFunction("quater", Hibernate.INTEGER));
-// registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER));
- registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER));
-// registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER));
+ // Aggregations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) );
- registerFunction("curdate", new NoArgSQLFunction("curdate", Hibernate.DATE));
- registerFunction("curtime", new NoArgSQLFunction("curtime", Hibernate.TIME));
- registerFunction("curtimestamp", new NoArgSQLFunction("curtimestamp", Hibernate.TIME));
- registerFunction("now", new NoArgSQLFunction("now", Hibernate.TIMESTAMP));
+ // select topic, syntax from information_schema.help
+ // where section like 'Function%' order by section, topic
+ //
+ // see also -> http://www.h2database.com/html/functions.html
- registerFunction("database", new NoArgSQLFunction("database", Hibernate.STRING));
- registerFunction("user", new NoArgSQLFunction("user", Hibernate.STRING));
+ // Numeric Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan2", new StandardSQLFunction( "atan2", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "bitand", new StandardSQLFunction( "bitand", StandardBasicTypes.INTEGER ) );
+ registerFunction( "bitor", new StandardSQLFunction( "bitor", StandardBasicTypes.INTEGER ) );
+ registerFunction( "bitxor", new StandardSQLFunction( "bitxor", StandardBasicTypes.INTEGER ) );
+ registerFunction( "ceiling", new StandardSQLFunction( "ceiling", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "compress", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) );
+ registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "decrypt", new StandardSQLFunction( "decrypt", StandardBasicTypes.BINARY ) );
+ registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "encrypt", new StandardSQLFunction( "encrypt", StandardBasicTypes.BINARY ) );
+ registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "expand", new StandardSQLFunction( "compress", StandardBasicTypes.BINARY ) );
+ registerFunction( "floor", new StandardSQLFunction( "floor", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "hash", new StandardSQLFunction( "hash", StandardBasicTypes.BINARY ) );
+ registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "power", new StandardSQLFunction( "power", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "rand", new NoArgSQLFunction( "rand", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "round", new StandardSQLFunction( "round", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
+ registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "truncate", new StandardSQLFunction( "truncate", StandardBasicTypes.DOUBLE ) );
- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);
+ // String Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
+ registerFunction( "difference", new StandardSQLFunction( "difference", StandardBasicTypes.INTEGER ) );
+ registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw", StandardBasicTypes.STRING ) );
+ registerFunction( "insert", new StandardSQLFunction( "lower", StandardBasicTypes.STRING ) );
+ registerFunction( "left", new StandardSQLFunction( "left", StandardBasicTypes.STRING ) );
+ registerFunction( "lcase", new StandardSQLFunction( "lcase", StandardBasicTypes.STRING ) );
+ registerFunction( "ltrim", new StandardSQLFunction( "ltrim", StandardBasicTypes.STRING ) );
+ registerFunction( "octet_length", new StandardSQLFunction( "octet_length", StandardBasicTypes.INTEGER ) );
+ registerFunction( "position", new StandardSQLFunction( "position", StandardBasicTypes.INTEGER ) );
+ registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex", StandardBasicTypes.STRING ) );
+ registerFunction( "repeat", new StandardSQLFunction( "repeat", StandardBasicTypes.STRING ) );
+ registerFunction( "replace", new StandardSQLFunction( "replace", StandardBasicTypes.STRING ) );
+ registerFunction( "right", new StandardSQLFunction( "right", StandardBasicTypes.STRING ) );
+ registerFunction( "rtrim", new StandardSQLFunction( "rtrim", StandardBasicTypes.STRING ) );
+ registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
+ registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
+ registerFunction( "stringencode", new StandardSQLFunction( "stringencode", StandardBasicTypes.STRING ) );
+ registerFunction( "stringdecode", new StandardSQLFunction( "stringdecode", StandardBasicTypes.STRING ) );
+ registerFunction( "stringtoutf8", new StandardSQLFunction( "stringtoutf8", StandardBasicTypes.BINARY ) );
+ registerFunction( "ucase", new StandardSQLFunction( "ucase", StandardBasicTypes.STRING ) );
+ registerFunction( "utf8tostring", new StandardSQLFunction( "utf8tostring", StandardBasicTypes.STRING ) );
- }
+ // Time and Date Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) );
+ registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) );
+ registerFunction( "curtimestamp", new NoArgSQLFunction( "curtimestamp", StandardBasicTypes.TIME ) );
+ registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME ) );
+ registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "datediff", new StandardSQLFunction( "datediff", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
+ registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
+ registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
+ registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) );
+ registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) );
- public String getAddColumnString() {
- return "add column";
- }
+ // System Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) );
+ registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) );
- public boolean supportsIdentityColumns() {
- return true;
- }
+ getDefaultProperties().setProperty( AvailableSettings.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
+ // http://code.google.com/p/h2database/issues/detail?id=235
+ getDefaultProperties().setProperty( AvailableSettings.NON_CONTEXTUAL_LOB_CREATION, "true" );
+ }
- public String getIdentityColumnString() {
- return "generated by default as identity"; // not null is implicit
- }
+ @Override
+ public String getAddColumnString() {
+ return "add column";
+ }
- public String getIdentitySelectString() {
- return "call identity()";
- }
+ @Override
+ public boolean supportsIdentityColumns() {
+ return true;
+ }
- public String getIdentityInsertString() {
- return "null";
- }
+ @Override
+ public String getIdentityColumnString() {
+ // not null is implicit
+ return "generated by default as identity";
+ }
- public String getForUpdateString() {
- return " for update";
- }
+ @Override
+ public String getIdentitySelectString() {
+ return "call identity()";
+ }
- public boolean supportsUnique() {
- return true;
- }
+ @Override
+ public String getIdentityInsertString() {
+ return "null";
+ }
- public boolean supportsLimit() {
- return true;
- }
+ @Override
+ public String getForUpdateString() {
+ return " for update";
+ }
- public String getLimitString(String sql, boolean hasOffset) {
- return new StringBuffer(sql.length() + 20).
- append(sql).
- append(hasOffset ? " limit ? offset ?" : " limit ?").
- toString();
- }
-
- public boolean bindLimitParametersInReverseOrder() {
- return true;
- }
+ @Override
+ public boolean supportsLimit() {
+ return true;
+ }
- public boolean bindLimitParametersFirst() {
- return false;
- }
+ @Override
+ public String getLimitString(String sql, boolean hasOffset) {
+ return sql + (hasOffset ? " limit ? offset ?" : " limit ?");
+ }
- public boolean supportsIfExistsAfterTableName() {
- return true;
- }
+ @Override
+ public boolean bindLimitParametersInReverseOrder() {
+ return true;
+ }
- public boolean supportsSequences() {
- return true;
- }
+ @Override
+ public boolean bindLimitParametersFirst() {
+ return false;
+ }
+ @Override
+ public boolean supportsIfExistsAfterTableName() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsIfExistsAfterConstraintName() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsSequences() {
+ return true;
+ }
+
+ @Override
public boolean supportsPooledSequences() {
return true;
}
- public String getCreateSequenceString(String sequenceName) {
- return "create sequence " + sequenceName;
- }
+ @Override
+ public String getCreateSequenceString(String sequenceName) {
+ return "create sequence " + sequenceName;
+ }
- public String getDropSequenceString(String sequenceName) {
- return "drop sequence " + sequenceName;
- }
+ @Override
+ public String getDropSequenceString(String sequenceName) {
+ return "drop sequence " + sequenceName;
+ }
- public String getSelectSequenceNextValString(String sequenceName) {
- return "next value for " + sequenceName;
- }
+ @Override
+ public String getSelectSequenceNextValString(String sequenceName) {
+ return "next value for " + sequenceName;
+ }
- public String getSequenceNextValString(String sequenceName) {
- return "call next value for " + sequenceName;
- }
+ @Override
+ public String getSequenceNextValString(String sequenceName) {
+ return "call next value for " + sequenceName;
+ }
- public String getQuerySequencesString() {
- return querySequenceString;
- }
+ @Override
+ public String getQuerySequencesString() {
+ return querySequenceString;
+ }
+ @Override
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
- return EXTRACTER;
- }
+ return EXTRACTER;
+ }
- private static ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() {
+ private static final ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() {
+ /**
+ * Extract the name of the violated constraint from the given SQLException.
+ *
+ * @param sqle The exception that was the result of the constraint violation.
+ * @return The extracted constraint name.
+ */
+ public String extractConstraintName(SQLException sqle) {
+ String constraintName = null;
+ // 23000: Check constraint violation: {0}
+ // 23001: Unique index or primary key violation: {0}
+ if ( sqle.getSQLState().startsWith( "23" ) ) {
+ final String message = sqle.getMessage();
+ final int idx = message.indexOf( "violation: " );
+ if ( idx > 0 ) {
+ constraintName = message.substring( idx + "violation: ".length() );
+ }
+ }
+ return constraintName;
+ }
+ };
- /**
- * Extract the name of the violated constraint from the given SQLException.
- *
- * @param sqle The exception that was the result of the constraint violation.
- * @return The extracted constraint name.
- */
- public String extractConstraintName(SQLException sqle) {
- String constraintName = null;
- // 23000: Check constraint violation: {0}
- // 23001: Unique index or primary key violation: {0}
- if(sqle.getSQLState().startsWith("23")) {
- String message = sqle.getMessage();
- int idx = message.indexOf("violation: ");
- if(idx > 0) {
- constraintName = message.substring(idx + "violation: ".length());
- }
- }
- return constraintName;
- }
+ @Override
+ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {
+ SQLExceptionConversionDelegate delegate = super.buildSQLExceptionConversionDelegate();
+ if (delegate == null) {
+ delegate = new SQLExceptionConversionDelegate() {
+ @Override
+ public JDBCException convert(SQLException sqlException, String message, String sql) {
+ final int errorCode = JdbcExceptionHelper.extractErrorCode( sqlException );
- };
+ if (40001 == errorCode) {
+ // DEADLOCK DETECTED
+ return new LockAcquisitionException(message, sqlException, sql);
+ }
- public boolean supportsTemporaryTables() {
- return true;
- }
-
- public String getCreateTemporaryTableString() {
- return "create temporary table if not exists";
- }
+ if (50200 == errorCode) {
+ // LOCK NOT AVAILABLE
+ return new PessimisticLockException(message, sqlException, sql);
+ }
- public boolean supportsCurrentTimestampSelection() {
- return true;
- }
-
- public boolean isCurrentTimestampSelectStringCallable() {
- return false;
- }
-
- public String getCurrentTimestampSelectString() {
- return "call current_timestamp()";
- }
-
- public boolean supportsUnionAll() {
- return true;
- }
+ if ( 90006 == errorCode ) {
+ // NULL not allowed for column [90006-145]
+ final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName( sqlException );
+ return new ConstraintViolationException( message, sqlException, sql, constraintName );
+ }
+ return null;
+ }
+ };
+ }
+ return delegate;
+ }
+ @Override
+ public boolean supportsTemporaryTables() {
+ return true;
+ }
+
+ @Override
+ public String getCreateTemporaryTableString() {
+ return "create cached local temporary table if not exists";
+ }
+
+ @Override
+ public String getCreateTemporaryTablePostfix() {
+ // actually 2 different options are specified here:
+ // 1) [on commit drop] - says to drop the table on transaction commit
+ // 2) [transactional] - says to not perform an implicit commit of any current transaction
+ return "on commit drop transactional";
+ }
+
+ @Override
+ public Boolean performTemporaryTableDDLInIsolation() {
+ // explicitly create the table using the same connection and transaction
+ return Boolean.FALSE;
+ }
+
+ @Override
+ public boolean dropTemporaryTableAfterUse() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsCurrentTimestampSelection() {
+ return true;
+ }
+
+ @Override
+ public boolean isCurrentTimestampSelectStringCallable() {
+ return false;
+ }
+
+ @Override
+ public String getCurrentTimestampSelectString() {
+ return "call current_timestamp()";
+ }
+
+ @Override
+ public boolean supportsUnionAll() {
+ return true;
+ }
+
+
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsLobValueChangePropogation() {
return false;
}
-}
\ No newline at end of file
+
+ @Override
+ public boolean requiresParensForTupleDistinctCounts() {
+ return true;
+ }
+
+ @Override
+ public boolean doesReadCommittedCauseWritersToBlockReaders() {
+ // see http://groups.google.com/group/h2-database/browse_thread/thread/562d8a49e2dabe99?hl=en
+ return true;
+ }
+
+ @Override
+ public boolean supportsTuplesInSubqueries() {
+ return false;
+ }
+}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/HANAColumnStoreDialect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/HANARowStoreDialect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/HSQLDialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/HSQLDialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/HSQLDialect.java 17 Aug 2012 14:33:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/HSQLDialect.java 30 Jul 2014 16:15:52 -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,52 +20,91 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
+import java.io.Serializable;
import java.sql.SQLException;
import java.sql.Types;
-import java.io.Serializable;
-import org.hibernate.Hibernate;
+import org.hibernate.JDBCException;
import org.hibernate.LockMode;
+import org.hibernate.MappingException;
import org.hibernate.StaleObjectStateException;
-import org.hibernate.JDBCException;
-import org.hibernate.engine.SessionImplementor;
-import org.hibernate.persister.entity.Lockable;
import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
import org.hibernate.dialect.function.NoArgSQLFunction;
+import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.dialect.lock.LockingStrategy;
+import org.hibernate.dialect.lock.OptimisticForceIncrementLockingStrategy;
+import org.hibernate.dialect.lock.OptimisticLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticForceIncrementLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticReadSelectLockingStrategy;
+import org.hibernate.dialect.lock.PessimisticWriteSelectLockingStrategy;
import org.hibernate.dialect.lock.SelectLockingStrategy;
-import org.hibernate.exception.JDBCExceptionHelper;
-import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
-import org.hibernate.exception.ViolatedConstraintNameExtracter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
+import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
+import org.hibernate.internal.CoreMessageLogger;
+import org.hibernate.internal.util.JdbcExceptionHelper;
+import org.hibernate.internal.util.ReflectHelper;
+import org.hibernate.persister.entity.Lockable;
+import org.hibernate.type.StandardBasicTypes;
+import org.jboss.logging.Logger;
+
/**
- * An SQL dialect compatible with HSQLDB (Hypersonic SQL).
+ * An SQL dialect compatible with HSQLDB (HyperSQL).
*
* Note this version supports HSQLDB version 1.8 and higher, only.
+ *
+ * Enhancements to version 3.5.0 GA to provide basic support for both HSQLDB 1.8.x and 2.x
+ * Does not works with Hibernate 3.2 - 3.4 without alteration.
*
* @author Christoph Sturm
* @author Phillip Baird
+ * @author Fred Toussi
*/
+@SuppressWarnings("deprecation")
public class HSQLDialect extends Dialect {
+ private static final CoreMessageLogger LOG = Logger.getMessageLogger(
+ CoreMessageLogger.class,
+ HSQLDialect.class.getName()
+ );
- private static final Logger log = LoggerFactory.getLogger( HSQLDialect.class );
+ /**
+ * version is 18 for 1.8 or 20 for 2.0
+ */
+ private int hsqldbVersion = 18;
+
+ /**
+ * Constructs a HSQLDialect
+ */
public HSQLDialect() {
super();
+
+ try {
+ final Class props = ReflectHelper.classForName( "org.hsqldb.persist.HsqlDatabaseProperties" );
+ final String versionString = (String) props.getDeclaredField( "THIS_VERSION" ).get( null );
+
+ hsqldbVersion = Integer.parseInt( versionString.substring( 0, 1 ) ) * 10;
+ hsqldbVersion += Integer.parseInt( versionString.substring( 2, 3 ) );
+ }
+ catch ( Throwable e ) {
+ // must be a very old version
+ }
+
registerColumnType( Types.BIGINT, "bigint" );
- registerColumnType( Types.BINARY, "binary" );
+ registerColumnType( Types.BINARY, "binary($l)" );
registerColumnType( Types.BIT, "bit" );
- registerColumnType( Types.CHAR, "char(1)" );
+ registerColumnType( Types.BOOLEAN, "boolean" );
+ registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.DATE, "date" );
- registerColumnType( Types.DECIMAL, "decimal" );
+
+ registerColumnType( Types.DECIMAL, "decimal($p,$s)" );
registerColumnType( Types.DOUBLE, "double" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.INTEGER, "integer" );
@@ -77,178 +116,256 @@
registerColumnType( Types.TIMESTAMP, "timestamp" );
registerColumnType( Types.VARCHAR, "varchar($l)" );
registerColumnType( Types.VARBINARY, "varbinary($l)" );
- registerColumnType( Types.NUMERIC, "numeric" );
+
+ if ( hsqldbVersion < 20 ) {
+ registerColumnType( Types.NUMERIC, "numeric" );
+ }
+ else {
+ registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
+ }
+
//HSQL has no Blob/Clob support .... but just put these here for now!
- registerColumnType( Types.BLOB, "longvarbinary" );
- registerColumnType( Types.CLOB, "longvarchar" );
+ if ( hsqldbVersion < 20 ) {
+ registerColumnType( Types.BLOB, "longvarbinary" );
+ registerColumnType( Types.CLOB, "longvarchar" );
+ }
+ else {
+ registerColumnType( Types.BLOB, "blob($l)" );
+ registerColumnType( Types.CLOB, "clob($l)" );
+ }
- registerFunction( "ascii", new StandardSQLFunction( "ascii", Hibernate.INTEGER ) );
- registerFunction( "char", new StandardSQLFunction( "char", Hibernate.CHARACTER ) );
- registerFunction( "length", new StandardSQLFunction( "length", Hibernate.LONG ) );
+ // aggregate functions
+ registerFunction( "avg", new AvgWithArgumentCastFunction( "double" ) );
+
+ // string functions
+ registerFunction( "ascii", new StandardSQLFunction( "ascii", StandardBasicTypes.INTEGER ) );
+ registerFunction( "char", new StandardSQLFunction( "char", StandardBasicTypes.CHARACTER ) );
registerFunction( "lower", new StandardSQLFunction( "lower" ) );
registerFunction( "upper", new StandardSQLFunction( "upper" ) );
registerFunction( "lcase", new StandardSQLFunction( "lcase" ) );
registerFunction( "ucase", new StandardSQLFunction( "ucase" ) );
- registerFunction( "soundex", new StandardSQLFunction( "soundex", Hibernate.STRING ) );
+ registerFunction( "soundex", new StandardSQLFunction( "soundex", StandardBasicTypes.STRING ) );
registerFunction( "ltrim", new StandardSQLFunction( "ltrim" ) );
registerFunction( "rtrim", new StandardSQLFunction( "rtrim" ) );
registerFunction( "reverse", new StandardSQLFunction( "reverse" ) );
- registerFunction( "space", new StandardSQLFunction( "space", Hibernate.STRING ) );
+ registerFunction( "space", new StandardSQLFunction( "space", StandardBasicTypes.STRING ) );
+ registerFunction( "str", new SQLFunctionTemplate( StandardBasicTypes.STRING, "cast(?1 as varchar(256))" ) );
+ registerFunction( "to_char", new StandardSQLFunction( "to_char", StandardBasicTypes.STRING ) );
registerFunction( "rawtohex", new StandardSQLFunction( "rawtohex" ) );
registerFunction( "hextoraw", new StandardSQLFunction( "hextoraw" ) );
- registerFunction( "user", new NoArgSQLFunction( "user", Hibernate.STRING ) );
- registerFunction( "database", new NoArgSQLFunction( "database", Hibernate.STRING ) );
+ // system functions
+ registerFunction( "user", new NoArgSQLFunction( "user", StandardBasicTypes.STRING ) );
+ registerFunction( "database", new NoArgSQLFunction( "database", StandardBasicTypes.STRING ) );
- registerFunction( "current_date", new NoArgSQLFunction( "current_date", Hibernate.DATE, false ) );
- registerFunction( "curdate", new NoArgSQLFunction( "curdate", Hibernate.DATE ) );
- registerFunction( "current_timestamp", new NoArgSQLFunction( "current_timestamp", Hibernate.TIMESTAMP, false ) );
- registerFunction( "now", new NoArgSQLFunction( "now", Hibernate.TIMESTAMP ) );
- registerFunction( "current_time", new NoArgSQLFunction( "current_time", Hibernate.TIME, false ) );
- registerFunction( "curtime", new NoArgSQLFunction( "curtime", Hibernate.TIME ) );
- registerFunction( "day", new StandardSQLFunction( "day", Hibernate.INTEGER ) );
- registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", Hibernate.INTEGER ) );
- registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", Hibernate.INTEGER ) );
- registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", Hibernate.INTEGER ) );
- registerFunction( "month", new StandardSQLFunction( "month", Hibernate.INTEGER ) );
- registerFunction( "year", new StandardSQLFunction( "year", Hibernate.INTEGER ) );
- registerFunction( "week", new StandardSQLFunction( "week", Hibernate.INTEGER ) );
- registerFunction( "quater", new StandardSQLFunction( "quater", Hibernate.INTEGER ) );
- registerFunction( "hour", new StandardSQLFunction( "hour", Hibernate.INTEGER ) );
- registerFunction( "minute", new StandardSQLFunction( "minute", Hibernate.INTEGER ) );
- registerFunction( "second", new StandardSQLFunction( "second", Hibernate.INTEGER ) );
- registerFunction( "dayname", new StandardSQLFunction( "dayname", Hibernate.STRING ) );
- registerFunction( "monthname", new StandardSQLFunction( "monthname", Hibernate.STRING ) );
+ // datetime functions
+ if ( hsqldbVersion < 20 ) {
+ registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.DATE, false ) );
+ }
+ else {
+ registerFunction( "sysdate", new NoArgSQLFunction( "sysdate", StandardBasicTypes.TIMESTAMP, false ) );
+ }
+ registerFunction( "current_date", new NoArgSQLFunction( "current_date", StandardBasicTypes.DATE, false ) );
+ registerFunction( "curdate", new NoArgSQLFunction( "curdate", StandardBasicTypes.DATE ) );
+ registerFunction(
+ "current_timestamp", new NoArgSQLFunction( "current_timestamp", StandardBasicTypes.TIMESTAMP, false )
+ );
+ registerFunction( "now", new NoArgSQLFunction( "now", StandardBasicTypes.TIMESTAMP ) );
+ registerFunction( "current_time", new NoArgSQLFunction( "current_time", StandardBasicTypes.TIME, false ) );
+ registerFunction( "curtime", new NoArgSQLFunction( "curtime", StandardBasicTypes.TIME ) );
+ registerFunction( "day", new StandardSQLFunction( "day", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofweek", new StandardSQLFunction( "dayofweek", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofyear", new StandardSQLFunction( "dayofyear", StandardBasicTypes.INTEGER ) );
+ registerFunction( "dayofmonth", new StandardSQLFunction( "dayofmonth", StandardBasicTypes.INTEGER ) );
+ registerFunction( "month", new StandardSQLFunction( "month", StandardBasicTypes.INTEGER ) );
+ registerFunction( "year", new StandardSQLFunction( "year", StandardBasicTypes.INTEGER ) );
+ registerFunction( "week", new StandardSQLFunction( "week", StandardBasicTypes.INTEGER ) );
+ registerFunction( "quarter", new StandardSQLFunction( "quarter", StandardBasicTypes.INTEGER ) );
+ registerFunction( "hour", new StandardSQLFunction( "hour", StandardBasicTypes.INTEGER ) );
+ registerFunction( "minute", new StandardSQLFunction( "minute", StandardBasicTypes.INTEGER ) );
+ registerFunction( "second", new SQLFunctionTemplate( StandardBasicTypes.INTEGER, "cast(second(?1) as int)" ) );
+ registerFunction( "dayname", new StandardSQLFunction( "dayname", StandardBasicTypes.STRING ) );
+ registerFunction( "monthname", new StandardSQLFunction( "monthname", StandardBasicTypes.STRING ) );
+ // numeric functions
registerFunction( "abs", new StandardSQLFunction( "abs" ) );
- registerFunction( "sign", new StandardSQLFunction( "sign", Hibernate.INTEGER ) );
+ registerFunction( "sign", new StandardSQLFunction( "sign", StandardBasicTypes.INTEGER ) );
- registerFunction( "acos", new StandardSQLFunction( "acos", Hibernate.DOUBLE ) );
- registerFunction( "asin", new StandardSQLFunction( "asin", Hibernate.DOUBLE ) );
- registerFunction( "atan", new StandardSQLFunction( "atan", Hibernate.DOUBLE ) );
- registerFunction( "cos", new StandardSQLFunction( "cos", Hibernate.DOUBLE ) );
- registerFunction( "cot", new StandardSQLFunction( "cot", Hibernate.DOUBLE ) );
- registerFunction( "exp", new StandardSQLFunction( "exp", Hibernate.DOUBLE ) );
- registerFunction( "log", new StandardSQLFunction( "log", Hibernate.DOUBLE ) );
- registerFunction( "log10", new StandardSQLFunction( "log10", Hibernate.DOUBLE ) );
- registerFunction( "sin", new StandardSQLFunction( "sin", Hibernate.DOUBLE ) );
- registerFunction( "sqrt", new StandardSQLFunction( "sqrt", Hibernate.DOUBLE ) );
- registerFunction( "tan", new StandardSQLFunction( "tan", Hibernate.DOUBLE ) );
- registerFunction( "pi", new NoArgSQLFunction( "pi", Hibernate.DOUBLE ) );
- registerFunction( "rand", new StandardSQLFunction( "rand", Hibernate.FLOAT ) );
+ registerFunction( "acos", new StandardSQLFunction( "acos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "asin", new StandardSQLFunction( "asin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "atan", new StandardSQLFunction( "atan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cos", new StandardSQLFunction( "cos", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "cot", new StandardSQLFunction( "cot", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "exp", new StandardSQLFunction( "exp", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log", new StandardSQLFunction( "log", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "log10", new StandardSQLFunction( "log10", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "sin", new StandardSQLFunction( "sin", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "sqrt", new StandardSQLFunction( "sqrt", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "tan", new StandardSQLFunction( "tan", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "pi", new NoArgSQLFunction( "pi", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "rand", new StandardSQLFunction( "rand", StandardBasicTypes.FLOAT ) );
- registerFunction( "radians", new StandardSQLFunction( "radians", Hibernate.DOUBLE ) );
- registerFunction( "degrees", new StandardSQLFunction( "degrees", Hibernate.DOUBLE ) );
+ registerFunction( "radians", new StandardSQLFunction( "radians", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "degrees", new StandardSQLFunction( "degrees", StandardBasicTypes.DOUBLE ) );
+ registerFunction( "round", new StandardSQLFunction( "round" ) );
registerFunction( "roundmagic", new StandardSQLFunction( "roundmagic" ) );
+ registerFunction( "truncate", new StandardSQLFunction( "truncate" ) );
registerFunction( "ceiling", new StandardSQLFunction( "ceiling" ) );
registerFunction( "floor", new StandardSQLFunction( "floor" ) );
- // Multi-param dialect functions...
- registerFunction( "mod", new StandardSQLFunction( "mod", Hibernate.INTEGER ) );
+ // special functions
+ // from v. 2.2.0 ROWNUM() is supported in all modes as the equivalent of Oracle ROWNUM
+ if ( hsqldbVersion > 21 ) {
+ registerFunction( "rownum", new NoArgSQLFunction( "rownum", StandardBasicTypes.INTEGER ) );
+ }
// function templates
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE );
}
+ @Override
public String getAddColumnString() {
return "add column";
}
+ @Override
public boolean supportsIdentityColumns() {
return true;
}
+ @Override
public String getIdentityColumnString() {
- return "generated by default as identity (start with 1)"; //not null is implicit
+ //not null is implicit
+ return "generated by default as identity (start with 1)";
}
+ @Override
public String getIdentitySelectString() {
return "call identity()";
}
+ @Override
public String getIdentityInsertString() {
- return "null";
+ return hsqldbVersion < 20 ? "null" : "default";
}
- public String getForUpdateString() {
- return "";
+ @Override
+ public boolean supportsLockTimeouts() {
+ return false;
}
- public boolean supportsUnique() {
- return false;
+ @Override
+ public String getForUpdateString() {
+ if ( hsqldbVersion >= 20 ) {
+ return " for update";
+ }
+ else {
+ return "";
+ }
}
+ @Override
public boolean supportsLimit() {
return true;
}
+ @Override
public String getLimitString(String sql, boolean hasOffset) {
- return new StringBuffer( sql.length() + 10 )
- .append( sql )
- .insert( sql.toLowerCase().indexOf( "select" ) + 6, hasOffset ? " limit ? ?" : " top ?" )
- .toString();
+ if ( hsqldbVersion < 20 ) {
+ return new StringBuilder( sql.length() + 10 )
+ .append( sql )
+ .insert(
+ sql.toLowerCase().indexOf( "select" ) + 6,
+ hasOffset ? " limit ? ?" : " top ?"
+ )
+ .toString();
+ }
+ else {
+ return sql + (hasOffset ? " offset ? limit ?" : " limit ?");
+ }
}
+ @Override
public boolean bindLimitParametersFirst() {
- return true;
+ return hsqldbVersion < 20;
}
+ @Override
public boolean supportsIfExistsAfterTableName() {
return true;
}
+ @Override
public boolean supportsColumnCheck() {
- return false;
+ return hsqldbVersion >= 20;
}
+ @Override
public boolean supportsSequences() {
return true;
}
+ @Override
public boolean supportsPooledSequences() {
return true;
}
+ /**
+ * HSQL will start with 0, by default. In order for Hibernate to know that this not transient,
+ * manually start with 1.
+ */
+ @Override
protected String getCreateSequenceString(String sequenceName) {
- return "create sequence " + sequenceName;
+ return "create sequence " + sequenceName + " start with 1";
}
+
+ /**
+ * Because of the overridden {@link #getCreateSequenceString(String)}, we must also override
+ * {@link #getCreateSequenceString(String, int, int)} to prevent 2 instances of "start with".
+ */
+ @Override
+ protected String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) throws MappingException {
+ if ( supportsPooledSequences() ) {
+ return "create sequence " + sequenceName + " start with " + initialValue + " increment by " + incrementSize;
+ }
+ throw new MappingException( getClass().getName() + " does not support pooled sequences" );
+ }
+ @Override
protected String getDropSequenceString(String sequenceName) {
return "drop sequence " + sequenceName;
}
+ @Override
public String getSelectSequenceNextValString(String sequenceName) {
return "next value for " + sequenceName;
}
+ @Override
public String getSequenceNextValString(String sequenceName) {
return "call next value for " + sequenceName;
}
+ @Override
public String getQuerySequencesString() {
// this assumes schema support, which is present in 1.8.0 and later...
return "select sequence_name from information_schema.system_sequences";
}
+ @Override
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
- return EXTRACTER;
+ return hsqldbVersion < 20 ? EXTRACTER_18 : EXTRACTER_20;
}
- private static ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() {
-
- /**
- * Extract the name of the violated constraint from the given SQLException.
- *
- * @param sqle The exception that was the result of the constraint violation.
- * @return The extracted constraint name.
- */
+ private static final ViolatedConstraintNameExtracter EXTRACTER_18 = new TemplatedViolatedConstraintNameExtracter() {
+ @Override
public String extractConstraintName(SQLException sqle) {
String constraintName = null;
- int errorCode = JDBCExceptionHelper.extractErrorCode( sqle );
+ final int errorCode = JdbcExceptionHelper.extractErrorCode( sqle );
if ( errorCode == -8 ) {
constraintName = extractUsingTemplate(
@@ -267,54 +384,281 @@
}
else if ( errorCode == -177 ) {
constraintName = extractUsingTemplate(
- "Integrity constraint violation - no parent ", " table:", sqle.getMessage()
+ "Integrity constraint violation - no parent ", " table:",
+ sqle.getMessage()
);
}
-
return constraintName;
}
};
/**
- * HSQL does not really support temp tables; just take advantage of the
- * fact that it is a single user db...
+ * HSQLDB 2.0 messages have changed
+ * messages may be localized - therefore use the common, non-locale element " table: "
*/
+ private static final ViolatedConstraintNameExtracter EXTRACTER_20 = new TemplatedViolatedConstraintNameExtracter() {
+ @Override
+ public String extractConstraintName(SQLException sqle) {
+ String constraintName = null;
+
+ final int errorCode = JdbcExceptionHelper.extractErrorCode( sqle );
+
+ if ( errorCode == -8 ) {
+ constraintName = extractUsingTemplate(
+ "; ", " table: ", sqle.getMessage()
+ );
+ }
+ else if ( errorCode == -9 ) {
+ constraintName = extractUsingTemplate(
+ "; ", " table: ", sqle.getMessage()
+ );
+ }
+ else if ( errorCode == -104 ) {
+ constraintName = extractUsingTemplate(
+ "; ", " table: ", sqle.getMessage()
+ );
+ }
+ else if ( errorCode == -177 ) {
+ constraintName = extractUsingTemplate(
+ "; ", " table: ", sqle.getMessage()
+ );
+ }
+ return constraintName;
+ }
+ };
+
+ @Override
+ public String getSelectClauseNullString(int sqlType) {
+ String literal;
+ switch ( sqlType ) {
+ case Types.LONGVARCHAR:
+ case Types.VARCHAR:
+ case Types.CHAR:
+ literal = "cast(null as varchar(100))";
+ break;
+ case Types.LONGVARBINARY:
+ case Types.VARBINARY:
+ case Types.BINARY:
+ literal = "cast(null as varbinary(100))";
+ break;
+ case Types.CLOB:
+ literal = "cast(null as clob)";
+ break;
+ case Types.BLOB:
+ literal = "cast(null as blob)";
+ break;
+ case Types.DATE:
+ literal = "cast(null as date)";
+ break;
+ case Types.TIMESTAMP:
+ literal = "cast(null as timestamp)";
+ break;
+ case Types.BOOLEAN:
+ literal = "cast(null as boolean)";
+ break;
+ case Types.BIT:
+ literal = "cast(null as bit)";
+ break;
+ case Types.TIME:
+ literal = "cast(null as time)";
+ break;
+ default:
+ literal = "cast(null as int)";
+ }
+ return literal;
+ }
+
+ @Override
+ public boolean supportsUnionAll() {
+ return true;
+ }
+
+ // temporary table support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ // Hibernate uses this information for temporary tables that it uses for its own operations
+ // therefore the appropriate strategy is taken with different versions of HSQLDB
+
+ // All versions of HSQLDB support GLOBAL TEMPORARY tables where the table
+ // definition is shared by all users but data is private to the session
+ // HSQLDB 2.0 also supports session-based LOCAL TEMPORARY tables where
+ // the definition and data is private to the session and table declaration
+ // can happen in the middle of a transaction
+
+ @Override
public boolean supportsTemporaryTables() {
return true;
}
+ @Override
+ public String generateTemporaryTableName(String baseTableName) {
+ if ( hsqldbVersion < 20 ) {
+ return "HT_" + baseTableName;
+ }
+ else {
+ // With HSQLDB 2.0, the table name is qualified with MODULE to assist the drop
+ // statement (in-case there is a global name beginning with HT_)
+ return "MODULE.HT_" + baseTableName;
+ }
+ }
+
+ @Override
+ public String getCreateTemporaryTableString() {
+ if ( hsqldbVersion < 20 ) {
+ return "create global temporary table";
+ }
+ else {
+ return "declare local temporary table";
+ }
+ }
+
+ @Override
+ public String getCreateTemporaryTablePostfix() {
+ return "";
+ }
+
+ @Override
+ public String getDropTemporaryTableString() {
+ return "drop table";
+ }
+
+ @Override
+ public Boolean performTemporaryTableDDLInIsolation() {
+ // Different behavior for GLOBAL TEMPORARY (1.8) and LOCAL TEMPORARY (2.0)
+ if ( hsqldbVersion < 20 ) {
+ return Boolean.TRUE;
+ }
+ else {
+ return Boolean.FALSE;
+ }
+ }
+
+ @Override
+ public boolean dropTemporaryTableAfterUse() {
+ // Version 1.8 GLOBAL TEMPORARY table definitions persist beyond the end
+ // of the session (by default, data is cleared at commit).
+ //
+ // Version 2.x LOCAL TEMPORARY table definitions do not persist beyond
+ // the end of the session (by default, data is cleared at commit).
+ return true;
+ }
+
+ // current timestamp support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ /**
+ * HSQLDB 1.8.x requires CALL CURRENT_TIMESTAMP but this should not
+ * be treated as a callable statement. It is equivalent to
+ * "select current_timestamp from dual" in some databases.
+ * HSQLDB 2.0 also supports VALUES CURRENT_TIMESTAMP
+ *
+ * {@inheritDoc}
+ */
+ @Override
public boolean supportsCurrentTimestampSelection() {
+ return true;
+ }
+
+ @Override
+ public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
+ @Override
+ public String getCurrentTimestampSelectString() {
+ return "call current_timestamp";
+ }
+
+ @Override
+ public String getCurrentTimestampSQLFunctionName() {
+ // the standard SQL function name is current_timestamp...
+ return "current_timestamp";
+ }
+
+ /**
+ * For HSQLDB 2.0, this is a copy of the base class implementation.
+ * For HSQLDB 1.8, only READ_UNCOMMITTED is supported.
+ *
+ * {@inheritDoc}
+ */
+ @Override
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
- // HSQLDB only supports READ_UNCOMMITTED transaction isolation
- return new ReadUncommittedLockingStrategy( lockable, lockMode );
+ if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT ) {
+ return new PessimisticForceIncrementLockingStrategy( lockable, lockMode );
+ }
+ else if ( lockMode == LockMode.PESSIMISTIC_WRITE ) {
+ return new PessimisticWriteSelectLockingStrategy( lockable, lockMode );
+ }
+ else if ( lockMode == LockMode.PESSIMISTIC_READ ) {
+ return new PessimisticReadSelectLockingStrategy( lockable, lockMode );
+ }
+ else if ( lockMode == LockMode.OPTIMISTIC ) {
+ return new OptimisticLockingStrategy( lockable, lockMode );
+ }
+ else if ( lockMode == LockMode.OPTIMISTIC_FORCE_INCREMENT ) {
+ return new OptimisticForceIncrementLockingStrategy( lockable, lockMode );
+ }
+
+ if ( hsqldbVersion < 20 ) {
+ return new ReadUncommittedLockingStrategy( lockable, lockMode );
+ }
+ else {
+ return new SelectLockingStrategy( lockable, lockMode );
+ }
}
- public static class ReadUncommittedLockingStrategy extends SelectLockingStrategy {
+ private static class ReadUncommittedLockingStrategy extends SelectLockingStrategy {
public ReadUncommittedLockingStrategy(Lockable lockable, LockMode lockMode) {
super( lockable, lockMode );
}
- public void lock(Serializable id, Object version, Object object, SessionImplementor session)
+ public void lock(Serializable id, Object version, Object object, int timeout, SessionImplementor session)
throws StaleObjectStateException, JDBCException {
if ( getLockMode().greaterThan( LockMode.READ ) ) {
- log.warn( "HSQLDB supports only READ_UNCOMMITTED isolation" );
+ LOG.hsqldbSupportsOnlyReadCommittedIsolation();
}
- super.lock( id, version, object, session );
+ super.lock( id, version, object, timeout, session );
}
}
+ @Override
+ public boolean supportsCommentOn() {
+ return hsqldbVersion >= 20;
+ }
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ @Override
public boolean supportsEmptyInList() {
return false;
}
+ @Override
+ public boolean requiresCastingOfParametersInSelectClause() {
+ return true;
+ }
+
+ @Override
+ public boolean doesReadCommittedCauseWritersToBlockReaders() {
+ return hsqldbVersion >= 20;
+ }
+
+ @Override
+ public boolean doesRepeatableReadCauseReadersToBlockWriters() {
+ return hsqldbVersion >= 20;
+ }
+
+ @Override
public boolean supportsLobValueChangePropogation() {
return false;
}
+
+ @Override
+ public String toBooleanValueString(boolean bool) {
+ return String.valueOf( bool );
+ }
+
+ @Override
+ public boolean supportsTupleDistinctCounts() {
+ return false;
+ }
}
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/InformixDialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/InformixDialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/InformixDialect.java 17 Aug 2012 14:33:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/InformixDialect.java 30 Jul 2014 16:15:54 -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,32 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.SQLException;
import java.sql.Types;
import org.hibernate.MappingException;
-import org.hibernate.Hibernate;
import org.hibernate.dialect.function.VarArgsSQLFunction;
-import org.hibernate.exception.JDBCExceptionHelper;
-import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
-import org.hibernate.exception.ViolatedConstraintNameExtracter;
-import org.hibernate.util.StringHelper;
+import org.hibernate.dialect.unique.InformixUniqueDelegate;
+import org.hibernate.dialect.unique.UniqueDelegate;
+import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
+import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
+import org.hibernate.internal.util.JdbcExceptionHelper;
+import org.hibernate.internal.util.StringHelper;
+import org.hibernate.type.StandardBasicTypes;
/**
* Informix dialect.
*
- * Seems to work with Informix Dynamic Server Version 7.31.UD3,
- * Informix JDBC driver version 2.21JC3.
+ * Seems to work with Informix Dynamic Server Version 7.31.UD3, Informix JDBC driver version 2.21JC3.
+ *
* @author Steve Molitor
*/
public class InformixDialect extends Dialect {
+
+ private final UniqueDelegate uniqueDelegate;
/**
* Creates new InformixDialect instance. Sets up the JDBC /
@@ -51,169 +54,207 @@
public InformixDialect() {
super();
- registerColumnType(Types.BIGINT, "int8");
- registerColumnType(Types.BINARY, "byte");
- registerColumnType(Types.BIT, "smallint"); // Informix doesn't have a bit type
- registerColumnType(Types.CHAR, "char($l)");
- registerColumnType(Types.DATE, "date");
- registerColumnType(Types.DECIMAL, "decimal");
- registerColumnType(Types.DOUBLE, "float");
- registerColumnType(Types.FLOAT, "smallfloat");
- registerColumnType(Types.INTEGER, "integer");
- registerColumnType(Types.LONGVARBINARY, "blob"); // or BYTE
- registerColumnType(Types.LONGVARCHAR, "clob"); // or TEXT?
- registerColumnType(Types.NUMERIC, "decimal"); // or MONEY
- registerColumnType(Types.REAL, "smallfloat");
- registerColumnType(Types.SMALLINT, "smallint");
- registerColumnType(Types.TIMESTAMP, "datetime year to fraction(5)");
- registerColumnType(Types.TIME, "datetime hour to second");
- registerColumnType(Types.TINYINT, "smallint");
- registerColumnType(Types.VARBINARY, "byte");
- registerColumnType(Types.VARCHAR, "varchar($l)");
- registerColumnType(Types.VARCHAR, 255, "varchar($l)");
- registerColumnType(Types.VARCHAR, 32739, "lvarchar($l)");
+ registerColumnType( Types.BIGINT, "int8" );
+ registerColumnType( Types.BINARY, "byte" );
+ // Informix doesn't have a bit type
+ registerColumnType( Types.BIT, "smallint" );
+ registerColumnType( Types.CHAR, "char($l)" );
+ registerColumnType( Types.DATE, "date" );
+ registerColumnType( Types.DECIMAL, "decimal" );
+ registerColumnType( Types.DOUBLE, "float" );
+ registerColumnType( Types.FLOAT, "smallfloat" );
+ registerColumnType( Types.INTEGER, "integer" );
+ // or BYTE
+ registerColumnType( Types.LONGVARBINARY, "blob" );
+ // or TEXT?
+ registerColumnType( Types.LONGVARCHAR, "clob" );
+ // or MONEY
+ registerColumnType( Types.NUMERIC, "decimal" );
+ registerColumnType( Types.REAL, "smallfloat" );
+ registerColumnType( Types.SMALLINT, "smallint" );
+ registerColumnType( Types.TIMESTAMP, "datetime year to fraction(5)" );
+ registerColumnType( Types.TIME, "datetime hour to second" );
+ registerColumnType( Types.TINYINT, "smallint" );
+ registerColumnType( Types.VARBINARY, "byte" );
+ registerColumnType( Types.VARCHAR, "varchar($l)" );
+ registerColumnType( Types.VARCHAR, 255, "varchar($l)" );
+ registerColumnType( Types.VARCHAR, 32739, "lvarchar($l)" );
- registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
+ registerFunction( "concat", new VarArgsSQLFunction( StandardBasicTypes.STRING, "(", "||", ")" ) );
+
+ uniqueDelegate = new InformixUniqueDelegate( this );
}
+ @Override
public String getAddColumnString() {
return "add";
}
+ @Override
public boolean supportsIdentityColumns() {
return true;
}
- public String getIdentitySelectString(String table, String column, int type)
- throws MappingException {
- return type==Types.BIGINT ?
- "select dbinfo('serial8') from systables where tabid=1" :
- "select dbinfo('sqlca.sqlerrd1') from systables where tabid=1";
+ @Override
+ public String getIdentitySelectString(String table, String column, int type)
+ throws MappingException {
+ return type == Types.BIGINT
+ ? "select dbinfo('serial8') from informix.systables where tabid=1"
+ : "select dbinfo('sqlca.sqlerrd1') from informix.systables where tabid=1";
}
+ @Override
public String getIdentityColumnString(int type) throws MappingException {
- return type==Types.BIGINT ?
- "serial8 not null" :
- "serial not null";
+ return type == Types.BIGINT ?
+ "serial8 not null" :
+ "serial not null";
}
+ @Override
public boolean hasDataTypeInIdentityColumn() {
return false;
}
/**
- * The syntax used to add a foreign key constraint to a table.
* Informix constraint name must be at the end.
- * @return String
+ *
+ * {@inheritDoc}
*/
+ @Override
public String getAddForeignKeyConstraintString(
- String constraintName,
- String[] foreignKey,
- String referencedTable,
- String[] primaryKey, boolean referencesPrimaryKey
- ) {
- StringBuffer result = new StringBuffer(30);
-
- result.append(" add constraint ")
- .append(" foreign key (")
- .append( StringHelper.join(", ", foreignKey) )
- .append(") references ")
- .append(referencedTable);
-
- if(!referencesPrimaryKey) {
- result.append(" (")
- .append( StringHelper.join(", ", primaryKey) )
- .append(')');
+ String constraintName,
+ String[] foreignKey,
+ String referencedTable,
+ String[] primaryKey,
+ boolean referencesPrimaryKey) {
+ final StringBuilder result = new StringBuilder( 30 )
+ .append( " add constraint " )
+ .append( " foreign key (" )
+ .append( StringHelper.join( ", ", foreignKey ) )
+ .append( ") references " )
+ .append( referencedTable );
+
+ if ( !referencesPrimaryKey ) {
+ result.append( " (" )
+ .append( StringHelper.join( ", ", primaryKey ) )
+ .append( ')' );
}
- result.append(" constraint ").append(constraintName);
-
- return result.toString();
+ result.append( " constraint " ).append( constraintName );
+
+ return result.toString();
}
/**
- * The syntax used to add a primary key constraint to a table.
* Informix constraint name must be at the end.
- * @return String
+ *
+ * {@inheritDoc}
*/
+ @Override
public String getAddPrimaryKeyConstraintString(String constraintName) {
return " add constraint primary key constraint " + constraintName + " ";
}
+ @Override
public String getCreateSequenceString(String sequenceName) {
return "create sequence " + sequenceName;
}
+
+ @Override
public String getDropSequenceString(String sequenceName) {
return "drop sequence " + sequenceName + " restrict";
}
+ @Override
public String getSequenceNextValString(String sequenceName) {
- return "select " + getSelectSequenceNextValString( sequenceName ) + " from systables where tabid=1";
+ return "select " + getSelectSequenceNextValString( sequenceName ) + " from informix.systables where tabid=1";
}
+ @Override
public String getSelectSequenceNextValString(String sequenceName) {
return sequenceName + ".nextval";
}
+ @Override
public boolean supportsSequences() {
return true;
}
+ @Override
+ public boolean supportsPooledSequences() {
+ return true;
+ }
+
+ @Override
+ public String getQuerySequencesString() {
+ return "select tabname from informix.systables where tabtype='Q'";
+ }
+
+ @Override
public boolean supportsLimit() {
return true;
}
+ @Override
public boolean useMaxForLimit() {
return true;
}
+ @Override
public boolean supportsLimitOffset() {
return false;
}
+ @Override
public String getLimitString(String querySelect, int offset, int limit) {
- if (offset>0) throw new UnsupportedOperationException("informix has no offset");
- return new StringBuffer( querySelect.length()+8 )
- .append(querySelect)
- .insert( querySelect.toLowerCase().indexOf( "select" ) + 6, " first " + limit )
- .toString();
+ if ( offset > 0 ) {
+ throw new UnsupportedOperationException( "query result offset is not supported" );
+ }
+ return new StringBuilder( querySelect.length() + 8 )
+ .append( querySelect )
+ .insert( querySelect.toLowerCase().indexOf( "select" ) + 6, " first " + limit )
+ .toString();
}
+ @Override
public boolean supportsVariableLimit() {
return false;
}
+ @Override
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
- return EXTRACTER;
+ return EXTRACTER;
}
- private static ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() {
-
- /**
- * Extract the name of the violated constraint from the given SQLException.
- *
- * @param sqle The exception that was the result of the constraint violation.
- * @return The extracted constraint name.
- */
+ private static final ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() {
+ @Override
public String extractConstraintName(SQLException sqle) {
String constraintName = null;
-
- int errorCode = JDBCExceptionHelper.extractErrorCode(sqle);
+ final int errorCode = JdbcExceptionHelper.extractErrorCode( sqle );
+
if ( errorCode == -268 ) {
constraintName = extractUsingTemplate( "Unique constraint (", ") violated.", sqle.getMessage() );
}
else if ( errorCode == -691 ) {
- constraintName = extractUsingTemplate( "Missing key in referenced table for referential constraint (", ").", sqle.getMessage() );
+ constraintName = extractUsingTemplate(
+ "Missing key in referenced table for referential constraint (",
+ ").",
+ sqle.getMessage()
+ );
}
else if ( errorCode == -692 ) {
- constraintName = extractUsingTemplate( "Key value for constraint (", ") is still being referenced.", sqle.getMessage() );
+ constraintName = extractUsingTemplate(
+ "Key value for constraint (",
+ ") is still being referenced.",
+ sqle.getMessage()
+ );
}
-
- if (constraintName != null) {
+
+ if ( constraintName != null ) {
// strip table-owner because Informix always returns constraint names as "."
- int i = constraintName.indexOf('.');
- if (i != -1) {
- constraintName = constraintName.substring(i + 1);
+ final int i = constraintName.indexOf( '.' );
+ if ( i != -1 ) {
+ constraintName = constraintName.substring( i + 1 );
}
}
@@ -222,15 +263,38 @@
};
+ @Override
public boolean supportsCurrentTimestampSelection() {
return true;
}
+ @Override
public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
+ @Override
public String getCurrentTimestampSelectString() {
return "select distinct current timestamp from informix.systables";
}
-}
\ No newline at end of file
+
+ @Override
+ public boolean supportsTemporaryTables() {
+ return true;
+ }
+
+ @Override
+ public String getCreateTemporaryTableString() {
+ return "create temp table";
+ }
+
+ @Override
+ public String getCreateTemporaryTablePostfix() {
+ return "with no log";
+ }
+
+ @Override
+ public UniqueDelegate getUniqueDelegate() {
+ return uniqueDelegate;
+ }
+}
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/Ingres10Dialect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `3rdParty_sources/hibernate-core/org/hibernate/dialect/Ingres9Dialect.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: 3rdParty_sources/hibernate-core/org/hibernate/dialect/IngresDialect.java
===================================================================
RCS file: /usr/local/cvsroot/3rdParty_sources/hibernate-core/org/hibernate/dialect/IngresDialect.java,v
diff -u -r1.1 -r1.1.2.1
--- 3rdParty_sources/hibernate-core/org/hibernate/dialect/IngresDialect.java 17 Aug 2012 14:33:40 -0000 1.1
+++ 3rdParty_sources/hibernate-core/org/hibernate/dialect/IngresDialect.java 30 Jul 2014 16:15:54 -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,47 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.dialect;
import java.sql.Types;
-import org.hibernate.Hibernate;
-import org.hibernate.dialect.function.SQLFunctionTemplate;
+import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
+import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
+import org.hibernate.type.StandardBasicTypes;
/**
- * An Ingres SQL dialect.
+ * An SQL dialect for Ingres 9.2.
*
- * Known limitations:
- * - only supports simple constants or columns on the left side of an IN, making (1,2,3) in (...) or (
+ *