package jp.sourceforge.ea2ddl.dao.bsbhv;\r
\r
-\r
import java.util.List;\r
\r
+import org.seasar.dbflute.*;\r
+import org.seasar.dbflute.cbean.ConditionBean;\r
+import org.seasar.dbflute.cbean.EntityRowHandler;\r
+import org.seasar.dbflute.cbean.ListResultBean;\r
+import org.seasar.dbflute.cbean.PagingBean;\r
+import org.seasar.dbflute.cbean.PagingHandler;\r
+import org.seasar.dbflute.cbean.PagingInvoker;\r
+import org.seasar.dbflute.cbean.PagingResultBean;\r
+import org.seasar.dbflute.cbean.ResultBeanBuilder;\r
+import org.seasar.dbflute.dbmeta.DBMeta;\r
+import org.seasar.dbflute.jdbc.StatementConfig;\r
import jp.sourceforge.ea2ddl.dao.allcommon.*;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.bhv.setup.ValueLabelSetupper;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.cbean.ConditionBean;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.cbean.ListResultBean;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.cbean.ResultBeanBuilder;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingHandler;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingInvoker;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingBean;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.cbean.PagingResultBean;\r
-import jp.sourceforge.ea2ddl.dao.allcommon.dbmeta.DBMeta;\r
-import jp.sourceforge.ea2ddl.dao.exdao.*;\r
import jp.sourceforge.ea2ddl.dao.exentity.*;\r
import jp.sourceforge.ea2ddl.dao.bsentity.dbmeta.*;\r
import jp.sourceforge.ea2ddl.dao.cbean.*;\r
\r
-\r
/**\r
- * The behavior of t_implement.\r
+ * The behavior of t_implement that the type is TABLE. <br />\r
* <pre>\r
* [primary-key]\r
* \r
* </pre>\r
* @author DBFlute(AutoGenerator)\r
*/\r
-public abstract class BsTImplementBhv extends jp.sourceforge.ea2ddl.dao.allcommon.bhv.AbstractBehaviorReadable {\r
+public abstract class BsTImplementBhv extends org.seasar.dbflute.bhv.AbstractBehaviorReadable {\r
\r
// ===================================================================================\r
// Definition\r
/*df:BehaviorQueryPathEnd*/\r
\r
// ===================================================================================\r
- // Attribute\r
- // =========\r
- protected TImplementDao _dao;\r
-\r
- // ===================================================================================\r
// Table name\r
// ==========\r
/** @return The name on database of table. (NotNull) */\r
// ===================================================================================\r
// DBMeta\r
// ======\r
- /** @return The meta data of the database. (NotNull) */\r
+ /** @return The instance of DBMeta. (NotNull) */\r
public DBMeta getDBMeta() { return TImplementDbm.getInstance(); }\r
\r
- /** @return The meta data of the database as my table type. (NotNull) */\r
+ /** @return The instance of DBMeta as my table type. (NotNull) */\r
public TImplementDbm getMyDBMeta() { return TImplementDbm.getInstance(); }\r
\r
// ===================================================================================\r
- // Dao Accessor\r
- // ============\r
- public TImplementDao getMyDao() { return _dao; }\r
- public void setMyDao(TImplementDao dao) { assertObjectNotNull("dao", dao); _dao = dao; }\r
- public DaoReadable getDaoReadable() { return getMyDao(); }\r
-\r
- // ===================================================================================\r
// New Instance\r
// ============\r
public Entity newEntity() { return newMyEntity(); }\r
public TImplementCB newMyConditionBean() { return new TImplementCB(); }\r
\r
// ===================================================================================\r
+ // Current DBDef\r
+ // =============\r
+ @Override\r
+ protected DBDef getCurrentDBDef() {\r
+ return DBCurrent.getInstance().currentDBDef();\r
+ }\r
+\r
+ // ===================================================================================\r
+ // Default StatementConfig\r
+ // =======================\r
+ @Override\r
+ protected StatementConfig getDefaultStatementConfig() {\r
+ return DBFluteConfig.getInstance().getDefaultStatementConfig();\r
+ }\r
+ \r
+ // ===================================================================================\r
// Count Select\r
// ============\r
/**\r
- * Select the count of the condition-bean. {IgnorePagingCondition}\r
+ * Select the count by the condition-bean. {IgnorePagingCondition}\r
* @param cb The condition-bean of TImplement. (NotNull)\r
* @return The selected count.\r
*/\r
public int selectCount(TImplementCB cb) {\r
- assertConditionBeanNotNull(cb);\r
+ assertCBNotNull(cb);\r
return delegateSelectCount(cb);\r
}\r
+ \r
+ // ===================================================================================\r
+ // Cursor Select\r
+ // =============\r
+ /**\r
+ * Select the cursor by the condition-bean. <br />\r
+ * Attention: It has a mapping cost from result set to entity.\r
+ * @param cb The condition-bean of TImplement. (NotNull)\r
+ * @param entityRowHandler The handler of entity row of TImplement. (NotNull)\r
+ */\r
+ public void selectCursor(TImplementCB cb, EntityRowHandler<TImplement> entityRowHandler) {\r
+ assertCBNotNull(cb); assertObjectNotNull("entityRowHandler<TImplement>", entityRowHandler);\r
+ delegateSelectCursor(cb, entityRowHandler);\r
+ }\r
\r
// ===================================================================================\r
// Entity Select\r
* Select the entity by the condition-bean.\r
* @param cb The condition-bean of TImplement. (NotNull)\r
* @return The selected entity. (Nullalble)\r
- * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.\r
+ * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.\r
*/\r
public TImplement selectEntity(final TImplementCB cb) {\r
return helpSelectEntityInternally(cb, new InternalSelectEntityCallback<TImplement, TImplementCB>() {\r
* Select the entity by the condition-bean with deleted check.\r
* @param cb The condition-bean of TImplement. (NotNull)\r
* @return The selected entity. (NotNull)\r
- * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityAlreadyDeletedException When the entity has already been deleted.\r
- * @exception jp.sourceforge.ea2ddl.dao.allcommon.exception.EntityDuplicatedException When the entity has been duplicated.\r
+ * @exception org.seasar.dbflute.exception.EntityAlreadyDeletedException When the entity has already been deleted.\r
+ * @exception org.seasar.dbflute.exception.EntityDuplicatedException When the entity has been duplicated.\r
*/\r
public TImplement selectEntityWithDeletedCheck(final TImplementCB cb) {\r
return helpSelectEntityWithDeletedCheckInternally(cb, new InternalSelectEntityWithDeletedCheckCallback<TImplement, TImplementCB>() {\r
* @return The result bean of selected list. (NotNull)\r
*/\r
public ListResultBean<TImplement> selectList(TImplementCB cb) {\r
- assertConditionBeanNotNull(cb);\r
+ assertCBNotNull(cb);\r
return new ResultBeanBuilder<TImplement>(getTableDbName()).buildListResultBean(cb, delegateSelectList(cb));\r
}\r
\r
* @return The result bean of selected page. (NotNull)\r
*/\r
public PagingResultBean<TImplement> selectPage(final TImplementCB cb) {\r
- assertConditionBeanNotNull(cb);\r
+ assertCBNotNull(cb);\r
final PagingInvoker<TImplement> invoker = new PagingInvoker<TImplement>(getTableDbName());\r
final PagingHandler<TImplement> handler = new PagingHandler<TImplement>() {\r
public PagingBean getPagingBean() { return cb; }\r
}\r
\r
// ===================================================================================\r
- // Various Select\r
- // ==============\r
+ // Scalar Select\r
+ // =============\r
/**\r
- * Select the list of value-label.\r
- * @param cb The condition-bean of TImplement. (NotNull)\r
- * @param valueLabelSetupper The setupper of value-label. (NotNull)\r
- * @return The list of value-label. (NotNull)\r
+ * Select the scalar value derived by a function. <br />\r
+ * Call a function method after this method called like as follows:\r
+ * <pre>\r
+ * tImplementBhv.scalarSelect(Date.class).max(new ScalarQuery(TImplementCB cb) {\r
+ * cb.specify().columnXxxDatetime(); // the required specification of target column\r
+ * cb.query().setXxxName_PrefixSearch("S"); // query as you like it\r
+ * });\r
+ * </pre>\r
+ * @param <RESULT> The type of result.\r
+ * @param resultType The type of result. (NotNull)\r
+ * @return The scalar value derived by a function. (Nullable)\r
*/\r
- public List<java.util.Map<String, Object>> selectValueLabelList(TImplementCB cb, ValueLabelSetupper<TImplement> valueLabelSetupper) {\r
- return createValueLabelList(selectList(cb), valueLabelSetupper);\r
+ public <RESULT> SLFunction<TImplementCB, RESULT> scalarSelect(Class<RESULT> resultType) {\r
+ TImplementCB cb = newMyConditionBean();\r
+ cb.xsetupForScalarSelect();\r
+ cb.getSqlClause().disableSelectIndex(); // for when you use union\r
+ return new SLFunction<TImplementCB, RESULT>(cb, resultType);\r
}\r
-\r
-\r
-\r
// ===================================================================================\r
- // Pullout Foreign\r
- // ===============\r
- \r
+ // Pull out Foreign\r
+ // ================\r
+ \r
// ===================================================================================\r
// Delegate Method\r
// ===============\r
+ // [Behavior Command]\r
// -----------------------------------------------------\r
// Select\r
// ------\r
- protected int delegateSelectCount(TImplementCB cb) { assertConditionBeanNotNull(cb); return getMyDao().selectCount(cb); }\r
- protected List<TImplement> delegateSelectList(TImplementCB cb) { assertConditionBeanNotNull(cb); return getMyDao().selectList(cb); }\r
+ protected int delegateSelectCount(TImplementCB cb) { return invoke(createSelectCountCBCommand(cb)); }\r
+ protected void delegateSelectCursor(TImplementCB cb, EntityRowHandler<TImplement> entityRowHandler)\r
+ { invoke(createSelectCursorCBCommand(cb, entityRowHandler, TImplement.class)); }\r
+ protected int doCallReadCount(ConditionBean cb) { return delegateSelectCount((TImplementCB)cb); }\r
+ protected List<TImplement> delegateSelectList(TImplementCB cb)\r
+ { return invoke(createSelectListCBCommand(cb, TImplement.class)); }\r
+ @SuppressWarnings("unchecked")\r
+ protected List<Entity> doCallReadList(ConditionBean cb) { return (List)delegateSelectList((TImplementCB)cb); }\r
\r
// ===================================================================================\r
// Optimistic Lock Info\r