/** * Return the nearest mapped superclass that can join to this class. */ public ClassMapping getJoinablePCSuperclassMapping() { ClassMapping sup = getMappedPCSuperclassMapping(); if (sup == null) return null; if (_fk != null || _table == null || _table.equals(sup.getTable())) return sup; return null; }
/** * Throw the proper exception if the given handler-controlled value * represents an unjoinable relation. */ public static void assertJoinable(ValueMapping vm) { ClassMapping rel = vm.getTypeMapping(); if (rel != null && (rel.getTable() == null || !rel.getTable().equals(vm.getFieldMapping().getTable()))) throw RelationStrategies.unjoinable(vm); } }
/** * Throw the proper exception if the given handler-controlled value * represents an unjoinable relation. */ public static void assertJoinable(ValueMapping vm) { ClassMapping rel = vm.getTypeMapping(); if (rel != null && (rel.getTable() == null || !rel.getTable().equals(vm.getFieldMapping().getTable()))) throw RelationStrategies.unjoinable(vm); } }
/** * Throw the proper exception if the given handler-controlled value * represents an unjoinable relation. */ public static void assertJoinable(ValueMapping vm) { ClassMapping rel = vm.getTypeMapping(); if (rel != null && (rel.getTable() == null || !rel.getTable().equals(vm.getFieldMapping().getTable()))) throw RelationStrategies.unjoinable(vm); } }
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_UPDATE, sm, false); if (row != null) row.wherePrimaryKey(sm); }
public void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_DELETE, sm, true); row.wherePrimaryKey(sm); }
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_UPDATE, sm, false); if (row != null) row.wherePrimaryKey(sm); }
public void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_DELETE, sm, true); row.wherePrimaryKey(sm); }
public void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_DELETE, sm, true); row.wherePrimaryKey(sm); }
public void delete(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_DELETE, sm, true); row.wherePrimaryKey(sm); }
/** * Return the base table for the given instance. */ private static Table getBaseTable(OpenJPAStateManager sm) { ClassMapping cls = (ClassMapping) sm.getMetaData(); while (cls.getJoinablePCSuperclassMapping() != null) cls = cls.getJoinablePCSuperclassMapping(); return cls.getTable(); }
/** * Return the base table for the given instance. */ private static Table getBaseTable(OpenJPAStateManager sm) { ClassMapping cls = (ClassMapping) sm.getMetaData(); while (cls.getJoinablePCSuperclassMapping() != null) cls = cls.getJoinablePCSuperclassMapping(); return cls.getTable(); }
boolean isSecondaryColumn(Column col, OpenJPAStateManager sm) { ClassMapping mapping = (ClassMapping)sm.getMetaData(); while (mapping != null) { if (mapping.getTable() == col.getTable()) return false; else mapping = mapping.getPCSuperclassMapping(); } return true; } }
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); }
/** * Return the columns set for this discriminator, based on the given * templates. */ public Column[] getColumns(Discriminator discrim, Column[] tmplates, boolean adapt) { Table table = discrim.getClassMapping().getTable(); discrim.getMappingRepository().getMappingDefaults().populateColumns (discrim, table, tmplates); return createColumns(discrim, null, tmplates, table, adapt); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(cls.getTable(), Row.ACTION_INSERT, sm, true); row.setPrimaryKey(cls.getColumnIO(), sm); row.setForeignKey(cls.getJoinForeignKey(), 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); row.setPrimaryKey(cls.getColumnIO(), sm); row.setForeignKey(cls.getJoinForeignKey(), cls.getColumnIO(), sm); }
public void appendTo(SQLBuffer buf, FilterValue target, FilterValue[] args, ClassMapping type, JDBCStore store) { if (!args[0].isConstant()) throw new UserException(_loc.get("const-only", TAG)); if (!target.isPath()) throw new UserException(_loc.get("path-only", TAG)); // alias the column using the target's context, so that the // correct relation path to the target is used ClassMapping mapping = target.getClassMapping(); String colName = args[0].getValue().toString(); buf.append(target.getColumnAlias(colName, mapping.getTable())); }
public void appendTo(SQLBuffer buf, FilterValue target, FilterValue[] args, ClassMapping type, JDBCStore store) { if (!args[0].isConstant()) throw new UserException(_loc.get("const-only", TAG)); if (!target.isPath()) throw new UserException(_loc.get("path-only", TAG)); // alias the column using the target's context, so that the // correct relation path to the target is used ClassMapping mapping = target.getClassMapping(); String colName = args[0].getValue().toString(); buf.append(target.getColumnAlias(colName, mapping.getTable())); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Row row = rm.getRow(disc.getClassMapping().getTable(), Row.ACTION_INSERT, sm, true); Object cls = getDiscriminatorValue((ClassMapping) sm.getMetaData()); if (disc.getColumnIO().isInsertable(0, cls == null)) row.setObject(disc.getColumns()[0], cls); }