📄 abstractinsertnoincrementaction.java
字号:
// $Id: AbstractInsertNoAction.java $Date: 2007-10-16 上午01:49:34 $
// $Id: AbstractInsertNoAction.java $Date: 2007-10-16 上午01:49:34 $
package org.speedframework.action;
import java.util.List;
import org.speedframework.entity.ParamEntity;
import org.speedframework.exception.SpeedFrameworkException;
import org.speedframework.message.IMessage;
import org.speedframework.sql.IInsertSQL;
import org.speedframework.sql.ISelectSQL;
import org.speedframework.sql.ITableInfoSQL;
/**
* Class AbstractInsertNoAction
* 适用于并无自增字段插入后需要检索PrimaryKey字段返回
* @author <a href="mailto:santafeng@gmail.com"> lizf </a>
* @version $Revision:1.0.0, $Date: 2007-10-16 上午01:49:34 $
*/
public class AbstractInsertNoIncrementAction extends AbstractAction implements IInsertAction {
/* (非 Javadoc)
* @see org.speedframework.action.IAction#doAction(org.speedframework.message.IMessage)
*/
public void doAction(IMessage message) {
log.debug("Speed engine is Add...");
String isql;
ParamEntity entity = message.getParamEntity();
Object pojo = entity.getEntity();
try {
String[] columnCache = columnInfoCache.getColumnInfos(pojo);
if (columnCache == null) {
ITableInfoSQL tOffer=this.factory.getTableInfoSQL();
tOffer.setTableObject(pojo);
String SQL = tOffer.getSQL();
this.columnInfoCache.putColumnInfo(pojo, this.executor.select(
SQL, null));
}
IInsertSQL iOffer = factory.getInsertSQL();
iOffer.setTableObject(pojo);
isql = iOffer.getSQL();
// this.executor.setFactory(factory);
List paramName = iOffer.getParam(isql);
String[][] columnType = columnInfoCache.getColumnInfoType(pojo,
paramName);
executor.insert(isql, columnType, pojo);
ISelectSQL sOffer=factory.getSelectSQL();
sOffer.setTableObject(pojo);
String _sql = sOffer.getSQL(
columnInfoCache.getPrimaryKeyColumnInfos(pojo));
List list = this.executor.select(_sql, pojo, pojo.getClass());
resultCache.removeCache(pojo, this.useCache);
this.result = list.get(0);
} catch (Exception e) {
throw new SpeedFrameworkException("OracleInsertAction error " + e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -