diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractBook.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractBook.java index 555e44a587..c1a4bdb4e5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractBook.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractBook.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.test.annotations.lob; + import javax.persistence.Column; import javax.persistence.Lob; import javax.persistence.MappedSuperclass; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractCompiledCode.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractCompiledCode.java index d8e149693d..bbe8db7c2c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractCompiledCode.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractCompiledCode.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.test.annotations.lob; + import javax.persistence.Lob; import javax.persistence.MappedSuperclass; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractLobTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractLobTest.java index 2724a503bc..2e20006804 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractLobTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/AbstractLobTest.java @@ -45,7 +45,7 @@ public abstract class AbstractLobTest { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/CompiledCode.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/CompiledCode.java index d0f6ed4dfb..f9986cc721 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/CompiledCode.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/CompiledCode.java @@ -1,5 +1,29 @@ -//$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.annotations.lob; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Dog.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Dog.java index 72d3eb2839..b43f0a9822 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Dog.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Dog.java @@ -1,4 +1,29 @@ +/* + * 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.annotations.lob; + import java.io.Serializable; public class Dog implements Serializable { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Editor.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Editor.java index 4f80088100..5aa035e987 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Editor.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/Editor.java @@ -1,5 +1,29 @@ -//$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.annotations.lob; + import java.io.Serializable; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java index 029ae45d07..058c9a29b2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageHolder.java @@ -1,4 +1,3 @@ -//$Id: $ /* * Hibernate, Relational Persistence for Idiomatic Java * @@ -24,6 +23,7 @@ * */ package org.hibernate.test.annotations.lob; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -31,8 +31,8 @@ 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. - * + * actually used. + * * @author Gail Badner */ @Entity @@ -51,8 +51,8 @@ public class ImageHolder { public void setId(Long id) { this.id = id; } - - @org.hibernate.annotations.Type(type="image") + + @org.hibernate.annotations.Type(type = "image") public byte[] getLongByteArray() { return longByteArray; } @@ -60,7 +60,8 @@ public class ImageHolder { public void setLongByteArray(byte[] longByteArray) { this.longByteArray = longByteArray; } - @org.hibernate.annotations.Type(type="serializable_image") + + @org.hibernate.annotations.Type(type = "serializable_image") public Dog getDog() { return dog; } @@ -68,7 +69,8 @@ public class ImageHolder { public void setDog(Dog dog) { this.dog = dog; } - @org.hibernate.annotations.Type(type="wrapped_image") + + @org.hibernate.annotations.Type(type = "wrapped_image") public Byte[] getPicByteArray() { return picByteArray; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java index 2f1308f643..684666c0bd 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/ImageTest.java @@ -42,74 +42,74 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; * * @author Gail Badner */ -@RequiresDialect( { SybaseASE15Dialect.class, SQLServerDialect.class, SybaseDialect.class, Sybase11Dialect.class }) +@RequiresDialect({ SybaseASE15Dialect.class, SQLServerDialect.class, SybaseDialect.class, Sybase11Dialect.class }) public class ImageTest extends BaseCoreFunctionalTestCase { private static final int ARRAY_SIZE = 10000; @Test public void testBoundedLongByteArrayAccess() { - byte[] original = buildRecursively(ARRAY_SIZE, true); - byte[] changed = buildRecursively(ARRAY_SIZE, false); + 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.save( entity ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); - entity = (ImageHolder) s.get(ImageHolder.class, entity.getId()); + entity = ( ImageHolder ) s.get( ImageHolder.class, entity.getId() ); Assert.assertNull( entity.getLongByteArray() ); Assert.assertNull( entity.getDog() ); Assert.assertNull( entity.getPicByteArray() ); - entity.setLongByteArray(original); + entity.setLongByteArray( original ); Dog dog = new Dog(); - dog.setName("rabbit"); - entity.setDog(dog); - entity.setPicByteArray(wrapPrimitive(original)); + 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()); + entity = ( ImageHolder ) s.get( ImageHolder.class, entity.getId() ); Assert.assertEquals( ARRAY_SIZE, entity.getLongByteArray().length ); - assertEquals(original, entity.getLongByteArray()); + assertEquals( original, entity.getLongByteArray() ); Assert.assertEquals( ARRAY_SIZE, entity.getPicByteArray().length ); - assertEquals(original, unwrapNonPrimitive(entity.getPicByteArray())); + assertEquals( original, unwrapNonPrimitive( entity.getPicByteArray() ) ); Assert.assertNotNull( entity.getDog() ); Assert.assertEquals( dog.getName(), entity.getDog().getName() ); - entity.setLongByteArray(changed); - entity.setPicByteArray(wrapPrimitive(changed)); - dog.setName("papa"); - entity.setDog(dog); + 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()); + entity = ( ImageHolder ) s.get( ImageHolder.class, entity.getId() ); Assert.assertEquals( ARRAY_SIZE, entity.getLongByteArray().length ); - assertEquals(changed, entity.getLongByteArray()); + assertEquals( changed, entity.getLongByteArray() ); Assert.assertEquals( ARRAY_SIZE, entity.getPicByteArray().length ); - assertEquals(changed, unwrapNonPrimitive(entity.getPicByteArray())); + assertEquals( changed, unwrapNonPrimitive( entity.getPicByteArray() ) ); Assert.assertNotNull( entity.getDog() ); Assert.assertEquals( dog.getName(), entity.getDog().getName() ); - entity.setLongByteArray(null); - entity.setPicByteArray(null); - entity.setDog(null); + 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()); + entity = ( ImageHolder ) s.get( ImageHolder.class, entity.getId() ); Assert.assertNull( entity.getLongByteArray() ); Assert.assertNull( entity.getDog() ); Assert.assertNull( entity.getPicByteArray() ); - s.delete(entity); + s.delete( entity ); s.getTransaction().commit(); s.close(); } @@ -117,7 +117,7 @@ public class ImageTest extends BaseCoreFunctionalTestCase { private Byte[] wrapPrimitive(byte[] bytes) { int length = bytes.length; Byte[] result = new Byte[length]; - for (int index = 0; index < length; index++) { + for ( int index = 0; index < length; index++ ) { result[index] = Byte.valueOf( bytes[index] ); } return result; @@ -126,7 +126,7 @@ public class ImageTest extends BaseCoreFunctionalTestCase { private byte[] unwrapNonPrimitive(Byte[] bytes) { int length = bytes.length; byte[] result = new byte[length]; - for (int i = 0; i < length; i++) { + for ( int i = 0; i < length; i++ ) { result[i] = bytes[i].byteValue(); } return result; @@ -134,21 +134,21 @@ public class ImageTest extends BaseCoreFunctionalTestCase { 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); + 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; + 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"); + if ( !ArrayHelper.isEquals( val1, val2 ) ) { + throw new AssertionFailedError( "byte arrays did not match" ); } } @@ -158,7 +158,7 @@ public class ImageTest extends BaseCoreFunctionalTestCase { } @Override - public Class[] getAnnotatedClasses() { + public Class[] getAnnotatedClasses() { return new Class[] { ImageHolder.class }; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LobTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LobTest.java index c83315a334..87c5b754a5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LobTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LobTest.java @@ -1,8 +1,7 @@ -//$Id$ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2010, Red Hat Inc. or third-party contributors as + * Copyright (c) 2008, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are * distributed under license by Red Hat Inc. @@ -25,14 +24,12 @@ package org.hibernate.test.annotations.lob; import org.hibernate.testing.DialectChecks; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.RequiresDialectFeature; /** * @author Emmanuel Bernard */ @RequiresDialectFeature(DialectChecks.SupportsExpectedLobUsagePattern.class) -@FailureExpectedWithNewMetamodel public class LobTest extends AbstractLobTest { @Override protected Class getBookClass() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java index 4bca12b083..72cc4f9072 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/LongStringHolder.java @@ -1,4 +1,3 @@ -//$Id: $ /* * Hibernate, Relational Persistence for Idiomatic Java * @@ -24,6 +23,7 @@ * */ package org.hibernate.test.annotations.lob; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -34,7 +34,7 @@ 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 @@ -62,6 +62,7 @@ public class LongStringHolder { public void setLongString(String longString) { this.longString = longString; } + @Type(type = "char_text") public char[] getName() { return name; @@ -70,6 +71,7 @@ public class LongStringHolder { public void setName(char[] name) { this.name = name; } + @Type(type = "wrapped_char_text") public Character[] getWhatEver() { return whatEver; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobEntity.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobEntity.java index 59b8a274e7..43d7723e7a 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobEntity.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.test.annotations.lob; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobTest.java index 5559755087..9e3ee46e1b 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/MaterializedBlobTest.java @@ -51,8 +51,12 @@ public class MaterializedBlobTest extends BaseCoreFunctionalTestCase { @Test public void testTypeSelection() { - int index = sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ).getEntityMetamodel().getPropertyIndex( "theBytes" ); - Type type = sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ).getEntityMetamodel().getProperties()[index].getType(); + int index = sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ) + .getEntityMetamodel() + .getPropertyIndex( "theBytes" ); + Type type = sessionFactory().getEntityPersister( MaterializedBlobEntity.class.getName() ) + .getEntityMetamodel() + .getProperties()[index].getType(); assertEquals( MaterializedBlobType.INSTANCE, type ); } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java index c86e66c5ef..d124c0d3fb 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/PrimitiveCharacterArrayTextType.java @@ -1,4 +1,3 @@ -//$Id: $ /* * Hibernate, Relational Persistence for Idiomatic Java * @@ -24,13 +23,14 @@ * */ package org.hibernate.test.annotations.lob; + import org.hibernate.type.AbstractSingleColumnStandardBasicType; import org.hibernate.type.descriptor.java.PrimitiveCharacterArrayTypeDescriptor; import org.hibernate.type.descriptor.sql.LongVarcharTypeDescriptor; /** * A type that maps JDBC {@link java.sql.Types#LONGVARCHAR LONGVARCHAR} and {@code char[]}. - * + * * @author Strong Liu */ public class PrimitiveCharacterArrayTextType extends AbstractSingleColumnStandardBasicType { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java index f0341e8271..98dd7bfe20 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/SerializableToImageType.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.test.annotations.lob; + import java.io.Serializable; import org.hibernate.type.AbstractSingleColumnStandardBasicType; @@ -32,14 +33,17 @@ import org.hibernate.type.descriptor.sql.LongVarbinaryTypeDescriptor; * A type that maps JDBC {@link java.sql.Types#LONGVARBINARY LONGVARBINARY} and {@link Serializable}. *

* TODO : this should really have access to the actual Serializable class so we have access to the proper classloader - * + * * @author Strong Liu */ public class SerializableToImageType extends AbstractSingleColumnStandardBasicType { public static final PrimitiveCharacterArrayTextType INSTANCE = new PrimitiveCharacterArrayTextType(); public SerializableToImageType() { - super( LongVarbinaryTypeDescriptor.INSTANCE, new SerializableTypeDescriptor( Serializable.class ) ); + super( + LongVarbinaryTypeDescriptor.INSTANCE, + new SerializableTypeDescriptor( Serializable.class ) + ); } public String getName() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/TextTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/TextTest.java index fe995b7a3d..b8dfb96c9b 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/TextTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/TextTest.java @@ -43,7 +43,7 @@ import static org.junit.Assert.assertNull; * * @author Steve Ebersole */ -@RequiresDialect({SybaseASE15Dialect.class,SQLServerDialect.class,SybaseDialect.class,Sybase11Dialect.class}) +@RequiresDialect({ SybaseASE15Dialect.class, SQLServerDialect.class, SybaseDialect.class, Sybase11Dialect.class }) public class TextTest extends BaseCoreFunctionalTestCase { @Override @@ -55,33 +55,37 @@ public class TextTest extends BaseCoreFunctionalTestCase { @Test public void testBoundedLongStringAccess() { - String original = buildRecursively(LONG_STRING_SIZE, 'x'); - String changed = buildRecursively(LONG_STRING_SIZE, 'y'); + 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.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())); + 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()); + entity = ( LongStringHolder ) s.get( + LongStringHolder.class, entity + .getId() + ); Assert.assertEquals( LONG_STRING_SIZE, entity.getLongString().length() ); Assert.assertEquals( original, entity.getLongString() ); Assert.assertNotNull( entity.getName() ); @@ -90,16 +94,18 @@ public class TextTest extends BaseCoreFunctionalTestCase { Assert.assertNotNull( entity.getWhatEver() ); Assert.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())); + 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()); + entity = ( LongStringHolder ) s.get( + LongStringHolder.class, entity + .getId() + ); Assert.assertEquals( LONG_STRING_SIZE, entity.getLongString().length() ); Assert.assertEquals( changed, entity.getLongString() ); Assert.assertNotNull( entity.getName() ); @@ -108,34 +114,36 @@ public class TextTest extends BaseCoreFunctionalTestCase { Assert.assertNotNull( entity.getWhatEver() ); Assert.assertEquals( LONG_STRING_SIZE, entity.getWhatEver().length ); assertEquals( changed.toCharArray(), unwrapNonPrimitive( entity.getWhatEver() ) ); - entity.setLongString(null); - entity.setName(null); - entity.setWhatEver(null); + 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); + 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"); + if ( !ArrayHelper.isEquals( val1, val2 ) ) { + throw new AssertionFailedError( "byte arrays did not match" ); } } private String buildRecursively(int size, char baseChar) { StringBuilder buff = new StringBuilder(); - for (int i = 0; i < size; i++) { - buff.append(baseChar); + for ( int i = 0; i < size; i++ ) { + buff.append( baseChar ); } return buff.toString(); } @@ -143,8 +151,8 @@ public class TextTest extends BaseCoreFunctionalTestCase { 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]); + for ( int index = 0; index < length; index++ ) { + result[index] = Character.valueOf( bytes[index] ); } return result; } @@ -152,7 +160,7 @@ public class TextTest extends BaseCoreFunctionalTestCase { private char[] unwrapNonPrimitive(Character[] bytes) { int length = bytes.length; char[] result = new char[length]; - for (int i = 0; i < length; i++) { + for ( int i = 0; i < length; i++ ) { result[i] = bytes[i].charValue(); } return result; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedBook.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedBook.java index bd311200df..e768aaa38d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedBook.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedBook.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.test.annotations.lob; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -34,10 +35,10 @@ import javax.persistence.Version; */ @Entity @Table(name = "ver_lob_book") -public class VersionedBook extends AbstractBook{ +public class VersionedBook extends AbstractBook { private Integer id; private Integer version; - + @Id @GeneratedValue public Integer getId() { @@ -56,5 +57,5 @@ public class VersionedBook extends AbstractBook{ public void setVersion(Integer i) { version = i; - } + } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedCompiledCode.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedCompiledCode.java index 4bd6730dc6..c96c7ec49c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedCompiledCode.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedCompiledCode.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.test.annotations.lob; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -34,7 +35,7 @@ import javax.persistence.Version; * @author Gail Badner */ @Entity -public class VersionedCompiledCode extends AbstractCompiledCode{ +public class VersionedCompiledCode extends AbstractCompiledCode { private Integer id; private Integer version; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedLobTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedLobTest.java index 2f9e6c2793..bb665b83b6 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedLobTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/VersionedLobTest.java @@ -148,7 +148,7 @@ public class VersionedLobTest extends AbstractLobTest { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/package-info.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/package-info.java index 837813d7c3..188ee2b660 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/package-info.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/lob/package-info.java @@ -1,28 +1,28 @@ /** - * Test package for metatata facilities + * Test package for metadata facilities * It contains an example of filter metadata */ @TypeDefs( { - @TypeDef( - name = "wrapped_char_text", - typeClass = org.hibernate.test.annotations.lob.CharacterArrayTextType.class + @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 - ) + @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; +) package org.hibernate.test.annotations.lob; + import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs;