Hibernate SVN: r20025 - core/trunk/core/src/test/java/org/hibernate/type.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-23 13:24:15 -0400 (Fri, 23 Jul 2010)
New Revision: 20025
Modified:
core/trunk/core/src/test/java/org/hibernate/type/BasicTypeRegistryTest.java
Log:
HHH-5283 - Add BasicType handling of java.net.URL
Modified: core/trunk/core/src/test/java/org/hibernate/type/BasicTypeRegistryTest.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/type/BasicTypeRegistryTest.java 2010-07-23 17:15:54 UTC (rev 20024)
+++ core/trunk/core/src/test/java/org/hibernate/type/BasicTypeRegistryTest.java 2010-07-23 17:24:15 UTC (rev 20025)
@@ -24,7 +24,7 @@
package org.hibernate.type;
import java.io.Serializable;
-import java.net.URL;
+import java.net.Socket;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -34,6 +34,7 @@
import org.hibernate.HibernateException;
import org.hibernate.engine.SessionImplementor;
+import org.hibernate.type.descriptor.java.StringTypeDescriptor;
import org.hibernate.type.descriptor.java.UrlTypeDescriptor;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
import org.hibernate.usertype.CompositeUserType;
@@ -66,13 +67,13 @@
}
public void testExpanding() {
- BasicType type = registry.getRegisteredType( URL.class.getName() );
+ BasicType type = registry.getRegisteredType( SomeNoopType.INSTANCE.getName() );
assertNull( type );
- registry.register( UrlType.INSTANCE );
- type = registry.getRegisteredType( URL.class.getName() );
+ registry.register( SomeNoopType.INSTANCE );
+ type = registry.getRegisteredType( SomeNoopType.INSTANCE.getName() );
assertNotNull( type );
- assertSame( UrlType.INSTANCE, type );
+ assertSame( SomeNoopType.INSTANCE, type );
}
public void testRegisteringUserTypes() {
@@ -96,20 +97,20 @@
assertEquals( CustomType.class, type.getClass() );
}
- public static class UrlType extends AbstractSingleColumnStandardBasicType<URL> {
- public static final UrlType INSTANCE = new UrlType();
+ public static class SomeNoopType extends AbstractSingleColumnStandardBasicType<String> {
+ public static final SomeNoopType INSTANCE = new SomeNoopType();
- public UrlType() {
- super( VarcharTypeDescriptor.INSTANCE, UrlTypeDescriptor.INSTANCE );
+ public SomeNoopType() {
+ super( VarcharTypeDescriptor.INSTANCE, StringTypeDescriptor.INSTANCE );
}
public String getName() {
- return "url";
+ return "noop";
}
@Override
protected boolean registerUnderJavaType() {
- return true;
+ return false;
}
}
14 years, 6 months
Hibernate SVN: r20024 - core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-23 13:15:54 -0400 (Fri, 23 Jul 2010)
New Revision: 20024
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java
Log:
HHH-5295 - Rendered JPAQL query shall be the same all the times, aliases shall not have random indexes
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java 2010-07-23 17:15:32 UTC (rev 20023)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java 2010-07-23 17:15:54 UTC (rev 20024)
@@ -70,7 +70,7 @@
private boolean distinct;
private Selection<? extends T> selection;
- private Set<Root<?>> roots = new HashSet<Root<?>>();
+ private Set<Root<?>> roots = new LinkedHashSet<Root<?>>();
private Set<FromImplementor> correlationRoots;
private Predicate restriction;
private List<Expression<?>> groupings = Collections.emptyList();
14 years, 6 months
Hibernate SVN: r20023 - core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-23 13:15:32 -0400 (Fri, 23 Jul 2010)
New Revision: 20023
Modified:
core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java
Log:
HHH-5295 - Rendered JPAQL query shall be the same all the times, aliases shall not have random indexes
Modified: core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java
===================================================================
--- core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java 2010-07-23 17:00:19 UTC (rev 20022)
+++ core/branches/Branch_3_5/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryStructure.java 2010-07-23 17:15:32 UTC (rev 20023)
@@ -70,7 +70,7 @@
private boolean distinct;
private Selection<? extends T> selection;
- private Set<Root<?>> roots = new HashSet<Root<?>>();
+ private Set<Root<?>> roots = new LinkedHashSet<Root<?>>();
private Set<FromImplementor> correlationRoots;
private Predicate restriction;
private List<Expression<?>> groupings = Collections.emptyList();
14 years, 6 months
Hibernate SVN: r20022 - in core/trunk: documentation/manual/src/main/docbook/en-US/content and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-23 13:00:19 -0400 (Fri, 23 Jul 2010)
New Revision: 20022
Added:
core/trunk/core/src/main/java/org/hibernate/type/UrlType.java
Modified:
core/trunk/core/src/main/java/org/hibernate/type/BasicTypeRegistry.java
core/trunk/documentation/manual/src/main/docbook/en-US/content/type.xml
Log:
HHH-5283 - Add BasicType handling of java.net.URL
Modified: core/trunk/core/src/main/java/org/hibernate/type/BasicTypeRegistry.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/BasicTypeRegistry.java 2010-07-23 16:42:36 UTC (rev 20021)
+++ core/trunk/core/src/main/java/org/hibernate/type/BasicTypeRegistry.java 2010-07-23 17:00:19 UTC (rev 20022)
@@ -63,6 +63,7 @@
register( BigIntegerType.INSTANCE );
register( StringType.INSTANCE );
+ register( UrlType.INSTANCE );
register( DateType.INSTANCE );
register( TimeType.INSTANCE );
Added: core/trunk/core/src/main/java/org/hibernate/type/UrlType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/UrlType.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/UrlType.java 2010-07-23 17:00:19 UTC (rev 20022)
@@ -0,0 +1,65 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type;
+
+import java.net.URL;
+
+import org.hibernate.dialect.Dialect;
+import org.hibernate.type.descriptor.java.UrlTypeDescriptor;
+import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
+
+/**
+ * A type that maps between {@link java.sql.Types#VARCHAR VARCHAR} and {@link URL}
+ *
+ * @author Steve Ebersole
+ */
+public class UrlType extends AbstractSingleColumnStandardBasicType<URL> implements DiscriminatorType<URL> {
+ public static final UrlType INSTANCE = new UrlType();
+
+ public UrlType() {
+ super( VarcharTypeDescriptor.INSTANCE, UrlTypeDescriptor.INSTANCE );
+ }
+
+ public String getName() {
+ return "url";
+ }
+
+ @Override
+ protected boolean registerUnderJavaType() {
+ return true;
+ }
+
+ @Override
+ public String toString(URL value) {
+ return UrlTypeDescriptor.INSTANCE.toString( value );
+ }
+
+ public String objectToSQLString(URL value, Dialect dialect) throws Exception {
+ return StringType.INSTANCE.objectToSQLString( toString( value ), dialect );
+ }
+
+ public URL stringToObject(String xml) throws Exception {
+ return UrlTypeDescriptor.INSTANCE.fromString( xml );
+ }
+}
Modified: core/trunk/documentation/manual/src/main/docbook/en-US/content/type.xml
===================================================================
--- core/trunk/documentation/manual/src/main/docbook/en-US/content/type.xml 2010-07-23 16:42:36 UTC (rev 20021)
+++ core/trunk/documentation/manual/src/main/docbook/en-US/content/type.xml 2010-07-23 17:00:19 UTC (rev 20022)
@@ -452,6 +452,23 @@
</varlistentry>
</variablelist>
</section>
+ <section id="types-basic-value-url">
+ <title><classname>java.net.URL</classname></title>
+ <variablelist>
+ <varlistentry>
+ <term><classname>org.hibernate.type.UrlType</classname></term>
+ <listitem>
+ <para>
+ Maps a <classname>java.net.URL</classname> to a JDBC VARCHAR (using the external form)
+ </para>
+ <para>
+ Registered under <literal>url</literal> and <literal>java.net.URL</literal> in the
+ type registry (see <xref linkend="types-registry"/>).
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </section>
<section id="types-basic-value-class">
<title><classname>java.lang.Class</classname></title>
<variablelist>
14 years, 6 months
Hibernate SVN: r20021 - core/trunk/entitymanager/src/main/docbook/en/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-07-23 12:42:36 -0400 (Fri, 23 Jul 2010)
New Revision: 20021
Modified:
core/trunk/entitymanager/src/main/docbook/en/modules/configuration.xml
Log:
HHH-5408 Change wording on "What is hibernate-jpa-2.0-api-x.y.z.jar" to suit Oracle
Lance asked us to adjust some details on how we use the word TCK. Basically better not use the word, it's too complicated :(
Modified: core/trunk/entitymanager/src/main/docbook/en/modules/configuration.xml
===================================================================
--- core/trunk/entitymanager/src/main/docbook/en/modules/configuration.xml 2010-07-23 16:41:23 UTC (rev 20020)
+++ core/trunk/entitymanager/src/main/docbook/en/modules/configuration.xml 2010-07-23 16:42:36 UTC (rev 20021)
@@ -66,12 +66,14 @@
</itemizedlist></para>
<note>
- <title>What is hibernate-jpa-2.0-api-x.y.z.jar</title>
+ <title>What is hibernate-jpa-2.0-api-x.y.z.jar?</title>
- <para>This is the JAR containing the JPA 2.0 API, it is fully compliant
- with the spec and passed the TCK signature test. You typically don't
- need it when you deploy your application in a Java EE 6 application
- server (like JBoss AS 6 for example).</para>
+ <para>This is the JAR containing the JPA 2.0 API, it provides all the
+ interfaces and concrete classes that the specification defines as public
+ API. Said otherwise, you can use this JAR to bootstrap any JPA provider
+ implementation. Note that you typically don't need it when you deploy
+ your application in a Java EE 6 application server (like JBoss AS 6 for
+ example).</para>
</note>
<para>Alternatively, if you use Maven, add the following
14 years, 6 months
Hibernate SVN: r20020 - core/branches/Branch_3_5/entitymanager/src/main/docbook/en/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-07-23 12:41:23 -0400 (Fri, 23 Jul 2010)
New Revision: 20020
Modified:
core/branches/Branch_3_5/entitymanager/src/main/docbook/en/modules/configuration.xml
Log:
HHH-5408 Change wording on "What is hibernate-jpa-2.0-api-x.y.z.jar" to suit Oracle
Lance asked us to adjust some details on how we use the word TCK. Basically better not use the word, it's too complicated :(
Modified: core/branches/Branch_3_5/entitymanager/src/main/docbook/en/modules/configuration.xml
===================================================================
--- core/branches/Branch_3_5/entitymanager/src/main/docbook/en/modules/configuration.xml 2010-07-23 16:38:57 UTC (rev 20019)
+++ core/branches/Branch_3_5/entitymanager/src/main/docbook/en/modules/configuration.xml 2010-07-23 16:41:23 UTC (rev 20020)
@@ -66,12 +66,14 @@
</itemizedlist></para>
<note>
- <title>What is hibernate-jpa-2.0-api-x.y.z.jar</title>
+ <title>What is hibernate-jpa-2.0-api-x.y.z.jar?</title>
- <para>This is the JAR containing the JPA 2.0 API, it is fully compliant
- with the spec and passed the TCK signature test. You typically don't
- need it when you deploy your application in a Java EE 6 application
- server (like JBoss AS 6 for example).</para>
+ <para>This is the JAR containing the JPA 2.0 API, it provides all the
+ interfaces and concrete classes that the specification defines as public
+ API. Said otherwise, you can use this JAR to bootstrap any JPA provider
+ implementation. Note that you typically don't need it when you deploy
+ your application in a Java EE 6 application server (like JBoss AS 6 for
+ example).</para>
</note>
<para>Alternatively, if you use Maven, add the following
14 years, 6 months
Hibernate SVN: r20019 - core/trunk/core/src/main/java/org/hibernate/dialect.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-23 12:38:57 -0400 (Fri, 23 Jul 2010)
New Revision: 20019
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
Log:
HHH-5401 - Update to HHH-5381 HSQLDB new dialect (Fred Toussi)
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-07-23 16:38:36 UTC (rev 20018)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-07-23 16:38:57 UTC (rev 20019)
@@ -88,6 +88,7 @@
registerColumnType( Types.BIGINT, "bigint" );
registerColumnType( Types.BINARY, "binary" );
registerColumnType( Types.BIT, "bit" );
+ registerColumnType( Types.BOOLEAN, "boolean" );
registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.DATE, "date" );
@@ -391,6 +392,9 @@
return literal;
}
+ public boolean supportsUnionAll() {
+ return true;
+ }
// temporary table support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Hibernate uses this information for temporary tables that it uses for its own operations
@@ -650,6 +654,10 @@
return false;
}
+ public String toBooleanValueString(boolean bool) {
+ return bool ? "true" : "false";
+ }
+
public boolean supportsTupleDistinctCounts() {
return false;
}
14 years, 6 months
Hibernate SVN: r20018 - core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-23 12:38:36 -0400 (Fri, 23 Jul 2010)
New Revision: 20018
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
Log:
HHH-5401 - Update to HHH-5381 HSQLDB new dialect (Fred Toussi)
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-07-23 16:33:39 UTC (rev 20017)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-07-23 16:38:36 UTC (rev 20018)
@@ -88,6 +88,7 @@
registerColumnType( Types.BIGINT, "bigint" );
registerColumnType( Types.BINARY, "binary" );
registerColumnType( Types.BIT, "bit" );
+ registerColumnType( Types.BOOLEAN, "boolean" );
registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.DATE, "date" );
@@ -391,6 +392,9 @@
return literal;
}
+ public boolean supportsUnionAll() {
+ return true;
+ }
// temporary table support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Hibernate uses this information for temporary tables that it uses for its own operations
@@ -649,6 +653,10 @@
return false;
}
+ public String toBooleanValueString(boolean bool) {
+ return bool ? "true" : "false";
+ }
+
public boolean supportsTupleDistinctCounts() {
return false;
}
14 years, 6 months
Hibernate SVN: r20017 - in core/trunk/core/src/main/java/org/hibernate: stat and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-23 12:33:39 -0400 (Fri, 23 Jul 2010)
New Revision: 20017
Modified:
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImpl.java
core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImplementor.java
Log:
HHH-5331 - Remove reflection calls on SessionFactory for JDK 1.5 detection in relation to Statistics
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-07-22 20:40:12 UTC (rev 20016)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-07-23 16:33:39 UTC (rev 20017)
@@ -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.impl;
@@ -30,17 +29,16 @@
import java.io.ObjectOutputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
-import java.lang.reflect.Constructor;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.LinkedHashSet;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.StringRefAddr;
@@ -50,20 +48,19 @@
import org.slf4j.LoggerFactory;
import org.hibernate.AssertionFailure;
+import org.hibernate.Cache;
import org.hibernate.ConnectionReleaseMode;
import org.hibernate.EntityMode;
+import org.hibernate.EntityNameResolver;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.MappingException;
import org.hibernate.ObjectNotFoundException;
import org.hibernate.QueryException;
import org.hibernate.SessionFactory;
-import org.hibernate.StatelessSession;
import org.hibernate.SessionFactoryObserver;
-import org.hibernate.EntityNameResolver;
-import org.hibernate.Cache;
+import org.hibernate.StatelessSession;
import org.hibernate.TypeHelper;
-import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.cache.CacheKey;
import org.hibernate.cache.CollectionRegion;
import org.hibernate.cache.EntityRegion;
@@ -90,9 +87,9 @@
import org.hibernate.engine.NamedSQLQueryDefinition;
import org.hibernate.engine.ResultSetMappingDefinition;
import org.hibernate.engine.SessionFactoryImplementor;
-import org.hibernate.engine.profile.FetchProfile;
-import org.hibernate.engine.profile.Fetch;
import org.hibernate.engine.profile.Association;
+import org.hibernate.engine.profile.Fetch;
+import org.hibernate.engine.profile.FetchProfile;
import org.hibernate.engine.query.QueryPlanCache;
import org.hibernate.engine.query.sql.NativeSQLQuerySpecification;
import org.hibernate.event.EventListeners;
@@ -109,23 +106,24 @@
import org.hibernate.persister.PersisterFactory;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
-import org.hibernate.persister.entity.Queryable;
import org.hibernate.persister.entity.Loadable;
+import org.hibernate.persister.entity.Queryable;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.proxy.EntityNotFoundDelegate;
+import org.hibernate.stat.ConcurrentStatisticsImpl;
import org.hibernate.stat.Statistics;
-import org.hibernate.stat.StatisticsImpl;
import org.hibernate.stat.StatisticsImplementor;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
import org.hibernate.tool.hbm2ddl.SchemaValidator;
import org.hibernate.transaction.TransactionFactory;
+import org.hibernate.tuple.entity.EntityTuplizer;
import org.hibernate.type.AssociationType;
import org.hibernate.type.Type;
import org.hibernate.type.TypeResolver;
import org.hibernate.util.CollectionHelper;
-import org.hibernate.util.ReflectHelper;
import org.hibernate.util.EmptyIterator;
+import org.hibernate.util.ReflectHelper;
/**
@@ -201,28 +199,10 @@
SessionFactoryObserver observer) throws HibernateException {
log.info("building session factory");
- Statistics concurrentStatistics = null;
- try {
- Class concurrentStatsClass = ReflectHelper.classForName("org.hibernate.stat.ConcurrentStatisticsImpl");
- Constructor constructor = concurrentStatsClass.getConstructor(new Class[]{SessionFactoryImplementor.class});
- concurrentStatistics = (Statistics) constructor.newInstance(new Object[]{this});
- log.trace("JDK 1.5 concurrent classes present");
- } catch ( NoClassDefFoundError noJava5 ) {
- log.trace("JDK 1.5 concurrent classes missing");
- } catch (Exception noJava5) {
- log.trace("JDK 1.5 concurrent classes missing");
- }
+ this.statistics = new ConcurrentStatisticsImpl( this );
+ getStatistics().setStatisticsEnabled( settings.isStatisticsEnabled() );
+ log.debug( "Statistics initialized [enabled={}]}", settings.isStatisticsEnabled() );
- if (concurrentStatistics != null) {
- this.statistics = concurrentStatistics;
- } else {
- this.statistics = new StatisticsImpl(this);
- }
-
- if ( log.isTraceEnabled() ) {
- log.trace("Statistics initialized with " + statistics.getClass().getName());
- }
-
this.properties = new Properties();
this.properties.putAll( cfg.getProperties() );
this.interceptor = cfg.getInterceptor();
@@ -444,9 +424,6 @@
}
}
- //stats
- getStatistics().setStatisticsEnabled( settings.isStatisticsEnabled() );
-
// EntityNotFoundDelegate
EntityNotFoundDelegate entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
if ( entityNotFoundDelegate == null ) {
Modified: core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImpl.java 2010-07-22 20:40:12 UTC (rev 20016)
+++ core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImpl.java 2010-07-23 16:33:39 UTC (rev 20017)
@@ -36,7 +36,10 @@
* @see org.hibernate.stat.Statistics
*
* @author Gavin King
+ *
+ * @deprecated Use {@link org.hibernate.stat.ConcurrentStatisticsImpl} instead
*/
+@Deprecated
public class StatisticsImpl implements Statistics, StatisticsImplementor {
//TODO: we should provide some way to get keys of collection of statistics to make it easier to retrieve from a GUI perspective
Modified: core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImplementor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImplementor.java 2010-07-22 20:40:12 UTC (rev 20016)
+++ core/trunk/core/src/main/java/org/hibernate/stat/StatisticsImplementor.java 2010-07-23 16:33:39 UTC (rev 20017)
@@ -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,39 +20,185 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.stat;
/**
- * Statistics SPI for the Hibernate core
+ * Statistics SPI for the Hibernate core. This is essentially the "statistic collector" API, its the contract
+ * called to collect various stats.
*
* @author Emmanuel Bernard
*/
public interface StatisticsImplementor {
+ /**
+ * Callback about a session being opened.
+ */
public void openSession();
+
+ /**
+ * Callback about a session being closed.
+ */
public void closeSession();
+
+ /**
+ * Callback about a flush occurring
+ */
public void flush();
+
+ /**
+ * Callback about a connection being obtained from {@link org.hibernate.connection.ConnectionProvider}
+ */
public void connect();
+
+ /**
+ * Callback about a statement being prepared.
+ */
+ public void prepareStatement();
+
+ /**
+ * Callback about a statement being closed.
+ */
+ public void closeStatement();
+
+ /**
+ * Callback about a transaction completing.
+ *
+ * @param success Was the transaction successful?
+ */
+ public void endTransaction(boolean success);
+
+ /**
+ * Callback about an entity being loaded. This might indicate a proxy or a fully initialized entity, but in either
+ * case it means without a separate SQL query being needed.
+ *
+ * @param entityName The name of the entity loaded.
+ */
public void loadEntity(String entityName);
+
+ /**
+ * Callback about an entity being fetched. Unlike {@link #loadEntity} this indicates a separate query being
+ * performed.
+ *
+ * @param entityName The name of the entity fetched.
+ */
public void fetchEntity(String entityName);
+
+ /**
+ * Callback about an entity being updated.
+ *
+ * @param entityName The name of the entity updated.
+ */
public void updateEntity(String entityName);
+
+ /**
+ * Callback about an entity being inserted
+ *
+ * @param entityName The name of the entity inserted
+ */
public void insertEntity(String entityName);
+
+ /**
+ * Callback about an entity being deleted.
+ *
+ * @param entityName The name of the entity deleted.
+ */
public void deleteEntity(String entityName);
+
+ /**
+ * Callback about an optimistic lock failure on an entity
+ *
+ * @param entityName The name of the entity.
+ */
+ public void optimisticFailure(String entityName);
+
+ /**
+ * Callback about a collection loading. This might indicate a lazy collection or an initialized collection being
+ * created, but in either case it means without a separate SQL query being needed.
+ *
+ * @param role The collection role.
+ */
public void loadCollection(String role);
+
+ /**
+ * Callback to indicate a collection being fetched. Unlike {@link #loadCollection}, this indicates a separate
+ * query was needed.
+ *
+ * @param role The collection role.
+ */
public void fetchCollection(String role);
+
+ /**
+ * Callback indicating a collection was updated.
+ *
+ * @param role The collection role.
+ */
public void updateCollection(String role);
+
+ /**
+ * Callback indicating a collection recreation (full deletion + full (re-)insertion).
+ *
+ * @param role The collection role.
+ */
public void recreateCollection(String role);
+
+ /**
+ * Callback indicating a collection removal.
+ *
+ * @param role The collection role.
+ */
public void removeCollection(String role);
+
+ /**
+ * Callback indicating a put into second level cache.
+ *
+ * @param regionName The name of the cache region
+ */
public void secondLevelCachePut(String regionName);
+
+ /**
+ * Callback indicating a get from second level cache resulted in a hit.
+ *
+ * @param regionName The name of the cache region
+ */
public void secondLevelCacheHit(String regionName);
+
+ /**
+ * Callback indicating a get from second level cache resulted in a miss.
+ *
+ * @param regionName The name of the cache region
+ */
public void secondLevelCacheMiss(String regionName);
- public void queryExecuted(String hql, int rows, long time);
+
+ /**
+ * Callback indicating a put into the query cache.
+ *
+ * @param hql The query
+ * @param regionName The cache region
+ */
+ public void queryCachePut(String hql, String regionName);
+
+ /**
+ * Callback indicating a get from the query cache resulted in a hit.
+ *
+ * @param hql The query
+ * @param regionName The name of the cache region
+ */
public void queryCacheHit(String hql, String regionName);
+
+ /**
+ * Callback indicating a get from the query cache resulted in a miss.
+ *
+ * @param hql The query
+ * @param regionName The name of the cache region
+ */
public void queryCacheMiss(String hql, String regionName);
- public void queryCachePut(String hql, String regionName);
- public void endTransaction(boolean success);
- public void closeStatement();
- public void prepareStatement();
- public void optimisticFailure(String entityName);
+
+ /**
+ * Callback indicating execution of a sql/hql query
+ *
+ * @param hql The query
+ * @param rows Number of rows returned
+ * @param time execution time
+ */
+ public void queryExecuted(String hql, int rows, long time);
}
\ No newline at end of file
14 years, 6 months
Hibernate SVN: r20016 - core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-07-22 16:40:12 -0400 (Thu, 22 Jul 2010)
New Revision: 20016
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java
Log:
HHH-5097 - Bug in ParameterizedFunctionExpression with two or more parameters: IllegalArgumentException
Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java 2010-07-22 20:39:15 UTC (rev 20015)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/ParameterizedFunctionExpression.java 2010-07-22 20:40:12 UTC (rev 20016)
@@ -98,8 +98,10 @@
}
protected void renderArguments(StringBuilder buffer, CriteriaQueryCompiler.RenderingContext renderingContext) {
+ String sep = "";
for ( Expression argument : argumentExpressions ) {
- buffer.append( ( (Renderable) argument ).render( renderingContext ) );
+ buffer.append( sep ).append( ( (Renderable) argument ).render( renderingContext ) );
+ sep = ", ";
}
}
}
14 years, 6 months