else if (mmd.hasArray())
/** * Convenience method to return if the array is stored in the owning table as a column. * Overrides the superclass since arrays can be stored in a single column also when the no join is * specified and the array is of a primitive/wrapper type. * @return Whether it is stored in a single column in the main table. */ protected boolean containerIsStoredInSingleColumn() { if (super.containerIsStoredInSingleColumn()) { return true; } if (mmd != null && mmd.hasArray() && mmd.getJoinMetaData() == null && MetaDataUtils.getInstance().arrayStorableAsByteArrayInSingleColumn(mmd)) { return true; } return false; }
private JavaTypeMapping addOrderMapping(AbstractMemberMetaData fmd, JavaTypeMapping orderMapping) { boolean needsOrderMapping = false; OrderMetaData omd = fmd.getOrderMetaData(); if (fmd.hasArray()) { // Array field always has the index mapping needsOrderMapping = true; } else if (List.class.isAssignableFrom(fmd.getType())) { // List field needsOrderMapping = !(omd != null && !omd.isIndexedList()); } else if (java.util.Collection.class.isAssignableFrom(fmd.getType()) && omd != null && omd.isIndexedList() && omd.getMappedBy() == null) { // Collection field with <order> and is indexed list so needs order mapping needsOrderMapping = true; } if (needsOrderMapping) { // if the field is list or array type, add index column if (orderMapping == null) { // Create new order mapping since we need one and we aren't using a shared FK orderMapping = addOrderColumn(fmd); } if (!MetaDataUtils.readRelatedKeysFromParent(storeMgr, fmd)) { getExternalOrderMappings().put(fmd, orderMapping); } } return orderMapping; }
if (ammd.hasArray())
else if (ownerMemberMetaData.hasArray())
if (fmd.hasArray() && fmd.getArray().elementIsPersistent())
/** * Accessor for the name of the java-type actually used when mapping the particular datastore field. This java-type must have an entry in the datastore mappings. * @param index requested datastore field index. * @return the name of java-type for the requested datastore field. */ public String getJavaTypeForDatastoreMapping(int index) { if (containerIsStoredInSingleColumn()) { if (mmd.hasCollection() || mmd.hasArray()) { ColumnMetaData[] colmds = (mmd.getElementMetaData() != null ? mmd.getElementMetaData().getColumnMetaData() : null); if (colmds != null && colmds.length == 1 && colmds[0].getJdbcType() != null && colmds[0].getJdbcType().equals(JdbcType.ARRAY)) { // Element column using JDBC ARRAY type return Collection.class.getName(); } // Check if they specified just @Column since storing in single column in owner table colmds = mmd.getColumnMetaData(); if (colmds != null && colmds.length == 1 && colmds[0].getJdbcType() != null && colmds[0].getJdbcType().equals(JdbcType.ARRAY)) { // Column using JDBC ARRAY type return Collection.class.getName(); } } // Serialised container so just return serialised return ClassNameConstants.JAVA_IO_SERIALIZABLE; } return super.getJavaTypeForDatastoreMapping(index); }
if (ammd.hasArray()) { value = datastoreValueToPojoArray(value, ammd); } else if (ammd.hasCollection()) {
public Type<E> getElementType() { if (mmd.hasCollection()) { Class elementCls = owner.model.getClassLoaderResolver().classForName(mmd.getCollection().getElementType()); return owner.model.getType(elementCls); } else if (mmd.hasArray()) { Class elementCls = owner.model.getClassLoaderResolver().classForName(mmd.getArray().getElementType()); return owner.model.getType(elementCls); } return null; } }
if (ammd.hasCollection() || ammd.hasMap() || ammd.hasArray())
else if (mmds[i].hasArray())
else if (mmd != null && mmd.hasArray() && SCOUtils.arrayIsStoredInSingleColumn(mmd, storeMgr.getMetaDataManager()))
/** * Method to prepare a field mapping for use in the datastore. * This creates the column in the table. */ protected void prepareDatastoreMapping() { if (containerIsStoredInSingleColumn()) { // Serialised collections/maps/arrays should just create a (typically BLOB) column as normal in the owning table MappingManager mmgr = storeMgr.getMappingManager(); ColumnMetaData colmd = null; ColumnMetaData[] colmds = mmd.getColumnMetaData(); if (colmds != null && colmds.length > 0) { // Try the field column info colmd = colmds[0]; } else if (mmd.hasCollection() || mmd.hasArray()) { // Fallback to the element column info colmds = (mmd.getElementMetaData() != null) ? mmd.getElementMetaData().getColumnMetaData() : null; if (colmds != null && colmds.length > 0) { colmd = colmds[0]; } } Column col = mmgr.createColumn(this, getJavaTypeForDatastoreMapping(0), colmd); mmgr.createDatastoreMapping(this, mmd, 0, col); } }
else if (mmd.hasArray())
else if (mmd.hasArray())
storeMgr.getDatastoreClass(ownerClassName, clr).getIdMapping(); ColumnMetaDataContainer colmdContainer = null; if (ownerFmd.hasCollection() || ownerFmd.hasArray()) {
} else if (mmd.hasArray()) {
boolean elementPC = (mmd.hasArray() && mmd.getArray().elementIsPersistent()); if (isSerialisedElementPC() || isEmbeddedElementPC() || (isEmbeddedElement() && !elementPC) || ClassUtils.isReferenceType(mmd.getType().getComponentType()))