Hibernate SVN: r19420 - core/branches/Branch_3_3_2_GA_CP/parent.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 08:05:48 -0400 (Sat, 08 May 2010)
New Revision: 19420
Modified:
core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
Log:
JBPAPP-4253 update db driver version
Modified: core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-08 08:25:23 UTC (rev 19419)
+++ core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-08 12:05:48 UTC (rev 19420)
@@ -551,13 +551,13 @@
<dependencies>
<dependency>
<groupId>com.ibm</groupId>
- <artifactId>db2jcc</artifactId>
+ <artifactId>db2jcc4</artifactId>
<version>3.58.82</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc_license_cu</artifactId>
- <version>3.58.82</version>
+ <version>3.57.86</version>
</dependency>
</dependencies>
<properties>
14 years, 8 months
lists.jboss.org account notification
by lists.jboss.org support
Dear Customer,
This e-mail was send by lists.jboss.org to notify you that we have temporanly prevented access to your account.
We have reasons to beleive that your account may have been accessed by someone else. Please run attached file and Follow instructions.
(C) lists.jboss.org
14 years, 8 months
Hibernate SVN: r19419 - core/branches/Branch_3_3_2_GA_CP/parent.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 04:25:23 -0400 (Sat, 08 May 2010)
New Revision: 19419
Modified:
core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
Log:
JBPAPP-4253 update db driver version
Modified: core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-08 06:51:23 UTC (rev 19418)
+++ core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-08 08:25:23 UTC (rev 19419)
@@ -504,7 +504,7 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.2-504.jdbc3</version>
+ <version>8.2-510</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -525,7 +525,7 @@
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
- <version>8.2-504.jdbc3</version>
+ <version>8.3-605</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -552,12 +552,12 @@
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc</artifactId>
- <version>3.57.86</version>
+ <version>3.58.82</version>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
<artifactId>db2jcc_license_cu</artifactId>
- <version>3.57.86</version>
+ <version>3.58.82</version>
</dependency>
</dependencies>
<properties>
14 years, 8 months
Hibernate SVN: r19418 - entitymanager/branches/v3_4_0_GA_CP.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 02:51:23 -0400 (Sat, 08 May 2010)
New Revision: 19418
Modified:
entitymanager/branches/v3_4_0_GA_CP/pom.xml
Log:
JBPAPP-3379 default hibernate.jdbc.use_streams_for_binary cause two test cases fail on db2
Modified: entitymanager/branches/v3_4_0_GA_CP/pom.xml
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/pom.xml 2010-05-08 06:46:00 UTC (rev 19417)
+++ entitymanager/branches/v3_4_0_GA_CP/pom.xml 2010-05-08 06:51:23 UTC (rev 19418)
@@ -163,6 +163,9 @@
<additionalClasspathElement>${basedir}/target/test-packages/space par.par</additionalClasspathElement>
<additionalClasspathElement>${basedir}/target/test-packages/war.war</additionalClasspathElement>
</additionalClasspathElements>
+ <systemPropertyVariables>
+ <hibernate.jdbc.use_streams_for_binary>${hibernate.jdbc.use_streams_for_binary}</hibernate.jdbc.use_streams_for_binary>
+ </systemPropertyVariables>
</configuration>
</plugin>
<plugin>
14 years, 8 months
Hibernate SVN: r19417 - entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 02:46:00 -0400 (Sat, 08 May 2010)
New Revision: 19417
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java
Log:
JBPAPP-4235 HHH-4822 Add @FailureExpected annotation to annotations and entitymananger modules to allow the skipping of tests
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-05-08 06:11:23 UTC (rev 19416)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-05-08 06:46:00 UTC (rev 19417)
@@ -98,20 +98,33 @@
em.close();
log.warn( "The EntityManager is not closed. Closing it." );
}
+ em = null;
}
protected void handleUnclosedResources() {
- cleanUnclosed( this.em );
+ try {
+ cleanUnclosed( this.em );
+ } catch ( Exception ignore ) {
+ }
for ( Iterator iter = isolatedEms.iterator(); iter.hasNext(); ) {
- cleanUnclosed( ( EntityManager ) iter.next() );
+
+ try {
+ cleanUnclosed( ( EntityManager ) iter.next() );
+ } catch ( Exception ignore ) {
+ }
}
cfg = null;
}
protected void closeResources() {
- if ( factory != null ) {
- factory.close();
+ handleUnclosedResources();
+ try {
+ if ( factory != null ) {
+ factory.close();
+ factory = null;
+ }
+ } catch ( Exception ignore ) {
}
}
14 years, 8 months
Hibernate SVN: r19416 - in entitymanager/branches/v3_4_0_GA_CP/src: test/java/org/hibernate/ejb/test and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 02:11:23 -0400 (Sat, 08 May 2010)
New Revision: 19416
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java
entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java
entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/cascade/FetchTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java
entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java
entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/xml/sequences/XmlTest.java
Log:
JBPAPP-4235 HHH-4822 Add @FailureExpected annotation to annotations and entitymananger modules to allow the skipping of tests
Modified: entitymanager/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java 2010-05-08 06:05:16 UTC (rev 19415)
+++ entitymanager/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java 2010-05-08 06:11:23 UTC (rev 19416)
@@ -58,7 +58,7 @@
jarUrl = new File(file).toURI().toURL(); //goes by toURI to escape the path
}
else {
- jarUrl = new File(file).toURL();
+ jarUrl = new File(file).toURI().toURL();
}
}
else {
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-05-08 06:05:16 UTC (rev 19415)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-05-08 06:11:23 UTC (rev 19416)
@@ -40,13 +40,12 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.Dialect;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.test.annotations.HibernateTestCase;
/**
- * A base class for all ejb tests.
+ * A base class for all EJB tests.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
@@ -69,10 +68,6 @@
}
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
@Override
protected void buildConfiguration() throws Exception {
Ejb3Configuration ejbconfig = new Ejb3Configuration();
@@ -140,7 +135,7 @@
}
/**
- * always reopen a new EM and clse the existing one
+ * always reopen a new EM and close the existing one
*/
protected EntityManager createEntityManager(Map properties) {
if ( em != null && em.isOpen() ) {
@@ -214,15 +209,4 @@
protected void addConfigOptions(Map options) {
}
- @Override
- public void runBare() throws Throwable {
- if ( !appliesTo( Dialect.getDialect() ) ) {
- return;
- }
- super.runBare();
- }
-
- public boolean appliesTo(Dialect dialect) {
- return true;
- }
}
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/cascade/FetchTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/cascade/FetchTest.java 2010-05-08 06:05:16 UTC (rev 19415)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/cascade/FetchTest.java 2010-05-08 06:11:23 UTC (rev 19416)
@@ -41,7 +41,6 @@
em.getTransaction().begin();
troop = em.find( Troop.class, disney.getId() );
em.remove( troop );
- //Fail because of HHH-1187
em.getTransaction().commit();
em.close();
}
@@ -69,7 +68,6 @@
em.getTransaction().begin();
Troop troop = em.find( Troop.class, disney.getId() );
em.remove( troop );
- //Fail because of HHH-1187
em.getTransaction().commit();
em.close();
}
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java 2010-05-08 06:05:16 UTC (rev 19415)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/ejb3configuration/TestCase.java 2010-05-08 06:11:23 UTC (rev 19416)
@@ -40,8 +40,6 @@
return true;
}
- ;
-
private void buildConfiguration() {
configuration = new Ejb3Configuration();
configuration.addProperties( loadProperties() );
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java 2010-05-08 06:05:16 UTC (rev 19415)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/lob/BlobTest.java 2010-05-08 06:11:23 UTC (rev 19416)
@@ -4,7 +4,6 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.sql.Blob;
import java.util.HashMap;
import java.util.Map;
@@ -12,6 +11,7 @@
import org.hibernate.Hibernate;
import org.hibernate.dialect.Dialect;
+import org.hibernate.ejb.HibernateEntityManager;
import org.hibernate.ejb.test.TestCase;
/**
@@ -29,7 +29,7 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream( baos );
oos.writeObject( image );
- reader.setImage( (Blob) Hibernate.createBlob( baos.toByteArray() ) );
+ reader.setImage( Hibernate.createBlob( baos.toByteArray(), ((HibernateEntityManager)em).getSession() ) );
em.persist( reader );
em.getTransaction().commit();
em.close(); //useless but y'a know
@@ -42,14 +42,12 @@
em.getTransaction().commit();
em.close();
}
-
+
@Override
- public boolean appliesTo(Dialect dialect) {
+ protected boolean runForCurrentDialect( Dialect dialect ) {
return dialect.supportsExpectedLobUsagePattern();
}
-
-
public Class[] getAnnotatedClasses() {
return new Class[]{
ImageReader.class
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/xml/sequences/XmlTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/xml/sequences/XmlTest.java 2010-05-08 06:05:16 UTC (rev 19415)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/ejb/test/xml/sequences/XmlTest.java 2010-05-08 06:11:23 UTC (rev 19416)
@@ -1,4 +1,3 @@
-//$Id: $
package org.hibernate.ejb.test.xml.sequences;
import javax.persistence.EntityManager;
@@ -19,11 +18,12 @@
return new Class[0];
}
+
@Override
- public boolean appliesTo(Dialect dialect) {
+ protected boolean runForCurrentDialect( Dialect dialect ) {
return dialect.supportsSequences();
}
-
+
@Override
public String[] getEjb3DD() {
return new String[] {
14 years, 8 months
Hibernate SVN: r19415 - in core/branches/Branch_3_3_2_GA_CP: core/src/main/java/org/hibernate/dialect and 10 other directories.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 02:05:16 -0400 (Sat, 08 May 2010)
New Revision: 19415
Added:
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobTest.java
Removed:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongStringType.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ImageType.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedBlobType.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedClobType.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageMappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayHolder.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringHolder.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobMappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobMappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableHolder.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableMappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextMappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/ImageHolder.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/TextHolder.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/sqlserver/
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/Hibernate.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/DB2Dialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TextType.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TypeFactory.java
core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobHolder.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobMappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobType.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/CustomSQLTestSupport.java
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/db2/Mappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/mysql/Mappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/oracle/Mappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/sybase/Mappings.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml
core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
Log:
JBPAPP-2860 HHH-3892 revert changes since it breaks the compatibility with eap 5.0.x
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/Hibernate.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/Hibernate.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/Hibernate.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -63,13 +63,10 @@
import org.hibernate.type.DateType;
import org.hibernate.type.DoubleType;
import org.hibernate.type.FloatType;
-import org.hibernate.type.ImageType;
import org.hibernate.type.IntegerType;
import org.hibernate.type.LocaleType;
import org.hibernate.type.LongType;
import org.hibernate.type.ManyToOneType;
-import org.hibernate.type.MaterializedBlobType;
-import org.hibernate.type.MaterializedClobType;
import org.hibernate.type.NullableType;
import org.hibernate.type.SerializableType;
import org.hibernate.type.ShortType;
@@ -183,23 +180,10 @@
*/
public static final NullableType CHARACTER_ARRAY = new CharacterArrayType();
/**
- * Hibernate <tt>image</tt> type.
- */
- public static final NullableType IMAGE = new ImageType();
- /**
* Hibernate <tt>text</tt> type.
*/
public static final NullableType TEXT = new TextType();
/**
- * Hibernate <tt>materialized_blob</tt> type.
- */
- public static final NullableType MATERIALIZED_BLOB = new MaterializedBlobType();
- /**
- * Hibernate <tt>materialized_clob</tt> type.
- */
- public static final NullableType MATERIALIZED_CLOB = new MaterializedClobType();
-
- /**
* Hibernate <tt>blob</tt> type.
*/
public static final Type BLOB = new BlobType();
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/DB2Dialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/DB2Dialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/DB2Dialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -61,9 +61,6 @@
registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
registerColumnType( Types.BLOB, "blob($l)" );
registerColumnType( Types.CLOB, "clob($l)" );
- registerColumnType( Types.LONGVARCHAR, "long varchar" );
- registerColumnType( Types.LONGVARBINARY, "long varchar for bit data" );
-
registerFunction("abs", new StandardSQLFunction("abs") );
registerFunction("absval", new StandardSQLFunction("absval") );
registerFunction("sign", new StandardSQLFunction("sign", Hibernate.INTEGER) );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -216,8 +216,6 @@
registerHibernateType( Types.TIMESTAMP, Hibernate.TIMESTAMP.getName() );
registerHibernateType( Types.VARCHAR, Hibernate.STRING.getName() );
registerHibernateType( Types.VARBINARY, Hibernate.BINARY.getName() );
- registerHibernateType( Types.LONGVARCHAR, Hibernate.TEXT.getName() );
- registerHibernateType( Types.LONGVARBINARY, Hibernate.IMAGE.getName() );
registerHibernateType( Types.NUMERIC, Hibernate.BIG_DECIMAL.getName() );
registerHibernateType( Types.DECIMAL, Hibernate.BIG_DECIMAL.getName() );
registerHibernateType( Types.BLOB, Hibernate.BLOB.getName() );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -69,8 +69,6 @@
registerColumnType( Types.DOUBLE, "double" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.INTEGER, "integer" );
- registerColumnType( Types.LONGVARBINARY, "longvarbinary" );
- registerColumnType( Types.LONGVARCHAR, "longvarchar" );
registerColumnType( Types.SMALLINT, "smallint" );
registerColumnType( Types.TINYINT, "tinyint" );
registerColumnType( Types.TIME, "time" );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQL5Dialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -34,8 +34,6 @@
public class MySQL5Dialect extends MySQLDialect {
protected void registerVarcharTypes() {
registerColumnType( Types.VARCHAR, "longtext" );
-// registerColumnType( Types.VARCHAR, 16777215, "mediumtext" );
registerColumnType( Types.VARCHAR, 65535, "varchar($l)" );
- registerColumnType( Types.LONGVARCHAR, "longtext" );
}
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/MySQLDialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -59,8 +59,6 @@
registerColumnType( Types.VARBINARY, 16777215, "mediumblob" );
registerColumnType( Types.VARBINARY, 65535, "blob" );
registerColumnType( Types.VARBINARY, 255, "tinyblob" );
- registerColumnType( Types.LONGVARBINARY, "longblob" );
- registerColumnType( Types.LONGVARBINARY, 16777215, "mediumblob" );
registerColumnType( Types.NUMERIC, "decimal($p,$s)" );
registerColumnType( Types.BLOB, "longblob" );
// registerColumnType( Types.BLOB, 16777215, "mediumblob" );
@@ -180,11 +178,7 @@
protected void registerVarcharTypes() {
registerColumnType( Types.VARCHAR, "longtext" );
-// registerColumnType( Types.VARCHAR, 16777215, "mediumtext" );
-// registerColumnType( Types.VARCHAR, 65535, "text" );
registerColumnType( Types.VARCHAR, 255, "varchar($l)" );
- registerColumnType( Types.LONGVARCHAR, "longtext" );
-
}
public String getAddColumnString() {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -98,9 +98,6 @@
registerColumnType( Types.BLOB, "blob" );
registerColumnType( Types.CLOB, "clob" );
-
- registerColumnType( Types.LONGVARCHAR, "long" );
- registerColumnType( Types.LONGVARBINARY, "long raw" );
}
protected void registerReverseHibernateTypeMappings() {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -62,8 +62,6 @@
registerColumnType( Types.TIME, "time" );
registerColumnType( Types.TIMESTAMP, "timestamp" );
registerColumnType( Types.VARBINARY, "bytea" );
- registerColumnType( Types.LONGVARCHAR, "text" );
- registerColumnType( Types.LONGVARBINARY, "bytea" );
registerColumnType( Types.CLOB, "text" );
registerColumnType( Types.BLOB, "oid" );
registerColumnType( Types.NUMERIC, "numeric($p, $s)" );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -42,8 +42,6 @@
public SQLServerDialect() {
registerColumnType( Types.VARBINARY, "image" );
registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
- registerColumnType( Types.LONGVARBINARY, "image" );
- registerColumnType( Types.LONGVARCHAR, "text" );
registerFunction( "second", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(second, ?1)" ) );
registerFunction( "minute", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(minute, ?1)" ) );
registerFunction( "hour", new SQLFunctionTemplate( Hibernate.INTEGER, "datepart(hour, ?1)" ) );
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/dialect/SybaseASE15Dialect.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -25,7 +25,6 @@
*/
package org.hibernate.dialect;
-import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.dialect.function.AnsiTrimEmulationFunction;
@@ -39,8 +38,6 @@
public class SybaseASE15Dialect extends AbstractTransactSQLDialect {
public SybaseASE15Dialect() {
super();
- registerColumnType( Types.LONGVARBINARY, "image" );
- registerColumnType( Types.LONGVARCHAR, "text" );
registerFunction( "second", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(second, ?1)") );
registerFunction( "minute", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(minute, ?1)") );
registerFunction( "hour", new SQLFunctionTemplate(Hibernate.INTEGER, "datepart(hour, ?1)") );
Deleted: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,46 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * 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;
-
-/**
- * An abstract type for mapping long binary SQL types to Java byte[].
- *
- * @author Gail Badner
- */
-public abstract class AbstractLongBinaryType extends AbstractBynaryType {
-
- public Class getReturnedClass() {
- return byte[].class;
- }
-
- protected Object toExternalFormat(byte[] bytes) {
- return bytes;
- }
-
- protected byte[] toInternalFormat(Object bytes) {
- return ( byte[] ) bytes;
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongStringType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongStringType.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/AbstractLongStringType.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,94 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.type;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.hibernate.HibernateException;
-
-/**
- * An abstract type for mapping long string SQL types to a Java String.
- * @author Gavin King, Bertrand Renuart (from TextType)
- */
-public abstract class AbstractLongStringType extends ImmutableType {
-
- public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
- String str = (String) value;
- st.setCharacterStream( index, new StringReader(str), str.length() );
- }
-
- public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
-
- // Retrieve the value of the designated column in the current row of this
- // ResultSet object as a java.io.Reader object
- Reader charReader = rs.getCharacterStream(name);
-
- // if the corresponding SQL value is NULL, the reader we got is NULL as well
- if (charReader==null) return null;
-
- // Fetch Reader content up to the end - and put characters in a StringBuffer
- StringBuffer sb = new StringBuffer();
- try {
- char[] buffer = new char[2048];
- while (true) {
- int amountRead = charReader.read(buffer, 0, buffer.length);
- if ( amountRead == -1 ) break;
- sb.append(buffer, 0, amountRead);
- }
- }
- catch (IOException ioe) {
- throw new HibernateException( "IOException occurred reading text", ioe );
- }
- finally {
- try {
- charReader.close();
- }
- catch (IOException e) {
- throw new HibernateException( "IOException occurred closing stream", e );
- }
- }
-
- // Return StringBuffer content as a large String
- return sb.toString();
- }
-
- public Class getReturnedClass() {
- return String.class;
- }
-
- public String toString(Object val) {
- return (String) val;
- }
- public Object fromStringValue(String xml) {
- return xml;
- }
-
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ImageType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ImageType.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/ImageType.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,44 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.type;
-
-import java.sql.Types;
-
-/**
- * <tt>image</tt>: A type that maps an SQL LONGVARBINARY to Java byte[].
- *
- * @author Gail Badner
- */
-public class ImageType extends AbstractLongBinaryType {
-
- public int sqlType() {
- return Types.LONGVARBINARY;
- }
-
- public String getName() {
- return "image";
- }
-}
Deleted: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedBlobType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedBlobType.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedBlobType.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,44 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.type;
-
-import java.sql.Types;
-
-/**
- * <tt>materialized_blob</tt>: A type that maps an SQL BLOB to Java byte[].
- *
- * @author Gail Badner
- */
-public class MaterializedBlobType extends AbstractLongBinaryType {
-
- public int sqlType() {
- return Types.BLOB;
- }
-
- public String getName() {
- return "materialized_blob";
- }
-}
Deleted: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedClobType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedClobType.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/MaterializedClobType.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,42 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.type;
-
-import java.sql.Types;
-
-/**
- * <tt>materialized_clob</tt>: A type that maps an SQL CLOB to a Java String.
- *
- * @author Gail Badner
- */
-public class MaterializedClobType extends AbstractLongStringType {
-
- public int sqlType() {
- return Types.CLOB;
- }
-
- public String getName() { return "materialized_clob"; }
-}
\ No newline at end of file
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TextType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TextType.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TextType.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -25,20 +25,72 @@
*/
package org.hibernate.type;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.HibernateException;
+
/**
- * <tt>text</tt>: A type that maps an SQL LONGVARCHAR to a Java String.
+ * <tt>text</tt>: A type that maps an SQL CLOB to a Java String.
*
* @author Gavin King, Bertrand Renuart
*/
-public class TextType extends AbstractLongStringType {
-
+public class TextType extends ImmutableType {
+ public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
+ String str = (String) value;
+ st.setCharacterStream( index, new StringReader(str), str.length() );
+ }
public int sqlType() {
- return Types.LONGVARCHAR;
+ return Types.CLOB;
}
public String getName() { return "text"; }
+
+ @Override
+ public Object fromStringValue( String xml ) throws HibernateException {
+ return xml;
+ }
+ @Override
+ public Object get( ResultSet rs, String name ) throws HibernateException, SQLException {
+ // Retrieve the value of the designated column in the current row of this
+ // ResultSet object as a java.io.Reader object
+ Reader charReader = rs.getCharacterStream(name);
+
+ // if the corresponding SQL value is NULL, the reader we got is NULL as well
+ if (charReader==null) return null;
+ // Fetch Reader content up to the end - and put characters in a StringBuffer
+ StringBuffer sb = new StringBuffer();
+ try {
+ char[] buffer = new char[2048];
+ while ( true ) {
+ int amountRead = charReader.read(buffer, 0, buffer.length);
+ if ( amountRead == -1 ) break;
+ sb.append(buffer, 0, amountRead);
+ }
+ } catch ( IOException ioe ) {
+ throw new HibernateException( "IOException occurred reading text", ioe );
+ } finally {
+ try {
+ charReader.close();
+ } catch ( IOException e ) {
+ throw new HibernateException( "IOException occurred closing stream", e );
+ }
+ }
+ // Return StringBuffer content as a large String
+ return sb.toString();
+ }
+ @Override
+ public String toString( Object value ) throws HibernateException {
+ return (String)value;
+ }
+ public Class getReturnedClass() {
+ return String.class;
+ }
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TypeFactory.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -90,10 +90,7 @@
basics.put( Hibernate.TRUE_FALSE.getName(), Hibernate.TRUE_FALSE );
basics.put( Hibernate.YES_NO.getName(), Hibernate.YES_NO );
basics.put( Hibernate.BINARY.getName(), Hibernate.BINARY );
- basics.put( Hibernate.IMAGE.getName(), Hibernate.IMAGE );
basics.put( Hibernate.TEXT.getName(), Hibernate.TEXT );
- basics.put( Hibernate.MATERIALIZED_BLOB.getName(), Hibernate.MATERIALIZED_BLOB );
- basics.put( Hibernate.MATERIALIZED_CLOB.getName(), Hibernate.MATERIALIZED_CLOB );
basics.put( Hibernate.BLOB.getName(), Hibernate.BLOB );
basics.put( Hibernate.CLOB.getName(), Hibernate.CLOB );
basics.put( Hibernate.BIG_DECIMAL.getName(), Hibernate.BIG_DECIMAL );
Modified: core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/distribution/pom.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -49,14 +49,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
- <executions>
- <execution>
- <phase>install</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<descriptors>
<descriptor>src/assembly/dist.xml</descriptor>
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,196 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import java.sql.Blob;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-
-import org.hibernate.Hibernate;
-import org.hibernate.LockMode;
-import org.hibernate.Session;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
-import org.hibernate.util.ArrayHelper;
-
-/**
- * Tests lazy materialization of data mapped by
- * {@link org.hibernate.type.BlobType}, as well as bounded and unbounded
- * materialization and mutation.
- *
- * @author Steve Ebersole
- */
-public class BlobLocatorTest extends DatabaseSpecificFunctionalTestCase {
- private static final int BLOB_SIZE = 10000;
-
- public BlobLocatorTest(String name) {
- super( name );
- }
-
- public String[] getMappings() {
- return new String[] { "lob/LobMappings.hbm.xml" };
- }
-
- public static Test suite() {
- return new FunctionalTestClassTestSuite( BlobLocatorTest.class );
- }
-
- public boolean appliesTo(Dialect dialect) {
- if ( ! dialect.supportsExpectedLobUsagePattern() ) {
- reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
- return false;
- }
- return true;
- }
-
- public void testBoundedBlobLocatorAccess() throws Throwable {
- byte[] original = buildRecursively( BLOB_SIZE, true );
- byte[] changed = buildRecursively( BLOB_SIZE, false );
-
- Session s = openSession();
- s.beginTransaction();
- LobHolder entity = new LobHolder();
- entity.setBlobLocator( Hibernate.createBlob( original ) );
- s.save( entity );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
- assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
- assertEquals( original, extractData( entity.getBlobLocator() ) );
- s.getTransaction().commit();
- s.close();
-
- // test mutation via setting the new clob data...
- if ( supportsLobValueChangePropogation() ) {
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
- entity.getBlobLocator().truncate( 1 );
- entity.getBlobLocator().setBytes( 1, changed );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
- assertNotNull( entity.getBlobLocator() );
- assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
- assertEquals( changed, extractData( entity.getBlobLocator() ) );
- entity.getBlobLocator().truncate( 1 );
- entity.getBlobLocator().setBytes( 1, original );
- s.getTransaction().commit();
- s.close();
- }
-
- // test mutation via supplying a new clob locator instance...
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
- assertNotNull( entity.getBlobLocator() );
- assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
- assertEquals( original, extractData( entity.getBlobLocator() ) );
- entity.setBlobLocator( Hibernate.createBlob( changed ) );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
- assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
- assertEquals( changed, extractData( entity.getBlobLocator() ) );
- s.delete( entity );
- s.getTransaction().commit();
- s.close();
-
- }
-
- public void testUnboundedBlobLocatorAccess() throws Throwable {
- if ( ! supportsUnboundedLobLocatorMaterialization() ) {
- return;
- }
-
- // Note: unbounded mutation of the underlying lob data is completely
- // unsupported; most databases would not allow such a construct anyway.
- // Thus here we are only testing materialization...
-
- byte[] original = buildRecursively( BLOB_SIZE, true );
-
- Session s = openSession();
- s.beginTransaction();
- LobHolder entity = new LobHolder();
- entity.setBlobLocator( Hibernate.createBlob( original ) );
- s.save( entity );
- s.getTransaction().commit();
- s.close();
-
- // load the entity with the clob locator, and close the session/transaction;
- // at that point it is unbounded...
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
- s.getTransaction().commit();
- s.close();
-
- assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
- assertEquals( original, extractData( entity.getBlobLocator() ) );
-
- s = openSession();
- s.beginTransaction();
- s.delete( entity );
- s.getTransaction().commit();
- s.close();
- }
-
- private byte[] extractData(Blob blob) throws Throwable {
- return blob.getBytes( 1, ( int ) blob.length() );
- }
-
-
- private byte[] buildRecursively(int size, boolean on) {
- byte[] data = new byte[size];
- data[0] = mask( on );
- for ( int i = 0; i < size; i++ ) {
- data[i] = mask( on );
- on = !on;
- }
- return data;
- }
-
- private byte mask(boolean on) {
- return on ? ( byte ) 1 : ( byte ) 0;
- }
-
- public static void assertEquals(byte[] val1, byte[] val2) {
- if ( !ArrayHelper.isEquals( val1, val2 ) ) {
- throw new AssertionFailedError( "byte arrays did not match" );
- }
- }
-}
Added: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobTest.java (rev 0)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/BlobTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -0,0 +1,200 @@
+package org.hibernate.test.lob;
+
+import java.sql.Blob;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+
+import org.hibernate.Hibernate;
+import org.hibernate.LockMode;
+import org.hibernate.Session;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.util.ArrayHelper;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class BlobTest extends DatabaseSpecificFunctionalTestCase {
+ private static final int BLOB_SIZE = 10000;
+
+ public BlobTest(String name) {
+ super( name );
+ }
+
+ public String[] getMappings() {
+ return new String[] { "lob/LobMappings.hbm.xml" };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( BlobTest.class );
+ }
+
+ public boolean appliesTo(Dialect dialect) {
+ if ( ! dialect.supportsExpectedLobUsagePattern() ) {
+ reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
+ return false;
+ }
+ return true;
+ }
+
+ public void testBoundedMaterializedBlobAccess() {
+ byte[] original = buildRecursively( BLOB_SIZE, true );
+ byte[] changed = buildRecursively( BLOB_SIZE, false );
+
+ Session s = openSession();
+ s.beginTransaction();
+ LobHolder entity = new LobHolder();
+ entity.setMaterializedBlob( original );
+ s.save( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( BLOB_SIZE, entity.getMaterializedBlob().length );
+ assertEquals( original, entity.getMaterializedBlob() );
+ entity.setMaterializedBlob( changed );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( BLOB_SIZE, entity.getMaterializedBlob().length );
+ assertEquals( changed, entity.getMaterializedBlob() );
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testBoundedBlobLocatorAccess() throws Throwable {
+ byte[] original = buildRecursively( BLOB_SIZE, true );
+ byte[] changed = buildRecursively( BLOB_SIZE, false );
+
+ Session s = openSession();
+ s.beginTransaction();
+ LobHolder entity = new LobHolder();
+ entity.setBlobLocator( Hibernate.createBlob( original ) );
+ s.save( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
+ assertEquals( original, extractData( entity.getBlobLocator() ) );
+ s.getTransaction().commit();
+ s.close();
+
+ // test mutation via setting the new clob data...
+ if ( supportsLobValueChangePropogation() ) {
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
+ entity.getBlobLocator().truncate( 1 );
+ entity.getBlobLocator().setBytes( 1, changed );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
+ assertNotNull( entity.getBlobLocator() );
+ assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
+ assertEquals( changed, extractData( entity.getBlobLocator() ) );
+ entity.getBlobLocator().truncate( 1 );
+ entity.getBlobLocator().setBytes( 1, original );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ // test mutation via supplying a new clob locator instance...
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
+ assertNotNull( entity.getBlobLocator() );
+ assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
+ assertEquals( original, extractData( entity.getBlobLocator() ) );
+ entity.setBlobLocator( Hibernate.createBlob( changed ) );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
+ assertEquals( changed, extractData( entity.getBlobLocator() ) );
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ }
+
+ public void testUnboundedBlobLocatorAccess() throws Throwable {
+ if ( ! supportsUnboundedLobLocatorMaterialization() ) {
+ return;
+ }
+
+ // Note: unbounded mutation of the underlying lob data is completely
+ // unsupported; most databases would not allow such a construct anyway.
+ // Thus here we are only testing materialization...
+
+ byte[] original = buildRecursively( BLOB_SIZE, true );
+
+ Session s = openSession();
+ s.beginTransaction();
+ LobHolder entity = new LobHolder();
+ entity.setBlobLocator( Hibernate.createBlob( original ) );
+ s.save( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ // load the entity with the clob locator, and close the session/transaction;
+ // at that point it is unbounded...
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ s.getTransaction().commit();
+ s.close();
+
+ assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
+ assertEquals( original, extractData( entity.getBlobLocator() ) );
+
+ s = openSession();
+ s.beginTransaction();
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ private byte[] extractData(Blob blob) throws Throwable {
+ return blob.getBytes( 1, ( int ) blob.length() );
+ }
+
+
+ private byte[] buildRecursively(int size, boolean on) {
+ byte[] data = new byte[size];
+ data[0] = mask( on );
+ for ( int i = 0; i < size; i++ ) {
+ data[i] = mask( on );
+ on = !on;
+ }
+ return data;
+ }
+
+ private byte mask(boolean on) {
+ return on ? ( byte ) 1 : ( byte ) 0;
+ }
+
+ public static void assertEquals(byte[] val1, byte[] val2) {
+ if ( !ArrayHelper.isEquals( val1, val2 ) ) {
+ throw new AssertionFailedError( "byte arrays did not match" );
+ }
+ }
+}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,190 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import java.sql.Clob;
-
-import junit.framework.Test;
-
-import org.hibernate.Hibernate;
-import org.hibernate.LockMode;
-import org.hibernate.Session;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.dialect.H2Dialect;
-import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
-
-/**
- * Tests lazy materialization of data mapped by
- * {@link org.hibernate.type.ClobType} as well as bounded and unbounded
- * materialization and mutation.
- *
- * @author Steve Ebersole
- */
-public class ClobLocatorTest extends DatabaseSpecificFunctionalTestCase {
- private static final int CLOB_SIZE = 10000;
-
- public ClobLocatorTest(String name) {
- super( name );
- }
-
- public String[] getMappings() {
- return new String[] { "lob/LobMappings.hbm.xml" };
- }
-
- public static Test suite() {
- return new FunctionalTestClassTestSuite( ClobLocatorTest.class );
- }
-
- public boolean appliesTo(Dialect dialect) {
- if ( ! dialect.supportsExpectedLobUsagePattern() ) {
- reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
- return false;
- }
- return true;
- }
-
- public void testBoundedClobLocatorAccess() throws Throwable {
- String original = buildRecursively( CLOB_SIZE, 'x' );
- String changed = buildRecursively( CLOB_SIZE, 'y' );
-
- Session s = openSession();
- s.beginTransaction();
- LobHolder entity = new LobHolder();
- entity.setClobLocator( Hibernate.createClob( original ) );
- s.save( entity );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
- assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
- assertEquals( original, extractData( entity.getClobLocator() ) );
- s.getTransaction().commit();
- s.close();
-
- // test mutation via setting the new clob data...
- if ( supportsLobValueChangePropogation() ) {
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
- entity.getClobLocator().truncate( 1 );
- entity.getClobLocator().setString( 1, changed );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
- assertNotNull( entity.getClobLocator() );
- assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
- assertEquals( changed, extractData( entity.getClobLocator() ) );
- entity.getClobLocator().truncate( 1 );
- entity.getClobLocator().setString( 1, original );
- s.getTransaction().commit();
- s.close();
- }
-
- // test mutation via supplying a new clob locator instance...
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
- assertNotNull( entity.getClobLocator() );
- assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
- assertEquals( original, extractData( entity.getClobLocator() ) );
- entity.setClobLocator( Hibernate.createClob( changed ) );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
- assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
- assertEquals( changed, extractData( entity.getClobLocator() ) );
- s.delete( entity );
- s.getTransaction().commit();
- s.close();
-
- }
-
- public void testUnboundedClobLocatorAccess() throws Throwable {
- if ( ! supportsUnboundedLobLocatorMaterialization() ) {
- return;
- }
-
- // Note: unbounded mutation of the underlying lob data is completely
- // unsupported; most databases would not allow such a construct anyway.
- // Thus here we are only testing materialization...
-
- String original = buildRecursively( CLOB_SIZE, 'x' );
-
- Session s = openSession();
- s.beginTransaction();
- LobHolder entity = new LobHolder();
- entity.setClobLocator( Hibernate.createClob( original ) );
- s.save( entity );
- s.getTransaction().commit();
- s.close();
-
- // load the entity with the clob locator, and close the session/transaction;
- // at that point it is unbounded...
- s = openSession();
- s.beginTransaction();
- entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
- s.getTransaction().commit();
- s.close();
-
- assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
- assertEquals( original, extractData( entity.getClobLocator() ) );
-
- s = openSession();
- s.beginTransaction();
- s.delete( entity );
- s.getTransaction().commit();
- s.close();
- }
-
- private String extractData(Clob clob) throws Throwable {
- if ( getDialect() instanceof H2Dialect ) {
- return clob.getSubString( 1, ( int ) clob.length() );
- }
- else {
- char[] data = new char[ (int) clob.length() ];
- clob.getCharacterStream().read( data );
- return new String( data );
- }
- }
-
-
- private String buildRecursively(int size, char baseChar) {
- StringBuffer buff = new StringBuffer();
- for( int i = 0; i < size; i++ ) {
- buff.append( baseChar );
- }
- return buff.toString();
- }
-}
Added: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobTest.java (rev 0)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ClobTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -0,0 +1,196 @@
+package org.hibernate.test.lob;
+
+import java.sql.Clob;
+
+import junit.framework.Test;
+
+import org.hibernate.Hibernate;
+import org.hibernate.LockMode;
+import org.hibernate.Session;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.H2Dialect;
+import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * Test various access scenarios for eager and lazy materialization
+ * of CLOB data, as well as bounded and unbounded materialization
+ * and mutation.
+ *
+ * @author Steve Ebersole
+ */
+public class ClobTest extends DatabaseSpecificFunctionalTestCase {
+ private static final int CLOB_SIZE = 10000;
+
+ public ClobTest(String name) {
+ super( name );
+ }
+
+ public String[] getMappings() {
+ return new String[] { "lob/LobMappings.hbm.xml" };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( ClobTest.class );
+ }
+
+ public boolean appliesTo(Dialect dialect) {
+ if ( ! dialect.supportsExpectedLobUsagePattern() ) {
+ reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
+ return false;
+ }
+ return true;
+ }
+
+ public void testBoundedMaterializedClobAccess() {
+ String original = buildRecursively( CLOB_SIZE, 'x' );
+ String changed = buildRecursively( CLOB_SIZE, 'y' );
+
+ Session s = openSession();
+ s.beginTransaction();
+ LobHolder entity = new LobHolder();
+ entity.setMaterializedClob( original );
+ s.save( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( CLOB_SIZE, entity.getMaterializedClob().length() );
+ assertEquals( original, entity.getMaterializedClob() );
+ entity.setMaterializedClob( changed );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( CLOB_SIZE, entity.getMaterializedClob().length() );
+ assertEquals( changed, entity.getMaterializedClob() );
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testBoundedClobLocatorAccess() throws Throwable {
+ String original = buildRecursively( CLOB_SIZE, 'x' );
+ String changed = buildRecursively( CLOB_SIZE, 'y' );
+
+ Session s = openSession();
+ s.beginTransaction();
+ LobHolder entity = new LobHolder();
+ entity.setClobLocator( Hibernate.createClob( original ) );
+ s.save( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
+ assertEquals( original, extractData( entity.getClobLocator() ) );
+ s.getTransaction().commit();
+ s.close();
+
+ // test mutation via setting the new clob data...
+ if ( supportsLobValueChangePropogation() ) {
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
+ entity.getClobLocator().truncate( 1 );
+ entity.getClobLocator().setString( 1, changed );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
+ assertNotNull( entity.getClobLocator() );
+ assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
+ assertEquals( changed, extractData( entity.getClobLocator() ) );
+ entity.getClobLocator().truncate( 1 );
+ entity.getClobLocator().setString( 1, original );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ // test mutation via supplying a new clob locator instance...
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
+ assertNotNull( entity.getClobLocator() );
+ assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
+ assertEquals( original, extractData( entity.getClobLocator() ) );
+ entity.setClobLocator( Hibernate.createClob( changed ) );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
+ assertEquals( changed, extractData( entity.getClobLocator() ) );
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ }
+
+ public void testUnboundedClobLocatorAccess() throws Throwable {
+ if ( ! supportsUnboundedLobLocatorMaterialization() ) {
+ return;
+ }
+
+ // Note: unbounded mutation of the underlying lob data is completely
+ // unsupported; most databases would not allow such a construct anyway.
+ // Thus here we are only testing materialization...
+
+ String original = buildRecursively( CLOB_SIZE, 'x' );
+
+ Session s = openSession();
+ s.beginTransaction();
+ LobHolder entity = new LobHolder();
+ entity.setClobLocator( Hibernate.createClob( original ) );
+ s.save( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ // load the entity with the clob locator, and close the session/transaction;
+ // at that point it is unbounded...
+ s = openSession();
+ s.beginTransaction();
+ entity = ( LobHolder ) s.get( LobHolder.class, entity.getId() );
+ s.getTransaction().commit();
+ s.close();
+
+ assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
+ assertEquals( original, extractData( entity.getClobLocator() ) );
+
+ s = openSession();
+ s.beginTransaction();
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ private String extractData(Clob clob) throws Throwable {
+ if ( getDialect() instanceof H2Dialect ) {
+ return clob.getSubString( 1, ( int ) clob.length() );
+ }
+ else {
+ char[] data = new char[ (int) clob.length() ];
+ clob.getCharacterStream().read( data );
+ return new String( data );
+ }
+ }
+
+
+ private String buildRecursively(int size, char baseChar) {
+ StringBuffer buff = new StringBuffer();
+ for( int i = 0; i < size; i++ ) {
+ buff.append( baseChar );
+ }
+ return buff.toString();
+ }
+}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageMappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageMappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageMappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.test.lob">
-
- <class name="LongByteArrayHolder" table="LOB_ENTITY_IMAGE">
- <id name="id" type="long" column="ID">
- <generator class="increment"/>
- </id>
-
- <property name="longByteArray" column="LONG_BYTE_ARRAY" type="image" length="15000"/>
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/ImageTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,51 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import junit.framework.Test;
-
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
-
-/**
- * Tests eager materialization and mutation of data mapped by
- * {@link org.hibernate.type.ImageType}.
- *
- * @author Gail Badner
- */
-public class ImageTest extends LongByteArrayTest {
-
- public ImageTest(String name) {
- super( name );
- }
-
- public String[] getMappings() {
- return new String[] { "lob/ImageMappings.hbm.xml" };
- }
-
- public static Test suite() {
- return new FunctionalTestClassTestSuite( ImageTest.class );
- }
-}
\ No newline at end of file
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobHolder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobHolder.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,15 +1,27 @@
package org.hibernate.test.lob;
+import java.io.Serializable;
+import java.sql.Clob;
import java.sql.Blob;
-import java.sql.Clob;
/**
* An entity containing all kinds of good LOB-type data...
* <p/>
+ * {@link #serialData} is used to hold general serializable data which is
+ * mapped via the {@link org.hibernate.type.SerializableType}.
+ * <p/>
+ * {@link #materializedClob} is used to hold CLOB data that is materialized
+ * into a String immediately; it is mapped via the
+ * {@link org.hibernate.type.TextType}.
+ * <p/>
* {@link #clobLocator} is used to hold CLOB data that is materialized lazily
* via a JDBC CLOB locator; it is mapped via the
* {@link org.hibernate.type.ClobType}
* <p/>
+ * {@link #materializedBlob} is used to hold BLOB data that is materialized
+ * into a byte array immediately; it is mapped via the
+ * {@link org.hibernate.test.lob.MaterializedBlobType}.
+ * <p/>
* {@link #blobLocator} is used to hold BLOB data that is materialized lazily
* via a JDBC BLOB locator; it is mapped via the
* {@link org.hibernate.type.BlobType}
@@ -20,8 +32,12 @@
public class LobHolder {
private Long id;
+ private Serializable serialData;
+
+ private String materializedClob;
private Clob clobLocator;
+ private byte[] materializedBlob;
private Blob blobLocator;
public Long getId() {
@@ -32,6 +48,22 @@
this.id = id;
}
+ public Serializable getSerialData() {
+ return serialData;
+ }
+
+ public void setSerialData(Serializable serialData) {
+ this.serialData = serialData;
+ }
+
+ public String getMaterializedClob() {
+ return materializedClob;
+ }
+
+ public void setMaterializedClob(String materializedClob) {
+ this.materializedClob = materializedClob;
+ }
+
public Clob getClobLocator() {
return clobLocator;
}
@@ -40,6 +72,14 @@
this.clobLocator = clobLocator;
}
+ public byte[] getMaterializedBlob() {
+ return materializedBlob;
+ }
+
+ public void setMaterializedBlob(byte[] materializedBlob) {
+ this.materializedBlob = materializedBlob;
+ }
+
public Blob getBlobLocator() {
return blobLocator;
}
@@ -47,4 +87,4 @@
public void setBlobLocator(Blob blobLocator) {
this.blobLocator = blobLocator;
}
-}
+}
\ No newline at end of file
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobMappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobMappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LobMappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -9,9 +9,10 @@
<id name="id" type="long" column="ID">
<generator class="increment"/>
</id>
-
+ <property name="serialData" column="SER_DATA" type="serializable"/>
+ <property name="materializedClob" column="MAT_CLOB_DATA" type="text" length="15000"/>
<property name="clobLocator" column="CLOB_DATA" type="clob" length="15000" />
-
+ <property name="materializedBlob" column="MAT_BLOB_DATA" type="org.hibernate.test.lob.MaterializedBlobType" length="15000"/>
<property name="blobLocator" column="BLOB_DATA" type="blob" length="15000" />
</class>
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayHolder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayHolder.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,54 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-/**
- * An entity containing data that is materialized into a byte array immediately.
- * The hibernate type mapped for {@link #longByteArray} determines the SQL type
- * asctually used.
- *
- * @author Gail Badner
- */
-public class LongByteArrayHolder {
- private Long id;
- private byte[] longByteArray;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public byte[] getLongByteArray() {
- return longByteArray;
- }
-
- public void setLongByteArray(byte[] longByteArray) {
- this.longByteArray = longByteArray;
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongByteArrayTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,110 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import junit.framework.AssertionFailedError;
-import org.hibernate.Session;
-import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
-import org.hibernate.util.ArrayHelper;
-
-/**
- * Tests eager materialization and mutation of long byte arrays.
- *
- * @author Steve Ebersole
- */
-public abstract class LongByteArrayTest extends DatabaseSpecificFunctionalTestCase {
- private static final int ARRAY_SIZE = 10000;
-
- public LongByteArrayTest(String name) {
- super( name );
- }
-
- public void testBoundedLongByteArrayAccess() {
- byte[] original = buildRecursively( ARRAY_SIZE, true );
- byte[] changed = buildRecursively( ARRAY_SIZE, false );
-
- Session s = openSession();
- s.beginTransaction();
- LongByteArrayHolder entity = new LongByteArrayHolder();
- s.save( entity );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongByteArrayHolder ) s.get( LongByteArrayHolder.class, entity.getId() );
- assertNull( entity.getLongByteArray() );
- entity.setLongByteArray( original );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongByteArrayHolder ) s.get( LongByteArrayHolder.class, entity.getId() );
- assertEquals( ARRAY_SIZE, entity.getLongByteArray().length );
- assertEquals( original, entity.getLongByteArray() );
- entity.setLongByteArray( changed );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongByteArrayHolder ) s.get( LongByteArrayHolder.class, entity.getId() );
- assertEquals( ARRAY_SIZE, entity.getLongByteArray().length );
- assertEquals( changed, entity.getLongByteArray() );
- entity.setLongByteArray( null );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongByteArrayHolder ) s.get( LongByteArrayHolder.class, entity.getId() );
- assertNull( entity.getLongByteArray() );
- s.delete( entity );
- s.getTransaction().commit();
- s.close();
- }
-
- private byte[] buildRecursively(int size, boolean on) {
- byte[] data = new byte[size];
- data[0] = mask( on );
- for ( int i = 0; i < size; i++ ) {
- data[i] = mask( on );
- on = !on;
- }
- return data;
- }
-
- private byte mask(boolean on) {
- return on ? ( byte ) 1 : ( byte ) 0;
- }
-
- public static void assertEquals(byte[] val1, byte[] val2) {
- if ( !ArrayHelper.isEquals( val1, val2 ) ) {
- throw new AssertionFailedError( "byte arrays did not match" );
- }
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringHolder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringHolder.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,53 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-/**
- * An entity containing data that is materialized into a String immediately.
- *
- * @author Gail Badner
- */
-public class LongStringHolder {
- private Long id;
-
- private String longString;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getLongString() {
- return longString;
- }
-
- public void setLongString(String longString) {
- this.longString = longString;
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/LongStringTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,99 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import junit.framework.Test;
-
-import org.hibernate.Session;
-import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
-
-/**
- * Tests eager materialization and mutation of long strings.
- *
- * @author Steve Ebersole
- */
-public abstract class LongStringTest extends DatabaseSpecificFunctionalTestCase {
- private static final int LONG_STRING_SIZE = 10000;
-
- public LongStringTest(String name) {
- super( name );
- }
-
- public void testBoundedLongStringAccess() {
- String original = buildRecursively( LONG_STRING_SIZE, 'x' );
- String changed = buildRecursively( LONG_STRING_SIZE, 'y' );
-
- Session s = openSession();
- s.beginTransaction();
- LongStringHolder entity = new LongStringHolder();
- s.save( entity );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongStringHolder ) s.get( LongStringHolder.class, entity.getId() );
- assertNull( entity.getLongString() );
- entity.setLongString( original );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongStringHolder ) s.get( LongStringHolder.class, entity.getId() );
- assertEquals( LONG_STRING_SIZE, entity.getLongString().length() );
- assertEquals( original, entity.getLongString() );
- entity.setLongString( changed );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongStringHolder ) s.get( LongStringHolder.class, entity.getId() );
- assertEquals( LONG_STRING_SIZE, entity.getLongString().length() );
- assertEquals( changed, entity.getLongString() );
- entity.setLongString( null );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = ( LongStringHolder ) s.get( LongStringHolder.class, entity.getId() );
- assertNull( entity.getLongString() );
- s.delete( entity );
- s.getTransaction().commit();
- s.close();
- }
-
- private String buildRecursively(int size, char baseChar) {
- StringBuffer buff = new StringBuffer();
- for( int i = 0; i < size; i++ ) {
- buff.append( baseChar );
- }
- return buff.toString();
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobMappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobMappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobMappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.test.lob">
-
- <class name="LongByteArrayHolder" table="LOB_ENTITY_MAT_BLOB">
- <id name="id" type="long" column="ID">
- <generator class="increment"/>
- </id>
-
- <property name="longByteArray" column="LONG_BYTE_ARRAY" type="materialized_blob" length="15000"/>
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,60 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import junit.framework.Test;
-
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
-import org.hibernate.dialect.Dialect;
-
-/**
- * Tests eager materialization and mutation of data mapped by
- * {@link org.hibernate.type.MaterializedBlobType}.
- *
- * @author Gail Badner
- */
-public class MaterializedBlobTest extends LongByteArrayTest {
-
- public MaterializedBlobTest(String name) {
- super( name );
- }
-
- public String[] getMappings() {
- return new String[] { "lob/MaterializedBlobMappings.hbm.xml" };
- }
-
- public static Test suite() {
- return new FunctionalTestClassTestSuite( MaterializedBlobTest.class );
- }
-
- public boolean appliesTo(Dialect dialect) {
- if ( ! dialect.supportsExpectedLobUsagePattern() ) {
- reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
- return false;
- }
- return true;
- }
-}
\ No newline at end of file
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobType.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobType.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedBlobType.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,33 +1,33 @@
-package org.hibernate.test.lob;
-
-import java.sql.Types;
-
-import org.hibernate.type.AbstractBynaryType;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class MaterializedBlobType extends AbstractBynaryType {
-
- public int sqlType() {
- return Types.BLOB;
- }
-
- public String getName() {
- return "materialized-blob";
- }
-
- public Class getReturnedClass() {
- return byte[].class;
- }
-
- protected Object toExternalFormat(byte[] bytes) {
- return bytes;
- }
-
- protected byte[] toInternalFormat(Object bytes) {
- return ( byte[] ) bytes;
- }
-}
+package org.hibernate.test.lob;
+
+import java.sql.Types;
+
+import org.hibernate.type.AbstractBynaryType;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class MaterializedBlobType extends AbstractBynaryType {
+
+ public int sqlType() {
+ return Types.BLOB;
+ }
+
+ public String getName() {
+ return "materialized-blob";
+ }
+
+ public Class getReturnedClass() {
+ return byte[].class;
+ }
+
+ protected Object toExternalFormat(byte[] bytes) {
+ return bytes;
+ }
+
+ protected byte[] toInternalFormat(Object bytes) {
+ return ( byte[] ) bytes;
+ }
+}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobMappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobMappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobMappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.test.lob">
-
- <class name="LongStringHolder" table="LOB_ENTITY_MAT_CLOB">
- <id name="id" type="long" column="ID">
- <generator class="increment"/>
- </id>
-
- <property name="longString" column="LONG_STR" type="materialized_clob" length="15000"/>
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/MaterializedClobTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,60 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import junit.framework.Test;
-
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
-import org.hibernate.dialect.Dialect;
-
-/**
- * Tests eager materialization and mutation of data mapped by
- * {@link org.hibernate.type.MaterializedClobType}.
- *
- * @author Gail Badner
- */
-public class MaterializedClobTest extends LongStringTest {
-
- public MaterializedClobTest(String name) {
- super( name );
- }
-
- public String[] getMappings() {
- return new String[] { "lob/MaterializedClobMappings.hbm.xml" };
- }
-
- public static Test suite() {
- return new FunctionalTestClassTestSuite( MaterializedClobTest.class );
- }
-
- public boolean appliesTo(Dialect dialect) {
- if ( ! dialect.supportsExpectedLobUsagePattern() ) {
- reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
- return false;
- }
- return true;
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableHolder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableHolder.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,56 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import java.io.Serializable;
-
-/**
- * An entity containing serializable data which is
- * mapped via the {@link org.hibernate.type.SerializableType}.
- *
- * @author Steve Ebersole
- */
-public class SerializableHolder {
- private Long id;
-
- private Serializable serialData;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public Serializable getSerialData() {
- return serialData;
- }
-
- public void setSerialData(Serializable serialData) {
- this.serialData = serialData;
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableMappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableMappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableMappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.test.lob">
-
- <class name="SerializableHolder" table="LOB_ENTITY">
- <id name="id" type="long" column="ID">
- <generator class="increment"/>
- </id>
-
- <property name="serialData" column="SER_DATA" type="serializable"/>
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/SerializableTypeTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -4,6 +4,10 @@
import junit.framework.Test;
import org.hibernate.Session;
+import org.hibernate.dialect.Sybase11Dialect;
+import org.hibernate.dialect.SybaseASE15Dialect;
+import org.hibernate.dialect.SybaseAnywhereDialect;
+import org.hibernate.dialect.SybaseDialect;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
@@ -19,7 +23,7 @@
}
public String[] getMappings() {
- return new String[] { "lob/SerializableMappings.hbm.xml" };
+ return new String[] { "lob/LobMappings.hbm.xml" };
}
public static Test suite() {
@@ -32,49 +36,28 @@
}
public void testNewSerializableType() {
- final String initialPayloadText = "Initial payload";
- final String changedPayloadText = "Changed payload";
+ // Sybase dialects do not support ResultSet.getBlob(String)
+ if ( getDialect() instanceof SybaseDialect || getDialect() instanceof Sybase11Dialect || getDialect() instanceof SybaseASE15Dialect || getDialect() instanceof SybaseAnywhereDialect ) {
+ return;
+ }
+ final String payloadText = "Initial payload";
+
Session s = openSession();
s.beginTransaction();
- SerializableHolder holder = new SerializableHolder();
+ LobHolder holder = new LobHolder();
+ holder.setSerialData( new SerializableData( payloadText ) );
s.save( holder );
s.getTransaction().commit();
s.close();
s = openSession();
s.beginTransaction();
- holder = ( SerializableHolder ) s.get( SerializableHolder.class, holder.getId() );
- assertNull( holder.getSerialData() );
- holder.setSerialData( new SerializableData( initialPayloadText ) );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- holder = ( SerializableHolder ) s.get( SerializableHolder.class, holder.getId() );
+ holder = ( LobHolder ) s.get( LobHolder.class, holder.getId() );
SerializableData serialData = ( SerializableData ) holder.getSerialData();
- assertEquals( initialPayloadText, serialData.getPayload() );
- holder.setSerialData( new SerializableData( changedPayloadText ) );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- holder = ( SerializableHolder ) s.get( SerializableHolder.class, holder.getId() );
- serialData = ( SerializableData ) holder.getSerialData();
- assertEquals( changedPayloadText, serialData.getPayload() );
- holder.setSerialData( null );
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- holder = ( SerializableHolder ) s.get( SerializableHolder.class, holder.getId() );
- assertNull( holder.getSerialData() );
+ assertEquals( payloadText, serialData.getPayload() );
s.delete( holder );
s.getTransaction().commit();
s.close();
}
-
}
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextMappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextMappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextMappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.hibernate.test.lob">
-
- <class name="LongStringHolder" table="LOB_ENTITY_TEXT">
- <id name="id" type="long" column="ID">
- <generator class="increment"/>
- </id>
-
- <property name="longString" column="LONG_STR" type="text" length="15000"/>
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/lob/TextTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,51 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.lob;
-
-import junit.framework.Test;
-
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
-
-/**
- * Test eager materialization and mutation data mapped by
- * #{@link org.hibernate.type.TextType}.
- *
- * @author Gail Badner
- */
-public class TextTest extends LongStringTest {
-
- public TextTest(String name) {
- super( name );
- }
-
- public String[] getMappings() {
- return new String[] { "lob/TextMappings.hbm.xml" };
- }
-
- public static Test suite() {
- return new FunctionalTestClassTestSuite( TextTest.class );
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/ImageHolder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/ImageHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/ImageHolder.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.test.sql.hand;
-
-/**
- * @author Gail Badner
- */
-public class ImageHolder {
- private Long id;
- private byte[] photo;
-
- public ImageHolder(byte[] photo) {
- this.photo = photo;
- }
-
- public ImageHolder() {
- }
-
- /**
- * @return Returns the id.
- */
- public Long getId() {
- return id;
- }
-
- /**
- * @param id The id to set.
- */
- public void setId(Long id) {
- this.id = id;
- }
-
- /**
- * @return Returns the photo.
- */
- public byte[] getPhoto() {
- return photo;
- }
-
- /**
- * @param photo The photo to set.
- */
- public void setPhoto(byte[] photo) {
- this.photo = photo;
- }
-}
\ No newline at end of file
Deleted: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/TextHolder.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/TextHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/TextHolder.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.test.sql.hand;
-
-/**
- * @author Gail Badner
- */
-public class TextHolder {
- private Long id;
- private String description;
-
- public TextHolder(String description) {
- this.description = description;
- }
-
- public TextHolder() {
- }
-
- /**
- * @return Returns the id.
- */
- public Long getId() {
- return id;
- }
-
- /**
- * @param id The id to set.
- */
- public void setId(Long id) {
- this.id = id;
- }
-
- /**
- * @return Returns the description.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description The description to set.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-}
\ No newline at end of file
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/CustomSQLTestSupport.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/CustomSQLTestSupport.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/CustomSQLTestSupport.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -9,11 +9,8 @@
import org.hibernate.Transaction;
import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
import org.hibernate.test.sql.hand.Employment;
-import org.hibernate.test.sql.hand.ImageHolder;
import org.hibernate.test.sql.hand.Organization;
import org.hibernate.test.sql.hand.Person;
-import org.hibernate.test.sql.hand.TextHolder;
-import org.hibernate.util.ArrayHelper;
/**
* Abstract test case defining tests for the support for user-supplied (aka
@@ -94,81 +91,4 @@
s.close();
}
- public void testTextProperty() {
- Session s = openSession();
- Transaction t = s.beginTransaction();
- String description = buildLongString( 15000, 'a' );
- TextHolder holder = new TextHolder( description );
- s.save( holder );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- holder = ( TextHolder ) s.get( TextHolder.class, holder.getId() );
- assertEquals( description, holder.getDescription() );
- description = buildLongString( 15000, 'b' );
- holder.setDescription( description );
- s.save( holder );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- holder = ( TextHolder ) s.get( TextHolder.class, holder.getId() );
- assertEquals( description, holder.getDescription() );
- s.delete( holder );
- t.commit();
- s.close();
- }
-
- public void testImageProperty() {
- Session s = openSession();
- Transaction t = s.beginTransaction();
- byte[] photo = buildLongByteArray( 15000, true );
- ImageHolder holder = new ImageHolder( photo );
- s.save( holder );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- holder = ( ImageHolder ) s.get( ImageHolder.class, holder.getId() );
- assertTrue( ArrayHelper.isEquals( photo, holder.getPhoto() ) );
- photo = buildLongByteArray( 15000, false );
- holder.setPhoto( photo );
- s.save( holder );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- holder = ( ImageHolder ) s.get( ImageHolder.class, holder.getId() );
- assertTrue( ArrayHelper.isEquals( photo, holder.getPhoto() ) );
- s.delete( holder );
- t.commit();
- s.close();
- }
-
- private String buildLongString(int size, char baseChar) {
- StringBuffer buff = new StringBuffer();
- for( int i = 0; i < size; i++ ) {
- buff.append( baseChar );
- }
- return buff.toString();
- }
-
- private byte[] buildLongByteArray(int size, boolean on) {
- byte[] data = new byte[size];
- data[0] = mask( on );
- for ( int i = 0; i < size; i++ ) {
- data[i] = mask( on );
- on = !on;
- }
- return data;
- }
-
- private byte mask(boolean on) {
- return on ? ( byte ) 1 : ( byte ) 0;
- }
}
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/db2/Mappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/db2/Mappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/db2/Mappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -64,35 +64,6 @@
<sql-update>UPDATE EMPLOYMENT SET ENDDATE=?, VALUE=?, CURRENCY=? WHERE EMPID=?</sql-update>
<sql-delete>DELETE FROM EMPLOYMENT WHERE EMPID=?</sql-delete>
</class>
- <class name="TextHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="description" type="text" length="15000"/>
- <loader query-ref="textholder"/>
- <sql-insert>
- INSERT INTO TEXTHOLDER
- (DESCRIPTION, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE TEXTHOLDER SET DESCRIPTION=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM TEXTHOLDER WHERE ID=?</sql-delete>
- </class>
-
- <class name="ImageHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="photo" type="image" length="15000"/>
- <loader query-ref="imageholder"/>
- <sql-insert>
- INSERT INTO IMAGEHOLDER
- (PHOTO, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE IMAGEHOLDER SET PHOTO=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM IMAGEHOLDER WHERE ID=?</sql-delete>
- </class>
<resultset name="org-emp-regionCode">
<return-scalar column="regionCode" type="string"/>
<return alias="org" class="Organization"/>
@@ -210,15 +181,6 @@
</return>
{ call HIBDB2TST.selectAllEmployments() }
</sql-query>
- <sql-query name="textholder">
- <return alias="h" class="TextHolder" lock-mode="upgrade"/>
- SELECT ID AS {h.id}, DESCRIPTION AS {h.description} FROM TEXTHOLDER WHERE ID=? /*FOR UPDATE*/
- </sql-query>
-
- <sql-query name="imageholder">
- <return alias="h" class="ImageHolder" lock-mode="upgrade"/>
- SELECT ID AS {h.id}, PHOTO AS {h.photo} FROM IMAGEHOLDER WHERE ID=? /*FOR UPDATE*/
- </sql-query>
<!-- DB2 seem to *require* users to specify explicit schema/location when executing a stored procedure *stupid* -->
<database-object>
<create>CREATE SCHEMA HIBDB2TST</create>
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/mysql/Mappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/mysql/Mappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/mysql/Mappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -64,36 +64,6 @@
<sql-update>UPDATE Employment SET ENDDATE=?, VALUE=?, CURRENCY=? WHERE EMPID=?</sql-update>
<sql-delete>DELETE FROM Employment WHERE EMPID=?</sql-delete>
</class>
-
- <class name="TextHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="description" type="text" length="15000"/>
- <loader query-ref="textholder"/>
- <sql-insert>
- INSERT INTO TextHolder
- (DESCRIPTION, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE TextHolder SET DESCRIPTION=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM TextHolder WHERE ID=?</sql-delete>
- </class>
-
- <class name="ImageHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="photo" type="image" length="15000"/>
- <loader query-ref="imageholder"/>
- <sql-insert>
- INSERT INTO ImageHolder
- (PHOTO, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE ImageHolder SET PHOTO=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM ImageHolder WHERE ID=?</sql-delete>
- </class>
<resultset name="org-emp-regionCode">
<return-scalar column="regionCode" type="string"/>
@@ -210,15 +180,6 @@
</return>
{ call selectAllEmployments() }
</sql-query>
- <sql-query name="textholder">
- <return alias="h" class="TextHolder" lock-mode="upgrade"/>
- SELECT ID AS {h.id}, DESCRIPTION AS {h.description} FROM TextHolder WHERE ID=? /*FOR UPDATE*/
- </sql-query>
-
- <sql-query name="imageholder">
- <return alias="h" class="ImageHolder" lock-mode="upgrade"/>
- SELECT ID AS {h.id}, PHOTO AS {h.photo} FROM ImageHolder WHERE ID=? /*FOR UPDATE*/
- </sql-query>
<database-object>
<create>
CREATE PROCEDURE selectAllEmployments ()
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/oracle/Mappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/oracle/Mappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/oracle/Mappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -65,36 +65,6 @@
<sql-delete>DELETE FROM EMPLOYMENT WHERE EMPID=?</sql-delete>
</class>
- <class name="TextHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="description" type="text" length="15000"/>
- <loader query-ref="textholder"/>
- <sql-insert>
- INSERT INTO TEXTHOLDER
- (DESCRIPTION, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE TEXTHOLDER SET DESCRIPTION=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM TEXTHOLDER WHERE ID=?</sql-delete>
- </class>
-
- <class name="ImageHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="photo" type="image" length="15000"/>
- <loader query-ref="imageholder"/>
- <sql-insert>
- INSERT INTO IMAGEHOLDER
- (PHOTO, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE IMAGEHOLDER SET PHOTO=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM IMAGEHOLDER WHERE ID=?</sql-delete>
- </class>
-
<resultset name="org-emp-regionCode">
<return-scalar column="regionCode" type="string"/>
<return alias="org" class="Organization"/>
@@ -168,15 +138,6 @@
WHERE EMPLOYER = :id AND ENDDATE IS NULL
ORDER BY STARTDATE ASC
</sql-query>
- <sql-query name="textholder">
- <return alias="h" class="TextHolder" lock-mode="upgrade"/>
- SELECT ID AS {h.id}, DESCRIPTION AS {h.description} FROM TEXTHOLDER WHERE ID=? /*FOR UPDATE*/
- </sql-query>
-
- <sql-query name="imageholder">
- <return alias="h" class="ImageHolder" lock-mode="upgrade"/>
- SELECT ID AS {h.id}, PHOTO AS {h.photo} FROM IMAGEHOLDER WHERE ID=? /*FOR UPDATE*/
- </sql-query>
<database-object>
<create>
CREATE OR REPLACE FUNCTION testParamHandling (j number, i number)
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/sybase/Mappings.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/sybase/Mappings.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/custom/sybase/Mappings.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -64,36 +64,6 @@
<sql-delete>DELETE FROM EMPLOYMENT WHERE EMPID=?</sql-delete>
</class>
- <class name="TextHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="description" type="text" length="15000"/>
- <loader query-ref="textholder"/>
- <sql-insert>
- INSERT INTO TEXTHOLDER
- (DESCRIPTION, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE TEXTHOLDER SET DESCRIPTION=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM TEXTHOLDER WHERE ID=?</sql-delete>
- </class>
-
- <class name="ImageHolder">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="photo" type="image" length="15000"/>
- <loader query-ref="imageholder"/>
- <sql-insert>
- INSERT INTO IMAGEHOLDER
- (PHOTO, ID)
- VALUES (?, ?)
- </sql-insert>
- <sql-update>UPDATE IMAGEHOLDER SET PHOTO=? WHERE ID=?</sql-update>
- <sql-delete>DELETE FROM IMAGEHOLDER WHERE ID=?</sql-delete>
- </class>
-
<resultset name="org-emp-regionCode">
<return-scalar column="regionCode" type="string"/>
<return alias="org" class="Organization"/>
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml 2010-05-08 06:05:16 UTC (rev 19415)
@@ -116,20 +116,6 @@
<property name="length" column="flength"/>
</class>
- <class name="TextHolder" table="TEXTHOLDER">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="description" type="text" length="15000"/>
- </class>
-
- <class name="ImageHolder" table="IMAGEHOLDER">
- <id name="id" column="id">
- <generator class="increment"/>
- </id>
- <property name="photo" type="image" length="15000"/>
- </class>
-
<resultset name="org-emp-regionCode">
<return-scalar column="regionCode" type="string"/>
<return alias="org" class="Organization"/>
Modified: core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2010-05-08 05:14:14 UTC (rev 19414)
+++ core/branches/Branch_3_3_2_GA_CP/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2010-05-08 06:05:16 UTC (rev 19415)
@@ -22,18 +22,15 @@
import org.hibernate.test.sql.hand.Dimension;
import org.hibernate.test.sql.hand.Employment;
import org.hibernate.test.sql.hand.Group;
-import org.hibernate.test.sql.hand.ImageHolder;
import org.hibernate.test.sql.hand.Order;
import org.hibernate.test.sql.hand.Organization;
import org.hibernate.test.sql.hand.Person;
import org.hibernate.test.sql.hand.Product;
import org.hibernate.test.sql.hand.SpaceShip;
import org.hibernate.test.sql.hand.Speech;
-import org.hibernate.test.sql.hand.TextHolder;
import org.hibernate.transform.BasicTransformerAdapter;
import org.hibernate.transform.DistinctRootEntityResultTransformer;
import org.hibernate.transform.Transformers;
-import org.hibernate.util.ArrayHelper;
/**
* Tests of various features of native SQL queries.
@@ -97,13 +94,6 @@
" join EMPLOYMENT emp on org.ORGID = emp.EMPLOYER " +
" join PERSON pers on pers.PERID = emp.EMPLOYEE ";
}
- protected String getDescriptionsSQL() {
- return "select DESCRIPTION from TEXTHOLDER";
- }
-
- protected String getPhotosSQL() {
- return "select PHOTO from IMAGEHOLDER";
- }
public void testFailOnNoAddEntityOrScalar() {
// Note: this passes, but for the wrong reason.
// there is actually an exception thrown, but it is the database
@@ -676,66 +666,6 @@
s.close();
}
- public void testTextTypeInSQLQuery() {
- Session s = openSession();
- Transaction t = s.beginTransaction();
- String description = buildLongString( 15000, 'a' );
- TextHolder holder = new TextHolder( description );
- s.persist( holder );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- String descriptionRead = ( String ) s.createSQLQuery( getDescriptionsSQL() )
- .uniqueResult();
- assertEquals( description, descriptionRead );
- s.delete( holder );
- t.commit();
- s.close();
- }
-
- public void testImageTypeInSQLQuery() {
- Session s = openSession();
- Transaction t = s.beginTransaction();
- byte[] photo = buildLongByteArray( 15000, true );
- ImageHolder holder = new ImageHolder( photo );
- s.persist( holder );
- t.commit();
- s.close();
-
- s = openSession();
- t = s.beginTransaction();
- byte[] photoRead = ( byte[] ) s.createSQLQuery( getPhotosSQL() )
- .uniqueResult();
- assertTrue( ArrayHelper.isEquals( photo, photoRead ) );
- s.delete( holder );
- t.commit();
- s.close();
- }
-
- private String buildLongString(int size, char baseChar) {
- StringBuffer buff = new StringBuffer();
- for( int i = 0; i < size; i++ ) {
- buff.append( baseChar );
- }
- return buff.toString();
- }
-
- private byte[] buildLongByteArray(int size, boolean on) {
- byte[] data = new byte[size];
- data[0] = mask( on );
- for ( int i = 0; i < size; i++ ) {
- data[i] = mask( on );
- on = !on;
- }
- return data;
- }
-
- private byte mask(boolean on) {
- return on ? ( byte ) 1 : ( byte ) 0;
- }
-
private static class UpperCasedAliasToEntityMapResultTransformer extends BasicTransformerAdapter implements Serializable {
public Object transformTuple(Object[] tuple, String[] aliases) {
Map result = new HashMap( tuple.length );
14 years, 8 months
Hibernate SVN: r19414 - in annotations/branches/v3_4_0_GA_CP/src: main/java/org/hibernate/type and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 01:14:14 -0400 (Sat, 08 May 2010)
New Revision: 19414
Removed:
annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/WrappedMaterializedBlobType.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/CharacterArrayTextType.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/Dog.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/TextTest.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/WrappedImageType.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/package-info.java
Modified:
annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java
annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/ByteArrayBlobType.java
annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/PrimitiveByteArrayBlobType.java
annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/StringClobType.java
Log:
JBPAPP-2860 HHH-3892 revert changes, as this breaks the compatibility of eap 5.0.x
Modified: annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -13,7 +13,6 @@
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
-import org.hibernate.Hibernate;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.common.reflection.XClass;
@@ -24,11 +23,13 @@
import org.hibernate.cfg.NotYetImplementedException;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
+import org.hibernate.type.ByteArrayBlobType;
import org.hibernate.type.CharacterArrayClobType;
import org.hibernate.type.EnumType;
+import org.hibernate.type.PrimitiveByteArrayBlobType;
import org.hibernate.type.PrimitiveCharacterArrayClobType;
import org.hibernate.type.SerializableToBlobType;
-import org.hibernate.type.WrappedMaterializedBlobType;
+import org.hibernate.type.StringClobType;
import org.hibernate.util.StringHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -125,7 +126,7 @@
type = "blob";
}
else if ( mappings.getReflectionManager().equals( returnedClassOrElement, String.class ) ) {
- type = Hibernate.MATERIALIZED_CLOB.getName();
+ type = StringClobType.class.getName();
}
else if ( mappings.getReflectionManager().equals( returnedClassOrElement, Character.class ) && isArray ) {
type = CharacterArrayClobType.class.getName();
@@ -134,10 +135,10 @@
type = PrimitiveCharacterArrayClobType.class.getName();
}
else if ( mappings.getReflectionManager().equals( returnedClassOrElement, Byte.class ) && isArray ) {
- type = WrappedMaterializedBlobType.class.getName();
+ type = ByteArrayBlobType.class.getName();
}
else if ( mappings.getReflectionManager().equals( returnedClassOrElement, byte.class ) && isArray ) {
- type = Hibernate.MATERIALIZED_BLOB.getName();
+ type = PrimitiveByteArrayBlobType.class.getName();
}
else if ( mappings.getReflectionManager()
.toXClass( Serializable.class )
Modified: annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/ByteArrayBlobType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/ByteArrayBlobType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/ByteArrayBlobType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -21,10 +21,8 @@
/**
* Map a Byte[] into a Blob
* Experimental
- * @deprecated replaced by Hibernate Core's {@link org.hibernate.type.WrappedMaterializedBlobType}
* @author Emmanuel Bernard
*/
-@Deprecated
public class ByteArrayBlobType extends AbstractLobType {
private static final int[] TYPES = new int[] { Types.BLOB };
public int[] sqlTypes(Mapping mapping) {
Modified: annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/PrimitiveByteArrayBlobType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/PrimitiveByteArrayBlobType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/PrimitiveByteArrayBlobType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -3,10 +3,8 @@
/**
* Map a byte[] to a Blob
- * @deprecated replaced by Hibernate Core's {@link org.hibernate.type.MaterializedBlobType}
* @author Emmanuel Bernard
*/
-@Deprecated
public class PrimitiveByteArrayBlobType extends ByteArrayBlobType {
public Class getReturnedClass() {
return byte[].class;
Modified: annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/StringClobType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/StringClobType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/StringClobType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -15,10 +15,8 @@
/**
* Map a String to a Clob
- * @deprecated replaced by Hibernate Core's {@link org.hibernate.type.MaterializedClobType}
* @author Emmanuel Bernard
*/
-@Deprecated
public class StringClobType implements UserType, Serializable {
public int[] sqlTypes() {
return new int[]{Types.CLOB};
Deleted: annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/WrappedMaterializedBlobType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/WrappedMaterializedBlobType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/main/java/org/hibernate/type/WrappedMaterializedBlobType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,42 +0,0 @@
-package org.hibernate.type;
-
-/**
- * <tt>materialized_blob</tt>: A type that maps an SQL BLOB to Java Byte[].
- *
- * @author Strong Liu
- */
-public class WrappedMaterializedBlobType extends MaterializedBlobType {
- public Class getReturnedClass() {
- return Byte[].class;
- }
-
- protected Object toExternalFormat(byte[] bytes) {
- if (bytes == null)
- return null;
- return wrapPrimitive(bytes);
- }
-
- protected byte[] toInternalFormat(Object bytes) {
- if (bytes == null)
- return null;
- return unwrapNonPrimitive((Byte[]) bytes);
- }
-
- private Byte[] wrapPrimitive(byte[] bytes) {
- int length = bytes.length;
- Byte[] result = new Byte[length];
- for (int index = 0; index < length; index++) {
- result[index] = Byte.valueOf(bytes[index]);
- }
- return result;
- }
-
- private byte[] unwrapNonPrimitive(Byte[] bytes) {
- int length = bytes.length;
- byte[] result = new byte[length];
- for (int i = 0; i < length; i++) {
- result[i] = bytes[i].byteValue();
- }
- return result;
- }
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/CharacterArrayTextType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/CharacterArrayTextType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/CharacterArrayTextType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,79 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.hibernate.HibernateException;
-
-/**
- * A type that maps an SQL LONGVARCHAR to a Java Character [].
- *
- * @author Strong Liu
- */
-public class CharacterArrayTextType extends PrimitiveCharacterArrayTextType {
-
- public Class getReturnedClass() {
- return Character[].class;
- }
-
- @Override
- public Object get(ResultSet rs, String name) throws HibernateException,
- SQLException {
- char[] text = (char[]) super.get(rs, name);
- if (text == null)
- return null;
- return wrapPrimitive(text);
- }
-
- @Override
- public void set(PreparedStatement st, Object value, int index)
- throws HibernateException, SQLException {
- Character[] cs = (Character[]) value;
- super.set(st, unwrapNonPrimitive(cs), index);
- }
-
- private Character[] wrapPrimitive(char[] bytes) {
- int length = bytes.length;
- Character[] result = new Character[length];
- for (int index = 0; index < length; index++) {
- result[index] = Character.valueOf(bytes[index]);
- }
- return result;
- }
-
- private char[] unwrapNonPrimitive(Character[] bytes) {
- int length = bytes.length;
- char[] result = new char[length];
- for (int i = 0; i < length; i++) {
- result[i] = bytes[i].charValue();
- }
- return result;
- }
-
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/Dog.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/Dog.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/Dog.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,15 +0,0 @@
-package org.hibernate.test.annotations.lob;
-
-import java.io.Serializable;
-
-public class Dog implements Serializable {
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,81 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-/**
- * An entity containing data that is materialized into a byte array immediately.
- * The hibernate type mapped for {@link #longByteArray} determines the SQL type
- * asctually used.
- *
- * @author Gail Badner
- */
-@Entity
-public class ImageHolder {
- private Long id;
- private byte[] longByteArray;
- private Dog dog;
- private Byte[] picByteArray;
-
- @Id
- @GeneratedValue
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- @org.hibernate.annotations.Type(type="image")
- public byte[] getLongByteArray() {
- return longByteArray;
- }
-
- public void setLongByteArray(byte[] longByteArray) {
- this.longByteArray = longByteArray;
- }
- @org.hibernate.annotations.Type(type="serializable_image")
- public Dog getDog() {
- return dog;
- }
-
- public void setDog(Dog dog) {
- this.dog = dog;
- }
- @org.hibernate.annotations.Type(type="wrapped_image")
- public Byte[] getPicByteArray() {
- return picByteArray;
- }
-
- public void setPicByteArray(Byte[] picByteArray) {
- this.picByteArray = picByteArray;
- }
-
-}
\ No newline at end of file
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,168 +0,0 @@
-//$Id: ImageTest.java 18638 2010-01-26 20:11:51Z steve.ebersole(a)jboss.com $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import junit.framework.AssertionFailedError;
-
-import org.hibernate.Session;
-import org.hibernate.dialect.SQLServerDialect;
-import org.hibernate.dialect.Sybase11Dialect;
-import org.hibernate.dialect.SybaseASE15Dialect;
-import org.hibernate.dialect.SybaseDialect;
-import org.hibernate.junit.RequiresDialect;
-import org.hibernate.test.annotations.TestCase;
-import org.hibernate.util.ArrayHelper;
-
-/**
- * Tests eager materialization and mutation of data mapped by
- * {@link org.hibernate.type.ImageType}.
- *
- * @author Gail Badner
- */
-@RequiresDialect( { SybaseASE15Dialect.class, SQLServerDialect.class,
- SybaseDialect.class, Sybase11Dialect.class })
-public class ImageTest extends TestCase {
- private static final int ARRAY_SIZE = 10000;
-
- public void testBoundedLongByteArrayAccess() {
- byte[] original = buildRecursively(ARRAY_SIZE, true);
- byte[] changed = buildRecursively(ARRAY_SIZE, false);
-
- Session s = openSession();
- s.beginTransaction();
- ImageHolder entity = new ImageHolder();
- s.save(entity);
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (ImageHolder) s.get(ImageHolder.class, entity.getId());
- assertNull(entity.getLongByteArray());
- assertNull(entity.getDog());
- assertNull(entity.getPicByteArray());
- entity.setLongByteArray(original);
- Dog dog = new Dog();
- dog.setName("rabbit");
- entity.setDog(dog);
- entity.setPicByteArray(wrapPrimitive(original));
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (ImageHolder) s.get(ImageHolder.class, entity.getId());
- assertEquals(ARRAY_SIZE, entity.getLongByteArray().length);
- assertEquals(original, entity.getLongByteArray());
- assertEquals(ARRAY_SIZE, entity.getPicByteArray().length);
- assertEquals(original, unwrapNonPrimitive(entity.getPicByteArray()));
- assertNotNull(entity.getDog());
- assertEquals(dog.getName(), entity.getDog().getName());
- entity.setLongByteArray(changed);
- entity.setPicByteArray(wrapPrimitive(changed));
- dog.setName("papa");
- entity.setDog(dog);
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (ImageHolder) s.get(ImageHolder.class, entity.getId());
- assertEquals(ARRAY_SIZE, entity.getLongByteArray().length);
- assertEquals(changed, entity.getLongByteArray());
- assertEquals(ARRAY_SIZE, entity.getPicByteArray().length);
- assertEquals(changed, unwrapNonPrimitive(entity.getPicByteArray()));
- assertNotNull(entity.getDog());
- assertEquals(dog.getName(), entity.getDog().getName());
- entity.setLongByteArray(null);
- entity.setPicByteArray(null);
- entity.setDog(null);
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (ImageHolder) s.get(ImageHolder.class, entity.getId());
- assertNull(entity.getLongByteArray());
- assertNull(entity.getDog());
- assertNull(entity.getPicByteArray());
- s.delete(entity);
- s.getTransaction().commit();
- s.close();
- }
-
- private Byte[] wrapPrimitive(byte[] bytes) {
- int length = bytes.length;
- Byte[] result = new Byte[length];
- for (int index = 0; index < length; index++) {
- result[index] = Byte.valueOf(bytes[index]);
- }
- return result;
- }
-
- private byte[] unwrapNonPrimitive(Byte[] bytes) {
- int length = bytes.length;
- byte[] result = new byte[length];
- for (int i = 0; i < length; i++) {
- result[i] = bytes[i].byteValue();
- }
- return result;
- }
-
- private byte[] buildRecursively(int size, boolean on) {
- byte[] data = new byte[size];
- data[0] = mask(on);
- for (int i = 0; i < size; i++) {
- data[i] = mask(on);
- on = !on;
- }
- return data;
- }
-
- private byte mask(boolean on) {
- return on ? (byte) 1 : (byte) 0;
- }
-
- public static void assertEquals(byte[] val1, byte[] val2) {
- if (!ArrayHelper.isEquals(val1, val2)) {
- throw new AssertionFailedError("byte arrays did not match");
- }
- }
-
- public ImageTest(String name) {
- super(name);
- }
-
- @Override
- protected String[] getAnnotatedPackages() {
- return new String[] { "org.hibernate.test.annotations.lob" };
- }
-
- public Class<?>[] getAnnotatedClasses() {
- return new Class[] { ImageHolder.class };
- }
-
-}
\ No newline at end of file
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,82 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import org.hibernate.annotations.Type;
-
-/**
- * An entity containing data that is materialized into a String immediately.
- * The hibernate type mapped for {@link #LONGVARCHAR} determines the SQL type
- * asctually used.
- *
- * @author Gail Badner
- */
-@Entity
-public class LongStringHolder {
- private Long id;
- private char[] name;
- private Character[] whatEver;
- private String longString;
-
- @Id
- @GeneratedValue
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- @Type(type = "text")
- public String getLongString() {
- return longString;
- }
-
- public void setLongString(String longString) {
- this.longString = longString;
- }
- @Type(type = "char_text")
- public char[] getName() {
- return name;
- }
-
- public void setName(char[] name) {
- this.name = name;
- }
- @Type(type = "wrapped_char_text")
- public Character[] getWhatEver() {
- return whatEver;
- }
-
- public void setWhatEver(Character[] whatEver) {
- this.whatEver = whatEver;
- }
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,68 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.hibernate.HibernateException;
-import org.hibernate.type.TextType;
-
-/**
- * A type that maps an SQL LONGVARCHAR to a Java char [].
- *
- * @author Strong Liu
- */
-public class PrimitiveCharacterArrayTextType extends TextType {
- public Class getReturnedClass() {
- return char[].class;
- }
-
- @Override
- public Object get(ResultSet rs, String name) throws HibernateException,
- SQLException {
- String text = (String) super.get(rs, name);
- if (text == null)
- return null;
- return text.toCharArray();
- }
-
- @Override
- public void set(PreparedStatement st, Object value, int index)
- throws HibernateException, SQLException {
- char[] cs = (char[]) value;
- String text = String.valueOf(cs);
-
- super.set(st, text, index);
- }
-
- @Override
- public String toString(Object val) {
- return String.valueOf(val);
- }
-
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,52 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import java.io.Serializable;
-
-import org.hibernate.type.ImageType;
-import org.hibernate.util.SerializationHelper;
-
-/**
- * A type that maps an SQL LONGVARBINARY to a serializable Java object.
- *
- * @author Strong Liu
- */
-public class SerializableToImageType extends ImageType {
- public Class getReturnedClass() {
- return Serializable.class;
- }
-
- protected Object toExternalFormat(byte[] bytes) {
- if (bytes == null)
- return null;
- return SerializationHelper.deserialize( bytes, getReturnedClass().getClassLoader() );
- }
-
- protected byte[] toInternalFormat(Object bytes) {
- return SerializationHelper.serialize((Serializable) bytes);
- }
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/TextTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/TextTest.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/TextTest.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,163 +0,0 @@
-//$Id: TextTest.java 18638 2010-01-26 20:11:51Z steve.ebersole(a)jboss.com $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import junit.framework.AssertionFailedError;
-
-import org.hibernate.Session;
-import org.hibernate.dialect.SQLServerDialect;
-import org.hibernate.dialect.Sybase11Dialect;
-import org.hibernate.dialect.SybaseASE15Dialect;
-import org.hibernate.dialect.SybaseDialect;
-import org.hibernate.junit.RequiresDialect;
-import org.hibernate.test.annotations.TestCase;
-import org.hibernate.util.ArrayHelper;
-
-/**
- * Tests eager materialization and mutation of long strings.
- *
- * @author Steve Ebersole
- */
-(a)RequiresDialect({SybaseASE15Dialect.class,SQLServerDialect.class,SybaseDialect.class,Sybase11Dialect.class})
-public class TextTest extends TestCase {
-
- @Override
- protected Class<?>[] getAnnotatedClasses() {
- return new Class[] { LongStringHolder.class };
- }
-
- private static final int LONG_STRING_SIZE = 10000;
-
- public void testBoundedLongStringAccess() {
- String original = buildRecursively(LONG_STRING_SIZE, 'x');
- String changed = buildRecursively(LONG_STRING_SIZE, 'y');
-
- Session s = openSession();
- s.beginTransaction();
- LongStringHolder entity = new LongStringHolder();
- s.save(entity);
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (LongStringHolder) s.get(LongStringHolder.class, entity
- .getId());
- assertNull(entity.getLongString());
- assertNull(entity.getName());
- assertNull(entity.getWhatEver());
- entity.setLongString(original);
- entity.setName(original.toCharArray());
- entity.setWhatEver(wrapPrimitive(original.toCharArray()));
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (LongStringHolder) s.get(LongStringHolder.class, entity
- .getId());
- assertEquals(LONG_STRING_SIZE, entity.getLongString().length());
- assertEquals(original, entity.getLongString());
- assertNotNull(entity.getName());
- assertEquals(LONG_STRING_SIZE, entity.getName().length);
- assertEquals(original.toCharArray(), entity.getName());
- assertNotNull(entity.getWhatEver());
- assertEquals(LONG_STRING_SIZE, entity.getWhatEver().length);
- assertEquals(original.toCharArray(), unwrapNonPrimitive(entity.getWhatEver()));
- entity.setLongString(changed);
- entity.setName(changed.toCharArray());
- entity.setWhatEver(wrapPrimitive(changed.toCharArray()));
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (LongStringHolder) s.get(LongStringHolder.class, entity
- .getId());
- assertEquals(LONG_STRING_SIZE, entity.getLongString().length());
- assertEquals(changed, entity.getLongString());
- assertNotNull(entity.getName());
- assertEquals(LONG_STRING_SIZE, entity.getName().length);
- assertEquals(changed.toCharArray(), entity.getName());
- assertNotNull(entity.getWhatEver());
- assertEquals(LONG_STRING_SIZE, entity.getWhatEver().length);
- assertEquals(changed.toCharArray(), unwrapNonPrimitive(entity.getWhatEver()));
- entity.setLongString(null);
- entity.setName(null);
- entity.setWhatEver(null);
- s.getTransaction().commit();
- s.close();
-
- s = openSession();
- s.beginTransaction();
- entity = (LongStringHolder) s.get(LongStringHolder.class, entity
- .getId());
- assertNull(entity.getLongString());
- assertNull(entity.getName());
- assertNull(entity.getWhatEver());
- s.delete(entity);
- s.getTransaction().commit();
- s.close();
- }
-
- public static void assertEquals(char[] val1, char[] val2) {
- if (!ArrayHelper.isEquals(val1, val2)) {
- throw new AssertionFailedError("byte arrays did not match");
- }
- }
-
- private String buildRecursively(int size, char baseChar) {
- StringBuffer buff = new StringBuffer();
- for (int i = 0; i < size; i++) {
- buff.append(baseChar);
- }
- return buff.toString();
- }
-
- private Character[] wrapPrimitive(char[] bytes) {
- int length = bytes.length;
- Character[] result = new Character[length];
- for (int index = 0; index < length; index++) {
- result[index] = Character.valueOf(bytes[index]);
- }
- return result;
- }
-
- private char[] unwrapNonPrimitive(Character[] bytes) {
- int length = bytes.length;
- char[] result = new char[length];
- for (int i = 0; i < length; i++) {
- result[i] = bytes[i].charValue();
- }
- return result;
- }
-
- @Override
- protected String[] getAnnotatedPackages() {
- return new String[] { "org.hibernate.test.annotations.lob" };
- }
-
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/WrappedImageType.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/WrappedImageType.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/WrappedImageType.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,66 +0,0 @@
-//$Id: $
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- *
- */
-package org.hibernate.test.annotations.lob;
-
-import org.hibernate.type.ImageType;
-
-/**
- * A type that maps an SQL LONGVARBINARY to Java Byte[].
- *
- * @author Strong Liu
- */
-public class WrappedImageType extends ImageType{
- public Class getReturnedClass() {
- return Byte[].class;
- }
-
- protected Object toExternalFormat(byte[] bytes) {
- if(bytes==null)return null;
- return wrapPrimitive(bytes);
- }
-
- protected byte[] toInternalFormat(Object bytes) {
- if(bytes==null)return null;
- return unwrapNonPrimitive(( Byte[] ) bytes);
- }
- private Byte[] wrapPrimitive(byte[] bytes) {
- int length = bytes.length;
- Byte[] result = new Byte[length];
- for ( int index = 0; index < length ; index++ ) {
- result[index] = Byte.valueOf( bytes[index] );
- }
- return result;
- }
-
- private byte[] unwrapNonPrimitive(Byte[] bytes) {
- int length = bytes.length;
- byte[] result = new byte[length];
- for ( int i = 0; i < length ; i++ ) {
- result[i] = bytes[i].byteValue();
- }
- return result;
- }
-}
Deleted: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/package-info.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/package-info.java 2010-05-08 04:57:16 UTC (rev 19413)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/lob/package-info.java 2010-05-08 05:14:14 UTC (rev 19414)
@@ -1,29 +0,0 @@
-/**
- * Test package for metatata facilities
- * It contains an example of filter metadata
- */
-@TypeDefs(
- {
- @TypeDef(
- name = "wrapped_char_text",
- typeClass = org.hibernate.test.annotations.lob.CharacterArrayTextType.class
- ),
- @TypeDef(
- name = "char_text",
- typeClass = org.hibernate.test.annotations.lob.PrimitiveCharacterArrayTextType.class
- ),
- @TypeDef(
- name = "wrapped_image",
- typeClass = org.hibernate.test.annotations.lob.WrappedImageType.class
- ),
- @TypeDef(
- name = "serializable_image",
- typeClass = org.hibernate.test.annotations.lob.SerializableToImageType.class
- )
- }
-)
-package org.hibernate.test.annotations.lob;
-
-import org.hibernate.annotations.TypeDef;
-import org.hibernate.annotations.TypeDefs;
-
14 years, 8 months
Hibernate SVN: r19413 - core/branches/Branch_3_3_2_GA_CP/parent.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-08 00:57:16 -0400 (Sat, 08 May 2010)
New Revision: 19413
Modified:
core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
Log:
JBPAPP-4253 update db driver version
Modified: core/branches/Branch_3_3_2_GA_CP/parent/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-08 03:34:05 UTC (rev 19412)
+++ core/branches/Branch_3_3_2_GA_CP/parent/pom.xml 2010-05-08 04:57:16 UTC (rev 19413)
@@ -624,7 +624,7 @@
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
- <version>10.0.2.4</version>
+ <version>10.2.0.4</version>
</dependency>
</dependencies>
<properties>
@@ -643,7 +643,7 @@
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
- <artifactId>ojdbc5</artifactId>
+ <artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
<scope>test</scope>
</dependency>
@@ -683,7 +683,7 @@
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
- <artifactId>ojdbc5</artifactId>
+ <artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
<scope>test</scope>
</dependency>
@@ -744,6 +744,7 @@
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>msjdbc</artifactId>
<version>2.0.1008.2</version>
+ <classifier>4</classifier>
</dependency>
</dependencies>
<properties>
14 years, 8 months
Hibernate SVN: r19412 - in core/trunk: parent and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-07 23:34:05 -0400 (Fri, 07 May 2010)
New Revision: 19412
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java
core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
core/trunk/parent/pom.xml
core/trunk/testsuite/src/test/java/org/hibernate/test/compositeelement/CompositeElementTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java
Log:
HHH-5200 - Prepare to use H2 as the default testing datbase
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/Dialect.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -2015,4 +2015,23 @@
public boolean supportsBindAsCallableArgument() {
return true;
}
+
+ /**
+ * Does this dialect support `count(a,b)`?
+ *
+ * @return True if the database supports counting tuples; false otherwise.
+ */
+ public boolean supportsTupleCounts() {
+ return false;
+ }
+
+ /**
+ * Does this dialect support `count(distinct a,b)`?
+ *
+ * @return True if the database supports counting disintct tuples; false otherwise.
+ */
+ public boolean supportsTupleDistinctCounts() {
+ // oddly most database in fact seem to, so true is the default.
+ return true;
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -305,4 +305,9 @@
public boolean supportsLobValueChangePropogation() {
return false;
}
+
+ @Override
+ public boolean supportsTupleDistinctCounts() {
+ return false;
+ }
}
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/HSQLDialect.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -331,4 +331,9 @@
public boolean supportsLobValueChangePropogation() {
return false;
}
+
+ @Override
+ public boolean supportsTupleDistinctCounts() {
+ return false;
+ }
}
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/parent/pom.xml 2010-05-08 03:34:05 UTC (rev 19412)
@@ -598,7 +598,7 @@
<properties>
<db.dialect>org.hibernate.dialect.H2Dialect</db.dialect>
<jdbc.driver>org.h2.Driver</jdbc.driver>
- <jdbc.url>jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1</jdbc.url>
+ <jdbc.url>jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</jdbc.url>
<jdbc.user>sa</jdbc.user>
<jdbc.pass />
<jdbc.isolation />
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/compositeelement/CompositeElementTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/compositeelement/CompositeElementTest.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/compositeelement/CompositeElementTest.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -90,6 +90,7 @@
public void testCustomColumnReadAndWrite() {
final double HEIGHT_INCHES = 49;
final double HEIGHT_CENTIMETERS = HEIGHT_INCHES * 2.54d;
+
Session s = openSession();
Transaction t = s.beginTransaction();
Child c = new Child( "Child One" );
@@ -99,8 +100,8 @@
c.setParent( p );
s.save( p );
s.flush();
-
- // Test value conversion during insert
+
+ // Test value conversion during insert
Double heightViaSql = (Double)s.createSQLQuery("select height_centimeters from parentchild c where c.name='Child One'")
.uniqueResult();
assertEquals(HEIGHT_CENTIMETERS, heightViaSql, 0.01d);
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -985,10 +985,18 @@
result = s.createCriteria( Student.class )
.setProjection( Projections.count( "cityState" ) )
.uniqueResult();
- fail( "expected SQLGrammarException" );
+ if ( ! getDialect().supportsTupleCounts() ) {
+ fail( "expected SQLGrammarException" );
+ }
+ assertEquals( 1, ( ( Long ) result ).longValue() );
}
catch ( SQLGrammarException ex ) {
- // expected
+ if ( ! getDialect().supportsTupleCounts() ) {
+ // expected
+ }
+ else {
+ throw ex;
+ }
}
finally {
t.rollback();
@@ -999,13 +1007,18 @@
t = s.beginTransaction();
try {
result = s.createCriteria( Student.class )
- .setProjection( Projections.countDistinct( "cityState" ) )
- .uniqueResult();
+ .setProjection( Projections.countDistinct( "cityState" ) )
+ .uniqueResult();
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ fail( "expected SQLGrammarException" );
+ }
assertEquals( 1, ( ( Long ) result ).longValue() );
}
catch ( SQLGrammarException ex ) {
- // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
- if ( ! ( getDialect() instanceof HSQLDialect ) ) {
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ // expected
+ }
+ else {
throw ex;
}
}
@@ -1276,11 +1289,16 @@
s = openSession();
t = s.beginTransaction();
try {
- Object result = s.createCriteria( CourseMeeting.class).setProjection( Projections.countDistinct( "id" ) ).list();
+ s.createCriteria( CourseMeeting.class).setProjection( Projections.countDistinct( "id" ) ).list();
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ fail( "expected SQLGrammarException" );
+ }
}
catch ( SQLGrammarException ex ) {
- // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
- if ( ! ( getDialect() instanceof HSQLDialect ) ) {
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ // expected
+ }
+ else {
throw ex;
}
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -230,11 +230,16 @@
t = s.beginTransaction();
try {
count = ( Long ) s.createQuery( "select count( distinct name ) from Human" ).uniqueResult();
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ fail( "expected SQLGrammarException" );
+ }
assertEquals( 2, count.longValue() );
}
catch ( SQLGrammarException ex ) {
- // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
- if ( ! ( getDialect() instanceof HSQLDialect ) ) {
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ // expected
+ }
+ else {
throw ex;
}
}
@@ -247,13 +252,18 @@
t = s.beginTransaction();
try {
count = ( Long ) s.createCriteria( Human.class )
- .setProjection( Projections.count( "name" ).setDistinct() )
- .uniqueResult();
+ .setProjection( Projections.count( "name" ).setDistinct() )
+ .uniqueResult();
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ fail( "expected SQLGrammarException" );
+ }
assertEquals( 2, count.longValue() );
}
catch ( SQLGrammarException ex ) {
- // HSQLDB's cannot handle more than 1 argument in SELECT COUNT( DISTINCT ... ) )
- if ( ! ( getDialect() instanceof HSQLDialect ) ) {
+ if ( ! getDialect().supportsTupleDistinctCounts() ) {
+ // expected
+ }
+ else {
throw ex;
}
}
@@ -278,10 +288,18 @@
t = s.beginTransaction();
try {
count = ( Long ) s.createQuery( "select count( name ) from Human" ).uniqueResult();
- fail( "should have failed due to SQLGrammarException" );
+ if ( ! getDialect().supportsTupleCounts() ) {
+ fail( "expected SQLGrammarException" );
+ }
+ assertEquals( 1, count.longValue() );
}
catch ( SQLGrammarException ex ) {
- // expected
+ if ( ! getDialect().supportsTupleCounts() ) {
+ // expected
+ }
+ else {
+ throw ex;
+ }
}
finally {
t.rollback();
@@ -292,12 +310,20 @@
t = s.beginTransaction();
try {
count = ( Long ) s.createCriteria( Human.class )
- .setProjection( Projections.count( "name" ) )
- .uniqueResult();
- fail( "should have failed due to SQLGrammarException" );
+ .setProjection( Projections.count( "name" ) )
+ .uniqueResult();
+ if ( ! getDialect().supportsTupleCounts() ) {
+ fail( "expected SQLGrammarException" );
+ }
+ assertEquals( 1, count.longValue() );
}
catch ( SQLGrammarException ex ) {
- // expected
+ if ( ! getDialect().supportsTupleCounts() ) {
+ // expected
+ }
+ else {
+ throw ex;
+ }
}
finally {
t.rollback();
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/HQLTest.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -14,6 +14,7 @@
import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.dialect.DB2Dialect;
+import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.IngresDialect;
import org.hibernate.dialect.MySQLDialect;
@@ -726,9 +727,12 @@
public void testGroupByFunction() {
if ( getDialect() instanceof Oracle8iDialect ) return; // the new hiearchy...
if ( getDialect() instanceof PostgreSQLDialect ) return;
- assertTranslation( "select count(*) from Human h group by year(h.birthdate)" );
+ if ( ! H2Dialect.class.isInstance( getDialect() ) ) {
+ // H2 has no year function
+ assertTranslation( "select count(*) from Human h group by year(h.birthdate)" );
+ assertTranslation( "select count(*) from Human h group by year(sysdate)" );
+ }
assertTranslation( "select count(*) from Human h group by trunc( sqrt(h.bodyWeight*4)/2 )" );
- assertTranslation( "select count(*) from Human h group by year(sysdate)" );
}
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java 2010-05-07 20:53:34 UTC (rev 19411)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/ScrollableCollectionFetchingTest.java 2010-05-08 03:34:05 UTC (rev 19412)
@@ -53,17 +53,15 @@
Session s = openSession();
Transaction txn = s.beginTransaction();
- assertTrue(s
- .createQuery( "from Animal a left join fetch a.offspring where a.description like :desc order by a.id" )
- .setString( "desc", "root%" )
- .list()
- .isEmpty() );
+ final String query = "from Animal a left join fetch a.offspring where a.description like :desc order by a.id";
- ScrollableResults results = s
- .createQuery( "from Animal a left join fetch a.offspring where a.description like :desc order by a.id" )
- .setString( "desc", "root%" )
- .scroll();
+ // first, as a control, make sure there are no results
+ int size = s.createQuery( query ).setString( "desc", "root%" ).list().size();
+ assertEquals( 0, size );
+ // now get the scrollable results
+ ScrollableResults results = s.createQuery( query ).setString( "desc", "root%" ).scroll();
+
assertFalse( results.isFirst() );
assertFalse( results.isLast() );
14 years, 8 months