Author: steve.ebersole(a)jboss.com
Date: 2010-05-20 16:37:56 -0400 (Thu, 20 May 2010)
New Revision: 19571
Modified:
core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java
core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/functional/cache/SQLFunctionsInterSystemsTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java
Log:
HHH-5245 - Introduce LobHelper
Modified: core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java 2010-05-20
20:19:34 UTC (rev 19570)
+++ core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupport.java 2010-05-20
20:37:56 UTC (rev 19571)
@@ -46,7 +46,7 @@
public LobCreator getLobCreator();
/**
- * Create an instance of a {@link LobCreator} appropriate for the current envionment,
mainly meant to account for
+ * Create an instance of a {@link LobCreator} appropriate for the current environment,
mainly meant to account for
* variance between JDBC 4 (<= JDK 1.6) and JDBC3 (>= JDK 1.5).
*
* @param lobCreationContext The context in which the LOB is being created
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/functional/cache/SQLFunctionsInterSystemsTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/functional/cache/SQLFunctionsInterSystemsTest.java 2010-05-20
20:19:34 UTC (rev 19570)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/dialect/functional/cache/SQLFunctionsInterSystemsTest.java 2010-05-20
20:37:56 UTC (rev 19571)
@@ -1,3 +1,26 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.test.dialect.functional.cache;
import java.sql.Statement;
@@ -510,8 +533,8 @@
Session s = openSession();
s.beginTransaction();
Blobber b = new Blobber();
- b.setBlob( Hibernate.createBlob( "foo/bar/baz".getBytes() ) );
- b.setClob( Hibernate.createClob("foo/bar/baz") );
+ b.setBlob( s.getLobHelper().createBlob( "foo/bar/baz".getBytes() ) );
+ b.setClob( s.getLobHelper().createClob("foo/bar/baz") );
s.save(b);
//s.refresh(b);
//assertTrue( b.getClob() instanceof ClobImpl );
@@ -542,7 +565,7 @@
s = openSession();
s.beginTransaction();
b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
- b.setClob( Hibernate.createClob("xcvfxvc xcvbx cvbx cvbx cvbxcvbxcvbxcvb")
);
+ b.setClob( s.getLobHelper().createClob("xcvfxvc xcvbx cvbx cvbx
cvbxcvbxcvbxcvb") );
s.flush();
s.getTransaction().commit();
s.close();
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java 2010-05-20
20:19:34 UTC (rev 19570)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/interfaceproxy/InterfaceProxyTest.java 2010-05-20
20:37:56 UTC (rev 19571)
@@ -3,7 +3,6 @@
import junit.framework.Test;
-import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.junit.functional.FunctionalTestCase;
@@ -41,11 +40,11 @@
Transaction t = s.beginTransaction();
Document d = new DocumentImpl();
d.setName("Hibernate in Action");
- d.setContent( Hibernate.createBlob( "blah blah blah".getBytes(), s ) );
+ d.setContent( s.getLobHelper().createBlob( "blah blah blah".getBytes() ) );
Long did = (Long) s.save(d);
SecureDocument d2 = new SecureDocumentImpl();
d2.setName("Secret");
- d2.setContent( Hibernate.createBlob( "wxyz wxyz".getBytes(), s ) );
+ d2.setContent( s.getLobHelper().createBlob( "wxyz wxyz".getBytes() ) );
// SybaseASE15Dialect only allows 7-bits in a byte to be inserted into a tinyint
// column (0 <= val < 128)
d2.setPermissionBits( (byte) 127 );
Modified:
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java 2010-05-20
20:19:34 UTC (rev 19570)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java 2010-05-20
20:37:56 UTC (rev 19571)
@@ -1,4 +1,26 @@
-//$Id: SQLFunctionsTest.java 10977 2006-12-12 23:28:04Z steve.ebersole(a)jboss.com $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.test.legacy;
import java.util.ArrayList;
@@ -13,7 +35,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.ScrollableResults;
import org.hibernate.Transaction;
@@ -519,8 +540,8 @@
Session s = openSession();
Blobber b = new Blobber();
- b.setBlob( Hibernate.createBlob( "foo/bar/baz".getBytes() ) );
- b.setClob( Hibernate.createClob("foo/bar/baz") );
+ b.setBlob( s.getLobHelper().createBlob( "foo/bar/baz".getBytes() ) );
+ b.setClob( s.getLobHelper().createClob("foo/bar/baz") );
s.save(b);
//s.refresh(b);
//assertTrue( b.getClob() instanceof ClobImpl );
@@ -556,7 +577,7 @@
s = openSession();
b = (Blobber) s.load( Blobber.class, new Integer( b.getId() ) );
- b.setClob( Hibernate.createClob("xcvfxvc xcvbx cvbx cvbx cvbxcvbxcvbxcvb")
);
+ b.setClob( s.getLobHelper().createClob("xcvfxvc xcvbx cvbx cvbx
cvbxcvbxcvbxcvb") );
s.flush();
s.connection().commit();
s.close();
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java 2010-05-20
20:19:34 UTC (rev 19570)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/lob/BlobLocatorTest.java 2010-05-20
20:37:56 UTC (rev 19571)
@@ -75,7 +75,7 @@
Session s = openSession();
s.beginTransaction();
LobHolder entity = new LobHolder();
- entity.setBlobLocator( Hibernate.createBlob( original ) );
+ entity.setBlobLocator( s.getLobHelper().createBlob( original ) );
s.save( entity );
s.getTransaction().commit();
s.close();
@@ -117,7 +117,7 @@
assertNotNull( entity.getBlobLocator() );
assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
assertEquals( original, extractData( entity.getBlobLocator() ) );
- entity.setBlobLocator( Hibernate.createBlob( changed ) );
+ entity.setBlobLocator( s.getLobHelper().createBlob( changed ) );
s.getTransaction().commit();
s.close();
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java 2010-05-20
20:19:34 UTC (rev 19570)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/lob/ClobLocatorTest.java 2010-05-20
20:37:56 UTC (rev 19571)
@@ -1,11 +1,10 @@
-//$Id: $
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -21,7 +20,6 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.test.lob;
@@ -29,7 +27,6 @@
import junit.framework.Test;
-import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.Session;
import org.hibernate.dialect.Dialect;
@@ -74,7 +71,7 @@
Session s = openSession();
s.beginTransaction();
LobHolder entity = new LobHolder();
- entity.setClobLocator( Hibernate.createClob( original ) );
+ entity.setClobLocator( s.getLobHelper().createClob( original ) );
s.save( entity );
s.getTransaction().commit();
s.close();
@@ -116,7 +113,7 @@
assertNotNull( entity.getClobLocator() );
assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
assertEquals( original, extractData( entity.getClobLocator() ) );
- entity.setClobLocator( Hibernate.createClob( changed ) );
+ entity.setClobLocator( s.getLobHelper().createClob( changed ) );
s.getTransaction().commit();
s.close();
@@ -145,7 +142,7 @@
Session s = openSession();
s.beginTransaction();
LobHolder entity = new LobHolder();
- entity.setClobLocator( Hibernate.createClob( original ) );
+ entity.setClobLocator( s.getLobHelper().createClob( original ) );
s.save( entity );
s.getTransaction().commit();
s.close();
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java 2010-05-20
20:19:34 UTC (rev 19570)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/mixed/MixedTest.java 2010-05-20
20:37:56 UTC (rev 19571)
@@ -1,9 +1,30 @@
-//$Id: MixedTest.java 15736 2008-12-27 00:49:42Z gbadner $
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
package org.hibernate.test.mixed;
import junit.framework.Test;
-import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.junit.functional.FunctionalTestCase;
@@ -39,13 +60,13 @@
Document d = new Document();
d.setName( "Hibernate in Action" );
- d.setContent( Hibernate.createBlob( "blah blah blah".getBytes() ) );
+ d.setContent( s.getLobHelper().createBlob( "blah blah blah".getBytes() ) );
d.setParent( f );
Long did = (Long) s.save( d );
SecureDocument d2 = new SecureDocument();
d2.setName( "Secret" );
- d2.setContent( Hibernate.createBlob( "wxyz wxyz".getBytes() ) );
+ d2.setContent( s.getLobHelper().createBlob( "wxyz wxyz".getBytes() ) );
// SybaseASE15Dialect only allows 7-bits in a byte to be inserted into a tinyint
// column (0 <= val < 128)
d2.setPermissionBits( (byte) 127 );