use of org.dbflute.s2dao.metadata.TnBeanMetaData in project dbflute-core by dbflute.
the class TnAbstractEntityDynamicCommand method setupUpdateWhere.
protected void setupUpdateWhere(StringBuilder sb, Set<String> uniqueDrivenPropSet, boolean optimisticLockHandling) {
final TnBeanMetaData bmd = _beanMetaData;
sb.append(" where ");
prepareWherePrimaryKey(sb, uniqueDrivenPropSet);
if (optimisticLockHandling && bmd.hasVersionNoPropertyType()) {
final TnPropertyType pt = bmd.getVersionNoPropertyType();
sb.append(" and ").append(pt.getColumnSqlName()).append(" = ?");
}
if (optimisticLockHandling && bmd.hasTimestampPropertyType()) {
final TnPropertyType pt = bmd.getTimestampPropertyType();
sb.append(" and ").append(pt.getColumnSqlName()).append(" = ?");
}
}
use of org.dbflute.s2dao.metadata.TnBeanMetaData in project dbflute-core by dbflute.
the class TnInsertEntityDynamicCommand method execute.
// ===================================================================================
// Execute
// =======
public Object execute(Object[] args) {
final Object bean = extractBeanFromArgsChecked(args);
final InsertOption<ConditionBean> option = extractInsertOptionChecked(args);
prepareStatementConfigOnThreadIfExists(option);
final TnBeanMetaData bmd = _beanMetaData;
final TnPropertyType[] propertyTypes = createInsertPropertyTypes(bmd, bean, _propertyNames, option);
final String sql = filterExecutedSql(createInsertSql(bmd, propertyTypes, option));
return doExecute(bean, propertyTypes, sql, option);
}
use of org.dbflute.s2dao.metadata.TnBeanMetaData in project dbflute-core by dbflute.
the class TnAbstractEntityHandler method doSetupUpdateWhereBindVariables.
protected void doSetupUpdateWhereBindVariables(List<Object> varList, List<ValueType> varValueTypeList, Object bean, Set<String> uniqueDrivenPropSet) {
final TnBeanMetaData bmd = getBeanMetaData();
if (uniqueDrivenPropSet != null && !uniqueDrivenPropSet.isEmpty()) {
for (String uniqueProp : uniqueDrivenPropSet) {
final TnPropertyType pt = bmd.getPropertyType(uniqueProp);
doRegisterUpdateWhereBindVariable(varList, varValueTypeList, bean, pt);
}
} else {
for (int i = 0; i < bmd.getPrimaryKeySize(); ++i) {
final TnPropertyType pt = bmd.getPropertyTypeByColumnName(bmd.getPrimaryKeyDbName(i));
doRegisterUpdateWhereBindVariable(varList, varValueTypeList, bean, pt);
}
}
if (_optimisticLockHandling && bmd.hasVersionNoPropertyType()) {
final TnPropertyType pt = bmd.getVersionNoPropertyType();
doRegisterUpdateWhereBindVariable(varList, varValueTypeList, bean, pt);
}
if (_optimisticLockHandling && bmd.hasTimestampPropertyType()) {
final TnPropertyType pt = bmd.getTimestampPropertyType();
doRegisterUpdateWhereBindVariable(varList, varValueTypeList, bean, pt);
}
}
use of org.dbflute.s2dao.metadata.TnBeanMetaData in project dbflute-core by dbflute.
the class TnRelationRowCreatorExtension method setupPropertyCache.
// ===================================================================================
// Property Cache Setup
// ====================
@Override
protected void setupPropertyCache(TnRelationRowCreationResource res) throws SQLException {
// - - - - - - - - - - -
if (res.isStopCurrentRelationMapping()) {
return;
}
// set up property cache about current bean meta data
final TnBeanMetaData nextBmd = res.getRelationBeanMetaData();
final List<TnPropertyType> ptList = nextBmd.getPropertyTypeList();
for (TnPropertyType pt : ptList) {
// already been filtered as target only
res.setCurrentPropertyType(pt);
setupPropertyCacheElement(res);
}
// set up next level relation's property cache
if (res.isStopNextRelationMapping()) {
return;
}
res.prepareNextLevelMapping();
try {
setupNextPropertyCache(res, nextBmd);
} finally {
res.closeNextLevelMapping();
}
}
use of org.dbflute.s2dao.metadata.TnBeanMetaData in project dbflute-core by dbflute.
the class TnRelationRowCreatorExtension method setupNextRelationRow.
// -----------------------------------------------------
// Next Relation
// -------------
protected void setupNextRelationRow(TnRelationRowCreationResource res) throws SQLException {
final TnBeanMetaData nextBmd = res.getRelationBeanMetaData();
final Object row = res.getRow();
res.prepareNextLevelMapping();
try {
final List<TnRelationPropertyType> nextRptList = nextBmd.getRelationPropertyTypeList();
for (TnRelationPropertyType nextRpt : nextRptList) {
setupNextRelationRowElement(res, row, nextRpt);
}
} finally {
res.setRow(row);
res.closeNextLevelMapping();
}
}
Aggregations