mirror of https://github.com/apache/openjpa.git
Fixed test case failure which occurs on DB platforms that use non-default max embedded LOB size.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@832816 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac531c5875
commit
f0ad193611
|
@ -20,9 +20,12 @@ package org.apache.openjpa.persistence.relations;
|
|||
|
||||
import java.sql.Types;
|
||||
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||
import org.apache.openjpa.jdbc.meta.ClassMapping;
|
||||
import org.apache.openjpa.jdbc.meta.FieldMapping;
|
||||
import org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy;
|
||||
import org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedBlobFieldStrategy;
|
||||
import org.apache.openjpa.jdbc.sql.DBDictionary;
|
||||
import org.apache.openjpa.persistence.JPAFacadeHelper;
|
||||
import org.apache.openjpa.persistence.test.SingleEMTestCase;
|
||||
|
||||
|
@ -38,7 +41,7 @@ public class TestMapCollectionToBlob
|
|||
ClassMapping cm = (ClassMapping) JPAFacadeHelper.getMetaData(em,
|
||||
HandlerToHandlerMapInstance.class);
|
||||
FieldMapping fm = cm.getFieldMapping("map");
|
||||
assertEquals(HandlerFieldStrategy.class, fm.getStrategy().getClass());
|
||||
assertEquals(getBlobFieldStrategy(), fm.getStrategy().getClass());
|
||||
assertEquals("NONSTD_MAPPING_MAP", fm.getTable().getName());
|
||||
assertEquals(fm.getTable().getColumn("MAP").getType(), Types.BLOB);
|
||||
|
||||
|
@ -49,4 +52,16 @@ public class TestMapCollectionToBlob
|
|||
em.getTransaction().commit();
|
||||
em.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the strategy that is used for handling blob fields, based upon
|
||||
* the configuration of the dictionary.
|
||||
*/
|
||||
private Class<?> getBlobFieldStrategy() {
|
||||
DBDictionary dict = ((JDBCConfiguration)(emf.getConfiguration())).getDBDictionaryInstance();
|
||||
if (dict.maxEmbeddedBlobSize == -1) {
|
||||
return HandlerFieldStrategy.class;
|
||||
}
|
||||
return MaxEmbeddedBlobFieldStrategy.class;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue