public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); ColumnIO io = vers.getColumnIO(); Object initial = nextVersion(null); Row row = rm.getRow(vers.getClassMapping().getTable(), Row.ACTION_INSERT, sm, true); for (int i = 0; i < cols.length; i++) if (io.isInsertable(i, initial == null)) row.setObject(cols[i], initial); // set initial version into state manager Object nextVersion; nextVersion = initial; sm.setNextVersion(nextVersion); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); ColumnIO io = vers.getColumnIO(); Object initial = nextVersion(null); for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_INSERT, sm, true); if (io.isInsertable(i, initial == null)) row.setObject(cols[i], getColumnValue(initial, i)); } // set initial version into state manager Object nextVersion; nextVersion = initial; sm.setNextVersion(nextVersion); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); ColumnIO io = vers.getColumnIO(); Object initial = nextVersion(null); for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_INSERT, sm, true); if (io.isInsertable(i, initial == null)) row.setObject(cols[i], getColumnValue(initial, i)); } // set initial version into state manager Object nextVersion; nextVersion = initial; sm.setNextVersion(nextVersion); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); ColumnIO io = vers.getColumnIO(); Object initial = nextVersion(null); for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_INSERT, sm, true); if (io.isInsertable(i, initial == null)) row.setObject(cols[i], getColumnValue(initial, i)); } // set initial version into state manager Object nextVersion; nextVersion = initial; sm.setNextVersion(nextVersion); }
public void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); ColumnIO io = vers.getColumnIO(); Object initial = nextVersion(null); for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_INSERT, sm, true); if (io.isInsertable(i, initial == null)) row.setObject(cols[i], getColumnValue(initial, i)); } // set initial version into state manager Object nextVersion; nextVersion = initial; sm.setNextVersion(nextVersion); }
/** * Synchronize internal information with the mapping data for the given * version. */ public void syncWith(Version version) { clear(false); ClassMapping cls = version.getClassMapping(); Column[] cols = version.getColumns(); setColumnIO(version.getColumnIO()); syncColumns(version, cols, false); syncIndex(version, version.getIndex()); if (version.getStrategy() == null || version.getStrategy() instanceof SuperclassVersionStrategy) return; // explicit version strategy if: // - unmapped class and version mapped // - mapped base class // - mapped subclass that doesn't rely on superclass version String strat = version.getStrategy().getAlias(); if ((!cls.isMapped() && !NoneVersionStrategy.ALIAS.equals(strat)) || (cls.isMapped() && cls.getJoinablePCSuperclassMapping() == null)) setStrategy(strat); }
/** * Synchronize internal information with the mapping data for the given * version. */ public void syncWith(Version version) { clear(false); ClassMapping cls = version.getClassMapping(); Column[] cols = version.getColumns(); setColumnIO(version.getColumnIO()); syncColumns(version, cols, false); syncIndex(version, version.getIndex()); if (version.getStrategy() == null || version.getStrategy() instanceof SuperclassVersionStrategy) return; // explicit version strategy if: // - unmapped class and version mapped // - mapped base class // - mapped subclass that doesn't rely on superclass version String strat = version.getStrategy().getAlias(); if ((!cls.isMapped() && !NoneVersionStrategy.ALIAS.equals(strat)) || (cls.isMapped() && cls.getJoinablePCSuperclassMapping() == null)) setStrategy(strat); }
/** * Synchronize internal information with the mapping data for the given * version. */ public void syncWith(Version version) { clear(false); ClassMapping cls = version.getClassMapping(); Column[] cols = version.getColumns(); setColumnIO(version.getColumnIO()); syncColumns(version, cols, false); syncIndex(version, version.getIndex()); if (version.getStrategy() == null || version.getStrategy() instanceof SuperclassVersionStrategy) return; // explicit version strategy if: // - unmapped class and version mapped // - mapped base class // - mapped subclass that doesn't rely on superclass version String strat = version.getStrategy().getAlias(); if ((!cls.isMapped() && !NoneVersionStrategy.ALIAS.equals(strat)) || (cls.isMapped() && cls.getJoinablePCSuperclassMapping() == null)) setStrategy(strat); }
/** * Synchronize internal information with the mapping data for the given * version. */ public void syncWith(Version version) { clear(false); ClassMapping cls = version.getClassMapping(); Column[] cols = version.getColumns(); setColumnIO(version.getColumnIO()); syncColumns(version, cols, false); syncIndex(version, version.getIndex()); if (version.getStrategy() == null || version.getStrategy() instanceof SuperclassVersionStrategy) return; // explicit version strategy if: // - unmapped class and version mapped // - mapped base class // - mapped subclass that doesn't rely on superclass version String strat = version.getStrategy().getAlias(); if ((!cls.isMapped() && !NoneVersionStrategy.ALIAS.equals(strat)) || (cls.isMapped() && cls.getJoinablePCSuperclassMapping() == null)) setStrategy(strat); }
/** * Synchronize internal information with the mapping data for the given * version. */ public void syncWith(Version version) { clear(false); ClassMapping cls = version.getClassMapping(); Column[] cols = version.getColumns(); setColumnIO(version.getColumnIO()); syncColumns(version, cols, false); syncIndex(version, version.getIndex()); if (version.getStrategy() == null || version.getStrategy() instanceof SuperclassVersionStrategy) return; // explicit version strategy if: // - unmapped class and version mapped // - mapped base class // - mapped subclass that doesn't rely on superclass version String strat = version.getStrategy().getAlias(); if ((!cls.isMapped() && !NoneVersionStrategy.ALIAS.equals(strat)) || (cls.isMapped() && cls.getJoinablePCSuperclassMapping() == null)) setStrategy(strat); } }
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); if (cols == null || cols.length == 0 || !sm.isDirty() && !sm.isVersionUpdateRequired()) return; Object curVersion = sm.getVersion(); Object nextVersion = nextVersion(curVersion); Row row = rm.getRow(vers.getClassMapping().getTable(), Row.ACTION_UPDATE, sm, true); row.setFailedObject(sm.getManagedInstance()); // set where and update conditions on row for (int i = 0; i < cols.length; i++) { if (curVersion != null && sm.isVersionCheckRequired()) row.whereObject(cols[i], curVersion); if (vers.getColumnIO().isUpdatable(i, nextVersion == null)) row.setObject(cols[i], nextVersion); } if (nextVersion != null) sm.setNextVersion(nextVersion); }
/** * Setup mapping. */ private void resolveMapping() { // if there is a version field, copy mapping info from it FieldMapping fm = _mapping.getVersionFieldMapping(); if (fm != null) _info.copy(fm.getValueInfo()); // map strategy MappingRepository repos = getMappingRepository(); if (_strategy == null) repos.getStrategyInstaller().installStrategy(this); Log log = repos.getLog(); if (log.isTraceEnabled()) log.trace(_loc.get("strategy", this, _strategy.getAlias())); // mark columns as mapped Column[] cols = getColumns(); ColumnIO io = getColumnIO(); for (int i = 0; i < cols.length; i++) { if (io.isInsertable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_INSERT, true); if (io.isUpdatable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_UPDATE, true); } }
/** * Setup mapping. */ private void resolveMapping() { // if there is a version field, copy mapping info from it FieldMapping fm = _mapping.getVersionFieldMapping(); if (fm != null) _info.copy(fm.getValueInfo()); // map strategy MappingRepository repos = getMappingRepository(); if (_strategy == null) repos.getStrategyInstaller().installStrategy(this); Log log = repos.getLog(); if (log.isTraceEnabled()) log.trace(_loc.get("strategy", this, _strategy.getAlias())); // mark columns as mapped Column[] cols = getColumns(); ColumnIO io = getColumnIO(); for (int i = 0; i < cols.length; i++) { if (io.isInsertable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_INSERT, true); if (io.isUpdatable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_UPDATE, true); } }
/** * Setup mapping. */ private void resolveMapping() { // if there is a version field, copy mapping info from it FieldMapping fm = _mapping.getVersionFieldMapping(); if (fm != null) _info.copy(fm.getValueInfo()); // map strategy MappingRepository repos = getMappingRepository(); if (_strategy == null) repos.getStrategyInstaller().installStrategy(this); Log log = repos.getLog(); if (log.isTraceEnabled()) log.trace(_loc.get("strategy", this, _strategy.getAlias())); // mark columns as mapped Column[] cols = getColumns(); ColumnIO io = getColumnIO(); for (int i = 0; i < cols.length; i++) { if (io.isInsertable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_INSERT, true); if (io.isUpdatable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_UPDATE, true); } }
/** * Setup mapping. */ private void resolveMapping() { // if there is a version field, copy mapping info from it FieldMapping fm = _mapping.getVersionFieldMapping(); if (fm != null) _info.copy(fm.getValueInfo()); // map strategy MappingRepository repos = getMappingRepository(); if (_strategy == null) repos.getStrategyInstaller().installStrategy(this); Log log = repos.getLog(); if (log.isTraceEnabled()) log.trace(_loc.get("strategy", this, _strategy.getAlias())); // mark columns as mapped Column[] cols = getColumns(); ColumnIO io = getColumnIO(); for (int i = 0; i < cols.length; i++) { if (io.isInsertable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_INSERT, true); if (io.isUpdatable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_UPDATE, true); } }
/** * Setup mapping. */ private void resolveMapping() { // if there is a version field, copy mapping info from it FieldMapping fm = _mapping.getVersionFieldMapping(); if (fm != null) _info.copy(fm.getValueInfo()); // map strategy MappingRepository repos = getMappingRepository(); if (_strategy == null) repos.getStrategyInstaller().installStrategy(this); Log log = repos.getLog(); if (log.isTraceEnabled()) log.trace(_loc.get("strategy", this, _strategy.getAlias())); // mark columns as mapped Column[] cols = getColumns(); ColumnIO io = getColumnIO(); for (int i = 0; i < cols.length; i++) { if (io.isInsertable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_INSERT, true); if (io.isUpdatable(i, false)) cols[i].setFlag(Column.FLAG_DIRECT_UPDATE, true); } }
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); if (cols == null || cols.length == 0 || !sm.isDirty() && !sm.isVersionUpdateRequired()) return; Object curVersion = sm.getVersion(); Object nextVersion = nextVersion(curVersion); // set where and update conditions on row for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_UPDATE, sm, true); row.setFailedObject(sm.getManagedInstance()); if (curVersion != null && sm.isVersionCheckRequired()) { row.whereObject(cols[i], getColumnValue(curVersion, i)); if (isSecondaryColumn(cols[i], sm)) { ForeignKey[] fks = cols[i].getTable().getForeignKeys(); for (ForeignKey fk : fks) { row.whereForeignKey(fk, sm); } } } if (vers.getColumnIO().isUpdatable(i, nextVersion == null)) row.setObject(cols[i], getColumnValue(nextVersion, i)); } if (nextVersion != null) sm.setNextVersion(nextVersion); }
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); if (cols == null || cols.length == 0 || !sm.isDirty() && !sm.isVersionUpdateRequired()) return; Object curVersion = sm.getVersion(); Object nextVersion = nextVersion(curVersion); // set where and update conditions on row for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_UPDATE, sm, true); row.setFailedObject(sm.getManagedInstance()); if (curVersion != null && sm.isVersionCheckRequired()) { row.whereObject(cols[i], getColumnValue(curVersion, i)); if (isSecondaryColumn(cols[i], sm)) { ForeignKey[] fks = cols[i].getTable().getForeignKeys(); for (ForeignKey fk : fks) { row.whereForeignKey(fk, sm); } } } if (vers.getColumnIO().isUpdatable(i, nextVersion == null)) row.setObject(cols[i], getColumnValue(nextVersion, i)); } if (nextVersion != null) sm.setNextVersion(nextVersion); }
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); if (cols == null || cols.length == 0 || !sm.isDirty() && !sm.isVersionUpdateRequired()) return; Object curVersion = sm.getVersion(); Object nextVersion = nextVersion(curVersion); // set where and update conditions on row for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_UPDATE, sm, true); row.setFailedObject(sm.getManagedInstance()); if (curVersion != null && sm.isVersionCheckRequired()) { row.whereObject(cols[i], getColumnValue(curVersion, i)); if (isSecondaryColumn(cols[i], sm)) { ForeignKey[] fks = cols[i].getTable().getForeignKeys(); for (ForeignKey fk : fks) { row.whereForeignKey(fk, sm); } } } if (vers.getColumnIO().isUpdatable(i, nextVersion == null)) row.setObject(cols[i], getColumnValue(nextVersion, i)); } if (nextVersion != null) sm.setNextVersion(nextVersion); }
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException { Column[] cols = vers.getColumns(); if (cols == null || cols.length == 0 || !sm.isDirty() && !sm.isVersionUpdateRequired()) return; Object curVersion = sm.getVersion(); Object nextVersion = nextVersion(curVersion); // set where and update conditions on row for (int i = 0; i < cols.length; i++) { Row row = rm.getRow(cols[i].getTable(), Row.ACTION_UPDATE, sm, true); row.setFailedObject(sm.getManagedInstance()); if (curVersion != null && sm.isVersionCheckRequired()) { row.whereObject(cols[i], getColumnValue(curVersion, i)); if (isSecondaryColumn(cols[i], sm)) { ForeignKey[] fks = cols[i].getTable().getForeignKeys(); for (ForeignKey fk : fks) { row.whereForeignKey(fk, sm); } } } if (vers.getColumnIO().isUpdatable(i, nextVersion == null)) row.setObject(cols[i], getColumnValue(nextVersion, i)); } if (nextVersion != null) sm.setNextVersion(nextVersion); }