Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "HHH-4098 VARBINARY should be BLOB in DB2400Dialect"

This reverts commit 5900205.
  • Loading branch information...
commit 4152ff660a01ae2e537d8fbaf650ed2df7bf1e85 1 parent 5900205
@brmeyer brmeyer authored
View
3  hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java
@@ -64,8 +64,7 @@ public DB2Dialect() {
registerColumnType( Types.DATE, "date" );
registerColumnType( Types.TIME, "time" );
registerColumnType( Types.TIMESTAMP, "timestamp" );
- registerColumnType( Types.VARBINARY, "blob($l)" );
- registerColumnType( Types.VARBINARY, 32766, "varchar($l) for bit data" );
+ registerColumnType( Types.VARBINARY, "varchar($l) for bit data" );
registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
registerColumnType( Types.BLOB, "blob($l)" );
registerColumnType( Types.CLOB, "clob($l)" );
View
122 hibernate-core/src/test/java/org/hibernate/test/annotations/type/TypeCapacityTest.java
@@ -1,122 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * JBoss, Home of Professional Open Source
- * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors
- * as indicated by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * 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, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.hibernate.test.annotations.type;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Iterator;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import org.hibernate.annotations.Type;
-import org.hibernate.dialect.DB2Dialect;
-import org.hibernate.mapping.Column;
-import org.hibernate.testing.RequiresDialect;
-import org.hibernate.testing.TestForIssue;
-import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
-import org.junit.Test;
-
-/**
- * @author Brett Meyer
- */
-// TODO: May eventually test other dialects.
-@RequiresDialect( DB2Dialect.class )
-public class TypeCapacityTest extends BaseCoreFunctionalTestCase {
-
- /**
- * Dialects use different SQL types based on max capacities. Ensure
- * DB2 VARBINARY uses varchar for < 32766 and blob for > 32766;
- */
- @Test
- @TestForIssue( jiraKey="HHH-4098" )
- public void testVarbinaryCapacity() {
- Column varbinary = getColumn( "varbinary" );
- assertNotNull(varbinary);
- assertEquals(varbinary.getSqlType(), "varchar(32765) for bit data");
-
- Column varbinaryBlob = getColumn( "varbinaryBlob" );
- assertNotNull(varbinaryBlob);
- assertEquals(varbinaryBlob.getSqlType(), "blob(32767)");
-
- }
-
- private Column getColumn( String name) {
- Iterator iter = configuration().createMappings().getTable(
- null, null, "TypeCapacityTest$TypeCapacityEntity" )
- .getColumnIterator();
-
- while ( iter.hasNext() ) {
- Column c = (Column) iter.next();
- if (c.getName().equals( name )) {
- return c;
- }
- }
- return null;
- }
-
- @Override
- protected Class<?>[] getAnnotatedClasses() {
- return new Class[] { TypeCapacityEntity.class };
- }
-
- @Entity
- public class TypeCapacityEntity {
-
- @Id
- @GeneratedValue
- private Long id;
-
- @Type( type="org.hibernate.type.BinaryType" )
- @javax.persistence.Column( length = 32765)
- private byte[] varbinary;
-
- @Type( type="org.hibernate.type.BinaryType" )
- @javax.persistence.Column( length = 32767)
- private byte[] varbinaryBlob;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public byte[] getVarbinary() {
- return varbinary;
- }
-
- public void setVarbinary(byte[] varbinary) {
- this.varbinary = varbinary;
- }
-
- public byte[] getVarbinaryBlob() {
- return varbinaryBlob;
- }
-
- public void setVarbinaryBlob(byte[] varbinaryBlob) {
- this.varbinaryBlob = varbinaryBlob;
- }
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.