public int getTypeCode() { return _val.getTypeCode(); }
public int getTypeCode() { return _val.getTypeCode(); }
public int getTypeCode() { return _val.getTypeCode(); }
public int getTypeCode() { return _val.getTypeCode(); }
public int getTypeCode() { return _val.getTypeCode(); }
return null; switch (vmd.getTypeCode()) { case JavaTypes.DATE:
return null; switch (vmd.getTypeCode()) { case JavaTypes.DATE:
public ClassMapping getClassMapping(ExpState state) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) return _class; if (_key) { if (pstate.field.getKey().getTypeCode() == JavaTypes.PC) return pstate.field.getKeyMapping().getTypeMapping(); return null; } if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) return pstate.field.getElementMapping().getTypeMapping(); if (pstate.field.getTypeCode() == JavaTypes.PC) return pstate.field.getTypeMapping(); return null; }
/** * Convert the given stored value <code>val</code> to a value for loading * into a state manager. The value <code>val</code> must be a singular * value; it cannot be a container. */ private static Object toNestedLoadable(OpenJPAStateManager sm, ValueMetaData vmd, Object val, FetchConfiguration fetch) { if (val == null) return null; switch (vmd.getTypeCode()) { // clone the date to prevent direct modification of our stored value case JavaTypes.DATE: return ((Date) val).clone(); case JavaTypes.PC: case JavaTypes.PC_UNTYPED: // for relations to other persistent objects, we store the // related object's oid -- convert it back into a persistent // instance StoreContext ctx = sm.getContext(); Object pc = ctx.find(val, fetch, null, null, 0); if (pc != null) return pc; OrphanedKeyAction action = ctx.getConfiguration(). getOrphanedKeyActionInstance(); return action.orphan(val, sm, vmd); default: return val; } }
public ClassMapping getClassMapping(ExpState state) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) return _class; if (_key) { if (pstate.field.getKey().getTypeCode() == JavaTypes.PC) return pstate.field.getKeyMapping().getTypeMapping(); return null; } if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) { if (pstate.field.isElementCollection() && pstate.field.getElement().isEmbedded()) pstate.isEmbedElementColl = true; return pstate.field.getElementMapping().getTypeMapping(); } if (pstate.field.getTypeCode() == JavaTypes.PC) return pstate.field.getTypeMapping(); return null; }
public ClassMapping getClassMapping(ExpState state) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) return _class; if (_key) { if (pstate.field.getKey().getTypeCode() == JavaTypes.PC) return pstate.field.getKeyMapping().getTypeMapping(); return null; } if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) { if (pstate.field.isElementCollection() && pstate.field.getElement().isEmbedded()) pstate.isEmbedElementColl = true; return pstate.field.getElementMapping().getTypeMapping(); } if (pstate.field.getTypeCode() == JavaTypes.PC) return pstate.field.getTypeMapping(); return null; }
public ClassMapping getClassMapping(ExpState state) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) return _class; if (_key) { if (pstate.field.getKey().getTypeCode() == JavaTypes.PC) return pstate.field.getKeyMapping().getTypeMapping(); return null; } if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) { if (pstate.field.isElementCollection() && pstate.field.getElement().isEmbedded()) pstate.isEmbedElementColl = true; return pstate.field.getElementMapping().getTypeMapping(); } if (pstate.field.getTypeCode() == JavaTypes.PC) return pstate.field.getTypeMapping(); return null; }
public ClassMapping getClassMapping(ExpState state) { PathExpState pstate = (PathExpState) state; if (pstate.field == null) return _class; if (_key) { if (pstate.field.getKey().getTypeCode() == JavaTypes.PC) return pstate.field.getKeyMapping().getTypeMapping(); return null; } if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) { if (pstate.field.isElementCollection() && pstate.field.getElement().isEmbedded()) pstate.isEmbedElementColl = true; return pstate.field.getElementMapping().getTypeMapping(); } if (pstate.field.getTypeCode() == JavaTypes.PC) return pstate.field.getTypeMapping(); return null; }
/** * Use hints in mapping data to figure out whether the given relation * field should use an inverse foreign key or an association table mapping. */ private boolean useInverseKeyMapping(FieldMapping field) { FieldMapping mapped = field.getMappedByMapping(); if (mapped != null) { if (mapped.getTypeCode() == JavaTypes.PC) return true; if (mapped.getElement().getTypeCode() == JavaTypes.PC) return false; throw new MetaDataException(_loc.get("bad-mapped-by", field, mapped)); } // without a mapped-by, we have to look for clues as to the mapping. // we assume that anything with element foreign key columns but no join // columns or table uses an inverse foreign key, and anything else uses // an association table FieldMappingInfo info = field.getMappingInfo(); ValueMapping elem = field.getElementMapping(); return info.getTableName() == null && info.getColumns().isEmpty() && !elem.getValueInfo().getColumns().isEmpty(); }
if (mapped.getTypeCode() == JavaTypes.PC || mapped.getTypeCode() == JavaTypes.PC_UNTYPED) return true; if (mapped.getElement().getTypeCode() == JavaTypes.PC) return false; throw new MetaDataException(_loc.get("bad-mapped-by", field,
/** * Traverse into the previous field of a relation path. * * @param last whether this is the last field in the path * @return the mapping of the related type, or null */ private ClassMapping traverseField(PathExpState pstate, boolean key, boolean forceOuter, boolean last) { if (pstate.field == null) return null; // traverse into field value if (key) pstate.joins = pstate.field.joinKey(pstate.joins, forceOuter); else pstate.joins = pstate.field.join(pstate.joins, forceOuter); // if this isn't the last field, traverse into the relation if (!last) joinRelation(pstate, key, forceOuter, true); // return the maping of the related type, if any if (key) return pstate.field.getKeyMapping().getTypeMapping(); if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) return pstate.field.getElementMapping().getTypeMapping(); return pstate.field.getTypeMapping(); }
/** * Traverse into the previous field of a relation path. * * @param last whether this is the last field in the path * @return the mapping of the related type, or null */ private ClassMapping traverseField(PathExpState pstate, boolean key, boolean forceOuter, boolean last) { if (pstate.field == null) return null; // traverse into field value if (key) pstate.joins = pstate.field.joinKey(pstate.joins, forceOuter); else pstate.joins = pstate.field.join(pstate.joins, forceOuter); // if this isn't the last field, traverse into the relation if (!last) joinRelation(pstate, key, forceOuter, true); // return the maping of the related type, if any if (key) return pstate.field.getKeyMapping().getTypeMapping(); if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) return pstate.field.getElementMapping().getTypeMapping(); return pstate.field.getTypeMapping(); }
/** * Traverse into the previous field of a relation path. * * @param last whether this is the last field in the path * @return the mapping of the related type, or null */ private ClassMapping traverseField(PathExpState pstate, boolean key, boolean forceOuter, boolean last) { if (pstate.field == null) return null; // traverse into field value if (key) pstate.joins = pstate.field.joinKey(pstate.joins, forceOuter); else pstate.joins = pstate.field.join(pstate.joins, forceOuter); // if this isn't the last field, traverse into the relation if (!last) joinRelation(pstate, key, forceOuter, true); // return the maping of the related type, if any if (key) return pstate.field.getKeyMapping().getTypeMapping(); if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) return pstate.field.getElementMapping().getTypeMapping(); return pstate.field.getTypeMapping(); }
/** * Traverse into the previous field of a relation path. * * @param last whether this is the last field in the path * @return the mapping of the related type, or null */ private ClassMapping traverseField(PathExpState pstate, boolean key, boolean forceOuter, boolean last) { if (pstate.field == null) return null; // traverse into field value if (key) pstate.joins = pstate.field.joinKey(pstate.joins, forceOuter); else pstate.joins = pstate.field.join(pstate.joins, forceOuter); // if this isn't the last field, traverse into the relation if (!last) joinRelation(pstate, key, forceOuter, true); // return the maping of the related type, if any if (key) return pstate.field.getKeyMapping().getTypeMapping(); if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) return pstate.field.getElementMapping().getTypeMapping(); return pstate.field.getTypeMapping(); }
/** * Traverse into the previous field of a relation path. * * @param last whether this is the last field in the path * @return the mapping of the related type, or null */ private ClassMapping traverseField(PathExpState pstate, boolean key, boolean forceOuter, boolean last) { if (pstate.field == null) return null; // traverse into field value if (key) pstate.joins = pstate.field.joinKey(pstate.joins, forceOuter); else pstate.joins = pstate.field.join(pstate.joins, forceOuter); // if this isn't the last field, traverse into the relation if (!last) joinRelation(pstate, key, forceOuter, true); // return the maping of the related type, if any if (key) return pstate.field.getKeyMapping().getTypeMapping(); if (pstate.field.getElement().getTypeCode() == JavaTypes.PC) return pstate.field.getElementMapping().getTypeMapping(); return pstate.field.getTypeMapping(); }