Hibernate SVN: r19345 - in core/trunk/core/src: main/java/org/hibernate/type/descriptor and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-02 20:04:27 -0400 (Sun, 02 May 2010)
New Revision: 19345
Added:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java
Removed:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java
Modified:
core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java
core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java
core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java
Log:
HHH-5138 - Redesign types + introduce TypeRegistry & TypeResolver
Modified: core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -31,8 +31,8 @@
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.jdbc.NonContextualLobCreator;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -40,9 +40,9 @@
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.jdbc.LobCreator;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan;
-import org.hibernate.type.descriptor.java.WrapperOptions;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.util.ArrayHelper;
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -0,0 +1,47 @@
+/*
+ * 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.descriptor;
+
+import java.io.InputStream;
+
+/**
+ * Wraps a binary stream to also provide the length which is needed when binding.
+ *
+ * @author Steve Ebersole
+ */
+public interface BinaryStream {
+ /**
+ * Retrieve the input stream.
+ *
+ * @return The input stream
+ */
+ public InputStream getInputStream();
+
+ /**
+ * Retrieve the length of the input stream
+ *
+ * @return The input stream length
+ */
+ public int getLength();
+}
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -0,0 +1,49 @@
+/*
+ * 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.descriptor;
+
+import java.io.Reader;
+
+/**
+ * Wraps a character stream (reader) to also provide the length (number of characters) which is needed
+ * when binding.
+ *
+ * @author Steve Ebersole
+ */
+public interface CharacterStream {
+ /**
+ * Retrieve the reader.
+ *
+ * @return The reader.
+ */
+ public Reader getReader();
+
+ /**
+ * Retrieve the number of characters. JDBC 3 and earlier defined the length in terms of int type rather than
+ * long type :(
+ *
+ * @return The number of characters.
+ */
+ public int getLength();
+}
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -0,0 +1,46 @@
+/*
+ * 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.descriptor;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+/**
+ * Contract for binding values to a {@link PreparedStatement}.
+ *
+ * @author Steve Ebersole
+ */
+public interface ValueBinder<X> {
+ /**
+ * Bind a value to a prepared statement.
+ *
+ * @param st The prepared statement to which to bind the value.
+ * @param value The value to bind.
+ * @param index The position at which to bind the value within the prepared statement
+ * @param options The options.
+ *
+ * @throws SQLException Indicates a JDBC error occurred.
+ */
+ public void bind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException;
+}
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -0,0 +1,47 @@
+/*
+ * 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.descriptor;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * Contract for extracting a value from a {@link ResultSet}.
+ *
+ * @author Steve Ebersole
+ */
+public interface ValueExtractor<X> {
+ /**
+ * Extract value from result set
+ *
+ * @param rs The result set from which to extract the value
+ * @param name The name by which to extract the value from the result set
+ * @param options The options
+ *
+ * @return The extracted value
+ *
+ * @throws SQLException Indicates a JDBC error occurred.
+ */
+ public X extract(ResultSet rs, String name, WrapperOptions options) throws SQLException;
+}
Copied: core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java (from rev 19335, core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java)
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -0,0 +1,36 @@
+/*
+ * 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.descriptor;
+
+import org.hibernate.engine.jdbc.LobCreator;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public interface WrapperOptions {
+ public boolean useStreamForLobBinding();
+ public LobCreator getLobCreator();
+}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link BigDecimal} handling.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link BigInteger} handling.
*
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -0,0 +1,52 @@
+/*
+ * 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.descriptor.java;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.hibernate.type.descriptor.BinaryStream;
+
+/**
+ * Implementation of {@link BinaryStream}
+ *
+ * @author Steve Ebersole
+ */
+public class BinaryStreamImpl implements BinaryStream {
+ private final ByteArrayInputStream stream;
+ private final int length;
+
+ public BinaryStreamImpl(byte[] bytes) {
+ this.stream = new ByteArrayInputStream( bytes );
+ this.length = bytes.length;
+ }
+
+ public InputStream getInputStream() {
+ return stream;
+ }
+
+ public int getLength() {
+ return length;
+ }
+}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -31,6 +31,7 @@
import org.hibernate.HibernateException;
import org.hibernate.engine.jdbc.BlobProxy;
import org.hibernate.engine.jdbc.WrappedBlob;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Blob} handling.
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -23,6 +23,8 @@
*/
package org.hibernate.type.descriptor.java;
+import org.hibernate.type.descriptor.WrapperOptions;
+
import static java.lang.Boolean.TRUE;
import static java.lang.Boolean.FALSE;
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,6 +29,8 @@
import java.sql.SQLException;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
@@ -86,6 +88,9 @@
if ( InputStream.class.isAssignableFrom( type ) ) {
return (X) new ByteArrayInputStream( unwrapBytes( value ) );
}
+ if ( BinaryStream.class.isAssignableFrom( type ) ) {
+ return (X) new BinaryStreamImpl( unwrapBytes( value ) );
+ }
if ( Blob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createBlob( unwrapBytes( value ) );
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -23,6 +23,8 @@
*/
package org.hibernate.type.descriptor.java;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Byte} handling.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,6 +29,7 @@
import java.util.GregorianCalendar;
import org.hibernate.cfg.Environment;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.CalendarComparator;
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,6 +29,7 @@
import java.util.GregorianCalendar;
import org.hibernate.cfg.Environment;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.CalendarComparator;
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -30,6 +30,8 @@
import java.util.Arrays;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
@@ -84,6 +86,9 @@
if ( Reader.class.isAssignableFrom( type ) ) {
return (X) new StringReader( new String( unwrapChars( value ) ) );
}
+ if ( CharacterStream.class.isAssignableFrom( type ) ) {
+ return (X) new CharacterStreamImpl( new String( unwrapChars( value ) ) );
+ }
throw unknownUnwrap( type );
}
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -0,0 +1,52 @@
+/*
+ * 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.descriptor.java;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.hibernate.type.descriptor.CharacterStream;
+
+/**
+ * Implementation of {@link CharacterStream}
+ *
+ * @author Steve Ebersole
+ */
+public class CharacterStreamImpl implements CharacterStream {
+ private final StringReader reader;
+ private final int length;
+
+ public CharacterStreamImpl(String chars) {
+ reader = new StringReader( chars );
+ length = chars.length();
+ }
+
+ public Reader getReader() {
+ return reader;
+ }
+
+ public int getLength() {
+ return length;
+ }
+}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -24,7 +24,7 @@
package org.hibernate.type.descriptor.java;
import org.hibernate.HibernateException;
-import org.hibernate.MappingException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Character} handling.
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -24,6 +24,7 @@
package org.hibernate.type.descriptor.java;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.ReflectHelper;
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -31,6 +31,7 @@
import org.hibernate.HibernateException;
import org.hibernate.engine.jdbc.ClobProxy;
import org.hibernate.engine.jdbc.WrappedClob;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Clob} handling.
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -25,6 +25,8 @@
import java.util.Currency;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* TODO : javadoc
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -30,6 +30,7 @@
import java.util.GregorianCalendar;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Double} handling.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Float} handling.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Integer} handling.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.io.Serializable;
import java.util.Comparator;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for the Java side of a value mapping.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -30,6 +30,7 @@
import java.util.GregorianCalendar;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -31,6 +31,7 @@
import java.util.GregorianCalendar;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -32,6 +32,7 @@
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -27,6 +27,8 @@
import java.util.Locale;
import java.util.StringTokenizer;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* TODO : javadoc
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Long} handling.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -30,6 +30,8 @@
import java.util.Arrays;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@code byte[]} handling.
@@ -97,6 +99,9 @@
if ( InputStream.class.isAssignableFrom( type ) ) {
return (X) new ByteArrayInputStream( value );
}
+ if ( BinaryStream.class.isAssignableFrom( type ) ) {
+ return (X) new BinaryStreamImpl( value );
+ }
if ( Blob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createBlob( value );
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -30,6 +30,8 @@
import java.util.Arrays;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
@@ -84,6 +86,9 @@
if ( Reader.class.isAssignableFrom( type ) ) {
return (X) new StringReader( new String( value ) );
}
+ if ( CharacterStream.class.isAssignableFrom( type ) ) {
+ return (X) new CharacterStreamImpl( new String( value ) );
+ }
throw unknownUnwrap( type );
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -27,6 +27,8 @@
import java.io.InputStream;
import java.io.Serializable;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.SerializationHelper;
/**
@@ -85,6 +87,9 @@
if ( InputStream.class.isAssignableFrom( type ) ) {
return (X) new ByteArrayInputStream( toBytes( value ) );
}
+ if ( BinaryStream.class.isAssignableFrom( type ) ) {
+ return (X) new BinaryStreamImpl( toBytes( value ) );
+ }
throw unknownUnwrap( type );
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -23,6 +23,8 @@
*/
package org.hibernate.type.descriptor.java;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Short} handling.
*
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,6 +29,8 @@
import java.sql.SQLException;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link String} handling.
@@ -61,6 +63,9 @@
if ( Reader.class.isAssignableFrom( type ) ) {
return (X) new StringReader( (String) value );
}
+ if ( CharacterStream.class.isAssignableFrom( type ) ) {
+ return (X) new CharacterStreamImpl( (String) value );
+ }
if ( Clob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createClob( value );
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.util.Comparator;
import java.util.TimeZone;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* TODO : javadoc
*
Deleted: core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -1,36 +0,0 @@
-/*
- * 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.descriptor.java;
-
-import org.hibernate.engine.jdbc.LobCreator;
-
-/**
- * TODO : javadoc
- *
- * @author Steve Ebersole
- */
-public interface WrapperOptions {
- public boolean useStreamForLobBinding();
- public LobCreator getLobCreator();
-}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,17 +29,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
-import static org.hibernate.type.descriptor.sql.SqlTypeDescriptor.Binder;
-
/**
- * Convenience base implementation of {@link Binder}
+ * Convenience base implementation of {@link ValueBinder}
*
* @author Steve Ebersole
*/
-public abstract class BasicBinder<J> implements Binder<J> {
+public abstract class BasicBinder<J> implements ValueBinder<J> {
private static final Logger log = LoggerFactory.getLogger( BasicBinder.class );
private final JavaTypeDescriptor<J> javaDescriptor;
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,17 +29,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
-import static org.hibernate.type.descriptor.sql.SqlTypeDescriptor.Extractor;
-
/**
- * Convenience base implementation of {@link Extractor}
+ * Convenience base implementation of {@link org.hibernate.type.descriptor.ValueExtractor}
*
* @author Steve Ebersole
*/
-public abstract class BasicExtractor<J> implements Extractor<J> {
+public abstract class BasicExtractor<J> implements ValueExtractor<J> {
private static final Logger log = LoggerFactory.getLogger( BasicExtractor.class );
private final JavaTypeDescriptor<J> javaDescriptor;
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#BIGINT BIGINT} handling.
@@ -43,7 +45,7 @@
return Types.BIGINT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#BIT BIT} handling.
@@ -46,7 +48,7 @@
return Types.BIT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -55,7 +57,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -30,8 +30,11 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#BLOB BLOB} handling.
@@ -45,12 +48,13 @@
return Types.BLOB;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
if ( options.useStreamForLobBinding() ) {
- st.setBinaryStream( index, getJavaDescriptor().unwrap( value, InputStream.class, options ) );
+ final BinaryStream binaryStream = javaTypeDescriptor.unwrap( value, BinaryStream.class, options );
+ st.setBinaryStream( index, binaryStream.getInputStream(), binaryStream.getLength() );
}
else {
st.setBlob( index, javaTypeDescriptor.unwrap( value, Blob.class, options ) );
@@ -59,7 +63,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -30,8 +30,11 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#CLOB CLOB} handling.
@@ -45,12 +48,13 @@
return Types.CLOB;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
if ( options.useStreamForLobBinding() ) {
- st.setCharacterStream( index, getJavaDescriptor().unwrap( value, Reader.class, options ) );
+ final CharacterStream characterStream = javaTypeDescriptor.unwrap( value, CharacterStream.class, options );
+ st.setCharacterStream( index, characterStream.getReader(), characterStream.getLength() );
}
else {
st.setClob( index, javaTypeDescriptor.unwrap( value, Clob.class, options ) );
@@ -59,7 +63,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#DATE DATE} handling.
@@ -44,7 +46,7 @@
return Types.DATE;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#DECIMAL DECIMAL} handling.
@@ -44,7 +46,7 @@
return Types.DECIMAL;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#DOUBLE DOUBLE} handling.
@@ -43,7 +45,7 @@
return Types.DOUBLE;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#INTEGER INTEGER} handling.
@@ -43,7 +45,7 @@
return Types.INTEGER;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#REAL REAL} handling.
@@ -43,7 +45,7 @@
return Types.REAL;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#SMALLINT SMALLINT} handling.
@@ -43,7 +45,7 @@
return Types.SMALLINT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -24,12 +24,10 @@
package org.hibernate.type.descriptor.sql;
import java.io.Serializable;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for the <tt>SQL</tt>/<tt>JDBC</tt> side of a value mapping.
@@ -44,15 +42,7 @@
*/
public int getSqlType();
- public static interface Binder<X> {
- public void bind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException;
- }
+ public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor);
- public <X> Binder<X> getBinder(JavaTypeDescriptor<X> javaTypeDescriptor);
-
- public static interface Extractor<X> {
- public X extract(ResultSet rs, String name, WrapperOptions options) throws SQLException;
- }
-
- public <X> Extractor<X> getExtractor(JavaTypeDescriptor<X> javaTypeDescriptor);
+ public <X> ValueExtractor<X> getExtractor(JavaTypeDescriptor<X> javaTypeDescriptor);
}
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.Time;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#TIME TIME} handling.
@@ -44,7 +46,7 @@
return Types.TIME;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.Timestamp;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#TIMESTAMP TIMESTAMP} handling.
@@ -44,7 +46,7 @@
return Types.TIMESTAMP;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#TINYINT TINYINT} handling.
@@ -46,7 +48,7 @@
return Types.TINYINT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -55,7 +57,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#VARBINARY VARBINARY} handling.
@@ -43,7 +45,7 @@
return Types.VARBINARY;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#VARCHAR VARCHAR} handling.
@@ -43,7 +45,7 @@
return Types.VARCHAR;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
Modified: core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java 2010-05-02 15:32:40 UTC (rev 19344)
+++ core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java 2010-05-03 00:04:27 UTC (rev 19345)
@@ -32,10 +32,11 @@
import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.jdbc.NonContextualLobCreator;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.StringTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
-import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
/**
@@ -63,8 +64,8 @@
public static final int BIND_POSITION = -1;
public void testNormalVarcharHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor = varcharSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = varcharSqlDescriptor.getBinder( stringJavaDescriptor );
+ final ValueExtractor<String> extractor = varcharSqlDescriptor.getExtractor( stringJavaDescriptor );
+ final ValueBinder<String> binder = varcharSqlDescriptor.getBinder( stringJavaDescriptor );
final String fixture = "string value";
@@ -77,8 +78,8 @@
}
public void testNullVarcharHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor = varcharSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = varcharSqlDescriptor.getBinder( stringJavaDescriptor );
+ final ValueExtractor<String> extractor = varcharSqlDescriptor.getExtractor( stringJavaDescriptor );
+ final ValueBinder<String> binder = varcharSqlDescriptor.getBinder( stringJavaDescriptor );
final String fixture = null;
@@ -91,8 +92,8 @@
}
public void testNormalClobHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor = clobSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = clobSqlDescriptor.getBinder( stringJavaDescriptor );
+ final ValueExtractor<String> extractor = clobSqlDescriptor.getExtractor( stringJavaDescriptor );
+ final ValueBinder<String> binder = clobSqlDescriptor.getBinder( stringJavaDescriptor );
final String fixture = "clob string";
final Clob clob = new StringClobImpl( fixture );
@@ -106,8 +107,8 @@
}
public void testNullClobHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor = clobSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = clobSqlDescriptor.getBinder( stringJavaDescriptor );
+ final ValueExtractor<String> extractor = clobSqlDescriptor.getExtractor( stringJavaDescriptor );
+ final ValueBinder<String> binder = clobSqlDescriptor.getBinder( stringJavaDescriptor );
final String fixture = null;
final Clob clob = null;
14 years, 8 months
Hibernate SVN: r19343 - core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-02 10:58:38 -0400 (Sun, 02 May 2010)
New Revision: 19343
Modified:
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
rollback method testRowValueConstructorSyntaxInInList
Modified: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2010-05-02 14:36:40 UTC (rev 19342)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2010-05-02 14:58:38 UTC (rev 19343)
@@ -511,7 +511,7 @@
list.add( new Id("123456789", order.getId().getOrderNumber(), "1234") );
query.setParameterList( "idList", list );
assertEquals( 2, query.list().size() );
- s.getTransaction().commit();
+ s.getTransaction().rollback();
s.close();
}
14 years, 8 months
Hibernate SVN: r19342 - core/trunk/testsuite/src/test/java/org/hibernate/test/hql.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-02 10:36:40 -0400 (Sun, 02 May 2010)
New Revision: 19342
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
Log:
can't open jira for now, the change of this commit only changes the methond of testRowValueConstructorSyntaxInInList, instead of transaction commit, here i changed it to rollback, since this may cause other test fails (org.hibernate.NonUniqueResultException: query did not return a unique result: 3)
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2010-05-02 14:20:53 UTC (rev 19341)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java 2010-05-02 14:36:40 UTC (rev 19342)
@@ -511,7 +511,7 @@
list.add( new Id("123456789", order.getId().getOrderNumber(), "1234") );
query.setParameterList( "idList", list );
assertEquals( 2, query.list().size() );
- s.getTransaction().commit();
+ s.getTransaction().rollback();
s.close();
}
14 years, 8 months
Hibernate SVN: r19341 - in search/trunk/hibernate-search/src: test/java/org/hibernate/search/test and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-05-02 10:20:53 -0400 (Sun, 02 May 2010)
New Revision: 19341
Added:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/AsyncBackendLongWorklistsStressTest.java
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/SyncBackendLongWorklistsStressTest.java
Modified:
search/trunk/hibernate-search/src/main/java/org/hibernate/search/batchindexing/Executors.java
search/trunk/hibernate-search/src/test/resources/log4j.properties
Log:
HSEARCH-515 Lucene AlreadyClosedExceptions During Batch Processing With ASYNC Workers
Modified: search/trunk/hibernate-search/src/main/java/org/hibernate/search/batchindexing/Executors.java
===================================================================
--- search/trunk/hibernate-search/src/main/java/org/hibernate/search/batchindexing/Executors.java 2010-05-02 10:47:19 UTC (rev 19340)
+++ search/trunk/hibernate-search/src/main/java/org/hibernate/search/batchindexing/Executors.java 2010-05-02 14:20:53 UTC (rev 19341)
@@ -25,11 +25,15 @@
package org.hibernate.search.batchindexing;
import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import org.hibernate.search.util.LoggerFactory;
+import org.slf4j.Logger;
+
/**
* Helper class to create threads;
* these threads are grouped and named to be identified in a profiler.
@@ -41,6 +45,8 @@
private static final String THREAD_GROUP_PREFIX = "Hibernate Search: ";
private static final int QUEUE_MAX_LENGTH = 1000; //TODO have it configurable?
+ private static final Logger log = LoggerFactory.make();
+
/**
* Creates a new fixed size ThreadPoolExecutor.
* It's using a blockingqueue of maximum 1000 elements and the rejection
@@ -70,7 +76,7 @@
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>( queueSize ),
new SearchThreadFactory( groupname ),
- new ThreadPoolExecutor.CallerRunsPolicy() );
+ new BlockPolicy() );
}
/**
@@ -97,5 +103,32 @@
}
}
+
+ /**
+ * A handler for rejected tasks that will have the caller block until
+ * space is available.
+ */
+ public static class BlockPolicy implements RejectedExecutionHandler {
+
+ /**
+ * Creates a <tt>BlockPolicy</tt>.
+ */
+ public BlockPolicy() { }
+
+ /**
+ * Puts the Runnable to the blocking queue, effectively blocking
+ * the delegating thread until space is available.
+ * @param r the runnable task requested to be executed
+ * @param e the executor attempting to execute this task
+ */
+ public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
+ try {
+ e.getQueue().put( r );
+ }
+ catch (InterruptedException e1) {
+ log.error( "Work discarded, thread was interrupted while waiting for space to schedule: {}", r );
+ }
+ }
+ }
}
Added: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/AsyncBackendLongWorklistsStressTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/AsyncBackendLongWorklistsStressTest.java (rev 0)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/AsyncBackendLongWorklistsStressTest.java 2010-05-02 14:20:53 UTC (rev 19341)
@@ -0,0 +1,36 @@
+/* $Id$
+ *
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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.search.test.backend;
+
+import org.hibernate.search.Environment;
+
+public class AsyncBackendLongWorklistsStressTest extends SyncBackendLongWorklistsStressTest {
+
+ protected void configure(org.hibernate.cfg.Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( Environment.WORKER_EXECUTION, "async" );
+ }
+
+}
Added: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/SyncBackendLongWorklistsStressTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/SyncBackendLongWorklistsStressTest.java (rev 0)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/backend/SyncBackendLongWorklistsStressTest.java 2010-05-02 14:20:53 UTC (rev 19341)
@@ -0,0 +1,100 @@
+/* $Id$
+ *
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates 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.search.test.backend;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.apache.lucene.search.MatchAllDocsQuery;
+import org.hibernate.Transaction;
+import org.hibernate.criterion.Projections;
+import org.hibernate.search.Environment;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.Search;
+import org.hibernate.search.store.FSDirectoryProvider;
+import org.hibernate.search.test.Clock;
+import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.util.FileHelper;
+
+public class SyncBackendLongWorklistsStressTest extends SearchTestCase {
+
+ /* needs to be sensibly higher than org.hibernate.search.batchindexing.Executors.QUEUE_MAX_LENGTH */
+ private static final int NUM_SAVED_ENTITIES = 3000;
+
+ public void testWorkLongerThanMaxQueueSize() throws Exception {
+ FullTextSession s = Search.getFullTextSession( openSession() );
+ for (int i = 0; i < NUM_SAVED_ENTITIES; i++ ) {
+ Transaction tx = s.beginTransaction();
+ Clock clock = new Clock( i, "brand num° " + i);
+ s.persist( clock );
+ tx.commit();
+ s.clear();
+ }
+
+ Transaction tx = s.beginTransaction();
+ // count of entities in database needs to be checked before SF is closed (HSQLDB will forget the entities)
+ Number count = (Number) s.createCriteria( Clock.class ).setProjection( Projections.rowCount() ).uniqueResult();
+ Assert.assertEquals( NUM_SAVED_ENTITIES, count.intValue() );
+ tx.commit();
+ s.close();
+
+ //we need to close the session to wait for all async work to be flushed
+ sessions.close();
+ buildSessionFactory( getMappings(), getAnnotatedPackages(), getXmlFiles() );
+
+ s = Search.getFullTextSession( openSession() );
+ tx = s.beginTransaction();
+ int fullTextCount = s.createFullTextQuery( new MatchAllDocsQuery(), Clock.class ).getResultSize();
+ Assert.assertEquals( NUM_SAVED_ENTITIES, fullTextCount );
+ tx.commit();
+ s.close();
+ }
+
+ @Override
+ protected Class<?>[] getMappings() {
+ return new Class[] { Clock.class };
+ }
+
+ protected void configure(org.hibernate.cfg.Configuration cfg) {
+ super.configure( cfg );
+ File sub = getBaseIndexDir();
+ cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
+ //needs FSDirectory to have the index contents survive the SessionFactory close
+ cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
+ cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+ cfg.setProperty( "hibernate.show_sql", "false" );
+ cfg.setProperty( "hibernate.format_sql", "false" );
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ File sub = getBaseIndexDir();
+ FileHelper.delete( sub );
+ }
+
+}
+
Modified: search/trunk/hibernate-search/src/test/resources/log4j.properties
===================================================================
--- search/trunk/hibernate-search/src/test/resources/log4j.properties 2010-05-02 10:47:19 UTC (rev 19340)
+++ search/trunk/hibernate-search/src/test/resources/log4j.properties 2010-05-02 14:20:53 UTC (rev 19341)
@@ -2,13 +2,13 @@
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} (%t) %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} (%t) %5p %c{1}:%L - %m%n
### direct messages to socket - chainsaw ###
log4j.appender.socket=org.apache.log4j.net.SocketAppender
14 years, 8 months
Hibernate SVN: r19340 - search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/worker.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-05-02 06:47:19 -0400 (Sun, 02 May 2010)
New Revision: 19340
Modified:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/worker/WorkerTestCase.java
Log:
Have WorkerTestCase skip query logging (very verbose, makes it quite faster too)
Modified: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/worker/WorkerTestCase.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/worker/WorkerTestCase.java 2010-05-02 10:44:21 UTC (rev 19339)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/worker/WorkerTestCase.java 2010-05-02 10:47:19 UTC (rev 19340)
@@ -215,6 +215,8 @@
cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
cfg.setProperty( "hibernate.search.Clock.directory_provider", FSDirectoryProvider.class.getName() );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+ cfg.setProperty( "hibernate.show_sql", "false" );
+ cfg.setProperty( "hibernate.format_sql", "false" );
}
@SuppressWarnings("unchecked")
14 years, 8 months
Hibernate SVN: r19339 - search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/jgroups/master.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-05-02 06:44:21 -0400 (Sun, 02 May 2010)
New Revision: 19339
Modified:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/jgroups/master/JGroupsMasterTest.java
Log:
typos in JGroups test
Modified: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/jgroups/master/JGroupsMasterTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/jgroups/master/JGroupsMasterTest.java 2010-05-01 22:16:36 UTC (rev 19338)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/jgroups/master/JGroupsMasterTest.java 2010-05-02 10:44:21 UTC (rev 19339)
@@ -90,7 +90,7 @@
}
private void prepareJGroupsChannel() throws Exception {
- channel = new JChannel( prepareJGroupsCongigurationString() );
+ channel = new JChannel( prepareJGroupsConfigurationString() );
channel.connect( CHANNEL_NAME );
}
@@ -167,11 +167,11 @@
cfg.setProperty( Environment.WORKER_BACKEND, "jgroupsMaster" );
cfg.setProperty( JGroupsBackendQueueProcessorFactory.JG_CLUSTER_NAME, CHANNEL_NAME );
cfg.setProperty(
- JGroupsBackendQueueProcessorFactory.CONFIGURATION_STRING, prepareJGroupsCongigurationString()
+ JGroupsBackendQueueProcessorFactory.CONFIGURATION_STRING, prepareJGroupsConfigurationString()
);
}
- private String prepareJGroupsCongigurationString() {
+ private String prepareJGroupsConfigurationString() {
return "UDP(mcast_addr=228.1.2.3;mcast_port=45566;ip_ttl=32):" +
"PING(timeout=3000;num_initial_members=6):" +
"FD(timeout=5000):" +
14 years, 8 months
Hibernate SVN: r19338 - core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/ordering/antlr.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-01 18:16:36 -0400 (Sat, 01 May 2010)
New Revision: 19338
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java
Log:
HHH-5064 - OrderBy string getting dumped to console on session factory creation (Shawn Clowater)
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java 2010-05-01 20:43:43 UTC (rev 19337)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java 2010-05-01 22:16:36 UTC (rev 19338)
@@ -71,7 +71,7 @@
log.trace( printer.showAsString( parser.getAST(), "--- {order-by fragment} ---" ) );
}
- GeneratedOrderByFragmentRenderer renderer = new GeneratedOrderByFragmentRenderer();
+ OrderByFragmentRenderer renderer = new OrderByFragmentRenderer();
try {
renderer.orderByFragment( parser.getAST() );
}
14 years, 8 months
Hibernate SVN: r19337 - core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-01 16:43:43 -0400 (Sat, 01 May 2010)
New Revision: 19337
Modified:
core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java
Log:
HHH-5064 - OrderBy string getting dumped to console on session factory creation (Shawn Clowater)
Modified: core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java 2010-05-01 20:32:48 UTC (rev 19336)
+++ core/trunk/core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java 2010-05-01 20:43:43 UTC (rev 19337)
@@ -71,7 +71,7 @@
log.trace( printer.showAsString( parser.getAST(), "--- {order-by fragment} ---" ) );
}
- GeneratedOrderByFragmentRenderer renderer = new GeneratedOrderByFragmentRenderer();
+ OrderByFragmentRenderer renderer = new OrderByFragmentRenderer();
try {
renderer.orderByFragment( parser.getAST() );
}
14 years, 8 months
Hibernate SVN: r19336 - core/trunk/core/src/main/java/org/hibernate/type.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-01 16:32:48 -0400 (Sat, 01 May 2010)
New Revision: 19336
Modified:
core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
Log:
HHH-5138 - Redesign types + introduce TypeRegistry & TypeResolver
Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-01 18:20:26 UTC (rev 19335)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-01 20:32:48 UTC (rev 19336)
@@ -63,9 +63,12 @@
private SessionFactoryImplementor factory;
public void injectSessionFactory(SessionFactoryImplementor factory) {
- if ( factory != null ) {
- log.warn( "Scoping types to session factory7 after already scoped" );
+ if ( this.factory != null ) {
+ log.warn( "Scoping types to session factory {} after already scoped {}", this.factory, factory );
}
+ else {
+ log.trace( "Scoping types to session factory {}", factory );
+ }
this.factory = factory;
}
14 years, 8 months