/** * Return true if we should use the generic untyped PC handler for the * given unmapped relation. */ private boolean useUntypedPCHandler(ValueMapping val) { ClassMapping rel = val.getTypeMapping(); return rel.getIdentityType() == ClassMapping.ID_UNKNOWN || (rel.getIdentityType() == ClassMapping.ID_APPLICATION && (rel.getPrimaryKeyFields().length == 0 || (!rel.isOpenJPAIdentity() && Modifier.isAbstract (rel.getObjectIdType().getModifiers())))); }
/** * Return true if we should use the generic untyped PC handler for the * given unmapped relation. */ private boolean useUntypedPCHandler(ValueMapping val) { ClassMapping rel = val.getTypeMapping(); return rel.getIdentityType() == ClassMapping.ID_UNKNOWN || (rel.getIdentityType() == ClassMapping.ID_APPLICATION && (rel.getPrimaryKeyFields().length == 0 || (!rel.isOpenJPAIdentity() && Modifier.isAbstract (rel.getObjectIdType().getModifiers())))); }
/** * Return true if we should use the generic untyped PC handler for the * given unmapped relation. */ private boolean useUntypedPCHandler(ValueMapping val) { ClassMapping rel = val.getTypeMapping(); return rel.getIdentityType() == ClassMapping.ID_UNKNOWN || (rel.getIdentityType() == ClassMapping.ID_APPLICATION && (rel.getPrimaryKeyFields().length == 0 || (!rel.isOpenJPAIdentity() && Modifier.isAbstract (rel.getObjectIdType().getModifiers())))); }
/** * Return true if we should use the generic untyped PC handler for the * given unmapped relation. */ private boolean useUntypedPCHandler(ValueMapping val) { ClassMapping rel = val.getTypeMapping(); return rel.getIdentityType() == ClassMapping.ID_UNKNOWN || (rel.getIdentityType() == ClassMapping.ID_APPLICATION && (rel.getPrimaryKeyFields().length == 0 || (!rel.isOpenJPAIdentity() && Modifier.isAbstract (rel.getObjectIdType().getModifiers())))); }
/** * Return true if we should use the generic untyped PC handler for the * given unmapped relation. */ private boolean useUntypedPCHandler(ValueMapping val) { ClassMapping rel = val.getTypeMapping(); return rel.getIdentityType() == ClassMapping.ID_UNKNOWN || (rel.getIdentityType() == ClassMapping.ID_APPLICATION && (rel.getPrimaryKeyFields().length == 0 || (!rel.isOpenJPAIdentity() && Modifier.isAbstract (rel.getObjectIdType().getModifiers())))); }
/** * The columns this mapping uses to uniquely identify an object. * These will typically be the primary key columns or the columns this * class uses to link to its superclass table. */ public Column[] getPrimaryKeyColumns() { if (_cols.length == 0 && getIdentityType() == ID_APPLICATION && isMapped()) { FieldMapping[] pks = getPrimaryKeyFieldMappings(); Collection cols = new ArrayList(pks.length); Column[] fieldCols; for (int i = 0; i < pks.length; i++) { fieldCols = pks[i].getColumns(); for (int j = 0; j < fieldCols.length; j++) cols.add(fieldCols[j]); } _cols = (Column[]) cols.toArray(new Column[cols.size()]); } return _cols; }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_INSERT, sm, true); if (cls.getIdentityType() == cls.ID_DATASTORE) row.setPrimaryKey(cls.getColumnIO(), sm); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_INSERT, sm, true); if (cls.getIdentityType() == cls.ID_DATASTORE) row.setPrimaryKey(cls.getColumnIO(), sm); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_INSERT, sm, true); if (cls.getIdentityType() == cls.ID_DATASTORE) row.setPrimaryKey(cls.getColumnIO(), sm); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_INSERT, sm, true); if (cls.getIdentityType() == cls.ID_DATASTORE) row.setPrimaryKey(cls.getColumnIO(), sm); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_INSERT, sm, true); if (cls.getIdentityType() == cls.ID_DATASTORE) row.setPrimaryKey(cls.getColumnIO(), sm); }
private Object[] getPKValues(OpenJPAStateManager sm, JDBCStore store) { Object[] pks = null; Object oid = sm.getObjectId(); if (_mapping.getIdentityType() == ClassMapping.ID_APPLICATION) pks = ApplicationIds.toPKValues(oid, _mapping); Object[] val = new Object[_pkCols.length]; int count = 0; for (int i = 0; i < _pkCols.length; i++, count++) { if (pks == null) val[0] = (oid == null) ? null : ((Id) oid).getId(); else { val[i] = _joins[i].getJoinValue(pks[_pkIndices[i]], _pkCols[i], store); } } return val; }
/** * Generate and write the application identity code. */ private ApplicationIdTool newApplicationIdTool(ClassMapping mapping) { ApplicationIdTool tool; if (mapping.getIdentityType() == ClassMapping.ID_APPLICATION && !mapping.isOpenJPAIdentity() && mapping.getPCSuperclass() == null) { tool = new ApplicationIdTool(_conf, mapping.getDescribedType(), mapping); tool.setDirectory(_dir); tool.setCodeFormat(_format); if (!tool.run()) return null; return tool; } return null; }
public static void mapRelationToUnmappedPC(ValueMapping vm, DBIdentifier name, boolean adapt) { if (vm.getTypeMapping().getIdentityType() == ClassMapping.ID_UNKNOWN) throw new MetaDataException(_loc.get("rel-to-unknownid", vm)); ValueMappingInfo vinfo = vm.getValueInfo(); Column[] tmplates = newUnmappedPCTemplateColumns(vm, name); vm.setColumns(vinfo.getColumns(vm, name, tmplates, vm.getFieldMapping().getTable(), adapt)); vm.setColumnIO(vinfo.getColumnIO()); }
public static void mapRelationToUnmappedPC(ValueMapping vm, DBIdentifier name, boolean adapt) { if (vm.getTypeMapping().getIdentityType() == ClassMapping.ID_UNKNOWN) throw new MetaDataException(_loc.get("rel-to-unknownid", vm)); ValueMappingInfo vinfo = vm.getValueInfo(); Column[] tmplates = newUnmappedPCTemplateColumns(vm, name); vm.setColumns(vinfo.getColumns(vm, name, tmplates, vm.getFieldMapping().getTable(), adapt)); vm.setColumnIO(vinfo.getColumnIO()); }
public static void mapRelationToUnmappedPC(ValueMapping vm, DBIdentifier name, boolean adapt) { if (vm.getTypeMapping().getIdentityType() == ClassMapping.ID_UNKNOWN) throw new MetaDataException(_loc.get("rel-to-unknownid", vm)); ValueMappingInfo vinfo = vm.getValueInfo(); Column[] tmplates = newUnmappedPCTemplateColumns(vm, name); vm.setColumns(vinfo.getColumns(vm, name, tmplates, vm.getFieldMapping().getTable(), adapt)); vm.setColumnIO(vinfo.getColumnIO()); }
public static void mapRelationToUnmappedPC(ValueMapping vm, DBIdentifier name, boolean adapt) { if (vm.getTypeMapping().getIdentityType() == ClassMapping.ID_UNKNOWN) throw new MetaDataException(_loc.get("rel-to-unknownid", vm)); ValueMappingInfo vinfo = vm.getValueInfo(); Column[] tmplates = newUnmappedPCTemplateColumns(vm, name); vm.setColumns(vinfo.getColumns(vm, name, tmplates, vm.getFieldMapping().getTable(), adapt)); vm.setColumnIO(vinfo.getColumnIO()); }
/** * Map a logical foreign key to an unmapped base class relation. */ public static void mapRelationToUnmappedPC(ValueMapping vm, String name, boolean adapt) { if (vm.getTypeMapping().getIdentityType() == ClassMapping.ID_UNKNOWN) throw new MetaDataException(_loc.get("rel-to-unknownid", vm)); ValueMappingInfo vinfo = vm.getValueInfo(); Column[] tmplates = newUnmappedPCTemplateColumns(vm, name); vm.setColumns(vinfo.getColumns(vm, name, tmplates, vm.getFieldMapping().getTable(), adapt)); vm.setColumnIO(vinfo.getColumnIO()); }
public void map(boolean adapt) { ValueMapping vm = cls.getEmbeddingMapping(); if (vm == null || vm.getType() != cls.getDescribedType()) throw new MetaDataException(_loc.get("not-embed", cls)); ClassMappingInfo info = cls.getMappingInfo(); info.assertNoSchemaComponents(cls, true); ClassMapping owner = vm.getFieldMapping().getDefiningMapping(); cls.setIdentityType(owner.getIdentityType()); cls.setObjectIdType(owner.getObjectIdType(), owner.isObjectIdTypeShared()); cls.setTable(vm.getFieldMapping().getTable()); cls.setPrimaryKeyColumns(owner.getPrimaryKeyColumns()); cls.setColumnIO(owner.getColumnIO()); }
public void map(boolean adapt) { ValueMapping vm = cls.getEmbeddingMapping(); if (vm == null || vm.getType() != cls.getDescribedType()) throw new MetaDataException(_loc.get("not-embed", cls)); ClassMappingInfo info = cls.getMappingInfo(); info.assertNoSchemaComponents(cls, true); ClassMapping owner = null; if (vm.getValueMappedByMapping() != null) owner = vm.getValueMappedByMapping().getDefiningMapping(); else owner = vm.getFieldMapping().getDefiningMapping(); cls.setIdentityType(owner.getIdentityType()); cls.setObjectIdType(owner.getObjectIdType(), owner.isObjectIdTypeShared()); cls.setTable(vm.getFieldMapping().getTable()); cls.setPrimaryKeyColumns(owner.getPrimaryKeyColumns()); cls.setColumnIO(owner.getColumnIO()); }