[pal-cvs 2497] [229] added mydbflute

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 7月 10日 (火) 22:25:28 JST


Revision: 229
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=229
Author:   takeharu
Date:     2007-07-10 22:21:18 +0900 (Tue, 10 Jul 2007)

Log Message:
-----------
added mydbflute

Added Paths:
-----------
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/Control.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/CacheDaoSelector.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/ClassificationDefinition.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoDicon.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoReadable.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoSelector.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoWritable.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/Entity.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/EntityDefinedCommonColumn.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/GenMetaData.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/annotation/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/annotation/OutsideSql.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorReadable.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorWritable.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorReadable.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorWritable.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionQuery.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBeanContext.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionQuery.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBeanContext.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ListResultBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/OrderByBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingResultBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SelectResource.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimpleOrderByBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimplePagingBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_equal.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterEqual.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterThan.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_inScope.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNotNull.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNull.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessEqual.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessThan.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notEqual.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notInScope.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_prefixSearch.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/cvalue/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/cvalue/ConditionValue.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/AbstractSqlClause.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByClause.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByElement.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_db2.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_default.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_derby.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_firebird.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_interbase.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mssql.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mysql.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_oracle.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_postgresql.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/AbstractDBMeta.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMeta.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMetaInstanceHandler.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/DaoExceptionContext.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasAlreadyBeenDeletedException.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasOverlappedException.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/SelectedCountExceedMaxCountException.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListString.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListStringImpl.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilder.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilderImpl.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetFactory.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetWrapper.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoInterceptor.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataExtension.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoSelectDynamicCommand.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhv.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhvImpl.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BaseDao.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BsParameterBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/customize/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/customize/BaseCustomizeDao.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/BaseEntity.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/PlainBaseEntity.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/dbmeta/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/dbmeta/DBMetaImpl.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/AbstractBsConditionQuery.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionInlineQuery.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionQuery.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionQuery.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/NestSelectSetupper.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhv.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhvImpl.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExParameterBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExtendedDao.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exentity/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exentity/ExtendedEntity.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/ArgumentBean.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanBs.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanEx.vmnet
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/AccessContext.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/CacheDaoSelector.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/ClassificationDefinition.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoDicon.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoReadable.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoSelector.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoWritable.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/Entity.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/EntityDefinedCommonColumn.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/GenMetaData.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/annotation/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/annotation/OutsideSql.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorReadable.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorWritable.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorReadable.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorWritable.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputResult.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionFailure.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionResult.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/load/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/load/LoadRefererOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ConditionBeanSetupper.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/EntityListSetupper.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelBox.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelSetupper.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionQuery.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBeanContext.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionQuery.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBeanContext.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ListResultBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/OrderByBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingResultBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SelectResource.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimpleOrderByBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimplePagingBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_equal.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterEqual.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterThan.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_inScope.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNotNull.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNull.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessEqual.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessThan.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_likeSearch.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notEqual.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notInScope.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_prefixSearch.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/ConditionOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/FromToOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/InScopeOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/LikeSearchOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/SimpleStringOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/SplitOptionParts.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToSingleByteOptionParts.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToUpperLowerCaseOptionParts.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/local/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/local/JapaneseOptionPartsAgent.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/cvalue/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/cvalue/ConditionValue.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowEndDeterminer.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowResource.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowSetupper.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/mapping/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/mapping/EntityDtoMapper.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/AbstractSqlClause.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByClause.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByElement.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_db2.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_default.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_derby.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_firebird.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_interbase.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mssql.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mysql.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_oracle.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_postgresql.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/AbstractDBMeta.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMeta.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMetaInstanceHandler.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/DaoExceptionContext.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasAlreadyBeenDeletedException.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasOverlappedException.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/SelectedCountExceedMaxCountException.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListString.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListStringImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilder.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilderImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/GeneralCharacter.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/JapaneseCharacter.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/GeneralCharacterImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/JapaneseCharacterImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingCallback.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingHeaderInfo.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingRowResource.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingSimpleFacade.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileToken.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingCallback.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingHeaderInfo.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingRowResource.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileMakingSimpleFacadeImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileTokenImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineMakingOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineToken.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineTokenizingOption.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/impl/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/impl/LineTokenImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedExecutionBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedParameterElement.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistory.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistoryWitness.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/TraceablePreparedStatement.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetFactory.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetWrapper.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2BeanMetaDataFactoryImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoInterceptor.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataExtension.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoSelectDynamicCommand.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoStatementFactory.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/history/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsbhv/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsbhv/BaseBhv.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BaseDao.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BsParameterBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/customize/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/customize/BaseCustomizeDao.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/BaseEntity.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/PlainBaseEntity.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/dbmeta/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/dbmeta/DBMetaImpl.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/AbstractBsConditionQuery.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionInlineQuery.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionQuery.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionQuery.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/NestSelectSetupper.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exbhv/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exbhv/ExtendedBhv.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExParameterBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExtendedDao.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exentity/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exentity/ExtendedEntity.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/ArgumentBean.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanBs.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanEx.vm
    pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/sql2entity-Control.vm


-------------- next part --------------
Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/Control.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/Control.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/Control.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,1457 @@
+
+
+targetdatabase = $targetDatabase
+
+##
+## Loop by data-model.
+##
+#foreach ($dataModel in $dataModels)
+
+  ##
+  ## Loop by database.
+  ##
+  #foreach ($database in $dataModel.Databases)
+
+    ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+    ## Initialize CustomizeDao and AdditionalForeignKey and ClassificationDeployment and IncludeQuery.
+    ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+    ${database.initializeCustomizeDao()}
+    ${database.initializeAdditionalForeignKey()}
+    ${database.initializeClassificationDeployment()}
+    ${database.initializeIncludeQuery()}
+
+    ## *****************************************************************************************************************
+    ##                                                                                                   Global Paramter
+    ##                                                                                                   ***************
+    ## ===================================================================================
+    ##                                                                            Language
+    ##                                                                            ========
+    #set ($glTargetLanguage = ${database.targetLanguage})
+
+    ## ===================================================================================
+    ##                                                                           Extension
+    ##                                                                           =========
+    #set ($glTemplateFileExtension = ${database.templateFileExtension})
+    #set ($glClassFileExtension = ${database.classFileExtension})
+
+    ## -----------------------------------------------------
+    ##                                                Prefix
+    ##                                                ------
+    #set ($glProjectPrefix = ${database.projectPrefix})
+    #set ($glBasePrefix = ${database.basePrefix})
+    #set ($glBaseSuffixForEntity = ${database.baseSuffixForEntity})
+
+    ## -----------------------------------------------------
+    ##                                                 Dicon
+    ##                                                 -----
+    #set ($glDaoDiconNamespace = "${database.daoDiconNamespace}")
+    #set ($glDaoDiconFileName = "${database.daoDiconFileName}")
+    #set ($glJdbcDiconResourceName = "${database.jdbcDiconResourceName}")
+
+    ## -----------------------------------------------------
+    ##                                            Class Name
+    ##                                            ----------
+    ## [Allcommon-Base-AccessContext]
+    #set ($glAccessContextName = "${glProjectPrefix}AccessContext")
+
+    ## [Allcommon-Base-Dao]
+    #set ($glDaoReadableInterfaceName = "${glProjectPrefix}DaoReadable")
+    #set ($glDaoWritableInterfaceName = "${glProjectPrefix}DaoWritable")
+
+    ## [Allcommon-Base-Entity]
+    #set ($glEntityInterfaceName = "${glProjectPrefix}Entity")
+    #set ($glEntityDefinedCommonColumnInterfaceName = "${glProjectPrefix}EntityDefinedCommonColumn")
+
+    ## [Allcommon-Base-DaoSelector]
+    #set ($glDaoSelectorInterfaceName = "${glProjectPrefix}DaoSelector")
+    #set ($glCacheDaoSelectorName = "${glProjectPrefix}CacheDaoSelector")
+
+    ## [Allcommon-Base-GenMetaData]
+    #set ($glGenMetaDataClassName = "${glProjectPrefix}GenMetaData")
+
+    ## [Allcommon-Base-ClassificationDefinition]
+    #set ($glClassificationDefinition = "${glProjectPrefix}ClassificationDefinition")
+
+    ## [Allcommon-Behavior]
+    #set ($glBehaviorReadableAbstractName = "${glProjectPrefix}AbstractBehaviorReadable")
+    #set ($glBehaviorWritableAbstractName = "${glProjectPrefix}AbstractBehaviorWritable")
+    #set ($glBehaviorReadableInterfaceName = "${glProjectPrefix}BehaviorReadable")
+    #set ($glBehaviorWritableInterfaceName = "${glProjectPrefix}BehaviorWritable")
+
+    ## [Allcommon-Behavior-Batch]
+    #set ($glTokenFileReflectionOptionName = "${glProjectPrefix}TokenFileReflectionOption")
+    #set ($glTokenFileReflectionResultName = "${glProjectPrefix}TokenFileReflectionResult")
+    #set ($glTokenFileReflectionFailureName = "${glProjectPrefix}TokenFileReflectionFailure")
+    #set ($glTokenFileOutputOptionName = "${glProjectPrefix}TokenFileOutputOption")
+    #set ($glTokenFileOutputResultName = "${glProjectPrefix}TokenFileOutputResult")
+
+    ## [Allcommon-Behavior-Load]
+    #set ($glLoadRefererOptionName = "${glProjectPrefix}LoadRefererOption")
+
+    ## [Allcommon-Behavior-Setup]
+    #set ($glConditionBeanSetupperName = "${glProjectPrefix}ConditionBeanSetupper")
+    #set ($glEntityListSetupperName = "${glProjectPrefix}EntityListSetupper")
+    #set ($glValueLabelSetupperName = "${glProjectPrefix}ValueLabelSetupper")
+    #set ($glValueLabelBoxName = "${glProjectPrefix}ValueLabelBox")
+
+    ## [Allcommon-ConditionBean]
+    #set ($glFetchNarrowingBeanInterfaceName = "${glProjectPrefix}FetchNarrowingBean")
+    #set ($glSimplePagingBeanName = "${glProjectPrefix}SimplePagingBean")
+    #set ($glSimpleOrderByBeanName = "${glProjectPrefix}SimpleOrderByBean")
+    #set ($glConditionBeanInterfaceName = "${glProjectPrefix}ConditionBean")
+    #set ($glConditionQueryInterfaceName = "${glProjectPrefix}ConditionQuery")
+    #set ($glOrderByBeanInterfaceName = "${glProjectPrefix}OrderByBean")
+    #set ($glPagingBeanInterfaceName = "${glProjectPrefix}PagingBean")
+    #set ($glSelectResourceInterfaceName = "${glProjectPrefix}SelectResource")
+    #set ($glFetchNarrowingBeanContextName = "${glProjectPrefix}FetchNarrowingBeanContext")
+    #set ($glPagingResultBeanName = "${glProjectPrefix}PagingResultBean")
+    #set ($glListResultBeanName = "${glProjectPrefix}ListResultBean")
+    #set ($glConditionBeanContextName = "${glProjectPrefix}ConditionBeanContext")
+    #set ($glConditionBeanAbstractName = "${glProjectPrefix}AbstractConditionBean")
+    #set ($glConditionQueryAbstractName = "${glProjectPrefix}AbstractConditionQuery")
+    #set ($glConditionKeyName = "${glProjectPrefix}ConditionKey")
+    #set ($glConditionValueName = "${glProjectPrefix}ConditionValue")
+
+    ## [Allcommon-ConditionBean-Option]
+    #set ($glConditionOptionInterfaceName = "${glProjectPrefix}ConditionOption")
+    #set ($glConditionOptionSimpleStringName = "${glProjectPrefix}SimpleStringOption")
+    #set ($glConditionOptionFromToName = "${glProjectPrefix}FromToOption")
+    #set ($glConditionOptionLikeSearchName = "${glProjectPrefix}LikeSearchOption")
+    #set ($glConditionOptionInScopeName = "${glProjectPrefix}InScopeOption")
+    #set ($glConditionOptionPartsSplitName = "${glProjectPrefix}SplitOptionParts")
+    #set ($glConditionOptionPartsToUpperLowerCaseName = "${glProjectPrefix}ToUpperLowerCaseOptionParts")
+    #set ($glConditionOptionPartsToSingleByteName = "${glProjectPrefix}ToSingleByteOptionParts")
+    #set ($glConditionOptionPartsAgentJapaneseName = "${glProjectPrefix}JapaneseOptionPartsAgent")
+
+    ## [Allcommon-ConditionBean-Grouping]
+    #set ($glGroupingOptionName = "${glProjectPrefix}GroupingOption")
+    #set ($glGroupingRowEndDeterminerName = "${glProjectPrefix}GroupingRowEndDeterminer")
+    #set ($glGroupingRowResourceName = "${glProjectPrefix}GroupingRowResource")
+    #set ($glGroupingRowSetupperName = "${glProjectPrefix}GroupingRowSetupper")
+
+    ## [Allcommon-ConditionBean-Mapping]
+    #set ($glEntityDtoMapperName = "${glProjectPrefix}EntityDtoMapper")
+
+    ## [Allcommon-ConditionBean-SqlClause]
+    #set ($glSqlClauseName = "${glProjectPrefix}SqlClause")
+    #set ($glSqlClauseInterfaceName = "${glProjectPrefix}SqlClause")
+    #set ($glSqlClauseAbstractName = "${glProjectPrefix}AbstractSqlClause")
+    #set ($glOrderByClauseName = "${glProjectPrefix}OrderByClause")
+    #set ($glOrderByElementName = "${glProjectPrefix}OrderByElement")
+
+    ## [Allcommon-DBMeta]
+    #set ($glDBMetaInterfaceName = "${glProjectPrefix}DBMeta")
+    #set ($glDBMetaAbstractName = "${glProjectPrefix}AbstractDBMeta")
+    #set ($glDBMetaInstanceHandlerName = "${glProjectPrefix}DBMetaInstanceHandler")
+
+    ## [Allcommon-Exception]
+    #set ($glDaoExceptionContextName = "${glProjectPrefix}DaoExceptionContext")
+    #set ($glRecordHasOverlappedException = "${glProjectPrefix}RecordHasOverlappedException")
+    #set ($glRecordHasAlreadyBeenDeletedException = "${glProjectPrefix}RecordHasAlreadyBeenDeletedException")
+    #set ($glSelectedCountExceedMaxCountExceptionName = "${glProjectPrefix}SelectedCountExceedMaxCountException")
+
+    ## [Allcommon-Helper]
+    #set ($glMapListStringName = "${glProjectPrefix}MapListString")
+    #set ($glMapListStringImplName = "${glProjectPrefix}MapListStringImpl")
+    #set ($glMapStringBuilderName = "${glProjectPrefix}MapStringBuilder")
+    #set ($glMapStringBuilderImplName = "${glProjectPrefix}MapStringBuilderImpl")
+
+    #set ($glGeneralCharacterName = "${glProjectPrefix}GeneralCharacter")
+    #set ($glGeneralCharacterImplName = "${glProjectPrefix}GeneralCharacterImpl")
+
+    #set ($glJapaneseCharacterName = "${glProjectPrefix}JapaneseCharacter")
+    #set ($glJapaneseCharacterImplName = "${glProjectPrefix}JapaneseCharacterImpl")
+
+    #set ($glLineTokenName = "${glProjectPrefix}LineToken")
+    #set ($glLineTokenImplName = "${glProjectPrefix}LineTokenImpl")
+    #set ($glLineTokenizingOptionName = "${glProjectPrefix}LineTokenizingOption")
+    #set ($glLineMakingOptionName = "${glProjectPrefix}LineMakingOption")
+
+    #set ($glFileTokenName = "${glProjectPrefix}FileToken")
+    #set ($glFileTokenImplName = "${glProjectPrefix}FileTokenImpl")
+
+    #set ($glFileTokenizingOptionName = "${glProjectPrefix}FileTokenizingOption")
+    #set ($glFileTokenizingRowResourceName = "${glProjectPrefix}FileTokenizingRowResource")
+    #set ($glFileTokenizingCallbackName = "${glProjectPrefix}FileTokenizingCallback")
+    #set ($glFileTokenizingHeaderInfoName = "${glProjectPrefix}FileTokenizingHeaderInfo")
+
+    #set ($glFileMakingOptionName = "${glProjectPrefix}FileMakingOption")
+    #set ($glFileMakingRowResourceName = "${glProjectPrefix}FileMakingRowResource")
+    #set ($glFileMakingCallbackName = "${glProjectPrefix}FileMakingCallback")
+    #set ($glFileMakingHeaderInfoName = "${glProjectPrefix}FileMakingHeaderInfo")
+    #set ($glFileMakingSimpleFacadeName = "${glProjectPrefix}FileMakingSimpleFacade")
+    #set ($glFileMakingSimpleFacadeImplName = "${glProjectPrefix}FileMakingSimpleFacadeImpl")
+
+    ## [Allcommon-Interceptor]
+    #set ($glCommonColumnSetupAbstractInterceptor = "${glProjectPrefix}CommonColumnSetupAbstractInterceptor")
+    #set ($glCommonColumnSetupBeforeInsertInterceptor = "${glProjectPrefix}CommonColumnSetupBeforeInsertInterceptor")
+    #set ($glCommonColumnSetupBeforeUpdateInterceptor = "${glProjectPrefix}CommonColumnSetupBeforeUpdateInterceptor")
+    #set ($glCommonColumnSetupBeforeDeleteInterceptor = "${glProjectPrefix}CommonColumnSetupBeforeDeleteInterceptor")
+
+    ## [Allcommon-JDBC-History]
+    #set ($glPreparedExecutionBeanName = "${glProjectPrefix}PreparedExecutionBean")
+    #set ($glPreparedParameterElementName = "${glProjectPrefix}PreparedParameterElement")
+    #set ($glStatementHistoryName = "${glProjectPrefix}StatementHistory")
+    #set ($glStatementHistoryWitnessName = "${glProjectPrefix}StatementHistoryWitness")
+    #set ($glTraceablePreparedStatementName = "${glProjectPrefix}TraceablePreparedStatement")
+
+    ## [Allcommon-S2Dao]
+    #set ($glSelectDynamicCommand = "${glProjectPrefix}S2DaoSelectDynamicCommand")
+    #set ($glDaoInterceptor = "${glProjectPrefix}S2DaoInterceptor")
+    #set ($glDaoMetaDataExtension = "${glProjectPrefix}S2DaoMetaDataExtension")
+    #set ($glDaoMetaDataFactoryImpl = "${glProjectPrefix}S2DaoMetaDataFactoryImpl")
+    #set ($glBeanMetaDataFactoryImpl = "${glProjectPrefix}S2BeanMetaDataFactoryImpl")
+    #set ($glDaoStatementFactory = "${glProjectPrefix}S2DaoStatementFactory")
+    #set ($glFetchNarrowingResultSetFactory = "${glProjectPrefix}FetchNarrowingResultSetFactory")
+    #set ($glFetchNarrowingResultSetWrapper = "${glProjectPrefix}FetchNarrowingResultSetWrapper")
+    #set ($glOutsideSqlAnnotation = "OutsideSql")
+
+    ## -----------------------------------------------------
+    ##                                         Variable Name
+    ##                                         -------------
+    #set ($glConditionBeanInitialName = "CB")
+    #set ($glConditionQueryInitialName = "CQ")
+    #set ($glAttachedCBArgsVariableName = "cb")
+    #set ($glParentVariablePrefix = "_parent")
+    #set ($glChildrenVariablePrefix = "_children")
+
+    ## -----------------------------------------------------
+    ##                                          Package Name
+    ##                                          ------------
+    ## [Common]
+    #set ($glPackageBaseCommon = "${database.baseCommonPackage}")
+    #set ($glPackageBaseCommonAnnotation = "${database.baseCommonPackage}.annotation")
+    #set ($glPackageBaseCommonBhv = "${database.baseCommonPackage}.bhv")
+    #set ($glPackageBaseCommonBhvBatch = "${database.baseCommonPackage}.bhv.batch")
+    #set ($glPackageBaseCommonBhvLoad = "${database.baseCommonPackage}.bhv.load")
+    #set ($glPackageBaseCommonBhvSetup = "${database.baseCommonPackage}.bhv.setup")
+    #set ($glPackageBaseCommonCBean = "${database.baseCommonPackage}.cbean")
+    #set ($glPackageBaseCommonCKey = "${database.baseCommonPackage}.cbean.ckey")
+    #set ($glPackageBaseCommonCBeanMapping = "${database.baseCommonPackage}.cbean.mapping")
+    #set ($glPackageBaseCommonCBeanGrouping = "${database.baseCommonPackage}.cbean.grouping")
+    #set ($glPackageBaseCommonSqlClause = "${database.baseCommonPackage}.cbean.sqlclause")
+    #set ($glPackageBaseCommonCValue = "${database.baseCommonPackage}.cbean.cvalue")
+    #set ($glPackageBaseCommonCOption = "${database.baseCommonPackage}.cbean.coption")
+    #set ($glPackageBaseCommonCOptionParts = "${database.baseCommonPackage}.cbean.coption.parts")
+    #set ($glPackageBaseCommonCOptionPartsLocal = "${database.baseCommonPackage}.cbean.coption.parts.local")
+    #set ($glPackageBaseCommonDBMeta = "${database.baseCommonPackage}.dbmeta")
+    #set ($glPackageBaseCommonException = "${database.baseCommonPackage}.exception")
+    #set ($glPackageBaseCommonHelper = "${database.baseCommonPackage}.helper")
+    #set ($glPackageBaseCommonHelperCharacter = "${database.baseCommonPackage}.helper.character")
+    #set ($glPackageBaseCommonHelperCharacterImpl = "${database.baseCommonPackage}.helper.character.impl")
+    #set ($glPackageBaseCommonHelperToken = "${database.baseCommonPackage}.helper.token")
+    #set ($glPackageBaseCommonHelperTokenLine = "${database.baseCommonPackage}.helper.token.line")
+    #set ($glPackageBaseCommonHelperTokenLineImpl = "${database.baseCommonPackage}.helper.token.line.impl")
+    #set ($glPackageBaseCommonHelperTokenFile = "${database.baseCommonPackage}.helper.token.file")
+    #set ($glPackageBaseCommonHelperTokenFileImpl = "${database.baseCommonPackage}.helper.token.file.impl")
+    #set ($glPackageBaseCommonInterceptor = "${database.baseCommonPackage}.interceptor")
+    #set ($glPackageBaseCommonJdbcHistory = "${database.baseCommonPackage}.jdbc.history")
+    #set ($glPackageBaseCommonS2Dao = "${database.baseCommonPackage}.s2dao")
+
+    ## [Main]
+    #set ($glPackageBaseBhv = "${database.baseBehaviorPackage}")
+    #set ($glPackageBaseDao = "${database.baseDaoPackage}" )
+    #set ($glPackageBaseCustomizeDao = "${database.baseDaoPackage}.customize" )
+    #set ($glPackageBaseEntity = "${database.baseEntityPackage}")
+    #set ($glPackageBaseCustomizeEntity = "${database.baseEntityPackage}.customize" )
+    #set ($glPackageExtendedBhv = "${database.extendedBehaviorPackage}")
+    #set ($glPackageExtendedDao = "${database.extendedDaoPackage}")
+    #set ($glPackageExtendedCustomizeDao = "${database.extendedDaoPackage}.customize" )
+    #set ($glPackageExtendedEntity = "${database.extendedEntityPackage}")
+    #set ($glPackageExtendedCustomizeEntity = "${database.extendedEntityPackage}.customize" )
+    #set ($glPackageBaseCB = "${database.conditionBeanPackage}.bs")
+    #set ($glPackageCB = "${database.conditionBeanPackage}")
+    #set ($glPackageBaseCQ = "${database.conditionBeanPackage}.cq.bs")
+    #set ($glPackageCQ = "${database.conditionBeanPackage}.cq")
+    #set ($glPackageCIQ = "${database.conditionBeanPackage}.cq.ciq")
+    #set ($glPackageNss = "${database.conditionBeanPackage}.nss")
+    #set ($glPackageBaseDBMeta = "${glPackageBaseEntity}.dbmeta")
+    #set ($glPackageBaseCustomizeDBMeta = "${glPackageBaseCustomizeEntity}.dbmeta")
+    #set ($glPackageBaseSqlParameterBean = "${database.SqlParameterBeanPackage}.bsparam")
+    #set ($glPackageExtendedSqlParameterBean = "${database.SqlParameterBeanPackage}.exparam")
+    #set ($glPackageArgumentBean = "${database.ArgumentBeanPackage}")
+
+    ## *****************************************************************************************************************
+    ##                                                                                                           Parsing
+    ##                                                                                                           *******
+    ## ===================================================================================
+    ##                                                                          annotation
+    ##                                                                          ==========
+    #if (($database.isTargetLanguageJava() && $database.isAvailableGenerics()) || $database.isTargetLanguageCSharp())
+      ## Setup java directory for allcommon.
+      $database.setupJavaDir_for_allcommon()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonAnnotation}))
+      $database.makeDirectory($path)
+
+      $database.debug("public void parseAllcommonAnnotation) {")
+      $database.debug("    parseOutsideSql();")
+
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonAnnotation})}${glOutsideSqlAnnotation}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/annotation/OutsideSql.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("}")
+    #end
+
+    ## ===================================================================================
+    ##                                                                            behavior
+    ##                                                                            ========
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonBhv}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseAllcommonBehavior) {")
+    $database.debug("    parseBehaviorReadable()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhv})}${glBehaviorReadableInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/bhv/BehaviorReadable.${glTemplateFileExtension}",$path ,"", "")
+    $database.debug("    parseBehaviorWritable()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhv})}${glBehaviorWritableInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/bhv/BehaviorWritable.${glTemplateFileExtension}",$path ,"", "")
+    $database.debug("    parseAbstractBehaviorReadable()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhv})}${glBehaviorReadableAbstractName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/bhv/AbstractBehaviorReadable.${glTemplateFileExtension}",$path ,"", "")
+    $database.debug("    parseAbstractBehaviorWritable()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhv})}${glBehaviorWritableAbstractName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/bhv/AbstractBehaviorWritable.${glTemplateFileExtension}",$path ,"", "")
+
+    #if ($database.isTargetLanguageJava())
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonBhvBatch}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseTokenFileReflectionOption()")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvBatch})}${glTokenFileReflectionOptionName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/bhv/batch/TokenFileReflectionOption.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseTokenFileReflectionResult()")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvBatch})}${glTokenFileReflectionResultName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/bhv/batch/TokenFileReflectionResult.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseTokenFileReflectionFailure()")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvBatch})}${glTokenFileReflectionFailureName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/bhv/batch/TokenFileReflectionFailure.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseTokenFileOutputOption()")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvBatch})}${glTokenFileOutputOptionName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/bhv/batch/TokenFileOutputOption.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseTokenFileOutputResult()")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvBatch})}${glTokenFileOutputResultName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/bhv/batch/TokenFileOutputResult.${glTemplateFileExtension}",$path ,"", "")
+
+      #if ($database.isAvailableGenerics())
+        #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonBhvLoad}))
+        $database.makeDirectory($path)
+
+        $database.debug("    parseLoadRefererOption()")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvLoad})}${glLoadRefererOptionName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/allcommon/bhv/load/LoadRefererOption.${glTemplateFileExtension}",$path ,"", "")
+
+        #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonBhvSetup}))
+        $database.makeDirectory($path)
+
+        $database.debug("    parseConditionBeanSetupper()")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvSetup})}${glConditionBeanSetupperName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/allcommon/bhv/setup/ConditionBeanSetupper.${glTemplateFileExtension}",$path ,"", "")
+
+        $database.debug("    parseEntityListSetupper()")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvSetup})}${glEntityListSetupperName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/allcommon/bhv/setup/EntityListSetupper.${glTemplateFileExtension}",$path ,"", "")
+
+        $database.debug("    parseValueLabelSetupper()")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvSetup})}${glValueLabelSetupperName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/allcommon/bhv/setup/ValueLabelSetupper.${glTemplateFileExtension}",$path ,"", "")
+
+        $database.debug("    parseValueLabelBox()")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonBhvSetup})}${glValueLabelBoxName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/allcommon/bhv/setup/ValueLabelBox.${glTemplateFileExtension}",$path ,"", "")
+      #end
+    #end
+    $database.debug("}")
+
+    ## ===================================================================================
+    ##                                                                      access-context
+    ##                                                                      ==============
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #if ($database.isTargetLanguageJava())
+      $database.debug("    parseAccessContext()")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glAccessContextName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/AccessContext.${glTemplateFileExtension}",$path ,"", "")
+    #end
+
+    ## -----------------------------------------------------
+    ##                                         allcommon dao
+    ##                                         -------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    $database.debug("    parseDaoReadable")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glDaoReadableInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/DaoReadable.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseDaoWritable")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glDaoWritableInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/DaoWritable.${glTemplateFileExtension}",$path ,"", "")
+
+    ## -----------------------------------------------------
+    ##                                      allcommon entity
+    ##                                      ----------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    $database.debug("public void parseEntityInterface() {")
+    $database.debug("    parseEntity();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glEntityInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/Entity.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseEntityDefinedCommonColumn();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glEntityDefinedCommonColumnInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/EntityDefinedCommonColumn.${glTemplateFileExtension}",$path ,"", "")
+    $database.debug("}")
+
+    ## -----------------------------------------------------
+    ##                              allcommon condition-bean
+    ##                              ------------------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCBean}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseConditionBeanFramework() {")
+    $database.debug("    parseFetchNarrowingBeanContext()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glFetchNarrowingBeanContextName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/FetchNarrowingBeanContext.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseFetchNarrowingBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glFetchNarrowingBeanInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/FetchNarrowingBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseSimpleOrderByBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glSimpleOrderByBeanName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/SimpleOrderByBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseSimplePagingBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glSimplePagingBeanName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/SimplePagingBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parsePagingResultBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glPagingResultBeanName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/PagingResultBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseListResultBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glListResultBeanName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ListResultBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionBeanContext()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glConditionBeanContextName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ConditionBeanContext.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glConditionBeanInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ConditionBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionQuery()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glConditionQueryInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ConditionQuery.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parsePagingBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glPagingBeanInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/PagingBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseOrderByBean()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glOrderByBeanInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/OrderByBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseSelectResource()")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glSelectResourceInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/SelectResource.${glTemplateFileExtension}",$path ,"", "")
+
+    ## Setup java directory.
+    $database.setupJavaDir_for_abstractCBean()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCBean}))
+    $database.makeDirectory($path)
+
+    $database.debug("    parseAbstractConditionBean")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glConditionBeanAbstractName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/AbstractConditionBean.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseAbstractConditionQuery")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBean})}${glConditionQueryAbstractName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/AbstractConditionQuery.${glTemplateFileExtension}",$path ,"", "")
+
+    ## -----------------------------------------------------
+    ##                allcommon condition-bean condition-key
+    ##                --------------------------------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCKey}))
+    $database.makeDirectory($path)
+
+    $database.debug("    parseConditionKey")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_equal")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}Equal.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_equal.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_notEqual")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}NotEqual.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_notEqual.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_greaterThan")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}GreaterThan.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_greaterThan.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_lessThan")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}LessThan.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_lessThan.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_greaterEqual")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}GreaterEqual.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_greaterEqual.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_lessEqual")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}LessEqual.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_lessEqual.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_prefixSearch")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}PrefixSearch.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_prefixSearch.${glTemplateFileExtension}",$path ,"", "")
+
+    #if ($database.isTargetLanguageJava())
+      $database.debug("    parseConditionKey_likeSearch")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}LikeSearch.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_likeSearch.${glTemplateFileExtension}",$path ,"", "")
+    #end
+
+    $database.debug("    parseConditionKey_inScope")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}InScope.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_inScope.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_notInScope")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}NotInScope.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_notInScope.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_isNull")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}IsNull.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_isNull.${glTemplateFileExtension}",$path ,"", "")
+
+    $database.debug("    parseConditionKey_isNotNull")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCKey})}${glConditionKeyName}IsNotNull.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/ckey/ConditionKey_isNotNull.${glTemplateFileExtension}",$path ,"", "")
+
+    #if ($database.isTargetLanguageJava())
+      ## -----------------------------------------------------
+      ##             allcommon condition-bean condition-option
+      ##             -----------------------------------------
+      ## Setup java directory for allcommon.
+      $database.setupJavaDir_for_allcommon()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCOption}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseConditionOption")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOption})}${glConditionOptionInterfaceName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/ConditionOption.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseSimpleStringOption")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOption})}${glConditionOptionSimpleStringName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/SimpleStringOption.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseFromToOption")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOption})}${glConditionOptionFromToName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/FromToOption.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseLikeSearchOption")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOption})}${glConditionOptionLikeSearchName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/LikeSearchOption.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseInScopeOption")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOption})}${glConditionOptionInScopeName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/InScopeOption.${glTemplateFileExtension}",$path ,"", "")
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCOptionParts}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseSplitOptionParts")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOptionParts})}${glConditionOptionPartsSplitName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/parts/SplitOptionParts.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseToUpperLowerCaseOptionParts")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOptionParts})}${glConditionOptionPartsToUpperLowerCaseName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/parts/ToUpperLowerCaseOptionParts.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseToSingleByteOptionParts")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOptionParts})}${glConditionOptionPartsToSingleByteName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/parts/ToSingleByteOptionParts.${glTemplateFileExtension}",$path ,"", "")
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCOptionPartsLocal}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseJapaneseOptionPartsAgent")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCOptionPartsLocal})}${glConditionOptionPartsAgentJapaneseName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/coption/parts/local/JapaneseOptionPartsAgent.${glTemplateFileExtension}",$path ,"", "")
+    #end
+
+    ## -------------------------------------------------------
+    ##                allcommon condition-bean condition-value
+    ##                ----------------------------------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCValue}))
+    $database.makeDirectory($path)
+
+    $database.debug("    parseConditionValue")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCValue})}${glConditionValueName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/cvalue/ConditionValue.${glTemplateFileExtension}",$path ,"", "")
+
+    ## -------------------------------------------------------
+    ##                       allcommon condition-bean grouping
+    ##                       ---------------------------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #if ($database.isTargetLanguageJava() && $database.isAvailableGenerics())
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCBeanGrouping}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseGroupingOption();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBeanGrouping})}${glGroupingOptionName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/grouping/GroupingOption.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseGroupingRowEndDeterminer();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBeanGrouping})}${glGroupingRowEndDeterminerName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/grouping/GroupingRowEndDeterminer.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseGroupingRowResource();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBeanGrouping})}${glGroupingRowResourceName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/grouping/GroupingRowResource.${glTemplateFileExtension}",$path ,"", "")
+
+      $database.debug("    parseGroupingRowSetupper();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBeanGrouping})}${glGroupingRowSetupperName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/grouping/GroupingRowSetupper.${glTemplateFileExtension}",$path ,"", "")
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonCBeanMapping}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseEntityDtoMapper();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonCBeanMapping})}${glEntityDtoMapperName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/mapping/EntityDtoMapper.${glTemplateFileExtension}",$path ,"", "")
+    #end
+
+    ## -------------------------------------------------------
+    ##                     allcommon condition-bean sql-clause
+    ##                     -----------------------------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonSqlClause}))
+    $database.makeDirectory($path)
+
+    $database.debug("    parseSqlClause")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause.${glTemplateFileExtension}",$path ,"" ,"")
+
+    $database.debug("    parseAbstractSqlClause")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseAbstractName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/AbstractSqlClause.${glTemplateFileExtension}",$path ,"" ,"")
+
+    #if ($database.isTargetLanguageJava())
+      $database.debug("    parseSqlClause_derby")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}Derby.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_derby.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_oracle")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}Oracle.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_oracle.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_firebird")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}Firebird.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_firebird.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_mysql")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}MySql.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_mysql.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_postgresql")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}PostgreSql.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_postgresql.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_mssql")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}SqlServer.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_mssql.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_db2")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}Db2.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_db2.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_interbase")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}Interbase.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_interbase.${glTemplateFileExtension}",$path ,"" ,"")
+
+      $database.debug("    parseSqlClause_default")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}Default.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_default.${glTemplateFileExtension}",$path ,"" ,"")
+    #end
+    #if ($database.isTargetLanguageCSharp())
+      $database.debug("    parseSqlClause_${database.DatabaseType}")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glSqlClauseInterfaceName}${database.DaoGenDbName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/SqlClause_${database.DatabaseType}.${glTemplateFileExtension}",$path ,"" ,"")
+    #end
+
+    $database.debug("    parseOrderByClause")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glOrderByClauseName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/OrderByClause.${glTemplateFileExtension}",$path ,"" ,"")
+
+    $database.debug("    parseOrderByElement")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonSqlClause})}${glOrderByElementName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/cbean/sqlclause/OrderByElement.${glTemplateFileExtension}",$path ,"" ,"")
+
+    $database.debug("}")
+
+    ## -------------------------------------------------------
+    ##                                        allcommon dbmeta
+    ##                                        ----------------
+    ## Setup java directory.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonDBMeta}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseDBMetaClass() {")
+    $database.debug("    parseDBMeta();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonDBMeta})}${glDBMetaInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/dbmeta/DBMeta.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseAbstractDBMeta();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonDBMeta})}${glDBMetaAbstractName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/dbmeta/AbstractDBMeta.${glTemplateFileExtension}",$path,"", "")
+
+    ## Setup java directory.
+    $database.setupJavaDir_for_dbmetaInstanceHandler()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonDBMeta}))
+    $database.makeDirectory($path)
+
+    $database.debug("    parseDBMetaInstanceHandler();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonDBMeta})}${glDBMetaInstanceHandlerName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/dbmeta/DBMetaInstanceHandler.${glTemplateFileExtension}",$path,"", "")
+
+    ## -------------------------------------------------------
+    ##                                     allcommon exception
+    ##                                     -------------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonException}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseExceptionClass() {")
+##    #if ($database.isTargetLanguageCSharp())
+##      $database.debug("    parseDaoExceptionContext();")
+##      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonException})}${glDaoExceptionContextName}.${glClassFileExtension}" )
+##      $generator.parse("om/${glTargetLanguage}/allcommon/exception/DaoExceptionContext.${glTemplateFileExtension}",$path,"", "")
+##    #end
+
+    $database.debug("    parseRecordHasAlreadyBeenDeletedException();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonException})}${glRecordHasAlreadyBeenDeletedException}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/exception/RecordHasAlreadyBeenDeletedException.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseRecordHasOverlappedException();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonException})}${glRecordHasOverlappedException}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/exception/RecordHasOverlappedException.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseSelectedCountExceedMaxCountException();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonException})}${glSelectedCountExceedMaxCountExceptionName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/exception/SelectedCountExceedMaxCountException.${glTemplateFileExtension}",$path,"", "")
+    $database.debug("}")
+
+    ## -------------------------------------------------------
+    ##                                        allcommon helper
+    ##                                        ----------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelper}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseHelperClass() {")
+
+    $database.debug("    parseMapListString();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelper})}${glMapListStringName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/helper/MapListString.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseMapListStringImpl();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelper})}${glMapListStringImplName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/helper/MapListStringImpl.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseMapStringBuilder();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelper})}${glMapStringBuilderName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/helper/MapStringBuilder.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseMapStringBuilderImpl();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelper})}${glMapStringBuilderImplName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/helper/MapStringBuilderImpl.${glTemplateFileExtension}",$path,"", "")
+
+    #if ($database.isTargetLanguageJava())
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelperCharacter}))
+      $database.makeDirectory($path)
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelperCharacterImpl}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseGeneralCharacter();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperCharacter})}${glGeneralCharacterName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/character/GeneralCharacter.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseGeneralCharacterImpl();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperCharacterImpl})}${glGeneralCharacterImplName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/character/impl/GeneralCharacterImpl.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseJapaneseCharacter();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperCharacter})}${glJapaneseCharacterName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/character/JapaneseCharacter.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseJapaneseCharacterImpl();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperCharacterImpl})}${glJapaneseCharacterImplName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/character/impl/JapaneseCharacterImpl.${glTemplateFileExtension}",$path,"", "")
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelperToken}))
+      $database.makeDirectory($path)
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelperTokenLine}))
+      $database.makeDirectory($path)
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelperTokenLineImpl}))
+      $database.makeDirectory($path)
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile}))
+      $database.makeDirectory($path)
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFileImpl}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parseLineToken();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenLine})}${glLineTokenName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/line/LineToken.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseLineTokenImpl();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenLineImpl})}${glLineTokenImplName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/line/impl/LineTokenImpl.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseLineTokenizingOption();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenLine})}${glLineTokenizingOptionName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/line/LineTokenizingOption.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseLineMakingOption();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenLine})}${glLineMakingOptionName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/line/LineMakingOption.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileToken();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileTokenName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileToken.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileTokenImpl();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFileImpl})}${glFileTokenImplName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/impl/FileTokenImpl.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileTokenizingOption();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileTokenizingOptionName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileTokenizingOption.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileTokenizingRowResource();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileTokenizingRowResourceName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileTokenizingRowResource.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileTokenizingCallback();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileTokenizingCallbackName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileTokenizingCallback.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileTokenizingHeaderInfo();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileTokenizingHeaderInfoName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileTokenizingHeaderInfo.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileMakingOption();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileMakingOptionName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileMakingOption.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileMakingRowResource();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileMakingRowResourceName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileMakingRowResource.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileMakingCallback();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileMakingCallbackName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileMakingCallback.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileMakingHeaderInfo();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileMakingHeaderInfoName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileMakingHeaderInfo.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileMakingSimpleFacade();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFile})}${glFileMakingSimpleFacadeName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/FileMakingSimpleFacade.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseFileMakingSimpleFacadeImpl();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonHelperTokenFileImpl})}${glFileMakingSimpleFacadeImplName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/helper/token/file/impl/FileMakingSimpleFacadeImpl.${glTemplateFileExtension}",$path,"", "")
+    #end
+
+    $database.debug("}")
+
+    ## -------------------------------------------------------
+    ##                                allcommon classification
+    ##                                ------------------------
+    ## Setup java directory for allcommon.
+    $database.setupJavaDir_for_allcommon()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommon}))
+    $database.makeDirectory($path)
+
+    #if ($database.hasClassificationDefinitionMap())
+      $database.debug("parseClassification();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glClassificationDefinition}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/ClassificationDefinition.${glTemplateFileExtension}",$path ,"" ,"")
+    #end
+
+    ## -------------------------------------------------------
+    ##                                     allcommon container
+    ##                                     -------------------
+    ## Setup java directory for daoDicon.
+    $database.setupJavaDir_for_daoDicon()
+
+    $database.debug("parseDaoDicon() {")
+    #foreach ($daoDiconPackageName in $database.daoDiconPackageNameList)
+      #set ($path = "${daoDiconPackageName}" )
+      $database.makeDirectory($path)
+
+      #set ($path = "${daoDiconPackageName}/${glDaoDiconFileName}" )
+      $database.debug("    ${path}")
+      $generator.parse("om/${glTargetLanguage}/allcommon/DaoDicon.${glTemplateFileExtension}", $path, "", "")
+    #end
+    $database.debug("}")
+
+    ## -------------------------------------------------------
+    ##                                  allcommon dao-selector
+    ##                                  ----------------------
+    ## Setup java directory for daoSelector.
+    $database.setupJavaDir_for_daoSelector()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommon}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseDaoSelector() {")
+    $database.debug("    parseDaoSelector();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glDaoSelectorInterfaceName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/DaoSelector.${glTemplateFileExtension}",$path ,"", "")
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                              Parse cache dao-selector
+    ##                                                                              ------------------------
+    ## Setup java directory for cacheDaoSelector.
+    $database.setupJavaDir_for_cacheDaoSelector()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommon}))
+    $database.makeDirectory($path)
+
+    $database.debug("    parseCacheDaoSelector();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glCacheDaoSelectorName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/CacheDaoSelector.${glTemplateFileExtension}",$path ,"", "")
+    $database.debug("}")
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                                   Parse gen meta data
+    ##                                                                                   -------------------
+    ## Setup java directory for genMetaData.
+    $database.setupJavaDir_for_genMetaData()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommon}))
+    $database.makeDirectory($path)
+
+    $database.debug("parseGenMetaData();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommon})}${glGenMetaDataClassName}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/GenMetaData.${glTemplateFileExtension}",$path ,"" ,"")
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                               Parse interceptor class
+    ##                                                                               -----------------------
+    ## Setup java directory for Interceptor.
+    $database.setupJavaDir_for_interceptor()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonInterceptor}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseInterceptorClass() {")
+    $database.debug("    parseCommonColumnSetupAbstractInterceptor();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonInterceptor})}${glCommonColumnSetupAbstractInterceptor}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseCommonColumnSetupBeforeInsertInterceptor();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonInterceptor})}${glCommonColumnSetupBeforeInsertInterceptor}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseCommonColumnSetupBeforeUpdateInterceptor();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonInterceptor})}${glCommonColumnSetupBeforeUpdateInterceptor}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.${glTemplateFileExtension}",$path,"", "")
+
+    $database.debug("    parseCommonColumnSetupBeforeDeleteInterceptor();")
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonInterceptor})}${glCommonColumnSetupBeforeDeleteInterceptor}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.${glTemplateFileExtension}",$path,"", "")
+    $database.debug("}")
+
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                                      Parse jdbc class
+    ##                                                                                      ----------------
+    #if ($database.isTargetLanguageJava() && $database.isAvailableGenerics())
+      $database.setupJavaDir_for_allcommon()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonJdbcHistory}))
+      $database.makeDirectory($path)
+
+      $database.debug("    parsePreparedExecutionBeanName();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonJdbcHistory})}${glPreparedExecutionBeanName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/jdbc/history/PreparedExecutionBean.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parsePreparedParameterElement();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonJdbcHistory})}${glPreparedParameterElementName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/jdbc/history/PreparedParameterElement.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseStatementHistory();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonJdbcHistory})}${glStatementHistoryName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/jdbc/history/StatementHistory.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseStatementHistoryWitness();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonJdbcHistory})}${glStatementHistoryWitnessName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/jdbc/history/StatementHistoryWitness.${glTemplateFileExtension}",$path,"", "")
+
+      $database.debug("    parseTraceablePreparedStatement();")
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonJdbcHistory})}${glTraceablePreparedStatementName}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/jdbc/history/TraceablePreparedStatement.${glTemplateFileExtension}",$path,"", "")
+    #end
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                            Parse extended s2dao class
+    ##                                                                            --------------------------
+    ## Setup java directory for s2daoObject.
+    $database.setupJavaDir_for_s2daoObject()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCommonS2Dao}))
+    $database.makeDirectory($path)
+
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glDaoInterceptor}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/S2DaoInterceptor.${glTemplateFileExtension}",$path,"", "")
+
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glDaoMetaDataExtension}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/S2DaoMetaDataExtension.${glTemplateFileExtension}",$path,"", "")
+
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glDaoMetaDataFactoryImpl}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/S2DaoMetaDataFactoryImpl.${glTemplateFileExtension}",$path,"", "")
+
+    #if ($database.isTargetLanguageJava() && $database.isVersionAfter1040())
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glBeanMetaDataFactoryImpl}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/S2BeanMetaDataFactoryImpl.${glTemplateFileExtension}",$path,"", "")
+    #end
+
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glSelectDynamicCommand}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/S2DaoSelectDynamicCommand.${glTemplateFileExtension}",$path,"", "")
+
+    #if ($database.isTargetLanguageJava())
+      #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glDaoStatementFactory}.${glClassFileExtension}" )
+      $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/S2DaoStatementFactory.${glTemplateFileExtension}",$path,"", "")
+    #end
+
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glFetchNarrowingResultSetFactory}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/FetchNarrowingResultSetFactory.${glTemplateFileExtension}",$path,"", "")
+
+    #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCommonS2Dao})}${glFetchNarrowingResultSetWrapper}.${glClassFileExtension}" )
+    $generator.parse("om/${glTargetLanguage}/allcommon/s2dao/FetchNarrowingResultSetWrapper.${glTemplateFileExtension}",$path,"", "")
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                                    Parse cutomize dao
+    ##                                                                                    ------------------
+    #if ($database.isAvailableCustomizeDaoGeneration())
+      ## Setup java directory.
+      $database.setupJavaDir_for_baseCustomizeDao()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCustomizeDao}))
+      $database.makeDirectory($path)
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCustomizeEntity}))
+      $database.makeDirectory($path)
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseCustomizeDBMeta}))
+      $database.makeDirectory($path)
+
+      ## Setup java directory.
+      $database.setupJavaDir_for_extendedCustomizeDao()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageExtendedCustomizeDao}))
+      $database.makeDirectory($path)
+      #set ($path = $strings.getPackageAsPath(${glPackageExtendedCustomizeEntity}))
+      $database.makeDirectory($path)
+
+      $database.debug("public void parseCustomizeDao() {")
+      $database.debug("    final List<String> tableNameList = getCustomizeTableList();")
+      $database.debug("    for (String tableName : tableNameList) {")
+      #foreach ($table in $database.CustomizeTableList)
+        #set ($myBaseDaoClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}Dao")
+        #set ($myBaseDaoPackageName = "${glPackageBaseCustomizeDao}")
+        #set ($myExtendedDaoClassName = "${glProjectPrefix}${table.JavaName}Dao")
+        #set ($myExtendedDaoPackageName = "${glPackageExtendedCustomizeDao}")
+        #set ($myBaseObjectClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}${glBaseSuffixForEntity}")
+        #set ($myBaseEntityPackageName = "${glPackageBaseCustomizeEntity}")
+        #set ($myExtendedObjectClassName = "${glProjectPrefix}${table.JavaName}")
+        #set ($myExtendedEntityPackageName = "${glPackageExtendedCustomizeEntity}")
+        #set ($myDBMetaClassName = "${glProjectPrefix}${table.JavaName}Dbm")
+        #set ($myDBMetaPackageName = "${glPackageBaseCustomizeDBMeta}")
+
+        #set ($isExistBehavior = false)
+        #set ($isExistDao = true)
+        #set ($isExistConditionBean = false)
+
+        ## Setup java directory.
+        $database.setupJavaDir_for_baseCustomizeDao()
+
+        $database.debug("        parseCustomizeBaseDao(tableName); // ${myBaseDaoClassName}")
+        #set ( $path = "${strings.getPackageAsPath(${myBaseDaoPackageName})}${myBaseDaoClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsdao/customize/BaseCustomizeDao.${glTemplateFileExtension}",$path ,"" ,"")
+
+        $database.debug("        parseCustomizeBaseEntity(tableName); // ${myBaseObjectClassName}")
+        #set ( $path = "${strings.getPackageAsPath(${myBaseEntityPackageName})}${myBaseObjectClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsentity/BaseEntity.${glTemplateFileExtension}",$path ,"" ,"")
+
+        $database.debug("        parseCustomizeDBMeta(tableName); // ${myDBMetaClassName}")
+        #set ( $path = "${strings.getPackageAsPath(${myDBMetaPackageName})}${myDBMetaClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsentity/dbmeta/DBMetaImpl.${glTemplateFileExtension}",$path,"", "")
+
+        ## Setup java directory.
+        $database.setupJavaDir_for_extendedCustomizeDao()
+
+        #set ( $path = "${strings.getPackageAsPath(${myExtendedDaoPackageName})}${myExtendedDaoClassName}.${glClassFileExtension}" )
+        #if (!$files.file(${generator.OutputPath},$path).exists())
+          $database.debug("        parseArgumentExtendedDai(tableName); // ${myExtendedDaoClassName}")
+          $generator.parse("om/${glTargetLanguage}/exdao/ExtendedDao.${glTemplateFileExtension}",$path ,"" ,"")
+        #end
+
+        #set ( $path = "${strings.getPackageAsPath(${myExtendedEntityPackageName})}${myExtendedObjectClassName}.${glClassFileExtension}" )
+        #if (!$files.file(${generator.OutputPath},$path).exists())
+          $database.debug("        parseArgumentExtendedEntity(tableName); // ${myExtendedDaoClassName}")
+          $generator.parse("om/${glTargetLanguage}/exentity/ExtendedEntity.${glTemplateFileExtension}",$path ,"" ,"")
+        #end
+
+      #end
+      $database.debug("    }")
+      $database.debug("}")
+    #end
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                               Parse sqlParameter bean
+    ##                                                                               -----------------------
+    #if ($database.isAvailableSqlParameterBeanGeneration())
+      ## Setup java directory.
+      $database.setupJavaDir_for_baseSqlParameter()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseSqlParameterBean}))
+      $database.makeDirectory($path)
+
+      ## Setup java directory.
+      $database.setupJavaDir_for_extendedSqlParameter()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageExtendedSqlParameterBean}))
+      $database.makeDirectory($path)
+
+      $database.debug("public void parseSqlParameterBean() {")
+      $database.debug("    // Package is ${glPackageSqlParameterBean}")
+      $database.debug("    final List<String> classNameList = getSqlParameterBeanClassNameList();")
+      $database.debug("    for (String className : classNameList) {")
+      #foreach ($sqlParameterBeanClassName in $database.SqlParameterBeanClassNameList)
+
+        #set ($propertyDefinitionMap = ${database.getSqlParameterBeanDefinitionMap().get($sqlParameterBeanClassName)})
+        #set ($mySqlParameterBeanName = "${sqlParameterBeanClassName}")
+        #set ($myBaseSqlParameterClassName = "${glProjectPrefix}${glBasePrefix}${sqlParameterBeanClassName}")
+        #set ($myExtendedSqlParameterClassName = "${glProjectPrefix}${sqlParameterBeanClassName}")
+
+        ## Setup java directory.
+        $database.setupJavaDir_for_baseSqlParameter()
+
+        $database.debug("        parseSqlParameterBean('${mySqlParameterBeanClassName}');")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseSqlParameterBean})}${myBaseSqlParameterClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/sbean/SqlParameterBeanBs.${glTemplateFileExtension}",$path ,"" ,"")
+
+        ## Setup java directory.
+        $database.setupJavaDir_for_extendedSqlParameter()
+
+        $database.debug("        parseSqlParameterBean('${myExtendedSqlParameterClassName}');")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageExtendedSqlParameterBean})}${myExtendedSqlParameterClassName}.${glClassFileExtension}" )
+        #if (!$files.file(${generator.OutputPath},$path).exists())
+          $generator.parse("om/${glTargetLanguage}/sbean/SqlParameterBeanEx.${glTemplateFileExtension}",$path ,"" ,"")
+        #end
+      #end
+      $database.debug("    }")
+      $database.debug("}")
+    #end
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                                   Parse arguemnt bean
+    ##                                                                                   -------------------
+    #if ($database.isAvailableArgumentBeanGeneration())
+      ## Setup java directory.
+      $database.setupJavaDir_for_argumentBean()
+
+      #set ($path = $strings.getPackageAsPath(${glPackageArgumentBean}))
+      $database.makeDirectory($path)
+
+      $database.debug("public void parseArgumentBean() {")
+      $database.debug("    // Package is ${glPackageArgumentBean}")
+      $database.debug("    final List<String> classNameList = getArgumentBeanClassNameList();")
+      $database.debug("    for (String className : classNameList) {")
+      #foreach ($argumentBeanClassName in $database.ArgumentBeanClassNameList)
+
+        #set ($propertyDefinitionMap = ${database.getArgumentBeanDefinitionMap().get($argumentBeanClassName)})
+        #set ($myArgumentBeanName = "${argumentBeanClassName}")
+        #set ($myArgumentBeanClassName = "${glProjectPrefix}${argumentBeanClassName}")
+
+        ## Setup java directory.
+        $database.setupJavaDir_for_argumentBean()
+
+        $database.debug("        parseArgumentBean('${myArgumentBeanClassName}');")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageArgumentBean})}${myArgumentBeanClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/sbean/ArgumentBean.${glTemplateFileExtension}",$path ,"" ,"")
+      #end
+      $database.debug("    }")
+      $database.debug("}")
+    #end
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                                    Parse table object
+    ##                                                                                    ------------------
+    ## Setup java directory for base.
+    $database.setupJavaDir_for_base()
+
+    ## for Sql2Entity
+    #set ($isSql2Entity = false)
+
+    #if ($database.isAvailableBehaviorGeneration())
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseBhv}))
+      $database.makeDirectory($path)
+    #end
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseDao}))
+    $database.makeDirectory($path)
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseEntity}))
+    $database.makeDirectory($path)
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseDBMeta}))
+    $database.makeDirectory($path)
+
+    ## Setup java directory for cbean.
+    $database.setupJavaDir_for_base_cbean()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCB}))
+    $database.makeDirectory($path)
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCQ}))
+    $database.makeDirectory($path)
+
+    #set ($path = $strings.getPackageAsPath(${glPackageCIQ}))
+    $database.makeDirectory($path)
+
+    #set ($path = $strings.getPackageAsPath(${glPackageCQ}))
+    $database.makeDirectory($path)
+
+    #set ($path = $strings.getPackageAsPath(${glPackageNss}))
+    $database.makeDirectory($path)
+
+    ## Setup java directory for cbean.
+    $database.setupJavaDir_for_extended_cbean()
+
+    #set ($path = $strings.getPackageAsPath(${glPackageCB}))
+    $database.makeDirectory($path)
+
+    ## Setup java directory for extended.
+    $database.setupJavaDir_for_extended()
+
+    #if ($database.isAvailableBehaviorGeneration())
+      #set ($path = $strings.getPackageAsPath(${glPackageExtendedBhv}))
+      $database.makeDirectory($path)
+    #end
+    #set ($path = $strings.getPackageAsPath(${glPackageExtendedDao}))
+    $database.makeDirectory($path)
+    #set ($path = $strings.getPackageAsPath(${glPackageExtendedEntity}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseTableList() {")
+    $database.debug("    final List<Table> tableList = getTableList();")
+    $database.debug("    for (Table tbl : tableList) {")
+    ##
+    ## Loop by tables.
+    ##
+    #foreach ($table in $database.Tables)
+      #if (!$table.isForReferenceOnly())
+
+        $database.debug("        parseTable(tbl); // ${table.Name} : ${table.JavaName}")
+        ##
+        ## Java name of the current table.
+        ##
+        #set ($myBaseBhvClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}Bhv")
+        #set ($myBaseBhvPackageName = "${glPackageBaseBhv}")
+        #set ($myExtendedBhvClassName = "${glProjectPrefix}${table.JavaName}Bhv")
+        #set ($myExtendedBhvPackageName = "${glPackageExtendedBhv}")
+
+        #set ($myBaseDaoClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}Dao")
+        #set ($myBaseDaoPackageName = "${glPackageBaseDao}")
+
+        #set ($myExtendedDaoClassName = "${glProjectPrefix}${table.JavaName}Dao")
+        #set ($myExtendedDaoPackageName = "${glPackageExtendedDao}")
+
+        #set ($myBaseObjectClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}${glBaseSuffixForEntity}")
+        #set ($myBaseEntityPackageName = "${glPackageBaseEntity}")
+
+        #set ($myExtendedObjectClassName = "${glProjectPrefix}${table.JavaName}")
+        #set ($myExtendedEntityPackageName = "${glPackageExtendedEntity}")
+
+        #set ($myBaseConditionBeanClassName = "${myBaseObjectClassName}${glConditionBeanInitialName}")
+        #set ($myConditionBeanClassName = "${myExtendedObjectClassName}${glConditionBeanInitialName}")
+        #set ($myAbstractBaseConditionQueryClassName = "${glProjectPrefix}Abstract${glBasePrefix}${table.JavaName}${glConditionQueryInitialName}")
+        #set ($myBaseConditionQueryClassName = "${myBaseObjectClassName}${glConditionQueryInitialName}")
+        #set ($myConditionQueryClassName = "${myExtendedObjectClassName}${glConditionQueryInitialName}")
+        #set ($myConditionInlineQueryClassName = "${myExtendedObjectClassName}CIQ")
+        #set ($myNestSelectSetupperClassName = "${myExtendedObjectClassName}Nss")
+
+        #set ($myDBMetaClassName = "${glProjectPrefix}${table.JavaName}Dbm")
+        #set ($myDBMetaPackageName = "${glPackageBaseDBMeta}")
+
+        #set ($myAttachedCBArgsString = "${glPackageCB}.${myConditionBeanClassName} ${glAttachedCBArgsVariableName}")
+
+        #set ($myEntityVariableName = "${table.uncapitalisedJavaName}")
+        #set ($myEntityListVariableName = "${table.uncapitalisedJavaName}List")
+        #set ($myCBVariableName = "${table.uncapitalisedJavaName}")
+        #set ($myBehaviorVariableName = "${table.uncapitalisedJavaName}Bhv")
+
+        #set ($isExistBehavior = false)
+        #if ($database.isAvailableBehaviorGeneration())
+          #set ($isExistBehavior = true)
+        #end
+        #set ($isExistDao = true)
+        #set ($isExistConditionBean = true)
+
+        ## Setup java directory for base.
+        $database.setupJavaDir_for_base()
+
+        #if ($database.isAvailableBehaviorGeneration())
+          #if ($database.isTargetLanguageCSharp())
+            #set ($myBaseBhvInterfaceName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}Bhv")
+            #set ($myExtendedBhvInterfaceName = "${glProjectPrefix}${table.JavaName}Bhv")
+            #set ($myBaseBhvClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}BhvImpl")
+            #set ($myExtendedBhvClassName = "${glProjectPrefix}${table.JavaName}BhvImpl")
+
+            #set ( $path = "${strings.getPackageAsPath(${glPackageBaseBhv})}${myBaseBhvClassName}.${glClassFileExtension}" )
+            $generator.parse("om/${glTargetLanguage}/bsbhv/BaseBhvImpl.${glTemplateFileExtension}", $path, "table", $table)
+
+            #set ( $path = "${strings.getPackageAsPath(${glPackageBaseBhv})}${myBaseBhvInterfaceName}.${glClassFileExtension}" )
+            $generator.parse("om/${glTargetLanguage}/bsbhv/BaseBhv.${glTemplateFileExtension}", $path, "table", $table)
+          #else
+            #set ( $path = "${strings.getPackageAsPath(${glPackageBaseBhv})}${myBaseBhvClassName}.${glClassFileExtension}" )
+            $generator.parse("om/${glTargetLanguage}/bsbhv/BaseBhv.${glTemplateFileExtension}", $path, "table", $table)
+          #end
+        #end
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseDao})}${myBaseDaoClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsdao/BaseDao.${glTemplateFileExtension}", $path, "table", $table)
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseEntity})}${myBaseObjectClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsentity/BaseEntity.${glTemplateFileExtension}", $path, "table", $table)
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseDBMeta})}${myDBMetaClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsentity/dbmeta/DBMetaImpl.${glTemplateFileExtension}",$path,"", "")
+
+        ## Setup java directory for extended.
+        $database.setupJavaDir_for_extended()
+
+        #if (!$database.isStopGenerateExtendedBhv())
+          #if ($database.isAvailableBehaviorGeneration())
+            #if ($database.isTargetLanguageCSharp())
+              #set ($myBaseBhvInterfaceName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}Bhv")
+              #set ($myExtendedBhvInterfaceName = "${glProjectPrefix}${table.JavaName}Bhv")
+              #set ($myBaseBhvClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}BhvImpl")
+              #set ($myExtendedBhvClassName = "${glProjectPrefix}${table.JavaName}BhvImpl")
+
+              #set ( $path = "${strings.getPackageAsPath(${glPackageExtendedBhv})}${myExtendedBhvClassName}.${glClassFileExtension}" )
+              #if (!$files.file(${generator.OutputPath},$path).exists())
+                $generator.parse("om/${glTargetLanguage}/exbhv/ExtendedBhvImpl.${glTemplateFileExtension}", $path, "table", $table)
+              #end
+
+              #set ( $path = "${strings.getPackageAsPath(${glPackageExtendedBhv})}${myExtendedBhvInterfaceName}.${glClassFileExtension}" )
+              #if (!$files.file(${generator.OutputPath},$path).exists())
+                $generator.parse("om/${glTargetLanguage}/exbhv/ExtendedBhv.${glTemplateFileExtension}", $path, "table", $table)
+              #end
+            #else
+              #set ( $path = "${strings.getPackageAsPath(${glPackageExtendedBhv})}${myExtendedBhvClassName}.${glClassFileExtension}" )
+              #if (!$files.file(${generator.OutputPath},$path).exists())
+                $generator.parse("om/${glTargetLanguage}/exbhv/ExtendedBhv.${glTemplateFileExtension}", $path, "table", $table)
+              #end
+            #end
+          #end
+        #end
+
+        #if (!$database.isStopGenerateExtendedDao())
+          #set ( $path = "${strings.getPackageAsPath(${glPackageExtendedDao})}${myExtendedDaoClassName}.${glClassFileExtension}" )
+          #if (!$files.file(${generator.OutputPath},$path).exists())
+            $generator.parse("om/${glTargetLanguage}/exdao/ExtendedDao.${glTemplateFileExtension}", $path, "table", $table)
+          #end
+        #end
+
+        #if (!$database.isStopGenerateExtendedEntity())
+          #set ( $path = "${strings.getPackageAsPath(${glPackageExtendedEntity})}${myExtendedObjectClassName}.${glClassFileExtension}" )
+          #if (!$files.file(${generator.OutputPath},$path).exists())
+            $generator.parse("om/${glTargetLanguage}/exentity/ExtendedEntity.${glTemplateFileExtension}", $path, "table", $table)
+          #end
+        #end
+
+        ## Setup java directory for base-cbean.
+        $database.setupJavaDir_for_base_cbean()
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCB})}${myBaseConditionBeanClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/cbean/BsConditionBean.${glTemplateFileExtension}", $path, "table", $table)
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCQ})}${myAbstractBaseConditionQueryClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/cbean/AbstractBsConditionQuery.${glTemplateFileExtension}", $path, "table", $table)
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageCIQ})}${myConditionInlineQueryClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/cbean/BsConditionInlineQuery.${glTemplateFileExtension}", $path, "table", $table)
+
+        #if ($database.isJavaDirOnlyOne())
+          #set ( $path = "${strings.getPackageAsPath(${glPackageBaseCQ})}${myBaseConditionQueryClassName}.${glClassFileExtension}" )
+          $generator.parse("om/${glTargetLanguage}/cbean/BsConditionQuery.${glTemplateFileExtension}", $path, "table", $table)
+        #else
+          #set ( $path = "${strings.getPackageAsPath(${glPackageCQ})}${myConditionQueryClassName}.${glClassFileExtension}" )
+          $generator.parse("om/${glTargetLanguage}/cbean/BsConditionQuery.${glTemplateFileExtension}", $path, "table", $table)
+        #end
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageNss})}${myNestSelectSetupperClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/cbean/NestSelectSetupper.${glTemplateFileExtension}", $path, "table", $table)
+
+        ## Setup java directory for extended-cbean.
+        $database.setupJavaDir_for_extended_cbean()
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageCB})}${myConditionBeanClassName}.${glClassFileExtension}" )
+        #if (!$files.file(${generator.OutputPath},$path).exists())
+          $generator.parse("om/${glTargetLanguage}/cbean/ExConditionBean.${glTemplateFileExtension}", $path, "table", $table)
+        #end
+
+        #if ($database.isJavaDirOnlyOne())
+          #set ( $path = "${strings.getPackageAsPath(${glPackageCQ})}${myConditionQueryClassName}.${glClassFileExtension}" )
+          #if (!$files.file(${generator.OutputPath},$path).exists())
+            $generator.parse("om/${glTargetLanguage}/cbean/ExConditionQuery.${glTemplateFileExtension}", $path, "table", $table)
+          #end
+        #end
+      #end
+    #end
+    $database.debug("    }")
+    $database.debug("}")
+  #end
+#end

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/CacheDaoSelector.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/CacheDaoSelector.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/CacheDaoSelector.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,257 @@
+
+using System;
+using System.Collections;
+
+#if ($database.isAvailableBehaviorGeneration())
+
+using ${glPackageBaseCommonBhv};
+#end
+
+using ${glPackageBaseCommonDBMeta};
+
+namespace ${glPackageBaseCommon} {
+
+    /**
+     * The implementation of dao-selector.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public class ${glCacheDaoSelectorName} : ${glDaoSelectorInterfaceName} {
+
+        protected Seasar.Framework.Container.IS2Container _container;
+        public Seasar.Framework.Container.IS2Container Container {
+            get { return _container; }
+            set { _container = value; }
+        }
+
+        /**
+         * Get dao-readable by dao type.
+         * 
+         * @param daoType Dao type. (NotNull)
+         * @return Dao-readable. (NotNull)
+         */
+        public ${glDaoReadableInterfaceName} GetRDao(Type daoType) {
+            AssertObjectNotNull("daoType", daoType);
+            return GetRDaoObject(daoType);
+        }
+
+        /**
+         * Get dao-readable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Dao-readable. (NotNull)
+         */
+        public ${glDaoReadableInterfaceName} GetRDao(${glEntityInterfaceName} entity) {
+            AssertObjectNotNull("entity", entity);
+            return GetRDao(entity.DBMeta.GetDaoType());
+        }
+
+        /**
+         * Get dao-readable by table multi-name.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Dao-readable. (NotNull)
+         */
+        public ${glDaoReadableInterfaceName} GetRDao(String tableMultiName) {
+            AssertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+            ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.GetInstanceByTableMultiName(tableMultiName);
+            return GetRDao(dbmeta.GetDaoType());
+        }
+
+        /**
+         * Get dao-writable by dao type.
+         * 
+         * @param daoType Dao type. (NotNull)
+         * @return Dao-writable. (NotNull)
+         */
+        public ${glDaoWritableInterfaceName} GetWDao(Type daoType) {
+            AssertObjectNotNull("daoType", daoType);
+            return (${glDaoWritableInterfaceName})GetRDao(daoType);
+        }
+
+        /**
+         * Get dao-writable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Dao-writable. (NotNull)
+         */
+        public ${glDaoWritableInterfaceName} GetWDao(${glEntityInterfaceName} entity) {
+            AssertObjectNotNull("entity", entity);
+            return (${glDaoWritableInterfaceName})GetRDao(entity);
+        }
+
+        /**
+         * Get dao-writable by table multi-name.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Dao-writable. (NotNull)
+         */
+        public ${glDaoWritableInterfaceName} GetWDao(String tableMultiName) {
+            AssertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+            return (${glDaoWritableInterfaceName})GetRDao(tableMultiName);
+        }
+
+        protected System.Collections.Generic.IDictionary<Type, ${glDaoReadableInterfaceName}> _daoCacheMap;
+        protected ${glDaoReadableInterfaceName} GetRDaoObject(Type daoType) {
+            ${glDaoReadableInterfaceName} result = null;
+            if (_daoCacheMap == null) {
+                _daoCacheMap = new System.Collections.Generic.Dictionary<Type, ${glDaoReadableInterfaceName}>();
+            }
+            if (_daoCacheMap.ContainsKey(daoType)) {
+                result = _daoCacheMap[daoType];
+            }
+            if (result == null) {
+                result = (${glDaoReadableInterfaceName})_container.GetComponent(daoType);
+                _daoCacheMap.Add(daoType, result);
+            }
+            return result;
+        }
+#if ($database.isAvailableBehaviorGeneration())
+
+        /**
+         * Get bhv-readable by bhv type.
+         * 
+         * @param bhvType Bhv type. (NotNull)
+         * @return Bhv-readable. (NotNull)
+         */
+        public ${glBehaviorReadableInterfaceName} GetRBhv(Type bhvType) {
+            AssertObjectNotNull("bhvType", bhvType);
+            return GetRBhvObject(bhvType);
+        }
+
+        /**
+         * Get bhv-readable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Bhv-readable. (NotNull)
+         */
+        public ${glBehaviorReadableInterfaceName} GetRBhv(${glEntityInterfaceName} entity) {
+            AssertObjectNotNull("entity", entity);
+            return GetRBhv(GetBhvType(entity.DBMeta));
+        }
+
+        /**
+         * Get bhv-readable by table multi-name.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Bhv-readable. (NotNull)
+         */
+        public ${glBehaviorReadableInterfaceName} GetRBhv(String tableMultiName) {
+            AssertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+            ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.GetInstanceByTableMultiName(tableMultiName);
+            return GetRBhv(GetBhvType(dbmeta));
+        }
+
+        /**
+         * Get bhv-writable by bhv type.
+         * 
+         * @param bhvType Bhv type. (NotNull)
+         * @return Bhv-writable. (NotNull)
+         */
+        public ${glBehaviorWritableInterfaceName} GetWBhv(Type bhvType) {
+            AssertObjectNotNull("bhvType", bhvType);
+            return (${glBehaviorWritableInterfaceName})GetRBhv(bhvType);
+        }
+
+        /**
+         * Get bhv-writable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Bhv-writable. (NotNull)
+         */
+        public ${glBehaviorWritableInterfaceName} GetWBhv(${glEntityInterfaceName} entity) {
+            AssertObjectNotNull("entity", entity);
+            return (${glBehaviorWritableInterfaceName})GetRBhv(entity);
+        }
+
+        /**
+         * Get bhv-writable by table multi-name.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Bhv-writable. (NotNull)
+         */
+        public ${glBehaviorWritableInterfaceName} GetWBhv(String tableMultiName) {
+            AssertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+            return (${glBehaviorWritableInterfaceName})GetRBhv(tableMultiName);
+        }
+
+        /**
+         * Get bhv-type by dbmeta.
+         * 
+         * @param dbmeta Dbmeta. (NotNull)
+         * @return Bhv-type. (NotNull)
+         */
+        protected Type GetBhvType(${glDBMetaInterfaceName} dbmeta) {
+            SetupDaoBhvMap();
+            return (Type)_daoBhvMap[dbmeta.GetDaoType()];
+        }
+
+        protected System.Collections.Generic.IDictionary<Type, ${glBehaviorReadableInterfaceName}> _bhvCacheMap;
+        protected ${glBehaviorReadableInterfaceName} GetRBhvObject(Type bhvType) {
+            ${glBehaviorReadableInterfaceName} result = null;
+            if (_bhvCacheMap == null) {
+                _bhvCacheMap = new System.Collections.Generic.Dictionary<Type, ${glBehaviorReadableInterfaceName}>();
+            }
+            if (_bhvCacheMap.ContainsKey(bhvType)) {
+                result = _bhvCacheMap[bhvType];
+            }
+            if (result == null) {
+                result = (${glBehaviorReadableInterfaceName})_container.GetComponent(bhvType);
+                _bhvCacheMap.Add(bhvType, result);
+            }
+            return result;
+        }
+
+        protected System.Collections.Generic.IDictionary<Type, Type> _daoBhvMap;
+        protected void SetupDaoBhvMap() {
+            if (_daoBhvMap == null) {
+                _daoBhvMap = new System.Collections.Generic.Dictionary<Type, Type>();
+  #foreach ($table in $database.Tables)
+
+                _daoBhvMap.Add(typeof(${glPackageExtendedDao}.${glProjectPrefix}${table.JavaName}Dao), typeof(${glPackageExtendedBhv}.${glProjectPrefix}${table.JavaName}Bhv));
+  #end
+
+            }
+        }
+#end
+
+        // ----------------------------------------------------------------
+        //                                                    Assert Object
+        //                                                    -------------
+        /**
+         * Assert that the object is not null.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param value Value. (NotNull)
+         * @exception IllegalArgumentException
+         */
+        protected void AssertObjectNotNull(String variableName, Object value) {
+            if (variableName == null) {
+                String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+                throw new SystemException(msg);
+            }
+            if (value == null) {
+                String msg = "The value should not be null: variableName=" + variableName;
+                throw new SystemException(msg);
+            }
+        }
+
+        // ----------------------------------------------------------------
+        //                                                    Assert String
+        //                                                    -------------
+        /**
+         * Assert that the entity is not null and not trimmed empty.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param value Value. (NotNull)
+         */
+        protected void AssertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+            AssertObjectNotNull("variableName", variableName);
+            AssertObjectNotNull(variableName, value);
+            if (value.Trim().Length ==0) {
+                String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
+                throw new SystemException(msg);
+            }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/ClassificationDefinition.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/ClassificationDefinition.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/ClassificationDefinition.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,75 @@
+#set ($myClassName = "${glClassificationDefinition}")
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommon} {
+
+    /// <summary>
+    /// The definition class that has classification.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public static class ${myClassName} {
+
+        // =====================================================================================
+        //                                                        Classification-Code-Definition
+        //                                                        ==============================
+#foreach ($classificationName in $database.ClassificationNameList)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+  #foreach ($classificationMap in $classificationMapList)
+
+        /// <summary>
+        /// The classification code of ${classificationMap.get('name')}.
+        /// ${classificationMap.get('comment')}
+        // </summary>
+        public const String CODE_${classificationName}_${classificationMap.get('name')} = "$classificationMap.get('code')";
+  #end
+#end
+
+        // =====================================================================================
+        //                                                 Classification-CodeNameMap-Definition
+        //                                                 =====================================
+#foreach ($classificationName in $database.ClassificationNameListValidNameOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+
+        /** The classification code-name map of ${classificationName}. */
+        public static readonly System.Collections.IDictionary CODE_NAME_MAP_${classificationName};
+
+#end
+#foreach ($classificationName in $database.ClassificationNameListValidAliasOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+
+        /** The classification code-alias map of ${classificationName}. */
+        public static readonly System.Collections.IDictionary CODE_ALIAS_MAP_${classificationName};
+#end
+
+        static ${myClassName}() {
+#foreach ($classificationName in $database.ClassificationNameListValidNameOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+
+            {
+                System.Collections.IDictionary map = new System.Collections.Hashtable();
+  #foreach ($classificationMap in $classificationMapList)
+
+                map.Add(CODE_${classificationName}_${classificationMap.get('name')}, "${classificationMap.get('name')}");
+  #end
+
+                CODE_NAME_MAP_${classificationName} = map;//java.util.Collections.unmodifiableMap(map);
+            }
+#end
+#foreach ($classificationName in $database.ClassificationNameListValidAliasOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+            {
+                System.Collections.IDictionary map = new System.Collections.Hashtable();
+  #foreach ($classificationMap in $classificationMapList)
+
+                map.Add(CODE_${classificationName}_${classificationMap.get('name')}, "${classificationMap.get('alias')}");
+  #end
+
+                CODE_ALIAS_MAP_${classificationName} = map;//java.util.Collections.unmodifiableMap(map);
+            }
+#end
+
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoDicon.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoDicon.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoDicon.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
+"http://www.seasar.org/dtd/components21.dtd">
+
+<components namespace="${glDaoDiconNamespace}">
+#foreach ($includePath in $database.DBFluteDiconBeforeJ2eeIncludePathList)
+
+    <include path="${includePath}"/>
+#end
+
+    <include path="${glJdbcDiconResourceName}"/>
+#foreach ($includePath in $database.DBFluteDiconOtherIncludePathList)
+
+    <include path="${includePath}"/>
+#end
+
+
+    <!-- S2Dao component. -->
+    <component class="Seasar.Dao.Impl.FieldAnnotationReaderFactory" />
+    <component class="${glPackageBaseCommonS2Dao}.${glDaoMetaDataFactoryImpl}"/>
+    <component name="interceptor" class="${glPackageBaseCommonS2Dao}.${glDaoInterceptor}"/>
+
+
+
+    <!-- Common column setup interceptor. -->
+    <component name="commonColumnSetupBeforeInsertInterceptor" class="${glPackageBaseCommonInterceptor}.${glCommonColumnSetupBeforeInsertInterceptor}"/>
+    <component name="commonColumnSetupBeforeUpdateInterceptor" class="${glPackageBaseCommonInterceptor}.${glCommonColumnSetupBeforeUpdateInterceptor}"/>
+    <component name="commonColumnSetupBeforeDeleteInterceptor" class="${glPackageBaseCommonInterceptor}.${glCommonColumnSetupBeforeDeleteInterceptor}"/>
+
+
+    <!-- Dao selector. -->
+    <component name="daoSelector" class="${glPackageBaseCommon}.${glCacheDaoSelectorName}"/>
+
+
+    <!-- Original dao component. -->
+    #foreach ($componentName in $database.getOriginalDaoComponentComponentNameList())
+      #set ($className = ${database.getOriginalDaoComponentClassName($componentName)})
+      #if ($database.isDaoComponent($componentName))
+
+    <component name="${componentName}" class="${className}">
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+      #else
+
+    <component name="${componentName}" class="${className}"/>
+      #end
+    #end
+
+
+    <!-- Original behavior aspect. -->
+    #foreach ($componentName in $database.getOriginalBehaviorAspectComponentNameList())
+      #set ($className = ${database.getOriginalBehaviorAspectClassName($componentName)})
+
+    <component name="${componentName}" class="${className}"/>
+    #end
+
+
+#foreach ($table in $database.Tables)
+
+    <!-- ${table.Name} -->
+
+  #if (${database.isAvailableCommonColumnSetupInterceptorToDao()})
+
+    <component class="${glPackageExtendedDao}.${glProjectPrefix}${table.JavaName}Dao">
+        <aspect pointcut="${database.ColumnSetupBeforeInsertInterceptorToDaoPointcutInitCap}">${glDaoDiconNamespace}.commonColumnSetupBeforeInsertInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeUpdateInterceptorToDaoPointcutInitCap}">${glDaoDiconNamespace}.commonColumnSetupBeforeUpdateInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeDeleteInterceptorToDaoPointcutInitCap}">${glDaoDiconNamespace}.commonColumnSetupBeforeDeleteInterceptor</aspect>
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+  #else
+
+    <component class="${glPackageExtendedDao}.${glProjectPrefix}${table.JavaName}Dao">
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+  #end
+  #if (${database.isAvailableBehaviorGeneration()})
+    #if (${database.isAvailableCommonColumnSetupInterceptorToBehavior()})
+
+    <component class="${glPackageExtendedBhv}.${glProjectPrefix}${table.JavaName}BhvImpl">
+#if (${database.isAvailableBehaviorRequiresNewTx()})
+        <aspect pointcut="${database.RequiresNewTransactionToBehaviorPointcut}">${database.RequiresNewTxComponentName}</aspect>
+#end
+#if (${database.isAvailableBehaviorRequiredTx()})
+        <aspect pointcut="${database.RequiredTransactionToBehaviorPointcut}">${database.RequiredTxComponentName}</aspect>
+#end
+        <aspect pointcut="${database.ColumnSetupBeforeInsertInterceptorToBehaviorPointcutInitCap}">${glDaoDiconNamespace}.commonColumnSetupBeforeInsertInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeUpdateInterceptorToBehaviorPointcutInitCap}">${glDaoDiconNamespace}.commonColumnSetupBeforeUpdateInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeDeleteInterceptorToBehaviorPointcutInitCap}">${glDaoDiconNamespace}.commonColumnSetupBeforeDeleteInterceptor</aspect>
+    #foreach ($componentName in $database.getOriginalBehaviorAspectComponentNameList())
+      #set ($pointcut = ${database.getOriginalBehaviorAspectPointcut($componentName)})
+
+        <aspect pointcut="${pointcut}">${glDaoDiconNamespace}.${componentName}</aspect>
+    #end
+
+    </component>
+    #else
+
+    <component class="${glPackageExtendedBhv}.${glProjectPrefix}${table.JavaName}BhvImpl">
+#if (${database.isAvailableBehaviorRequiresNewTx()})
+        <aspect pointcut="${database.RequiresNewTransactionToBehaviorPointcut}">${database.RequiresNewTxComponentName}</aspect>
+#end
+#if (${database.isAvailableBehaviorRequiredTx()})
+        <aspect pointcut="${database.RequiredTransactionToBehaviorPointcut}">${database.RequiredTxComponentName}</aspect>
+#end
+    #foreach ($componentName in $database.getOriginalBehaviorAspectComponentNameList())
+      #set ($pointcut = ${database.getOriginalBehaviorAspectPointcut($componentName)})
+
+        <aspect pointcut="${pointcut}">${glDaoDiconNamespace}.${componentName}</aspect>
+    #end
+
+    </component>
+    #end
+  #end
+#end
+
+#foreach ($table in $database.CustomizeTableList)
+
+    <!-- ${table.Name} (as customize dao) -->
+
+    <component class="${glPackageExtendedCustomizeDao}.${glProjectPrefix}${table.JavaName}Dao">
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+#end
+
+</components>

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoReadable.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoReadable.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoReadable.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,16 @@
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommon} {
+
+    /// <summary>
+    /// The interface of dao-readable.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glDaoReadableInterfaceName} {
+        // [Developer's comment] (2006/06/08)
+        // It cannot be done for the convenience of s2dao though I want to define methods for condition-bean here.
+        // DTO argument as Interface is not accepted.
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoSelector.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoSelector.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoSelector.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,117 @@
+
+using System;
+using System.Collections;
+#if ($database.isAvailableBehaviorGeneration())
+
+using ${glPackageBaseCommonBhv};
+#end
+
+namespace ${glPackageBaseCommon} {
+
+    /**
+     * The interface of dao-selector.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public interface ${glDaoSelectorInterfaceName} {
+
+        /**
+         * Get dao-readable by dao type.
+         * 
+         * @param daoType Dao type. (NotNull)
+         * @return Dao-readable. (NotNull)
+         */
+        ${glDaoReadableInterfaceName} GetRDao(Type daoType);
+
+        /**
+         * Get dao-readable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Dao-readable. (NotNull)
+         */
+        ${glDaoReadableInterfaceName} GetRDao(${glEntityInterfaceName} entity);
+
+        /**
+         * Get dao-readable by entity.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Dao-readable. (NotNull)
+         */
+        ${glDaoReadableInterfaceName} GetRDao(String tableMultiName);
+
+        /**
+         * Get dao-writable by dao type.
+         * 
+         * @param daoType Dao type. (NotNull)
+         * @return Dao-writable. (NotNull)
+         */
+        ${glDaoWritableInterfaceName} GetWDao(Type daoType);
+
+        /**
+         * Get dao-writable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Dao-writable. (NotNull)
+         */
+        ${glDaoWritableInterfaceName} GetWDao(${glEntityInterfaceName} entity);
+
+        /**
+         * Get dao-writable by entity.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Dao-writable. (NotNull)
+         */
+        ${glDaoWritableInterfaceName} GetWDao(String tableMultiName);
+    #if ($database.isAvailableBehaviorGeneration())
+
+        /**
+         * Get bhv-readable by bhv type.
+         * 
+         * @param bhvType Bhv type. (NotNull)
+         * @return Bhv-readable. (NotNull)
+         */
+        ${glBehaviorReadableInterfaceName} GetRBhv(Type bhvType);
+
+        /**
+         * Get bhv-readable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Bhv-readable. (NotNull)
+         */
+        ${glBehaviorReadableInterfaceName} GetRBhv(${glEntityInterfaceName} entity);
+
+        /**
+         * Get bhv-readable by table multi-name.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Bhv-readable. (NotNull)
+         */
+        ${glBehaviorReadableInterfaceName} GetRBhv(String tableMultiName);
+
+        /**
+         * Get bhv-writable by bhv type.
+         * 
+         * @param bhvType Bhv type. (NotNull)
+         * @return Bhv-writable. (NotNull)
+         */
+        ${glBehaviorWritableInterfaceName} GetWBhv(Type bhvType);
+
+        /**
+         * Get bhv-writable by entity.
+         * 
+         * @param entity Entity. (NotNull)
+         * @return Bhv-writable. (NotNull)
+         */
+        ${glBehaviorWritableInterfaceName} GetWBhv(${glEntityInterfaceName} entity);
+
+        /**
+         * Get bhv-writable by table multi-name.
+         * 
+         * @param tableMultiName Table multi-name. (NotNull)
+         * @return Bhv-writable. (NotNull)
+         */
+        ${glBehaviorWritableInterfaceName} GetWBhv(String tableMultiName);
+    #end
+
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoWritable.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoWritable.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/DaoWritable.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,58 @@
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommon} {
+
+    /// <summary>
+    /// The interface of dao-writable.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glDaoWritableInterfaceName} : ${glDaoReadableInterfaceName} {
+
+        /// <summary>
+        /// Insert one entity that the type is entity-interface.
+        /// </summary>
+        /// <param name="entity">Entity that the type is entity-interface. (NotNull)</returns>
+        /// <returns>Inserted count.</returns>
+        int Create(${glEntityInterfaceName} entity);
+
+        /// <summary>
+        /// Update one entity that the type is entity-interface.
+        /// </summary>
+        /// <param name="entity">Entity that the type is entity-interface. (NotNull)</returns>
+        /// <returns>Updated count.</returns>
+        int Modify(${glEntityInterfaceName} entity);
+
+        /// <summary>
+        /// Delete one entity that the type is entity-interface.
+        /// </summary>
+        /// <param name="entity">Entity that the type is entity-interface. (NotNull)</returns>
+        /// <returns>Deleted count.</returns>
+        int Remove(${glEntityInterfaceName} entity);
+
+        /// <summary>
+        /// Insert several entities that the type is entity-interface.
+        /// </summary>
+        /// <param name="entityList">Entity-list that the type is entity-interface. (NotNull)</returns>
+        /// <returns>Inserted count.</returns>
+/// TODO: This method has not been supported yet at S2Dao-dotNet. (2006/06/09)
+//        int CreateList(System.Collections.IList entityList);
+
+        /// <summary>
+        /// Update several entities that the type is entity-interface.
+        /// </summary>
+        /// <param name="entityList">Entity-list that the type is entity-interface. (NotNull)</returns>
+        /// <returns>Updated count.</returns>
+/// TODO: This method has not been supported yet at S2Dao-dotNet. (2006/06/09)
+//        int ModifyList(System.Collections.IList entityList);
+
+        /// <summary>
+        /// Delete several entities that the type is entity-interface.
+        /// </summary>
+        /// <param name="entityList">Entity-list that the type is entity-interface. (NotNull)</returns>
+        /// <returns>Deleted count.</returns>
+/// TODO: This method has not been supported yet at S2Dao-dotNet. (2006/06/09)
+//        int RemoveList(System.Collections.IList entityList);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/Entity.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/Entity.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/Entity.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,92 @@
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommonDBMeta};
+
+namespace ${glPackageBaseCommon} {
+
+    /// <summary>
+    /// The interface of entity.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glEntityInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             TableName
+        //                                                                             =========
+        /// <summary>
+        /// The property of table db-Name. (readonly)
+        /// </summary>
+        String TableDbName { get; }
+
+        /// <summary>
+        /// The property of table cap-prop-Name. (readonly)
+        /// </summary>
+        String TableCapPropName { get; }
+
+        /// <summary>
+        /// The property of table uncap-prop-Name. (readonly)
+        /// </summary>
+        String TableUncapPropName { get; }
+
+        // =====================================================================================
+        //                                                                                DBMeta
+        //                                                                                ======
+        /// <summary>
+        /// The property of DBMeta. (readonly)
+        /// </summary>
+        ${glDBMetaInterfaceName} DBMeta { get; }
+
+        // =====================================================================================
+        //                                                                     Accept Map-String
+        //                                                                     =================
+        /// <summary>
+        /// Accept primary-key map.
+        /// </summary>
+        /// <param name="primaryKeyMap">Primary-key map. (NotNull and NotEmpty)</param>
+        void AcceptPrimaryKeyMap(System.Collections.Generic.IDictionary<String, Object> primaryKeyMap);
+
+        /// <summary>
+        /// Accept primary-key map-string.
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary-key map-string. (NotNull)</param>
+        void AcceptPrimaryKeyMapString(String primaryKeyMapString);
+
+        /// <summary>
+        /// Accept column-value map.
+        /// </summary>
+        /// <param name="columnValueMap">Column-value map. (NotNull and NotEmpty)</param>
+        void AcceptColumnValueMap(System.Collections.Generic.IDictionary<String, Object> columnValueMap);
+
+        /// <summary>
+        /// Accept column-value map-string.
+        /// </summary>
+        /// <param name="columnValueMapString">Column-value map-string. (NotNull)</param>
+        void AcceptColumnValueMapString(String columnValueMapString);
+
+        // =====================================================================================
+        //                                                                    Extract Map-String
+        //                                                                    ==================
+        /// <summary>
+        /// Extract primary-key map-string. Delimiter is atmark and semicolon {@;}.
+        /// </summary>
+        /// <returns>Primary-key map-string.</returns>
+        String ExtractPrimaryKeyMapString();
+
+        /// <summary>
+        /// Extract column-value map-string. Delimiter is atmark and semicolon {@;}.
+        /// </summary>
+        /// <returns>Column-value map-string.</returns>
+        String ExtractColumnValueMapString();
+
+        // =====================================================================================
+        //                                                                         Determination
+        //                                                                         =============
+        /// <summary>
+        /// Has primary-key value?
+        /// </summary>
+        /// <returns>Determinationg.</returns>
+        bool HasPrimaryKeyValue { get; }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/EntityDefinedCommonColumn.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/EntityDefinedCommonColumn.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/EntityDefinedCommonColumn.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,63 @@
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommon} {
+
+    /// <summary>
+    /// The interface of entity defined common column.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glEntityDefinedCommonColumnInterfaceName} : ${glEntityInterfaceName} {
+#foreach ($columnName in ${database.CommonColumnNameList})
+  #set ($commonColumnMap = ${database.CommonColumnMap})
+  #set ($columnType = ${commonColumnMap.get(${columnName})})
+  #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+  #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${columnName})})
+  #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${columnName})})
+
+        /// <summary>
+        /// The property of ${uncapitalisedJavaName}.
+        /// </summary>
+        ${javaNative} ${javaName} { get; set; }
+
+        /// <summary>
+        /// Has the setter of ${javaName} been invoked?
+        /// </summary>
+        bool IsSetterInvoked${javaName}();
+  #if (${database.isAllClassificationColumn($columnName)})
+    #set ($classificationName = $database.getAllClassificationName($columnName))
+    #set ($classificationList = $database.getClassificationMapList($classificationName))
+    #foreach ($classificationMap in $classificationList)
+
+        /// <summary>
+        /// Classify the value of ${uncapitalisedJavaName} as ${classificationMap.get('name')}.
+        /// </summary>
+        void Classify${javaName}${classificationMap.get('name')}();
+
+        /// <summary>
+        /// Is the value of ${uncapitalisedJavaName} '${classificationMap.get('name')}'?
+        /// The difference of capital letters and small letters is NOT distinguished.
+        /// If the value is null, this method returns false!
+        /// </summary>
+        /// <returns>Determanation.</returns>
+        bool Is${javaName}${classificationMap.get('name')}();
+
+        /// <summary>
+        /// Is the value of ${uncapitalisedJavaName} '${classificationMap.get('name')}'?
+        /// The difference of capital letters and small letters is NOT distinguished.
+        /// If the value is null, this method throws exception!
+        /// </summary>
+        /// <returns>Determanation.</returns>
+        bool Is${javaName}${classificationMap.get('name')}IfNullException();
+    #end
+  #end
+#end
+
+        /// <summary>
+        /// Extract common-column-value map-string.
+        /// </summary>
+        /// <returns>Common-column-value map-string.</returns>
+        String ExtractCommonColumnValueMapString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/GenMetaData.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/GenMetaData.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/GenMetaData.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,354 @@
+#set ($myClassName = "${glGenMetaDataClassName}")
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommon} {
+
+    /// <summary>
+    /// The sigleton class that has generate-meta-data(GenMetaData).
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} {
+
+        /// <summary>Singleton instance.</summary>
+        private static readonly ${myClassName} _instance = new ${myClassName}();
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        private ${myClassName}() {
+        }
+
+        /// <summary>
+        /// Get instance.
+        /// </summary>
+        /// <returns>Singleton instance.</returns>
+        public static ${myClassName} GetInstance() {
+            return _instance;
+        }
+
+        // =========================================================================================
+        //                                                                     Generated method name
+        //                                                                     =====================
+        public String GetMethodNameOfGetCountAll() {
+            return "GetCountAll";
+        }
+
+        public String GetMethodNameOfGetListAll() {
+            return "GetListAll";
+        }
+
+        public String GetMethodNameOfGetEntity() {
+            return "GetEntity";
+        }
+
+        public String GetMethodNameOfSelectCountIgnoreFetchScope() {
+            return "SelectCountIgnoreFetchScope";
+        }
+
+        public String GetMethodNameOfSelectEntity() {
+            return "SelectEntity";
+        }
+
+        public String GetMethodNameOfSelectList() {
+            return "SelectList";
+        }
+
+        // =========================================================================================
+        //                                             Only when having generated, the effective one
+        //                                             =============================================
+        // -------------------------------------------------------------------------------
+        //                                                                           Basic
+        //                                                                           -----
+        /// <sumarry>
+        /// Get the property-value of targetLanguage.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetTargetLanguage() {
+            return "${database.TargetLanguage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of templateFileExtension.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetTemplateFileExtension() {
+            return "${database.TemplateFileExtension}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of classFileExtension.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetClassFileExtension() {
+            return "${database.ClassFileExtension}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of templateFileEncoding.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetTemplateEncoding() {
+            return "${database.TemplateFileEncoding}";
+        }
+
+        /// </sumarry>
+        /// Get the property-value of classAuthor.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetClassAuthor() {
+            return "${database.ClassAuthor}";
+        }
+
+        // -------------------------------------------------------------------------------
+        //                                                                       Available
+        //                                                                       ---------
+        /// <sumarry>
+        /// Is java name of table same as db name? Answer is ${database.isJavaNameOfTableSameAsDbName()}!
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public bool IsJavaNameOfTableSameAsDbName() {
+            return ${database.isJavaNameOfTableSameAsDbName()};
+        }
+
+        /// <sumarry>
+        /// Is java name of column same as db name? Answer is ${database.isJavaNameOfColumnSameAsDbName()}!
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public bool IsJavaNameOfColumnSameAsDbName() {
+            return ${database.isJavaNameOfColumnSameAsDbName()};
+        }
+
+        /// <sumarry>
+        /// Is available behavior generation? Answer is ${database.isAvailableBehaviorGeneration()}!
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public bool isAvailableBehaviorGeneration() {
+            return ${database.isAvailableBehaviorGeneration()};
+        }
+
+        /// <sumarry>
+        /// Is available common-column-setup interceptor to behavior? Answer is ${database.isAvailableCommonColumnSetupInterceptorToBehavior()}!
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public bool IsAvailableCommonColumnSetupInterceptorToBehavior() {
+            return ${database.isAvailableCommonColumnSetupInterceptorToBehavior()};
+        }
+
+        /// <sumarry>
+        /// Is available common-column-setup interceptor to dao? Answer is ${database.isAvailableCommonColumnSetupInterceptorToDao()}!
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public bool IsAvailableCommonColumnSetupInterceptorToDao() {
+            return ${database.isAvailableCommonColumnSetupInterceptorToDao()};
+        }
+
+        /// <sumarry>
+        /// Is available generics? Answer is ${database.isAvailableGenerics()}!
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public bool IsAvailableGenerics() {
+            return ${database.isAvailableGenerics()};
+        }
+
+        // -------------------------------------------------------------------------------
+        //                                                                          Prefix
+        //                                                                          ------
+        /// <sumarry>
+        /// Get the property-value of projectPrefix.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetProjectPrefix() {
+            return "${database.ProjectPrefix}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of basePrefix.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetBasePrefix() {
+            return "${database.BasePrefix}";
+        }
+
+        // -------------------------------------------------------------------------------
+        //                                                                        DaoDicon
+        //                                                                        --------
+        /// <sumarry>
+        /// Get the property-value of daoDiconNamespace.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetDaoDiconNamespace() {
+            return "${database.DaoDiconNamespace}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of daoDiconPackageName.
+        /// </sumarry>
+        /// <returns>The property-value.</sumarry>
+        public String GetDaoDiconPackageName() {
+            return "${database.DaoDiconPackageName}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of daoDiconFileName.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetDaoDiconFileName() {
+            return "${database.DaoDiconFileName}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of jdbcDiconResourceName.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetJdbcDiconResourceName() {
+            return "${database.JdbcDiconResourceName}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of requiredTxComponentName.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetRequiredTxComponentName() {
+            return "${database.requiredTxComponentName}";
+        }
+
+        // -------------------------------------------------------------------------------
+        //                                                                         Package
+        //                                                                         -------
+        /// <sumarry>
+        /// Get the property-value of baseCommonPackage.
+        ///
+        /// <returns>The property-value.</returns>
+        public String GetBaseCommonPackage() {
+            return "${database.BaseCommonPackage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of baseBehaviorPackage.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetBaseBehaviorPackage() {
+            return "${database.BaseBehaviorPackage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of baseDaoPackage.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetBaseDaoPackage() {
+            return "${database.BaseDaoPackage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of baseEntityPackage.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetBaseEntityPackage() {
+            return "${database.BaseEntityPackage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of conditionBeanPackage.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetConditionBeanPackage() {
+            return "${database.ConditionBeanPackage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of extendedDaoPackage.
+        /// </sumarry>
+        /// <returns>The property-value.</retuns>
+        public String GetExtendedDaoPackage() {
+            return "${database.ExtendedDaoPackage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of extendedBehaviorPackage.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetExtendedBehaviorPackage() {
+            return "${database.ExtendedBehaviorPackage}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of extendedEntityPackage.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetExtendedEntityPackage() {
+            return "${database.ExtendedEntityPackage}";
+        }
+
+        // -------------------------------------------------------------------------------
+        //                                                                 Optimistic Lock
+        //                                                                 ---------------
+        /// <sumarry>
+        /// Get the property-value of updateDateFieldName.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetUpdateDateFieldName() {
+            return "${database.UpdateDateFieldName}";
+        }
+
+        /// <sumarry>
+        /// Get the property-value of versionNoFieldName.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public String GetVersionNoFieldName() {
+            return "${database.VersionNoFieldName}";
+        }
+
+
+        // -------------------------------------------------------------------------------
+        //                                                                    Select Param
+        //                                                                    ------------
+        /// <sumarry>
+        /// Get the property-value of selectQueryTimeout.
+        /// </sumarry>
+        /// <returns>The property-value.</returns>
+        public int GetSelectQueryTimeout() {
+            return ${database.SelectQueryTimeout};
+        }
+
+        // -------------------------------------------------------------------------------
+        //                                                                         Extract
+        //                                                                         -------
+        /**
+         * Get the value of 'extractAcceptStartBrace'.
+         *
+         * @return The property-value. (NotNull)
+         */
+        public String GetExtractAcceptStartBrace() {
+            return "${database.extractAcceptStartBrace}";
+        }
+
+        /**
+         * Get the value of 'extractAcceptEndBrace'.
+         *
+         * @return The property-value. (NotNull)
+         */
+        public String GetExtractAcceptEndBrace() {
+            return "${database.extractAcceptEndBrace}";
+        }
+
+        /**
+         * Get the value of 'extractAcceptDelimiter'.
+         *
+         * @return The property-value. (NotNull)
+         */
+        public String GetExtractAcceptDelimiter() {
+            return "${database.extractAcceptDelimiter}";
+        }
+
+        /**
+         * Get the value of 'extractAcceptEqual'.
+         *
+         * @return The property-value. (NotNull)
+         */
+        public String GetExtractAcceptEqual() {
+            return "${database.extractAcceptEqual}";
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/annotation/OutsideSql.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/annotation/OutsideSql.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/annotation/OutsideSql.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,10 @@
+
+using System;
+
+namespace ${glPackageBaseCommonAnnotation} {
+    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+    public class ${glOutsideSqlAnnotation} : Attribute {
+        public ${glOutsideSqlAnnotation}() {
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorReadable.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorReadable.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorReadable.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,600 @@
+#set ($myClassName = "${glBehaviorReadableAbstractName}")
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonDBMeta};
+
+namespace ${glPackageBaseCommonBhv} {
+
+    /**
+     * The abstract class of behavior-readable.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public abstract class $myClassName : ${glBehaviorReadableInterfaceName} {
+
+        // =====================================================================================
+        //                                                                            Definition
+        //                                                                            ==========
+        /** Map-string map-mark. */
+        protected static readonly String MAP_STRING_MAP_MARK = "map:";
+
+        /** Map-string list-mark. */
+        protected static readonly String MAP_STRING_LIST_MARK = "list:";
+
+        /** Map-string start-brace. */
+        protected static readonly String MAP_STRING_START_BRACE = "${database.extractAcceptStartBrace}";
+
+        /** Map-string end-brace. */
+        protected static readonly String MAP_STRING_END_BRACE = "${database.extractAcceptEndBrace}";
+
+        /** Map-string delimiter. */
+        protected static readonly String MAP_STRING_DELIMITER = "${database.extractAcceptDelimiter}";
+
+        /** Map-string equal. */
+        protected static readonly String MAP_STRING_EQUAL = "${database.extractAcceptEqual}";
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        #region Attribute
+        /// <summary>Dao-selector instance.</summary>
+        protected ${glDaoSelectorInterfaceName} _daoSelector;
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                             TableName
+        //                                                                             =========
+        /// <summary>
+        /// The property of table db-Name. (readonly)
+        /// </summary>
+        abstract public String TableDbName { get; }
+
+        // =====================================================================================
+        //                                                                                DBMeta
+        //                                                                                ======
+        /// <summary>
+        /// The property of DBMeta. (readonly)
+        /// </summary>
+        abstract public ${glDBMetaInterfaceName} DBMeta { get; }
+
+        // =====================================================================================
+        //                                                                       Self Dispatcher
+        //                                                                       ===============
+        #region Self Dispatcher
+        /// <summary>
+        /// Behavior's self dispatcher as readable
+        /// </summary>
+        /// <returns>${glBehaviorReadableInterfaceName}</returns>
+        abstract protected ${glBehaviorReadableInterfaceName} SelfReadable { get; }
+        #endregion
+
+        // =====================================================================================
+        //                                                                          Dao Accessor
+        //                                                                          ============
+        #region Dao Accessor
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Dao-readable. (NotNull)
+         */
+        abstract public ${glDaoReadableInterfaceName} GetDaoReadable();
+        #endregion
+
+        // =====================================================================================
+        //                                                                          New Instance
+        //                                                                          ============
+        #region New Instance
+        /// <summary>
+        /// New entity.
+        /// </summary>
+        /// <returns>Entity. (NotNull)</returns>
+        abstract public ${glEntityInterfaceName} NewEntity();
+
+        /// <summary>
+        /// New condition-bean.
+        /// </summary>
+        /// <returns>Condition-bean. (NotNull)</returns>
+        abstract public ${glConditionBeanInterfaceName} NewConditionBean();
+        #endregion
+
+        // =====================================================================================
+        //                                                                          Dao Selector
+        //                                                                          ============
+        #region Dao Selector
+
+        /// <summary>
+        ///  The property of dao-selector.
+        /// </summary>
+        public ${glDaoSelectorInterfaceName} DaoSelector {
+            get { return _daoSelector; }
+            set { _daoSelector = value; }
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                       Delegate Method
+        //                                                                       ===============
+        #region Delegate-Method
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        int ${glBehaviorReadableInterfaceName}.CallGetCountAll() {
+            return DoCallGetCountAll();
+        }
+        abstract protected int DoCallGetCountAll();
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        IList ${glBehaviorReadableInterfaceName}.CallGetListAll() {
+            return DoCallGetListAll();
+        }
+        abstract protected IList DoCallGetListAll();
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        int ${glBehaviorReadableInterfaceName}.CallReadCount(${glConditionBeanInterfaceName} cb) {
+            return DoCallReadCount(cb);
+        }
+        abstract protected int DoCallReadCount(${glConditionBeanInterfaceName} cb);
+#if ($database.isMakeDeprecated())
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadCount()")]
+        int ${glBehaviorReadableInterfaceName}.CallReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb) {
+            return DoCallReadCountIgnoreFetchScope(cb);
+        }
+        abstract protected int DoCallReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb);
+#end
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read entity. If the select result is zero, it returns null. (Nullable)
+         */
+        ${glEntityInterfaceName} ${glBehaviorReadableInterfaceName}.CallReadEntity(${glConditionBeanInterfaceName} cb) {
+            return DoCallReadEntity(cb);
+        }
+        abstract protected ${glEntityInterfaceName} DoCallReadEntity(${glConditionBeanInterfaceName} cb);
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+         */
+        IList ${glBehaviorReadableInterfaceName}.CallReadList(${glConditionBeanInterfaceName} cb) {
+            return DoCallReadList(cb);
+        }
+        abstract protected IList DoCallReadList(${glConditionBeanInterfaceName} cb);
+
+
+
+#if ($database.isMakeDeprecated())
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadAllList()")]
+        IList ${glBehaviorReadableInterfaceName}.DelegateReadAllList() {
+            return DoDelegateReadAllList();
+        }
+        abstract protected IList DoDelegateReadAllList();
+#if ($database.isMakeDeprecated())
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please don't use!")]
+        int ${glBehaviorReadableInterfaceName}.DelegateReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb) {
+            return DoDelegateReadCountIgnoreFetchScope(cb);
+        }
+        abstract protected int DoDelegateReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb);
+#end
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read entity. If the select result is zero, it returns null. (Nullable)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadEntity()")]
+        ${glEntityInterfaceName} ${glBehaviorReadableInterfaceName}.DelegateReadEntity(${glConditionBeanInterfaceName} cb) {
+            return DoDelegateReadEntity(cb);
+        }
+        abstract protected ${glEntityInterfaceName} DoDelegateReadEntity(${glConditionBeanInterfaceName} cb);
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+         * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadList()")]
+        IList ${glBehaviorReadableInterfaceName}.DelegateReadList(${glConditionBeanInterfaceName} cb) {
+            return DoDelegateReadList(cb);
+        }
+        abstract protected IList DoDelegateReadList(${glConditionBeanInterfaceName} cb);
+
+#end
+
+        #endregion
+
+	    // =====================================================================================
+	    //                                                                         Basic Get All
+	    //                                                                         =============
+	    /**
+	     * Get count all.
+	     * 
+	     * @return Count all.
+	     */
+	    public int GetCountAll() {
+	        return this.SelfReadable.CallGetCountAll();
+	    }
+
+        // =====================================================================================
+        //                                                                          Basic Select
+        //                                                                          ============
+        #region Basic Select
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read count.</returns>
+        public int ReadCount(${glConditionBeanInterfaceName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return this.SelfReadable.CallReadCount(cb);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read entity. (Nullable)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasOverlappedException}"></exception>
+        public ${glEntityInterfaceName} ReadEntity(${glConditionBeanInterfaceName} cb) {
+            AssertConditionBeanNotNull(cb);
+            System.Collections.IList ls = this.SelfReadable.CallReadList(cb);
+            if (ls.Count == 0) {
+                return null;
+            }
+            AssertRecordHasBeenSelectedAsOne(ls, cb);
+            return (${glEntityInterfaceName})ls[0];
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read entity. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasOverlappedException}"></exception>
+        public ${glEntityInterfaceName} ReadEntityWithDeletedCheck(${glConditionBeanInterfaceName} cb) {
+            AssertConditionBeanNotNull(cb);
+            System.Collections.IList ls = this.SelfReadable.CallReadList(cb);
+            AssertRecordHasNotBeenDeleted(ls, cb);
+            AssertRecordHasBeenSelectedAsOne(ls, cb);
+            return (${glEntityInterfaceName})ls[0];
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>List-result-bean. (NotNull)</returns>
+        public ${glListResultBeanName} ReadList(${glConditionBeanInterfaceName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return new ResultBeanBuilder(this).BuildListResultBean(cb, this.SelfReadable.CallReadList(cb));
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read page. (NotNull)</returns>
+        public ${glPagingResultBeanName} ReadPage(${glConditionBeanInterfaceName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return this.SelfReadable.ReadPage(cb, new SelectPageSimpleInvoker(this));
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="invoker">Select-page-invoker. (NotNull)</param>
+        /// <returns>Read page. (NotNull)</returns>
+        public ${glPagingResultBeanName} ReadPage(${glConditionBeanInterfaceName} cb, SelectPageInvoker invoker) {
+            AssertConditionBeanNotNull(cb);
+            return invoker.InvokeSelectPage(new SelectPageSimpleCallback(cb, this));
+        }
+
+
+        /**
+         * Assert that record has not been deleted.
+         * 
+         * @param entity Selected entity.
+         * @param searchKey Search-key for Logging.
+         * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+         */
+        protected void AssertRecordHasNotBeenDeleted(${glPackageBaseCommon}.${glEntityInterfaceName} entity, Object searchKey4log) {
+            if (entity == null) {
+                String msg = "The record has already been deleted by other thread: searchKey=" + searchKey4log;
+                throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(msg);
+            }
+        }
+
+        /**
+         * Assert that record has not been deleted.
+         * 
+         * @param ls List.
+         * @param searchKey Search-key for Logging.
+         * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+         */
+        protected void AssertRecordHasNotBeenDeleted(System.Collections.IList ls, Object searchKey4log) {
+            if (ls == null || ls.Count == 0) {
+                String msg = "The record has already been deleted by other thread: searchKey=" + searchKey4log;
+                throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(msg);
+            }
+        }
+
+        /**
+         * Assert that record has been selected as one.
+         * 
+         * @param ls List.
+         * @param searchKey Search-key for Logging.
+         * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+         * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+         */
+        protected void AssertRecordHasBeenSelectedAsOne(System.Collections.IList ls, Object searchKey4log) {
+            if (ls == null || ls.Count == 0) {
+                String msg = "The record has already been deleted by other thread: searchKey=" + searchKey4log;
+                throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(msg);
+            }
+            if (ls.Count != 1) {
+                String msg = "This selected contents should be only one: searchKey=" + searchKey4log;
+                msg = msg + " resultCount=" + ls.Count;
+                throw new ${glPackageBaseCommonException}.${glRecordHasOverlappedException}(msg);
+            }
+        }
+
+        /**
+         * Assert that selected count has not exceeded max count.
+         * 
+         * @param selectedCount Selected count.
+         * @param maxCount Max count.
+         * @param clauseObject Clause object for exception message.
+         * @exception ${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}
+         */
+        protected void AssertSelectedCountHasNotExceededMaxCount(int selectedCount, int maxCount, Object clauseObject) {
+            AssertObjectNotNull("selectedCount", selectedCount);
+            AssertObjectNotNull("maxCount", maxCount);
+            if (selectedCount > maxCount) {
+                String msg = "Selected count[" + selectedCount + "] has exceeded max count[" + maxCount + "]: clauseObject=" + clauseObject;
+                throw new ${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}(msg, selectedCount, maxCount);
+            }
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Select
+        //                                                                        ==============
+        #region Various Select
+    #if ($database.isMakeDeprecated())
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param cb Condition-bean.
+         * @param maxCount Max count.
+         * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+         * @exception ${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}
+         */
+        [Obsolete("This method is deprecated.")]
+        public ${glListResultBeanName} ReadListAfterCheckingCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb, int maxCount) {
+            AssertConditionBeanNotNull(cb);
+            int selectedCount = this.SelfReadable.ReadCount(cb);
+            AssertSelectedCountHasNotExceededMaxCount(selectedCount, maxCount, cb);
+            return new ResultBeanBuilder(this).BuildListResultBean(cb, this.SelfReadable.CallReadList(cb));
+        }
+    #end
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="fetchSize">Fetch-size.</param>
+        /// <returns>Read page as first page. (NotNull)</returns>
+        public ${glPagingResultBeanName} ReadPageAsFirst(${glConditionBeanInterfaceName} cb, int fetchSize) {
+            AssertConditionBeanNotNull(cb);
+            cb.FetchFirst(fetchSize);
+            return this.SelfReadable.ReadPage(cb);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="fetchPageNumber">Fetch-page-number.</param>
+        /// <returns>Read page as PageNumber page. (NotNull)</returns>
+        public ${glPagingResultBeanName} ReadPageByPageNumber(${glConditionBeanInterfaceName} cb, int fetchPageNumber) {
+            AssertConditionBeanNotNull(cb);
+            cb.FetchPage(fetchPageNumber);
+            return this.SelfReadable.ReadPage(cb);
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                         Helper Method
+        //                                                                         =============
+        #region Helper Method
+
+        // ----------------------------------------------------------------
+        //                                                    Assert Object
+        //                                                    -------------
+        #region Assert Object
+
+        /**
+         * Assert that the argument is not null.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertObjectNotNull(String variableName, Object arg) {
+            if (variableName == null) {
+                String msg = "Argument[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (arg == null) {
+                String msg = "Argument[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+        }
+
+        /**
+         * Assert that the entity is not null.
+         * 
+         * @param entity Entity. (NotNull)
+         */
+        protected void AssertEntityNotNull(${glEntityInterfaceName} entity) {
+            AssertObjectNotNull("entity", entity);
+        }
+
+        /**
+         * Assert that the condition-bean is not null.
+         * 
+         * @param cb Condition-bean. (NotNull)
+         */
+        protected void AssertConditionBeanNotNull(${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName} cb) {
+            AssertObjectNotNull("cb", cb);
+        }
+
+        /**
+         * Assert that the entity has primary-key value.
+         * 
+         * @param entity Entity. (NotNull)
+         */
+        protected void AssertEntityNotNullAndHasPrimaryKeyValue(${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            if (!entity.HasPrimaryKeyValue) {
+                String msg = "The entity must should primary-key: entity=" + entity;
+                throw new ArgumentOutOfRangeException(msg + entity);
+            }
+        }
+
+        #endregion
+
+        // ----------------------------------------------------------------
+        //                                                    Assert String
+        //                                                    -------------
+        #region Assert String
+
+        /**
+         * Assert that the string is not null and not trimmed empty.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+            if (variableName == null) {
+                String msg = "Variable[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value == null) {
+                String msg = "Variable[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value.Trim().Length == 0) {
+                String msg = "Variable[" + variableName + "] should not be empty: [" + value + "]";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        #endregion
+
+
+        // ----------------------------------------------------------------
+        //                                                      Assert List
+        //                                                      -----------
+        #region Assert List
+        /**
+         * Assert that the list is empty.
+         * 
+         * @param ls List. (NotNull)
+         */
+        protected void AssertListNotNullAndEmpty(String variableName, IList ls) {
+            AssertObjectNotNull(variableName, ls);
+            if (!(ls.Count == 0)) {
+                String msg = "The list[" + variableName + "] should be empty: ls=" + ls.ToString();
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        /**
+         * Assert that the list is not empty.
+         * 
+         * @param ls List. (NotNull)
+         */
+        protected void AssertListNotNullAndNotEmpty(String variableName, IList ls) {
+            AssertObjectNotNull(variableName, ls);
+            if (ls.Count == 0) {
+                String msg = "The list[" + variableName + "] should not be empty: ls=" + ls.ToString();
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        /**
+         * Assert that the list having only one.
+         * 
+         * @param ls List. (NotNull)
+         */
+        protected void AssertListNotNullAndHasOnlyOne(String variableName, IList ls) {
+            AssertObjectNotNull(variableName, ls);
+            if (ls.Count != 1) {
+                String msg = "The list[" + variableName + "] should contain only one object: ls=" + ls.ToString();
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+        #endregion
+        #endregion
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorWritable.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorWritable.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/AbstractBehaviorWritable.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,470 @@
+#set ($myClassName = "${glBehaviorWritableAbstractName}")
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonHelper};
+
+namespace ${glPackageBaseCommonBhv} {
+
+    /**
+     * The abstract class of behavior-writable.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public abstract class $myClassName : ${glBehaviorReadableAbstractName}, ${glBehaviorWritableInterfaceName} {
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                       Self Dispatcher
+        //                                                                       ===============
+        #region Self Dispatcher
+        /// <summary>
+        /// Behavior's self dispatcher as writable
+        /// </summary>
+        /// <returns>${glBehaviorWritableInterfaceName}</returns>
+        abstract protected ${glBehaviorWritableInterfaceName} SelfWritable { get; }
+        #endregion
+
+        // =====================================================================================
+        //                                                                          Dao Accessor
+        //                                                                          ============
+        #region Dao Getter
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Dao-writable. (NotNull)
+         */
+        abstract public ${glDaoWritableInterfaceName} GetDaoWritable();
+        #endregion
+
+        // =====================================================================================
+        //                                                                       Delegate Method
+        //                                                                       ===============
+        #region Delegate-Method
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Inserted count.
+         */
+        int ${glBehaviorWritableInterfaceName}.CallCreate(${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            FilterEntityOfInsert(entity);
+            AssertEntityOfInsert(entity);
+            return DoCallCreate(entity);
+        }
+
+        /// <summary>
+        /// Filter the entity of insert.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void FilterEntityOfInsert(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        }
+
+        /// <summary>
+        /// Assert the entity of insert.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void AssertEntityOfInsert(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        }
+
+        abstract protected int DoCallCreate(${glEntityInterfaceName} entity);
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Updated count.
+         */
+        int ${glBehaviorWritableInterfaceName}.CallModify(${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            FilterEntityOfUpdate(entity);
+            AssertEntityOfUpdate(entity);
+            return DoCallModify(entity);
+        }
+
+        /// <summary>
+        /// Filter the entity of update.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void FilterEntityOfUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        }
+
+        /// <summary>
+        /// Assert the entity of update.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void AssertEntityOfUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        }
+
+        abstract protected int DoCallModify(${glEntityInterfaceName} entity);
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Deleted count.
+         */
+        int ${glBehaviorWritableInterfaceName}.CallRemove(${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            FilterEntityOfDelete(entity);
+            AssertEntityOfDelete(entity);
+            return DoCallRemove(entity);
+        }
+
+        /// <summary>
+        /// Filter the entity of delete.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void FilterEntityOfDelete(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        }
+
+        /// <summary>
+        /// Assert the entity of delete.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void AssertEntityOfDelete(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        }
+
+        abstract protected int DoCallRemove(${glEntityInterfaceName} entity);
+
+
+#if ($database.isMakeDeprecated())
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Inserted count.
+         */
+        [Obsolete("This method is deprecated. Please use CallCreate()")]
+        int ${glBehaviorWritableInterfaceName}.DelegateCreate(${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            FilterEntityOfInsert(entity);
+            AssertEntityOfInsert(entity);
+            return DoDelegateCreate(entity);
+        }
+
+        abstract protected int DoDelegateCreate(${glEntityInterfaceName} entity);
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Updated count.
+         */
+        [Obsolete("This method is deprecated. Please use CallModify()")]
+        int ${glBehaviorWritableInterfaceName}.DelegateModify(${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            FilterEntityOfUpdate(entity);
+            AssertEntityOfUpdate(entity);
+            return DoDelegateModify(entity);
+        }
+
+        abstract protected int DoDelegateModify(${glEntityInterfaceName} entity);
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Deleted count.
+         */
+        [Obsolete("This method is deprecated. Please use CallRemove()")]
+        int ${glBehaviorWritableInterfaceName}.DelegateRemove(${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            FilterEntityOfDelete(entity);
+            AssertEntityOfDelete(entity);
+            return DoDelegateRemove(entity);
+        }
+
+        abstract protected int DoDelegateRemove(${glEntityInterfaceName} entity);
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                   Basic Entity Update
+        //                                                                   ===================
+        #region Basic Entity Update
+        /// <summary>
+        /// Create.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        public void Create(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            this.SelfWritable.CallCreate(entity);
+        }
+
+        /// <summary>
+        /// Modify.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        public void Modify(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            int modifiedCount = this.SelfWritable.CallModify(entity);
+            if (modifiedCount != 1) {
+                throw new Seasar.Dao.NotSingleRowUpdatedRuntimeException(entity, modifiedCount);
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity.
+         * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+         */
+        public void ModifyAfterSelect(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName} = this.DBMeta.NewConditionBean();
+            ${glAttachedCBArgsVariableName}.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            ${glPackageBaseCommon}.${glEntityInterfaceName} currentEntity = this.SelfReadable.ReadEntity(${glAttachedCBArgsVariableName});
+            AssertRecordHasNotBeenDeleted(currentEntity, entity.ExtractPrimaryKeyMapString());
+            MergeEntity(entity, currentEntity);
+            this.SelfWritable.Modify(currentEntity);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        public void CreateOrModifyAfterSelect(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            if (!entity.HasPrimaryKeyValue) {
+                this.SelfWritable.Create(entity);
+                return;
+            }
+            ${glPackageBaseCommon}.${glEntityInterfaceName} currentEntity = null;
+            try {
+                ${glConditionBeanInterfaceName} cb = NewConditionBean();
+                cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+                currentEntity = ReadEntityWithDeletedCheck(cb);
+            } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}) {
+                this.SelfWritable.Create(entity);
+                return;
+            }
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            MergeEntity(entity, currentEntity);
+            this.SelfWritable.Modify(currentEntity);
+        }
+
+#if ($database.isMakeBehaviorForUpdate())
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param entity Entity.
+         * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+         */
+        public void ModifyAfterSelectForUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName} = this.DBMeta.NewConditionBean();
+            ${glAttachedCBArgsVariableName}.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            ${glAttachedCBArgsVariableName}.LockForUpdate();
+            ${glPackageBaseCommon}.${glEntityInterfaceName} currentEntity = this.SelfReadable.ReadEntity(${glAttachedCBArgsVariableName});
+            AssertRecordHasNotBeenDeleted(currentEntity, entity.ExtractPrimaryKeyMapString());
+            MergeEntity(entity, currentEntity);
+            this.SelfWritable.Modify(currentEntity);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        public void CreateOrModifyAfterSelectForUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            if (!entity.HasPrimaryKeyValue) {
+                this.SelfWritable.Create(entity);
+                return;
+            }
+            ${glPackageBaseCommon}.${glEntityInterfaceName} currentEntity = null;
+            try {
+                ${glConditionBeanInterfaceName} cb = NewConditionBean();
+                cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+                cb.LockForUpdate();
+                currentEntity = ReadEntityWithDeletedCheck(cb);
+            } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}) {
+                this.SelfWritable.Create(entity);
+                return;
+            }
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            MergeEntity(entity, currentEntity);
+            this.SelfWritable.Modify(currentEntity);
+        }
+#end
+
+        /**
+         * Merge entity.
+         * Copy the column data of sourceEntity that the setter has been invoked to destinationEntity.
+         * 
+         * @param sourceEntity Source entity.
+         * @param destinationEntity Destination entity.
+         */
+        abstract protected void MergeEntity(${glPackageBaseCommon}.${glEntityInterfaceName} sourceEntity, ${glPackageBaseCommon}.${glEntityInterfaceName} destinationEntity);
+
+        /// <summary>
+        /// Remove.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        public void Remove(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            AssertEntityNotNull(entity);
+            this.SelfWritable.CallRemove(entity);
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Update
+        //                                                                        ==============
+        #region Various Update
+        /// <summary>
+        /// Filter logical-delete entity.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void FilterLogicalDeleteEntity(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            // Nothing.
+        }
+
+        /// <summary>
+        /// Filter revival from logical-delete entity.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void FilterRevivalFromLogicalDeleteEntity(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            // Nothing.
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Insert
+        //                                                                        ==============
+        #region Various Insert
+        /// <summary>
+        /// Filter copy-insert entity.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        protected virtual void FilterCopyInsertEntity(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+            // Nothing.
+        }
+
+        /// <summary>
+        /// Reflect(insert or update) from separated-file.
+        /// </summary>
+        /// <remarks>
+        /// If transaction already started, The argument 'batchCount' is invalid. (Inherit the transaction)
+        /// </remarks>
+        /// <param name="filename">Name of the file. (NotNull and NotEmpty)</param>
+        /// <param name="encoding">Encoding of the file. (NotNull and NotEmpty)</param>
+        /// <param name="delimiter">Delimiter of the file. (NotNull and NotEmpty)</param>
+        /// <param name="batchCount">Batch-count for transaction.</param>
+        /// <param name="isErrorContinue">If true, this method continue in spite of throwing the exception.</param>
+        /// <returns>The list of InsertOrUpdateExceptionResult. (NotNull)</returns>
+        /// <exception cref="FileNotFoundException"></exception>
+        /// <exception cref="IOException"></exception>
+        public System.Collections.Generic.IList<OneEntityExceptionResult> ReflectFromSeparatedFile(
+                String filename, String encoding,
+                String delimiter, int batchCount, bool isErrorContinue){
+            AssertStringNotNullAndNotTrimmedEmpty("filename", filename);
+            AssertStringNotNullAndNotTrimmedEmpty("encoding", encoding);
+            AssertObjectNotNull("delimiter", delimiter);
+            
+            System.Collections.Generic.IList<OneEntityExceptionResult> exceptionList = new System.Collections.Generic.List<OneEntityExceptionResult>();
+
+            try{
+                ${glMapStringBuilderName} builder = new ${glMapStringBuilderImplName}();
+                builder.MapStringMapMark = MAP_STRING_MAP_MARK;
+                builder.MapStringStartBrace = MAP_STRING_START_BRACE;
+                builder.MapStringEndBrace = MAP_STRING_END_BRACE;
+                builder.MapStringDelimiter = MAP_STRING_DELIMITER;
+                builder.MapStringEqual = MAP_STRING_EQUAL;
+
+                System.Collections.Generic.IList<${glEntityInterfaceName}> entityList = new System.Collections.Generic.List<${glEntityInterfaceName}>();
+                int count = 0;
+
+                using(System.IO.StreamReader reader = new System.IO.StreamReader(
+                    filename, System.Text.Encoding.GetEncoding(encoding))){
+                    try{
+                        while (true) {
+                            ++count;
+
+                            String lineString = reader.ReadLine();
+                            if (lineString == null) {
+                                if (entityList.Count > 0) {
+                                    ReflectAfterSelectNew(entityList, isErrorContinue, exceptionList);
+                                    entityList.Clear();
+                                }
+                                break;
+                            }
+                            if (count == 1) {
+                                builder.ColumnNames = lineString.Split(delimiter.ToCharArray());
+                                continue;
+                            }
+
+                            String mapString = builder.BuildByDelimiter(lineString, delimiter);
+                            ${glEntityInterfaceName} entity = DBMeta.NewEntity();
+                            entity.AcceptColumnValueMapString(mapString);
+                            entityList.Add(entity);
+
+                            if (entityList.Count == batchCount) {
+                                ReflectAfterSelectNew(entityList, isErrorContinue, exceptionList);
+                                entityList.Clear();
+                            }
+                        }
+                    }
+                    finally{
+                        reader.Close();
+                    }
+                }
+            }
+            catch (System.IO.FileNotFoundException) {
+                throw;
+            } catch (System.IO.IOException) {
+                throw;
+            }
+            
+            return exceptionList;
+        }
+
+        /// <summary>
+        /// Reflect(insert or update) from separated-file.
+        /// </summary>
+        /// <param name="entityList">The list of entity that is reflection target. (NotNull)</param>
+        /// <param name="isErrorContinue">If true, this method continue in spite of throwing the exception.</param>
+        /// <returns>The list of InsertOrUpdateExceptionResult. (NotNull)</returns>
+        public void ReflectAfterSelectNew(System.Collections.Generic.IList<${glEntityInterfaceName}> entityList,
+                bool isErrorContinue, System.Collections.Generic.IList<OneEntityExceptionResult> exceptionList) {
+
+            foreach(${glEntityInterfaceName} entity in entityList) {
+                try {
+                    CreateOrModifyAfterSelect(entity);
+                } catch (System.Exception e) {
+                    if (isErrorContinue) {
+                        OneEntityExceptionResult result = new OneEntityExceptionResult();
+                        result.PrimaryKeyMapString = entity.ExtractPrimaryKeyMapString();
+                        result.Entity = entity;
+                        result.Exception = e;
+                        exceptionList.Add(result);
+                        continue;
+                    }
+                    throw;
+                }
+            }
+            return;
+        }
+
+        #endregion
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorReadable.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorReadable.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorReadable.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,429 @@
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonDBMeta};
+
+namespace ${glPackageBaseCommonBhv} {
+
+    /**
+     * The interface of behavior-readable.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public interface ${glBehaviorReadableInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             TableName
+        //                                                                             =========
+        /// <summary>
+        /// The property of table db-Name. (readonly)
+        /// </summary>
+        String TableDbName { get; }
+
+        // =====================================================================================
+        //                                                                                DBMeta
+        //                                                                                ======
+        /// <summary>
+        /// The property of DBMeta. (readonly)
+        /// </summary>
+        ${glDBMetaInterfaceName} DBMeta { get; }
+
+        // =====================================================================================
+        //                                                                          Dao Accessor
+        //                                                                          ============
+        /**
+         * Get dao-readable.
+         * 
+         * @return Dao-readable. (NotNull)
+         */
+        ${glDaoReadableInterfaceName} GetDaoReadable();
+
+        // =====================================================================================
+        //                                                                          New Instance
+        //                                                                          ============
+        /// <summary>
+        /// New entity.
+        /// </summary>
+        /// <returns>Entity. (NotNull)</returns>
+        ${glEntityInterfaceName} NewEntity();
+
+        /// <summary>
+        /// New condition-bean.
+        /// </summary>
+        /// <returns>Condition-bean. (NotNull)</returns>
+        ${glConditionBeanInterfaceName} NewConditionBean();
+
+        // =====================================================================================
+        //                                                                       Delegate-Method
+        //                                                                       ===============
+        /**
+         * Get count all. (Call-Method)
+         * 
+         * @return Count all. (NotNull)
+         */
+        int CallGetCountAll();
+
+        /**
+         * Read all list. (Call-Method)
+         * 
+         * @return Read all list. (NotNull)
+         */
+        IList CallGetListAll();
+
+        /**
+         * Read count by condition-bean. (Delegate-Method)
+         * Ignore fetchFirst() and fetchScope() and fetchPage(). But the fetch status of the condition-bean remains as it is.
+         * 
+         * @param cb Condition-bean. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        int CallReadCount(${glConditionBeanInterfaceName} cb);
+#if ($database.isMakeDeprecated())
+
+        /**
+         * Read count by condition-bean. (Delegate-Method)
+         * Ignore fetchFirst() and fetchScope() and fetchPage(). But the fetch status of the condition-bean remains as it is.
+         * 
+         * @param cb Condition-bean. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadCount()")]
+        int CallReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb);
+#end
+
+        /**
+         * Read entity by condition-bean. (Call-Method)
+         * 
+         * @param cb Condition-bean. (NotNull)
+         * @return Read entity. If the select result is zero, it returns null. (Nullable)
+         */
+        ${glEntityInterfaceName} CallReadEntity(${glConditionBeanInterfaceName} cb);
+
+        /**
+         * Read list by condition-bean. (Call-Method)
+         * 
+         * @param cb Condition-bean. (NotNull)
+         * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+         */
+        IList CallReadList(${glConditionBeanInterfaceName} cb);
+
+
+
+#if ($database.isMakeDeprecated())
+
+        /**
+         * Read all list. (Delegate-Method)
+         * 
+         * @return Read all list. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadAllList()")]
+        IList DelegateReadAllList();
+#if ($database.isMakeDeprecated())
+
+        /**
+         * Read count by condition-bean. (Delegate-Method)
+         * Ignore fetchFirst() and fetchScope() and fetchPage(). But the fetch status of the condition-bean remains as it is.
+         * 
+         * @param cb Condition-bean. (NotNull)
+         * @return Read count. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please don't use!")]
+        int DelegateReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb);
+#end
+
+        /**
+         * Read entity by condition-bean. (Delegate-Method)
+         * 
+         * @param cb Condition-bean. (NotNull)
+         * @return Read entity. If the select result is zero, it returns null. (Nullable)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadEntity()")]
+        ${glEntityInterfaceName} DelegateReadEntity(${glConditionBeanInterfaceName} cb);
+
+        /**
+         * Read list by condition-bean. (Delegate-Method)
+         * 
+         * @param cb Condition-bean. (NotNull)
+         * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+         */
+        [Obsolete("This method is deprecated. Please use CallReadList()")]
+        IList DelegateReadList(${glConditionBeanInterfaceName} cb);
+
+#end
+
+	    // =====================================================================================
+	    //                                                                         Basic Get All
+	    //                                                                         =============
+	    /**
+	     * Get count all.
+	     * 
+	     * @return Count all.
+	     */
+	    int GetCountAll();
+
+        // =====================================================================================
+        //                                                                          Basic Select
+        //                                                                          ============
+        #region Basic Select
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read count.</returns>
+        int ReadCount(${glConditionBeanInterfaceName} cb);
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read entity. (Nullable)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasOverlappedException}"></exception>
+        ${glEntityInterfaceName} ReadEntity(${glConditionBeanInterfaceName} cb);
+
+        /// <summary>
+        /// Read entity with deleted check.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read entity. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}">If the result is nothing.</exception>
+        ${glEntityInterfaceName} ReadEntityWithDeletedCheck(${glConditionBeanInterfaceName} cb);
+
+        /// <summary>
+        /// Read list.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>List-result-bean. (NotNull)</returns>
+        ${glListResultBeanName} ReadList(${glConditionBeanInterfaceName} cb);
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Read page. (NotNull)</returns>
+        ${glPagingResultBeanName} ReadPage(${glConditionBeanInterfaceName} cb);
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="invoker">Select-page-invoker. (NotNull)</param>
+        /// <returns>Read page. (NotNull)</returns>
+        ${glPagingResultBeanName} ReadPage(${glConditionBeanInterfaceName} cb, SelectPageInvoker invoker);
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Select
+        //                                                                        ==============
+        #region Various Select
+    #if ($database.isMakeDeprecated())
+
+        /**
+         * Read list after checking count.
+         * 
+         * @param cb Condition-bean.
+         * @param maxCount Max count.
+         * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+         * @exception ${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}
+         */
+        [Obsolete("This method is deprecated.")]
+        ${glListResultBeanName} ReadListAfterCheckingCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb, int maxCount);
+    #end
+
+        /// <summary>
+        /// Read page as first page.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="fetchSize">Fetch-size.</param>
+        /// <returns>Read page as first page. (NotNull)</returns>
+        ${glPagingResultBeanName} ReadPageAsFirst(${glConditionBeanInterfaceName} cb, int fetchSize);
+
+        /// <summary>
+        /// Read page by page-number.
+        /// If result-page is 'rb.getAllRecordCount > 0 && rb.getSelectedList().size() == 0', re-select as max-page.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="fetchPageNumber">Fetch-page-number.</param>
+        /// <returns>Read page as [fetchPageNumber] page. (NotNull)</returns>
+        ${glPagingResultBeanName} ReadPageByPageNumber(${glConditionBeanInterfaceName} cb, int fetchPageNumber);
+        #endregion
+    }
+
+    /// <summary>
+    /// The interface of select-page callback.
+    /// 
+    /// <![CDATA[
+    ///   ex) If you select as original method, the way is as follows:
+    /// 
+    ///      // Original behavior method of select-page-as-first as BookInfo.
+    ///      public SelectPageAsFirstBookInfo(BookCB cb, BookInfoPmb pmb, int fetchSize) {
+    ///          SelectPageCallback callback = new SelectPageAsFirstSimpleCallback(cb, pmb, fetchSize);
+    ///          return InvokeSelectPage(callback);
+    ///      }
+    /// 
+    ///      // Original select-page callback.
+    ///      public class SelectPageBookInfoCallback : SelectPageSimpleCallback {
+    ///          protected BookInfoPmb _pmb;
+    ///          public ${glConditionBeanInterfaceName} PagingBeanAsBookInfoCB { get { return (BookInfoCB)this.PagingBean; } }
+    ///          public SelectPageAsFirstBookInfo(BookBhv bhv, BookCB pb, BookInfoPmb pmb) : base(bhv, pb) {
+    ///              _pmb = pmb;
+    ///          }
+    ///          override int SelectPageCallback.SelectCountIgnoreFetchScope() {
+    ///              return this.Behavior.Dao.SelectCountIgnoreFetchScopeBookInfo(this.PagingBeanAsBookInfoCB, _pmb); // Original Method Invoking
+    ///          }
+    ///          override int SelectPageCallback.SelectList() {
+    ///              return this.Behavior.Dao.SelectListBookInfo(this.PagingBeanAsBookInfoCB, _pmb); // Original Method Invoking
+    ///          }
+    ///      }
+    /// ]]>
+    /// </summary>
+    public interface SelectPageCallback {
+        ${glPagingBeanInterfaceName} PagingBean { get; }
+        int SelectCountIgnoreFetchScope();
+        System.Collections.IList SelectList();
+    }
+
+    /// <summary>
+    /// The simple-implementation of select-page-as-first callback.
+    /// </summary>
+    public class SelectPageSimpleCallback : SelectPageCallback {
+        protected ${glPagingBeanInterfaceName} _pb;
+        protected ${glBehaviorReadableInterfaceName} _bhv;
+        public ${glPagingBeanInterfaceName} PagingBean { get { return _pb; } }
+        public SelectPageSimpleCallback(${glPagingBeanInterfaceName} pb, ${glBehaviorReadableInterfaceName} bhv) {
+            _pb = pb;
+            _bhv = bhv;
+        }
+        public virtual int SelectCountIgnoreFetchScope() {
+            // This is default method of select-count-ignore-fetch-scope.
+            return _bhv.ReadCount((${glConditionBeanInterfaceName})this.PagingBean);
+        }
+        public virtual System.Collections.IList SelectList() {
+            // This is default method of select-list.
+            return _bhv.ReadList((${glConditionBeanInterfaceName})this.PagingBean);
+        }
+    }
+
+    public class ResultBeanBuilder {
+
+        protected ${glBehaviorReadableInterfaceName} _bhv;
+        public ResultBeanBuilder(${glBehaviorReadableInterfaceName} bhv) {
+            _bhv = bhv;
+        }
+        public ${glBehaviorReadableInterfaceName} Bhv {
+            get { return _bhv; }
+        }
+
+        /**
+         * Build list-reuslt-bean.
+         * 
+         * @param ob Order-by-bean. (NotNull)
+         * @param selectedList Selected list. (NotNull)
+         * @return List-result-bean. (NotNull)
+         */
+        public ${glListResultBeanName} BuildListResultBean(${glOrderByBeanInterfaceName} ob, System.Collections.IList selectedList) {
+            ${glListResultBeanName} rb = new ${glListResultBeanName}();
+            rb.TableDbName = this.Bhv.TableDbName;
+            rb.AllRecordCount = selectedList.Count;
+            rb.SelectedList = selectedList;
+            rb.OrderByClause = ob.SqlComponentOfOrderByClause;
+            return rb;
+        }
+
+        /// <summary>
+        /// Build paging-result-bean.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Paging result bean. (NotNull)</returns>
+        public ${glPagingResultBeanName} BuildPagingResultBean(${glPagingBeanInterfaceName} pb, int allRecordCount, System.Collections.IList selectedList) {
+            ${glPagingResultBeanName} rb = new ${glPagingResultBeanName}();
+            rb.TableDbName = this.Bhv.TableDbName;
+            rb.AllRecordCount = allRecordCount;
+            rb.SelectedList = selectedList;
+            rb.PageSize = pb.FetchSize;
+            rb.CurrentPageNumber = pb.FetchPageNumber;
+            rb.OrderByClause = pb.SqlComponentOfOrderByClause;
+            return rb;
+        }
+    }
+
+    public interface SelectPageInvoker {
+        /// <summary>
+        /// Invoke select-page by callback.
+        /// </summary>
+        /// <param name="callback">Callback. (NotNull)</param>
+        ${glPagingResultBeanName} InvokeSelectPage(SelectPageCallback callback);
+    }
+
+    public class SelectPageSimpleInvoker : SelectPageInvoker {
+
+        protected ${glBehaviorReadableInterfaceName} _bhv;
+        public SelectPageSimpleInvoker(${glBehaviorReadableInterfaceName} bhv) {
+            _bhv = bhv;
+        }
+        public ${glBehaviorReadableInterfaceName} Bhv {
+            get { return _bhv; }
+        }
+
+        /// <summary>
+        /// Invoke select-page by callback.
+        /// </summary>
+        /// <param name="callback">Callback. (NotNull)</param>
+        public ${glPagingResultBeanName} InvokeSelectPage(SelectPageCallback callback) {
+            AssertObjectNotNull("callback", callback);
+            AssertObjectNotNull("callback.PagingBean", callback.PagingBean);
+            if (!callback.PagingBean.IsFetchScopeEffective) {
+                String msg = "When you invoke select page, you should set up fetch-scope of paging bean.";
+                msg = msg + " But the paging bean is not effective about fetch-scope: " + callback.PagingBean;
+                throw new SystemException(msg);
+            }
+            int allRecordCount = callback.SelectCountIgnoreFetchScope();
+            System.Collections.IList selectedList = callback.SelectList();
+            ${glPagingResultBeanName} rb = new ResultBeanBuilder(this.Bhv).BuildPagingResultBean(callback.PagingBean, allRecordCount, selectedList);
+            if (IsNecessaryToReadPageAgain(rb)) {
+                callback.PagingBean.FetchPage(rb.AllPageCount);
+                int reAllRecordCount = callback.SelectCountIgnoreFetchScope();
+                System.Collections.IList reSelectedList = callback.SelectList();
+                return new ResultBeanBuilder(this.Bhv).BuildPagingResultBean(callback.PagingBean, reAllRecordCount, reSelectedList);
+            } else {
+                return rb;
+            }
+        }
+
+        /// <summary>
+        /// Is it necessary to read page again?
+        /// </summary>
+        /// <param name="rb">Paging-result-bean. (NotNull)<param>
+        /// <returns>Determination.</return>
+        protected bool IsNecessaryToReadPageAgain(${glPagingResultBeanName} rb) {
+            return rb.AllRecordCount > 0 && rb.SelectedList.Count == 0;
+        }
+
+        /**
+         * Assert that the argument is not null.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertObjectNotNull(String variableName, Object arg) {
+            if (variableName == null) {
+                String msg = "Argument[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (arg == null) {
+                String msg = "Argument[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+        }
+    }
+
+    /// <summary>
+    /// The marker interface of simple condition-bean setupper.
+    /// </summary>
+    public interface SimpleCBSetupper {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorWritable.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorWritable.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/bhv/BehaviorWritable.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,172 @@
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+
+namespace ${glPackageBaseCommonBhv} {
+
+    /**
+     * The interface of behavior-writable.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public interface ${glBehaviorWritableInterfaceName} : ${glBehaviorReadableInterfaceName} {
+
+        /**
+         * Get dao-writable.
+         * 
+         * @return Dao-writable. (NotNull)
+         */
+        ${glDaoWritableInterfaceName} GetDaoWritable();
+
+        /**
+         * Create entity. (Call-Method)
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Inserted count.
+         */
+        int CallCreate(${glEntityInterfaceName} entity);
+
+        /**
+         * Modify entity. (Call-Method)
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Updated count.
+         */
+        int CallModify(${glEntityInterfaceName} entity);
+
+        /**
+         * Remove entity. (Call-Method)
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Deleted count.
+         */
+        int CallRemove(${glEntityInterfaceName} entity);
+
+#if ($database.isMakeDeprecated())
+
+        /**
+         * Create entity. (Delegate-Method)
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Inserted count.
+         */
+        [Obsolete("This method is deprecated. Please use CallCreate()")]
+        int DelegateCreate(${glEntityInterfaceName} entity);
+
+        /**
+         * Modify entity. (Delegate-Method)
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Updated count.
+         */
+        [Obsolete("This method is deprecated. Please use CallModify()")]
+        int DelegateModify(${glEntityInterfaceName} entity);
+
+        /**
+         * Remove entity. (Delegate-Method)
+         * 
+         * @param entity Entity that the type is entity-interface. (NotNull)
+         * @return Deleted count.
+         */
+        [Obsolete("This method is deprecated. Please use CallRemove()")]
+        int DelegateRemove(${glEntityInterfaceName} entity);
+#end
+
+        // =====================================================================================
+        //                                                                   Basic Entity Update
+        //                                                                   ===================
+        #region Basic Entity Update
+        /// <summary>
+        /// Create.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        void Create(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+        /// <summary>
+        /// Modify.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        void Modify(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+        /**
+        /// Modify after select.
+         * 
+         * @param entity Entity.
+         * @return Updated count.
+         * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+         */
+        void ModifyAfterSelect(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+        /// <summary>
+        /// Create or modify after select.
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        void CreateOrModifyAfterSelect(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+#if ($database.isMakeBehaviorForUpdate())
+
+        /// <summary>
+        /// Modify after select-for-update.
+        /// </summary>
+        /// <param name="entity">Entity.</param>
+        /// <exception cref="MspadminBiz.Dao.Allcommon.exception.RecordHasAlreadyBeenDeletedException"></exception>
+        void ModifyAfterSelectForUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+        /// <summary>
+        /// Create or modify after select-for-update.
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        void CreateOrModifyAfterSelectForUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+#end
+
+        /// <summary>
+        /// Remove.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        void Remove(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+        /// <summary>
+        /// Reflect(insert or update) from separated-file.
+        /// </summary>
+        /// <param name="filename">Name of the file. (NotNull and NotEmpty)</param>
+        /// <param name="encoding">Encoding of the file. (NotNull and NotEmpty)</param>
+        /// <param name="delimiter">Delimiter of the file. (NotNull and NotEmpty)</param>
+        /// <param name="batchCount">Batch-count for transaction.</param>
+        /// <param name="isErrorContinue">If true, this method continue in spite of throwing the exception.</param>
+        /// <returns>The list of InsertOrUpdateExceptionResult. (NotNull)</returns>
+        /// <exception cref="FileNotFoundException"></exception>
+        /// <exception cref="IOException"></exception>
+        System.Collections.Generic.IList<OneEntityExceptionResult> ReflectFromSeparatedFile(
+            String filename, String encoding, String delimiter, 
+            int batchCount, bool isErrorContinue);
+
+        #endregion
+    }
+
+
+    /// <summary>
+    /// Exception result for one entity. 
+    /// </summary>
+    public class OneEntityExceptionResult {
+        protected String _primaryKeyMapString;
+        protected ${glEntityInterfaceName} _entity;
+        protected Exception _exception;
+
+        public String PrimaryKeyMapString{
+            get { return _primaryKeyMapString; }
+            set { _primaryKeyMapString = value; }
+        }
+        
+        public ${glEntityInterfaceName} Entity{
+            get { return _entity; }
+            set { _entity = value; }
+        }
+        
+        public Exception Exception{
+            get { return _exception; }
+            set { _exception = value; }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,499 @@
+#set ($myClassName = "${glConditionBeanAbstractName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+using ${glPackageBaseCommonDBMeta};
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The condition-bean as abstract.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public abstract class $myClassName : ${glConditionBeanInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        /** SQL clause instance. */
+        protected readonly ${glSqlClauseName} _sqlClause;
+
+        /// <summary>Argument-bean. (for SqlComment)</summary>
+        protected Object _argumentBean;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _sqlClause = new ${glSqlClauseName}${database.DaoGenDbName}(GetTableDbName());
+        }
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        abstract public String GetTableDbName();
+
+        // =====================================================================================
+        //                                                                            PrimaryKey
+        //                                                                            ==========
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="primaryKeyMap">Primary key map. (NotNull and NotEmpty)</param>
+        abstract public void AcceptPrimaryKeyMap(System.Collections.Generic.IDictionary<String, Object> primaryKeyMap);
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary key map-string. (NotNull and NotEmpty)</param>
+        abstract public void AcceptPrimaryKeyMapString(String primaryKeyMapString);
+
+        // =====================================================================================
+        //                                                                             SqlClause
+        //                                                                             =========
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql clause. (NotNull)
+         */
+        public ${glSqlClauseName} SqlClause {
+            get {
+                return _sqlClause;
+            }
+        }
+
+        /**
+         * Get clause string.
+         * 
+         * @return Sql clause string. (NotNUll)
+         */
+        public String GetClause() {
+            return this.SqlClause.GetClause();
+        }
+
+        // =====================================================================================
+        //                                                                                 Query
+        //                                                                                 =====
+        /// <summary>
+        /// The property of condition-query as inteface.
+        /// </summary>
+        /// <returns>Instance of condition-query. (NotNull)</returns>
+        abstract public ${glConditionQueryInterfaceName} ConditionQueryAsInterface { get; }
+
+        // =====================================================================================
+        //                                                                        FetchNarrowing
+        //                                                                        ==============
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch-narrowing start-index.
+         */
+        public int FetchNarrowingSkipStartIndex { get { return this.SqlClause.FetchNarrowingSkipStartIndex; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch-narrowing size.
+         */
+        public int FetchNarrowingLoopCount { get { return this.SqlClause.FetchNarrowingLoopCount; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public bool IsFetchNarrowingSkipStartIndexEffective { get { return !this.SqlClause.IsFetchStartIndexSupported; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public bool IsFetchNarrowingLoopCountEffective { get { return !this.SqlClause.IsFetchSizeSupported; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determiantion.
+         */
+        public bool IsFetchNarrowingEffective { get { return this.SqlClause.IsFetchNarrowingEffective; } }
+
+        // =====================================================================================
+        //                                                                                Paging
+        //                                                                                ======
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param fetchSize Fetch-size. (NotMinus & NotZero)
+         * @return this. (NotNUll)
+         */
+        public ${glPagingBeanInterfaceName} FetchFirst(int fetchSize) {
+            this.SqlClause.FetchFirst(fetchSize);
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+         * @param fetchSize Fetch-size. (NotMinus & NotZero)
+         * @return this. (NotNUll)
+         */
+        public ${glPagingBeanInterfaceName} FetchScope(int fetchStartIndex, int fetchSize) {
+            this.SqlClause.FetchScope(fetchStartIndex, fetchSize);
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param fetchPageNumber Fetch-page-number. 1 origin. (NotMinus & NotZero)
+         * @return this. (NotNull)
+         */
+        public ${glPagingBeanInterfaceName} FetchPage(int fetchPageNumber) {
+            this.SqlClause.FetchPage(fetchPageNumber);
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNUll)
+         */
+        public ${glConditionBeanInterfaceName} LockForUpdate() {
+            this.SqlClause.LockForUpdate();
+            return this;
+        }
+
+        public int FetchStartIndex {
+            get { return this.SqlClause.FetchStartIndex; }
+        }
+
+        public int FetchSize {
+            get { return this.SqlClause.FetchSize; }
+        }
+
+        public int FetchPageNumber {
+            get { return this.SqlClause.FetchPageNumber; }
+        }
+
+        /**
+         * Get page start index.
+         * 
+         * @return Page start index. 0 origin. (NotMinus)
+         */
+        public int PageStartIndex {
+            get { return this.SqlClause.PageStartIndex; }
+        }
+
+        /**
+         * Get page end index.
+         * 
+         * @return Page end index. 0 origin. (NotMinus)
+         */
+        public int PageEndIndex {
+            get { return this.SqlClause.PageEndIndex; }
+        }
+
+        /**
+         * Is fetch scope effective?
+         * 
+         * @return Determination.
+         */
+        public bool IsFetchScopeEffective {
+            get { return this.SqlClause.IsFetchScopeEffective; }
+        }
+
+        // =====================================================================================
+        //                                                                          Limit Select
+        //                                                                          ============
+        /** Is limit-select PK only? */
+        protected bool _isLimitSelectPKOnly;
+
+        /**
+         * Is limit-select PK only?
+         * 
+         * @return Determination.
+         */
+        public bool IsLimitSelect_PKOnly() {
+            return _isLimitSelectPKOnly;
+        }
+
+        /**
+         * Limit select PK only.
+         *
+         * @return this. (NotNull)
+         */
+        public ${glConditionBeanInterfaceName} LimitSelect_PKOnly() {
+            _isLimitSelectPKOnly = true;
+            return this;
+        }
+
+        /**
+         * Limit select off.
+         *
+         * @return this. (NotNull)
+         */
+        public ${glConditionBeanInterfaceName} LimitSelect_Off() {
+            _isLimitSelectPKOnly = false;
+            return this;
+        }
+
+        // =====================================================================================
+        //                                                                               OrderBy
+        //                                                                               =======
+        /// <summary>
+        /// The property of sql component of order-by clause.
+        /// </summary>
+        public ${glOrderByClauseName} SqlComponentOfOrderByClause {
+            get { return this.SqlClause.GetSqlComponentOfOrderByClause(); }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} ClearOrderBy() {
+            this.SqlClause.ClearOrderBy();
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} IgnoreOrderBy() {
+            this.SqlClause.IgnoreOrderBy();
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public $glOrderByBeanInterfaceName MakeOrderByEffective() {
+            this.SqlClause.MakeOrderByEffective();
+            return this;
+        }
+
+        /**
+         * Setup order-by PrimaryKey asc. {order by primaryKey1 asc, primaryKey2 asc...}
+         * 
+         * @return this. (NotNUll)
+         */
+        abstract public ${glConditionBeanInterfaceName} AddOrderBy_PK_Asc();
+
+        /**
+         * Setup order-by PrimaryKey desc. {order by primaryKey1 desc, primaryKey2 desc...}
+         * 
+         * @return this. (NotNUll)
+         */
+        abstract public ${glConditionBeanInterfaceName} AddOrderBy_PK_Desc();
+
+        /**
+         * Register order-by-asc.
+         * 
+         * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} RegisterOrderByAsc(String orderByProperty) {
+            this.SqlClause.RegisterOrderBy(FilterOrderByProperty(orderByProperty), orderByProperty, true);
+            return this;
+        }
+
+        /**
+         * Register order-by-desc.
+         * 
+         * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} RegisterOrderByDesc(String orderByProperty) {
+            this.SqlClause.RegisterOrderBy(FilterOrderByProperty(orderByProperty), orderByProperty, false);
+            return this;
+        }
+
+        /**
+         * Reverse order-by or Override order-by asc.
+         * 
+         * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByAsc(String orderByProperty) {
+            this.SqlClause.ReverseOrderBy_Or_OverrideOrderBy(FilterOrderByProperty(orderByProperty), orderByProperty, true);
+            return this;
+        }
+
+        /**
+         * Reverse order-by or Override order-by desc.
+         * 
+         * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByDesc(String orderByProperty) {
+            this.SqlClause.ReverseOrderBy_Or_OverrideOrderBy(FilterOrderByProperty(orderByProperty), orderByProperty, false);
+            return this;
+        }
+
+        protected String FilterOrderByProperty(String orderByProperty) {
+            String[] orderBySlashArray = orderByProperty.Split('/');
+            StringBuilder sb = new StringBuilder();
+            ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.GetInstanceByTableDbName(GetTableDbName());
+            ${glConditionQueryInterfaceName} query = this.ConditionQueryAsInterface;
+            foreach (String orderBySlashElement in orderBySlashArray) {
+                String[] orderByDotArray = orderBySlashElement.Split('.');
+
+                if (orderByDotArray.Length == 1) {
+                    if (dbmeta.IsExistMultiName(orderBySlashElement)) {
+                        sb.Append("/").Append(query.GetRealColumnName(dbmeta.GetDbNameByMultiName(orderBySlashElement)));
+                    } else {
+                        sb.Append("/").Append(orderBySlashElement);
+                    }
+                } else {
+                    ${glDBMetaInterfaceName} foreignDBMeta = dbmeta;
+                    ${glConditionQueryInterfaceName} foreignQuery = query;
+                    int count = 0;
+                    foreach (String orderByDotElement in orderByDotArray) {
+                        count++;
+
+                        if (orderByDotArray.Length == count) {// Last Loop!
+                            if (!foreignDBMeta.IsExistMultiName(orderByDotElement)) {
+                                String msg = "The name for order-by is not existing: name=" + orderByDotElement;
+                                msg = msg + " orderBySlashElement=" + orderBySlashElement + " orderByProperty=" + orderByProperty;
+                                throw new SystemException(msg);
+                            }
+                            sb.Append("/").Append(foreignQuery.GetRealColumnName(foreignDBMeta.GetDbNameByMultiName(orderByDotElement)));
+                            break;
+                        }
+
+                        foreignDBMeta = foreignDBMeta.GetForeignDBMeta(orderByDotElement);
+                        foreignQuery = foreignQuery.GetForeignConditionQuery(orderByDotElement);
+                    }
+                }
+            }
+            sb.Remove(0, "/".Length);
+            return sb.ToString();
+        }
+
+        // =====================================================================================
+        //                                                               'for SqlComment' Method
+        //                                                               =======================
+        /**
+         * Get select-hint. {select [select-hint] * from table...}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        public String SelectHint {
+            get { return this.SqlClause.GetSelectHint(); }
+        }
+
+        /**
+         * Get from-base-table-hint. {select * from table [from-base-table-hint] where ...}
+         * 
+         * @return From-base-table-hint. (NotNull)
+         */
+        public String FromBaseTableHint {
+            get { return this.SqlClause.GetFromBaseTableHint(); }
+        }
+
+        /**
+         * Get from-hint. {select * from table [from-hint] where ...}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        public String FromHint {
+            get { return this.SqlClause.GetFromHint(); }
+        }
+
+        /**
+         * Get where clause. {order by [base-table].[column] asc, [fk-alias].[column] desc}
+         * 
+         * @return Where clause. (NotNull)
+         */
+        public String WhereClause {
+            get { return this.SqlClause.GetWhereClause(); }
+        }
+
+        /**
+         * Get order-by clause. {order by [base-table].[column] asc, [fk-alias].[column] desc}
+         * 
+         * @return Order-by clause. (NotNull)
+         */
+        public String OrderByClause {
+            get { return this.SqlClause.GetOrderByClause(); }
+        }
+
+        /**
+         * Get Sql-suffix. {select * from table where ... order by ... [sql-suffix]}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        public String SqlSuffix {
+            get { return this.SqlClause.GetSqlSuffix(); }
+        }
+
+        /// <summary>
+        /// The property of argumentBean. (for SqlComment)
+        /// </summary>
+        public Object ArgumentBean {
+            get { return _argumentBean; }
+            set { _argumentBean = value; }
+        }
+
+        // ------------------------------
+        //                   for Internal
+        //                   ------------
+        /**
+         * Set up various things for select-count-ignore-fetch-scope.
+         * This method is for INTERNAL. Don't invoke this!
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glConditionBeanInterfaceName} SetupSelectCountIgnoreFetchScope() {
+            _isSelectCountIgnoreFetchScope = true;
+            this.SqlClause.IgnoreIncludedSelectColumn();
+            this.SqlClause.IgnoreOrderBy();
+            this.SqlClause.IgnoreFetchScope();
+            return this;
+        }
+
+        /**
+         * Do after-care for select-count-ignore-fetch-scope.
+         * This method is for INTERNAL. Don't invoke this!
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glConditionBeanInterfaceName} AfterCareSelectCountIgnoreFetchScope() {
+            _isSelectCountIgnoreFetchScope = false;
+            this.SqlClause.MakeIncludedSelectColumnEffective();
+            this.SqlClause.MakeOrderByEffective();
+            this.SqlClause.MakeFetchScopeEffective();
+            return this;
+        }
+
+        /** Is set up various things for select-count-ignore-fetch-scope? */
+        protected bool _isSelectCountIgnoreFetchScope;
+
+        /**
+         * Is set up various things for select-count-ignore-fetch-scope?
+         * This method is for INTERNAL. Don't invoke this!
+         * 
+         * @return Determination.
+         */
+        public bool IsSelectCountIgnoreFetchScope() {
+            return _isSelectCountIgnoreFetchScope;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionQuery.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionQuery.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/AbstractConditionQuery.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,515 @@
+#set ($myClassName = "${glConditionQueryAbstractName}")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+using ${glPackageBaseCommonCKey};
+using ${glPackageBaseCommonCValue};
+using ${glPackageBaseCommonDBMeta};
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The abstract class of condition-query.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public abstract class ${myClassName} : ${glConditionQueryInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        /** Condition value for DUMMY. */
+        protected static readonly ${glConditionValueName} DUMMY_CONDITION_VALUE = new ${glConditionValueName}();
+
+        /** Object for DUMMY. */
+        protected static readonly Object DUMMY_OBJECT = new Object();
+
+        /** SQL clause. */
+        protected readonly ${glSqlClauseName} _sqlClause;
+
+        /** My alias name. */
+        protected readonly String _aliasName;
+
+        /** Nest level. */
+        protected readonly int _nestLevel;
+
+        /** Child query. */
+        protected readonly ${glConditionQueryInterfaceName} _childQuery;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /**
+         * Constructor.
+         * 
+         * @param childQuery Child query. (Nullable: If null, this is base instance.)
+         * @param sqlClause SQL clause instance. (NotNull)
+         * @param aliasName My alias name. (NotNull)
+         * @param nestLevel Nest level.
+         */
+        public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel) {
+            _childQuery = childQuery;
+            _sqlClause = sqlClause;
+            _aliasName = aliasName;
+            _nestLevel = nestLevel;
+        }
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        abstract public String GetTableDbName();
+
+        // =====================================================================================
+        //                                                                                Getter
+        //                                                                                ======
+        /**
+         * Get child query.
+         * 
+         * @return Child query. (Nullable)
+         */
+        public ${glConditionQueryInterfaceName} GetChildQuery() {
+            return _childQuery;
+        }
+
+        /**
+         * Get sql clause.
+         * 
+         * @return Sql clause. (NotNull)
+         */
+        public ${glSqlClauseName} GetSqlClause() {
+            return _sqlClause;
+        }
+
+        /**
+         * Get alias name.
+         * 
+         * @return Alias name. (NotNull)
+         */
+        public String GetAliasName() {
+            return _aliasName;
+        }
+
+        /**
+         * Get nest level.
+         * 
+         * @return Nest level.
+         */
+        public int GetNestLevel() {
+            return _nestLevel;
+        }
+
+        /**
+         * Get next nest level.
+         * 
+         * @return Next nest level.
+         */
+        public int GetNextNestLevel() {
+            return _nestLevel+1;
+        }
+
+        /**
+         * Is base query?
+         * 
+         * @param query Condition query. (NotNull)
+         * @return Determination.
+         */
+        public bool IsBaseQuery(${glConditionQueryInterfaceName} query) {
+            return (query.GetChildQuery() == null);
+        }
+
+        // =====================================================================================
+        //                                                                              RealName
+        //                                                                              ========
+        /// <summary>
+        ///    Get real alias name(that has nest level mark).
+        /// </summary>
+        /// <returns>Real alias name. (NotNull)</returns>
+        public String GetRealAliasName() {
+            if (GetNestLevel() > 1) {
+                return GetAliasName() + "_n" + GetNestLevel();
+            } else {
+                return GetAliasName();
+            }
+        }
+
+        /// <summary>
+        /// Get real column name(with real alias name).
+        /// </summary>
+        /// <param name="columnName">Column name without alias name. This should not contain comma.</param>
+        /// <returns>Real column name.</returns>
+        public String GetRealColumnName(String columnName) {
+            AssertColumnName(columnName);
+            return GetRealAliasName() + "." + columnName;
+        }
+
+        // =====================================================================================
+        //                                                                         IncludeAsMine
+        //                                                                         =============
+        /// <summary>
+        /// Register included-select-column.
+        /// </summary>
+        /// <param name="aliasName">Alias name. This should not contain comma. (NotNull)</param>
+        /// <param name="realColumnName">Real column name. This should not contain comma. (NotNull)</param>
+        protected void RegisterIncludedSelectColumn(String aliasName, String realColumnName) {
+            AssertAliasName(aliasName);
+            AssertColumnName(realColumnName);
+            GetSqlClause().RegisterIncludedSelectColumn(aliasName, realColumnName);
+        }
+
+        // =====================================================================================
+        //                                                                                 Query
+        //                                                                                 =====
+        /// <summary>
+        /// Register condition of ${col.UncapitalisedJavaName}.
+        /// </summary>
+        /// <param name="key">Condition key. (NotNull)</param>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName}. (Nullable)</param>
+        protected virtual void RegisterQuery(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                                             , String colName, String capPropName, String uncapPropName) {
+            if (key.IsValidRegistration(cvalue, value, key.GetConditionKey() + " of " + GetRealAliasName() + "." + uncapPropName)) {
+                key.SetupConditionValue(cvalue, value, GetLocation(capPropName, key));// If C#, CapProp!
+                GetSqlClause().RegisterWhereClause(GetRealColumnName(colName), key, cvalue);
+            }
+        }
+
+        /// <summary>
+        /// Register inline condition of ${col.UncapitalisedJavaName}.
+        /// </summary>
+        /// <param name="key">Condition key. (NotNull)</param>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName}. (Nullable)</param>
+        protected virtual void RegisterInlineQuery(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                                             , String colName, String capPropName, String uncapPropName) {
+            if (key.IsValidRegistration(cvalue, value, key.GetConditionKey() + " of " + GetRealAliasName() + "." + uncapPropName)) {
+                key.SetupConditionValue(cvalue, value, GetLocation(capPropName, key));// If C#, CapProp!
+                if (IsBaseQuery(this)) {
+                    GetSqlClause().RegisterBaseTableInlineWhereClause(colName, key, cvalue);
+                } else {
+                    GetSqlClause().RegisterOuterJoinInlineWhereClause(GetRealAliasName(), colName, key, cvalue);
+                }
+            }
+        }
+
+        // =====================================================================================
+        //                                                                              SubQuery
+        //                                                                              ========
+        protected void RegisterInScopeSubQuery(${glConditionQueryInterfaceName} subQuery
+                                     , String columnName, String relatedColumnName, String propertyName) {
+            String realColumnName = GetRealColumnName(columnName);
+            String subQueryClause = GetInScopeSubQuerySql(subQuery, relatedColumnName, propertyName);
+            GetSqlClause().RegisterWhereClause(realColumnName + " in (" + subQueryClause + ")");
+        }
+
+        protected void RegisterInlineInScopeSubQuery(${glConditionQueryInterfaceName} subQuery
+                                     , String columnName, String relatedColumnName, String propertyName) {
+            String subQueryClause = GetInScopeSubQuerySql(subQuery, relatedColumnName, propertyName);
+            String finalClause = columnName + " in (" + subQueryClause + ")";
+            if (IsBaseQuery(this)) {
+                GetSqlClause().RegisterBaseTableInlineWhereClause(finalClause);
+            } else {
+                GetSqlClause().RegisterOuterJoinInlineWhereClause(GetRealAliasName(), finalClause);
+            }
+        }
+
+        protected String GetInScopeSubQuerySql(${glConditionQueryInterfaceName} subQuery
+                                     , String relatedColumnName, String propertyName) {
+            String selectClause = "select " + subQuery.GetAliasName() + "." + relatedColumnName;
+            String fromClause = subQuery.GetSqlClause().GetFromClause();
+            String oldStr = ".ConditionQuery.";
+            String newStr = "." + GetLocationBase(propertyName) + ".";
+            String whereClause = subQuery.GetSqlClause().GetWhereClause().Replace(oldStr, newStr);
+            return selectClause + " " + fromClause + " " + whereClause;
+        }
+
+        protected void RegisterExistsSubQuery(${glConditionQueryInterfaceName} subQuery
+                                     , String columnName, String relatedColumnName, String propertyName) {
+            String realColumnName = GetRealColumnName(columnName);
+            String subQueryClause = GetExistsSubQuerySql(subQuery, realColumnName, relatedColumnName, propertyName);
+            GetSqlClause().RegisterWhereClause("exists (" + subQueryClause + ")");
+        }
+
+        // *Unsupport ExistsSubQuery as inline because it's so dangerous.
+
+        protected String GetExistsSubQuerySql(${glConditionQueryInterfaceName} subQuery
+                                 , String realColumnName, String relatedColumnName, String propertyName) {
+            String selectClause = "select " + subQuery.GetAliasName() + "." + relatedColumnName;
+            String fromClause = subQuery.GetSqlClause().GetFromClause();
+            String oldStr = ".ConditionQuery.";
+            String newStr = "." + GetLocationBase(propertyName) + ".";
+            String whereClause = subQuery.GetSqlClause().GetWhereClause().Replace(oldStr, newStr);
+
+            // String parentCondition = " and " + relatedColumnName + " = " + realColumnName;
+            String parentCondition = "";
+            if (whereClause.Contains("where")) {
+                parentCondition = " and " + relatedColumnName + " = " + realColumnName;
+            } else {
+                parentCondition = " where " + relatedColumnName + " = " + realColumnName;
+            }
+
+            return selectClause + " " + fromClause + " " + whereClause + parentCondition;
+        }
+
+        // =====================================================================================
+        //                                                                                Invoke
+        //                                                                                ======
+        public ${glConditionValueName} InvokeGetter(String columnMultiName) {
+            ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.GetInstanceByTableDbName(GetTableDbName());
+            String columnCapPropName = dbmeta.GetCapPropNameByMultiName(columnMultiName);
+
+            String methodName = columnCapPropName;
+            PropertyInfo propertyInfo = this.GetType().GetProperty(methodName);
+            if (propertyInfo == null) {
+                String msg = "The columnCapPropName is not existing in this table: columnCapPropName=" + columnCapPropName + " tableName=" + GetTableDbName();
+                msg = msg + " methodName=" + methodName;
+                throw new SystemException(msg);
+            }
+            Object result = propertyInfo.GetValue(this, null);
+            return (${glConditionValueName})result;
+        }
+
+        public void InvokeSetterEqual(String columnMultiName, Object value) {
+            InvokeSetter(columnMultiName, value, "equal");
+        }
+
+        public void InvokeSetterNotEqual(String columnMultiName, Object value) {
+            InvokeSetter(columnMultiName, value, "notEqual");
+        }
+
+        public void InvokeSetterGreaterThan(String columnMultiName, Object value) {
+            InvokeSetter(columnMultiName, value, "greaterThan");
+        }
+
+        public void InvokeSetterLessThan(String columnMultiName, Object value) {
+            InvokeSetter(columnMultiName, value, "lessThan");
+        }
+
+        public void InvokeSetterGreaterEqual(String columnMultiName, Object value) {
+            InvokeSetter(columnMultiName, value, "greaterEqual");
+        }
+
+        public void InvokeSetterLessEqual(String columnMultiName, Object value) {
+            InvokeSetter(columnMultiName, value, "lessEqual");
+        }
+
+        protected void InvokeSetter(String columnMultiName, Object value, String conditionKeyName) {
+            ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.GetInstanceByTableDbName(GetTableDbName());
+            String columnCapPropName = dbmeta.GetCapPropNameByMultiName(columnMultiName);
+
+            String methodName = "Set" + columnCapPropName + "_" + conditionKeyName.Substring(0, 1).ToUpper() + conditionKeyName.Substring(1);
+            MethodInfo methodInfo = this.GetType().GetMethod(methodName);
+            if (methodInfo == null) {
+                String msg = "The columnCapPropName is not existing in this table: columnCapPropName=" + columnCapPropName + " tableName=" + GetTableDbName();
+                msg = msg + " methodName=" + methodName;
+                throw new SystemException(msg);
+            }
+            methodInfo.Invoke(this, new Object[]{value});
+        }
+
+        public void InvokeAddOrderByAsc(String columnCapPropName) {
+            InvokeOrderBy(columnCapPropName, true);
+        }
+
+        public void InvokeAddOrderByDesc(String columnCapPropName) {
+            InvokeOrderBy(columnCapPropName, false);
+        }
+
+        protected void InvokeOrderBy(String columnMultiName, bool isAsc) {
+            ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.GetInstanceByTableDbName(GetTableDbName());
+            String columnCapPropName = dbmeta.GetCapPropNameByMultiName(columnMultiName);
+
+            String ascDesc = null;
+            if (isAsc) {
+                ascDesc = "Asc";
+            } else {
+                ascDesc = "Desc";
+            }
+            String methodName = "AddOrderBy_" + columnCapPropName + "_" + ascDesc;
+            MethodInfo methodInfo = this.GetType().GetMethod(methodName);
+            if (methodInfo == null) {
+                String msg = "The columnCapPropName is not existing in this table: columnCapPropName=" + columnCapPropName;
+                msg = msg + " tableName=" + GetTableDbName() + " methodName=" + methodName;
+                throw new SystemException(msg);
+            }
+            methodInfo.Invoke(this, null);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="foreignPropertyName">Foreign-property-name(Both OK - InitCap or not). (NotNull)</param>
+        /// <returns>Foreign condition-query as interface.</returns>
+        public ${glConditionQueryInterfaceName} GetForeignConditionQuery(String foreignPropertyName) {
+            String methodName = "Query" + foreignPropertyName.Substring(0, 1) + foreignPropertyName.Substring(1);
+            MethodInfo methodInfo = this.GetType().GetMethod(methodName);
+            if (methodInfo == null) {
+                String msg = "The foreignPropertyName is not existing in this table: foreignPropertyName=" + foreignPropertyName;
+                msg = msg + " tableName=" + GetTableDbName() + " methodName=" + methodName;
+                throw new SystemException(msg);
+            }
+            return (${glConditionQueryInterfaceName})methodInfo.Invoke(this, null);
+        }
+
+        /**
+         * Get location.
+         * 
+         * @param columnPropertyName Column property name.
+         * @param key Condition key.
+         * @return Next nest level.
+         */
+        protected String GetLocation(String columnPropertyName, ${glConditionKeyName} key) {
+            return GetLocationBase(columnPropertyName) + "." + key.GetConditionKey();
+        }
+
+        protected String GetLocationBase() {
+            StringBuilder sb = new StringBuilder();
+            ${glConditionQueryInterfaceName} query = this;
+            while (true) {
+                if (query.IsBaseQuery(query)) {
+                    sb.Insert(0, "ConditionQuery.");
+                    break;
+                } else {
+                    sb.Insert(0, "ConditionQuery" + query.GetAliasName() + ".");
+                }
+                query = query.GetChildQuery();
+            }
+            return sb.ToString();
+        }
+
+        protected String GetLocationBase(String columnPropertyName) {
+            return GetLocationBase() + columnPropertyName;
+        }
+
+
+        // =====================================================================================
+        //                                                                                Helper
+        //                                                                                ======
+        /// <summary>
+        /// Filter removing empty-string.
+        /// If the value is null or empty-string, returns null.
+        /// </summary>
+        /// <param name="value">Query-value-string. (Nullable)</param>
+        /// <returns>Filtered value. (Nullable)</returns>
+        protected String FilterRemoveEmptyString(String value) {
+            return ((value != null && value.Length != 0) ? value : null);
+        }
+
+        /// <summary>
+        /// Filter removing empty-string from the list.
+        /// If the list is null or empty-string, returns null.
+        /// </summary>
+        /// <param name="ls">List. (Nullable)</param>
+        /// <returns>Filtered list. (Nullable)</returns>
+        protected IList FilterRemoveEmptyStringFromList(IList ls) {
+            if (ls == null) {
+                return null;
+            }
+            IList newList = new ArrayList();
+            foreach (Object obj in ls) {
+                if ((obj is String) && "".Equals((String)obj)) {
+                    continue;
+                }
+                newList.Add(obj);
+            }
+            return newList;
+        }
+
+        // ----------------------------------------------------------------
+        //                                                    Assert Object
+        //                                                    -------------
+        #region Assert Object
+
+        /**
+         * Assert that the argument is not null.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertObjectNotNull(String variableName, Object arg) {
+            if (variableName == null) {
+                String msg = "Argument[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (arg == null) {
+                String msg = "Argument[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+        }
+
+        /**
+         * Assert that the column-name is not null and is not emtpy and does not contain comma.
+         * 
+         * @param columnName Column-name. (NotNull)
+         * @exception IllegalArgumentException
+         */
+        protected void AssertColumnName(String columnName) {
+            if (columnName == null) {
+                String msg = "The columnName should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (columnName.Trim().Length == 0) {
+                String msg = "The columnName should not be empty-string.";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+            if (columnName.Contains(",")) {
+                String msg = "The columnName should not contain comma ',': " + columnName;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        /**
+         * Assert that the alias-name is not null and is not emtpy and does not contain comma.
+         * 
+         * @param aliasName Alias-name. (NotNull)
+         * @exception IllegalArgumentException
+         */
+        protected void AssertAliasName(String aliasName) {
+            if (aliasName == null) {
+                String msg = "The aliasName should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (aliasName.Trim().Length == 0) {
+                String msg = "The aliasName should not be empty-string.";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+            if (aliasName.Contains(",")) {
+                String msg = "The aliasName should not contain comma ',': " + aliasName;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        #endregion
+
+        // ----------------------------------------------------------------
+        //                                                    Assert String
+        //                                                    -------------
+        #region Assert String
+
+        /**
+         * Assert that the string is not null and not trimmed empty.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+            if (variableName == null) {
+                String msg = "Variable[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value == null) {
+                String msg = "Variable[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value.Trim().Length == 0) {
+                String msg = "Variable[" + variableName + "] should not be empty: [" + value + "]";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        #endregion
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,144 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The condition-bean as interface.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glConditionBeanInterfaceName} : ${glPagingBeanInterfaceName} {
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        /// <summary>
+        /// Get the value of tableName. (readonly)
+        /// </summary>
+        String GetTableDbName();
+
+        // =====================================================================================
+        //                                                                            PrimaryKey
+        //                                                                            ==========
+        /// <summary>
+        /// Accept primary key map.
+        /// </summary>
+        /// <param name="primaryKeyMap">Primary key map. (NotNull and NotEmpty)</param>
+        void AcceptPrimaryKeyMap(System.Collections.Generic.IDictionary<String, Object> primaryKeyMap);
+
+        /// <summary>
+        /// Accept primary key map-string. Delimiter is atmark and semicolon {@;}.
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary key map-string. (NotNull and NotEmpty)</param>
+        void AcceptPrimaryKeyMapString(String primaryKeyMapString);
+
+        // =====================================================================================
+        //                                                                             SqlClause
+        //                                                                             =========
+        /**
+         * Get sql-clause instance.
+         * 
+         * @return Sql-clause. (NotNUll)
+         */
+        ${glSqlClauseName} SqlClause { get; }
+
+        /**
+         * Get clause string.
+         * 
+         * @return Sql clause string. (NotNUll)
+         */
+        String GetClause();
+
+        // =====================================================================================
+        //                                                                                 Query
+        //                                                                                 =====
+        /// <summary>
+        /// The property of condition-query as inteface.
+        /// </summary>
+        /// <returns>Instance of condition-query. (NotNull)</returns>
+        ${glConditionQueryInterfaceName} ConditionQueryAsInterface { get; }
+
+	    // =====================================================================================
+	    //                                                                          Limit Select
+	    //                                                                          ============
+	    /**
+	     * Is limit-select PK only?
+	     * 
+	     * @return Determination.
+	     */
+	    bool IsLimitSelect_PKOnly();
+
+	    /**
+	     * Limit select PK only.
+	     *
+	     * @return this. (NotNull)
+	     */
+	    ${glConditionBeanInterfaceName} LimitSelect_PKOnly();
+
+	    /**
+	     * Limit select off.
+	     *
+	     * @return this. (NotNull)
+	     */
+	    ${glConditionBeanInterfaceName} LimitSelect_Off();
+
+        // =====================================================================================
+        //                                                                               OrderBy
+        //                                                                               =======
+        /**
+         * Add order-by PrimaryKey asc. {order by primaryKey1 asc, primaryKey2 asc...}
+         * 
+         * @return this. (NotNUll)
+         */
+        ${glConditionBeanInterfaceName} AddOrderBy_PK_Asc();
+
+        /**
+         * Add order-by PrimaryKey desc. {order by primaryKey1 desc, primaryKey2 desc...}
+         * 
+         * @return this. (NotNUll)
+         */
+        ${glConditionBeanInterfaceName} AddOrderBy_PK_Desc();
+
+        // =====================================================================================
+        //                                                                               Advance
+        //                                                                               =======
+	    /**
+	     * Lock for update.
+	     * <p>
+	     * If you invoke this, your SQL lock target records for update.
+	     * It depends whether this method supports this on the database type.
+	     * 
+	     * @return this. (NotNUll)
+	     */
+        $glConditionBeanInterfaceName LockForUpdate();
+
+	    // ------------------------------
+	    //                   for Internal
+	    //                   ------------
+	    /**
+	     * Set up various things for select-count-ignore-fetch-scope.
+	     * This method is for INTERNAL. Don't invoke this!
+	     * 
+	     * @return this. (NotNull)
+	     */
+	    ${glConditionBeanInterfaceName} SetupSelectCountIgnoreFetchScope();
+
+	    /**
+	     * Do after-care for select-count-ignore-fetch-scope.
+	     * This method is for INTERNAL. Don't invoke this!
+	     * 
+	     * @return this. (NotNull)
+	     */
+	    ${glConditionBeanInterfaceName} AfterCareSelectCountIgnoreFetchScope();
+
+	    /**
+	     * Is set up various things for select-count-ignore-fetch-scope?
+	     * This method is for INTERNAL. Don't invoke this!
+	     * 
+	     * @return Determination.
+	     */
+	    bool IsSelectCountIgnoreFetchScope();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBeanContext.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBeanContext.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionBeanContext.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,86 @@
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+
+namespace ${glPackageBaseCommonCBean} {
+
+/**
+ * Condition-bean context. (referring to s2pager)
+ * 
+ * @author ${database.ClassAuthor}
+ */
+    public static class ${glConditionBeanContextName} {
+
+        /** The thread-local for this. */
+        private static LocalDataStoreSlot _conditionBeanBeanSlot = Thread.AllocateDataSlot();
+
+        /**
+         * Get fetch-narrowing-bean context on thread.
+         * 
+         * @return FetchNarrowing-bean. (Nullable)
+         */
+        public static ${glConditionBeanInterfaceName} GetConditionBeanOnThread() {
+            return (${glConditionBeanInterfaceName})Thread.GetData(_conditionBeanBeanSlot);
+        }
+
+        /**
+         * Set fetch-narrowing-bean context on thread.
+         * 
+         * @param ${glAttachedCBArgsVariableName} FetchNarrowing-bean. (NotNull)
+         */
+        public static void SetConditionBeanOnThread(${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName}) {
+            if (${glAttachedCBArgsVariableName} == null) {
+                String msg = "The argument[${glAttachedCBArgsVariableName}] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            Thread.SetData(_conditionBeanBeanSlot, ${glAttachedCBArgsVariableName});
+        }
+
+        /**
+         * Clear fetch-narrowing-bean context on thread.
+         */
+        public static void ClearConditionBeanOnThread() {
+            Thread.SetData(_conditionBeanBeanSlot, null);
+        }
+
+        /**
+         * Is existing fetch-narrowing-bean context on thread?
+         * 
+         * @return Determination.
+         */
+        public static bool IsExistConditionBeanOnThread() {
+            return (Thread.GetData(_conditionBeanBeanSlot) != null);
+        }
+
+        /**
+         * Is the argument condition-bean?
+         * 
+         * @param dtoInstance Dto instance.
+         * @return Determination.
+         */
+        public static bool IsTheArgumentConditionBean(Object dtoInstance) {
+            if (dtoInstance is ${glConditionBeanInterfaceName}) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        /**
+         * Is the type condition-bean?
+         * 
+         * @param dtoClass DtoClass.
+         * @return Determination.
+         */
+        public static bool IsTheTypeConditionBean(Type dtoType) {
+            if (typeof(${glConditionBeanInterfaceName}).IsAssignableFrom(dtoType)) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionQuery.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionQuery.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ConditionQuery.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,102 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonCValue};
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The condition-bean as interface.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glConditionQueryInterfaceName} {
+
+        /// <summary>
+        /// Get the value of tableName. (readonly)
+        /// </summary>
+        String GetTableDbName();
+
+        /**
+         * Get child query.
+         * 
+         * @return Child query. (Nullable)
+         */
+        ${glConditionQueryInterfaceName} GetChildQuery();
+
+        /**
+         * Get sql clause.
+         * 
+         * @return Sql clause. (NotNull)
+         */
+        ${glSqlClauseName} GetSqlClause();
+
+        /**
+         * Get alias name.
+         * 
+         * @return Alias name. (NotNull)
+         */
+        String GetAliasName();
+
+        /// <summary>
+        ///	Get real alias name(that has nest level mark).
+        /// </summary>
+        /// <returns>Real alias name. (NotNull)</returns>
+        String GetRealAliasName();
+
+        /// <summary>
+        /// Get real column name(with real alias name).
+        /// </summary>
+        /// <param name="columnName">Column name without alias name.</param>
+        /// <returns>Real column name.</returns>
+        String GetRealColumnName(String columnName);
+
+        /**
+         * Get nest level.
+         * 
+         * @return Nest level.
+         */
+        int GetNestLevel();
+
+        /**
+         * Get next nest level.
+         * 
+         * @return Next nest level.
+         */
+        int GetNextNestLevel();
+
+        /**
+         * Is base query?
+         * 
+         * @param query Condition query. (NotNull)
+         * @return Determination.
+         */
+        bool IsBaseQuery(${glConditionQueryInterfaceName} query);
+
+
+        // =====================================================================================
+        //                                                                                Invoke
+        //                                                                                ======
+        ${glConditionValueName} InvokeGetter(String columnMultiName);
+
+        void InvokeSetterEqual(String columnMultiName, Object value);
+        void InvokeSetterNotEqual(String columnMultiName, Object value);
+        void InvokeSetterGreaterThan(String columnMultiName, Object value);
+        void InvokeSetterLessThan(String columnMultiName, Object value);
+        void InvokeSetterGreaterEqual(String columnMultiName, Object value);
+        void InvokeSetterLessEqual(String columnMultiName, Object value);
+
+        void InvokeAddOrderByAsc(String columnMultiName);
+        void InvokeAddOrderByDesc(String columnMultiName);
+
+        // =====================================================================================
+        //                                                                         Foregin Query
+        //                                                                         =============
+        /// <summary>
+        /// Get foreign condition-query.
+        /// </summary>
+        /// <param name="foreignPropertyName">Foreign-property-name(Both OK - InitCap or not). (NotNull)</param>
+        /// <returns>Foreign condition-query as interface.</returns>
+        ${glConditionQueryInterfaceName} GetForeignConditionQuery(String foreignPropertyName);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,49 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The condition-bean as interface.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glFetchNarrowingBeanInterfaceName} {
+
+        /**
+         * Get fetch-narrowing start-index.
+         * 
+         * @return Fetch-narrowing start-index.
+         */
+        int FetchNarrowingSkipStartIndex { get; }
+
+        /**
+         * Get fetch-narrowing size.
+         * 
+         * @return Fetch-narrowing size.
+         */
+        int FetchNarrowingLoopCount { get; }
+
+	    /**
+	     * Is fetch start index supported?
+	     * 
+	     * @return Determination.
+	     */
+        bool IsFetchNarrowingSkipStartIndexEffective { get; }
+
+	    /**
+	     * Is fetch size supported?
+	     * 
+	     * @return Determination.
+	     */
+        bool IsFetchNarrowingLoopCountEffective { get; }
+
+	    /**
+	     * Is fetch-narrowing effective?
+	     * 
+	     * @return Determiantion.
+	     */
+        bool IsFetchNarrowingEffective { get; }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBeanContext.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBeanContext.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/FetchNarrowingBeanContext.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,86 @@
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+
+namespace ${glPackageBaseCommonCBean} {
+
+/**
+ * FetchNarrowing-Bean context. (referring to s2pager)
+ * 
+ * @author ${database.ClassAuthor}
+ */
+    public static class ${glFetchNarrowingBeanContextName} {
+
+        /** The thread-local for this. */
+        private static LocalDataStoreSlot _fetchNarrowingBeanSlot = Thread.AllocateDataSlot();
+
+        /**
+         * Get fetch-narrowing-bean context on thread.
+         * 
+         * @return FetchNarrowing-bean. (Nullable)
+         */
+        public static ${glFetchNarrowingBeanInterfaceName} GetFetchNarrowingBeanOnThread() {
+            return (${glFetchNarrowingBeanInterfaceName})Thread.GetData(_fetchNarrowingBeanSlot);
+        }
+
+        /**
+         * Set fetch-narrowing-bean context on thread.
+         * 
+         * @param ${glAttachedCBArgsVariableName} FetchNarrowing-bean. (NotNull)
+         */
+        public static void SetFetchNarrowingBeanOnThread(${glFetchNarrowingBeanInterfaceName} ${glAttachedCBArgsVariableName}) {
+            if (${glAttachedCBArgsVariableName} == null) {
+                String msg = "The argument[${glAttachedCBArgsVariableName}] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            Thread.SetData(_fetchNarrowingBeanSlot, ${glAttachedCBArgsVariableName});
+        }
+
+        /**
+         * Clear fetch-narrowing-bean context on thread.
+         */
+        public static void ClearFetchNarrowingBeanOnThread() {
+            Thread.SetData(_fetchNarrowingBeanSlot, null);
+        }
+
+        /**
+         * Is existing fetch-narrowing-bean context on thread?
+         * 
+         * @return Determination.
+         */
+        public static bool IsExistFetchNarrowingBeanOnThread() {
+            return (Thread.GetData(_fetchNarrowingBeanSlot) != null);
+        }
+
+        /**
+         * Is the argument fetch-narrowing-bean?
+         * 
+         * @param dtoInstance Dto instance.
+         * @return Determination.
+         */
+        public static bool IsTheArgumentFetchNarrowingBean(Object dtoInstance) {
+            if (dtoInstance is ${glFetchNarrowingBeanInterfaceName}) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        /**
+         * Is the type fetch-narrowing-bean?
+         * 
+         * @param dtoClass DtoClass.
+         * @return Determination.
+         */
+        public static bool IsTheTypeFetchNarrowingBean(Type dtoType) {
+            if (typeof(${glFetchNarrowingBeanInterfaceName}).IsAssignableFrom(dtoType)) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ListResultBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ListResultBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ListResultBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,223 @@
+#set ($myClassName = "${glListResultBeanName}")
+
+using System;
+using System.Text;
+
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The list-result-bean of ${myClassName}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : System.Collections.IList {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        #region Attribute
+
+        /// <summary>The value of table db-name.</summary>
+        protected String _tableDbName;
+
+        /// <summary>The value of all record count.</summary>
+        protected int _allRecordCount;
+
+        /// <summary>Selected list. Default value is empty.</summary>
+        protected System.Collections.IList _selectedList = new System.Collections.ArrayList();
+
+        /// <summary>The value of current page number.</summary>
+        protected ${glOrderByClauseName} _orderByClause = new ${glOrderByClauseName}();
+
+        /// <summary>Has the setter of selected list invoked?</summary>
+        protected bool _isSetterInvokedSelectedList;
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        public ${myClassName}() {
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                              Property
+        //                                                                              ========
+        #region Property
+
+        /// <summary>
+        /// The property of table db-name.
+        /// </summary>
+        public String TableDbName {
+            get { return _tableDbName; }
+            set { _tableDbName = value; }
+        }
+
+        /// <summary>
+        /// The property of all record count.
+        /// </summary>
+        public int AllRecordCount {
+            get { return _allRecordCount; }
+            set { _allRecordCount = value; }
+        }
+
+        /// <summary>
+        /// The property of all record count.
+        /// </summary>
+        public System.Collections.IList SelectedList {
+            get { return _selectedList; }
+            set { _isSetterInvokedSelectedList=true; _selectedList = value; }
+        }
+
+        /// <summary>
+        /// The property of order-by clause.
+        /// </summary>
+        public ${glOrderByClauseName} OrderByClause
+        {
+            get { return _orderByClause; }
+            set { _orderByClause = value; }
+        }
+        #endregion
+
+
+        // =====================================================================================
+        //                                                                         Determination
+        //                                                                         =============
+        #region Determination
+        /// <summary>
+        /// Has this result selected?
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSelectedResult { get { return _isSetterInvokedSelectedList; } }
+        #endregion
+
+        // =====================================================================================
+        //                                                                 Basic-Override Method
+        //                                                                 =====================
+        /// <summary>
+        /// This method overrides the method that is declared at super.
+        /// </summary>
+        /// <returns>View-string of all-columns value.</returns>
+        public override String ToString() {
+            StringBuilder sb = new StringBuilder();
+
+            sb.Append(" tableDbName=").Append(_tableDbName);
+            sb.Append(" allRecordCount=").Append(_tableDbName);
+            sb.Append(" selectedList.Count=").Append(_selectedList.Count);
+            sb.Append(" orderByClause=").Append(_orderByClause);
+
+            return sb.ToString();
+        }
+
+        // =====================================================================================
+        //                                                                         List Elements
+        //                                                                         =============
+        public virtual int Add(Object value)
+        {
+            return _selectedList.Add(value);
+        }
+
+        public virtual bool Contains(Object value)
+        {
+            return _selectedList.Contains(value);
+        }
+
+        public virtual void Clear()
+        {
+            _selectedList.Clear();
+        }
+
+        public virtual int IndexOf(Object value)
+        {
+            return _selectedList.IndexOf(value);
+        }
+
+        public virtual void Insert(int index, Object value)
+        {
+            _selectedList.Insert(index, value);
+        }
+
+
+        public virtual void Remove(Object value)
+        {
+            _selectedList.Remove(value);
+        }
+
+
+        public virtual void RemoveAt(int index)
+        {
+            _selectedList.RemoveAt(index);
+        }
+
+
+        public virtual bool IsReadOnly
+        {
+            get
+            {
+                return _selectedList.IsReadOnly;
+            }
+        }
+        public virtual bool IsFixedSize
+        {
+            get
+            {
+                return _selectedList.IsFixedSize;
+            }
+        }
+
+        public virtual void CopyTo(System.Array array, int index)
+        {
+            _selectedList.CopyTo(array, index);
+        }
+
+        public virtual int Count
+        {
+            get
+            {
+                return _selectedList.Count;
+            }
+        }
+
+        public virtual Object SyncRoot
+        {
+            get
+            {
+                return _selectedList.SyncRoot;
+            }
+        }
+
+        public virtual bool IsSynchronized
+        {
+            get
+            {
+                return _selectedList.IsSynchronized;
+            }
+        }
+
+        public virtual System.Collections.IEnumerator GetEnumerator()
+        {
+            return _selectedList.GetEnumerator();
+        }
+
+        public virtual Object this[int index]
+        {
+            get
+            {
+                return _selectedList[index];
+            }
+            set
+            {
+                _selectedList[index] = value;
+            }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/OrderByBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/OrderByBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/OrderByBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,79 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The condition-bean as interface.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glOrderByBeanInterfaceName} : ${glSelectResourceInterfaceName} {
+
+        /// <summary>
+        /// The property of sql component of order-by clause.
+        /// </summary>
+        ${glOrderByClauseName} SqlComponentOfOrderByClause { get; }
+
+        /**
+         * Clear order-by.
+         * 
+         * @return this. (NotNull)
+         */
+        ${glOrderByBeanInterfaceName} ClearOrderBy();
+
+	    /**
+	     * Ignore order-by.
+	     * 
+	     * @return this. (NotNull)
+	     */
+        ${glOrderByBeanInterfaceName} IgnoreOrderBy();
+
+	    /**
+	     * Make order-by effective.
+	     * 
+	     * @return this. (NotNull)
+	     */
+        ${glOrderByBeanInterfaceName} MakeOrderByEffective();
+
+	    /**
+	     * Get order-by clause.
+	     * 
+	     * @return Order-by clause. (NotNull)
+	     */
+	    String OrderByClause { get; }
+
+	    /**
+	     * Register order-by-asc.
+	     * 
+	     * @param columnFullName Column-full-name. ([table-name].[column-name]) (NotNull)
+	     * @return this. (NotNull)
+	     */
+	    ${glOrderByBeanInterfaceName} RegisterOrderByAsc(String columnFullName);
+
+	    /**
+	     * Register order-by-desc.
+	     * 
+	     * @param columnFullName Column-full-name. ([table-name].[column-name]) (NotNull)
+	     * @return this. (NotNull)
+	     */
+	    ${glOrderByBeanInterfaceName} RegisterOrderByDesc(String columnFullName);
+
+        /**
+         * Reverse order-by or Override order-by asc.
+         * 
+         * @param columnFullName Column-full-name. [firstColumn/secondColumn/...] (NotNull)
+         * @return this. (NotNull)
+         */
+        ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByAsc(String columnFullName);
+
+        /**
+         * Reverse order-by or Override order-by desc.
+         * 
+         * @param columnFullName Column-full-name. [firstColumn/secondColumn/...] (NotNull)
+         * @return this. (NotNull)
+         */
+        ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByDesc(String columnFullName);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,120 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The condition-bean as interface.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glPagingBeanInterfaceName} : ${glFetchNarrowingBeanInterfaceName}, ${glOrderByBeanInterfaceName} {
+
+        // =====================================================================================
+        //                                                                               Advance
+        //                                                                               =======
+        /// <summary>
+        /// Fetch first.
+        /// If you invoke this, your SQL returns [fetch-size] records from first.
+        /// </summary>
+        /// <param name="fetchSize">Fetch-size. (NotMinus & NotZero)</param>
+        /// <returns>this. (NotNull)</returns>
+        $glPagingBeanInterfaceName FetchFirst(int fetchSize);
+
+        /// <summary>
+        /// Fetch scope.
+        /// If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index].
+        /// </summary>
+        /// <param name="fetchStartIndex">Fetch-start-index. 0 origin. (NotMinus)</param>
+        /// <param name="fetchSize">Fetch-size. (NotMinus & NotZero)</param>
+        /// <returns>this. (NotNull)</returns>
+        $glPagingBeanInterfaceName FetchScope(int fetchStartIndex, int fetchSize);
+
+        /// <summary>
+        /// Fetch page.
+        /// When you invoke this, it is normally necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that.
+        /// But you also can use default-fetch-size without invoking 'fetchFirst()' or 'fetchScope()'.
+        /// If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index] calculated by [fetch-page-number].
+        /// </summary>
+        /// <param name="fetchPageNumber">Fetch-page-number. 1 origin. (NotMinus & NotZero)</param>
+        /// <returns>this. (NotNull)</returns>
+        ${glPagingBeanInterfaceName} FetchPage(int fetchPageNumber);
+
+        // =====================================================================================
+        //                                                                              Property
+        //                                                                              ========
+        /**
+         * Get fetch start index.
+         * 
+         * @return Fetch start index.
+         */
+        int FetchStartIndex { get; }
+
+        /**
+         * Get fetch size.
+         * 
+         * @return Fetch size.
+         */
+        int FetchSize { get; }
+
+        /**
+         * Get fetch page number.
+         * 
+         * @return Fetch page number.
+         */
+        int FetchPageNumber { get; }
+
+        /**
+         * Get page start index.
+         * 
+         * @return Page start index. 0 origin. (NotMinus)
+         */
+        int PageStartIndex { get; }
+
+        /**
+         * Get page end index.
+         * 
+         * @return Page end index. 0 origin. (NotMinus)
+         */
+        int PageEndIndex { get; }
+
+        /**
+         * Is fetch scope effective?
+         * 
+         * @return Determination.
+         */
+        bool IsFetchScopeEffective { get; }
+
+        // =====================================================================================
+        //                                                                                Clause
+        //                                                                                ======
+	    /**
+	     * Get select-hint.
+	     * 
+	     * @return Select-hint. (NotNull)
+	     */
+	    String SelectHint { get; }
+
+	    /**
+	     * Get from-hint.
+	     * 
+	     * @return From-hint. (NotNull)
+	     */
+	    String FromHint { get; }
+
+	    /**
+	     * Get sql-suffix.
+	     * 
+	     * @return Sql-suffix. (NotNull)
+	     */
+	    String SqlSuffix { get; }
+
+	    /**
+	     * Get order-by clause.
+	     * 
+	     * @return Order-by clause. (NotNull)
+	     */
+	    new String OrderByClause { get; }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingResultBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingResultBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/PagingResultBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,365 @@
+#set ($myClassName = "${glPagingResultBeanName}")
+
+using System;
+using System.Text;
+
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The paging-result-bean of ${myClassName}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glListResultBeanName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        #region Attribute
+
+        /// <summary>The value of all page size.</summary>
+        protected int _pageSize;
+
+        /// <summary>The value of current page number.</summary>
+        protected int _currentPageNumber;
+
+        /// <summary>The value of page-group size.</summary>
+        protected int _pageGroupSize = 0;
+
+        /// <summary>The value of page-range size.</summary>
+        protected int _pageRangeSize = 0;
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        public ${myClassName}() {
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                              Property
+        //                                                                              ========
+        #region Property
+
+        /// <summary>
+        /// The property of page size.
+        /// </summary>
+        public int PageSize {
+            get { return _pageSize; }
+            set { _pageSize = value; }
+        }
+
+        /// <summary>
+        /// The property of current page number.
+        /// </summary>
+        public int CurrentPageNumber {
+            get { return _currentPageNumber; }
+            set { _currentPageNumber = value; }
+        }
+
+        /// <summary>
+        /// The property of all page count.
+        /// </summary>
+        public int AllPageCount {
+            get { return CalculateAllPageCount(_allRecordCount, _pageSize); }
+        }
+
+        /**
+         * Get the value of currentStartRecordNumber.
+         * 
+         * @return The value of currentStartRecordNumber.
+         */
+        public int CurrentStartRecordNumber {
+            get { return CalculateCurrentStartRecordNumber(_currentPageNumber, _pageSize); }
+        }
+
+        /**
+         * Get the value of currentEndRecordNumber.
+         * 
+         * @return The value of currentEndRecordNumber.
+         */
+        public int CurrentEndRecordNumber {
+            get { return CalculateCurrentEndRecordNumber(_currentPageNumber, _pageSize); }
+        }
+
+        /// <summary>
+        /// The property of page-group size.
+        /// </summary>
+        public int PageGroupSize {
+            get { return _pageGroupSize; }
+            set { _pageGroupSize = value; }
+        }
+
+        /// <summary>
+        /// The property of range-group size.
+        /// </summary>
+        public int PageRangeSize {
+            get { return _pageRangeSize; }
+            set { _pageRangeSize = value; }
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                             Calculate
+        //                                                                             =========
+        #region Calculate
+
+        // -------------------------------------------
+        //                                        Page
+        //                                        ----
+        /**
+         * Calculate all page count.
+         * 
+         * @param allRecordCount All record count.
+         * @param pageSize Fetch-size.
+         * @returns All page count.
+         */
+        protected int CalculateAllPageCount(int allRecordCount, int pageSize) {
+            if (allRecordCount == 0) {
+                return 1;
+            }
+            int pageCountBase = (allRecordCount / pageSize);
+            if (allRecordCount % pageSize > 0) {
+                pageCountBase++;
+            }
+            return pageCountBase;
+        }
+
+        protected int CalculateCurrentStartRecordNumber(int currentPageNumber, int pageSize) {
+            return ((currentPageNumber - 1) * pageSize) + 1;
+        }
+
+        protected int CalculateCurrentEndRecordNumber(int currentPageNumber, int pageSize) {
+            return CalculateCurrentStartRecordNumber(currentPageNumber, pageSize) + _selectedList.Count - 1;
+        }
+
+        /// <summary>
+        /// Is existing previous page?
+        /// Using values are currentPageNumber.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsExistPrePage() {
+            return (_allRecordCount > 0 && _currentPageNumber > 1);
+        }
+
+        /// <summary>
+        /// Is existing next page?
+        /// Using values are currentPageNumber and allPageCount.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsExistNextPage() {
+            return (_allRecordCount > 0 && _currentPageNumber < this.AllPageCount);
+        }
+
+        // -------------------------------------------
+        //                                  Page Group
+        //                                  ----------
+        /// <summary>
+        /// Calculate current page-group start-page-number.
+        /// Using values are currentPageNumber and pageGroupSize.
+        /// </summary>
+        /// <returns>Current page-group start-page-number.</returns>
+        public int CalculateCurrentPageGroupStartPageNumber() {
+            int pageGroupSize = _pageGroupSize;
+            if (pageGroupSize == 0) {
+                String msg = "The pageGroupSize should be greater than 1. But the value is zero.";
+                msg = msg + " pageGroupSize=" + pageGroupSize;
+                throw new SystemException(msg);
+            }
+            if (pageGroupSize == 1) {
+                String msg = "The pageGroupSize should be greater than 1. But the value is one.";
+                msg = msg + " pageGroupSize=" + pageGroupSize;
+                throw new SystemException(msg);
+            }
+            int currentPageNumber = _currentPageNumber;
+            int currentPageGroupNumber = (currentPageNumber / pageGroupSize);
+            if ((currentPageNumber % pageGroupSize) == 0)
+            {
+                currentPageGroupNumber--;
+            }
+            int currentPageGroupStartPageNumber = (pageGroupSize * currentPageGroupNumber) + 1;
+            if (!(currentPageNumber >= currentPageGroupStartPageNumber)) {
+                String msg = "currentPageNumber should be greater equal currentPageGroupStartPageNumber. But:";
+                msg = msg + " currentPageNumber=" + currentPageNumber;
+                msg = msg + " currentPageGroupStartPageNumber=" + currentPageGroupStartPageNumber;
+                throw new SystemException(msg);
+            }
+            return currentPageGroupStartPageNumber;
+        }
+
+        /// <summary>
+        /// Get current page-group page-number-list.
+        /// Using values are currentPageNumber and pageGroupSize and allPageCount.
+        /// </summary>
+        /// <returns>Current page-group page-number-list.</returns>
+        public System.Collections.IList GetCurrentPageGroupPageNumberList() {
+            int allPageCount = this.AllPageCount;
+            int currentPageGroupStartPageNumber = CalculateCurrentPageGroupStartPageNumber();
+            if (!(currentPageGroupStartPageNumber > 0)) {
+                String msg = "currentPageGroupStartPageNumber should be greater than 0. {> 0} But:";
+                msg = msg + " currentPageGroupStartPageNumber=" + currentPageGroupStartPageNumber;
+                throw new SystemException(msg);
+            }
+            int nextPageGroupStartPageNumber = currentPageGroupStartPageNumber + _pageGroupSize;
+
+            System.Collections.IList resultList = new System.Collections.ArrayList();
+            for (int i=currentPageGroupStartPageNumber; i < nextPageGroupStartPageNumber && i <= allPageCount; i++) {
+                resultList.Add(i);
+            }
+            return resultList;
+        }
+
+        /// <summary>
+        /// Get current page-group page-number-array.
+        /// Using values are currentPageNumber and pageGroupSize and allPageCount.
+        /// </summary>
+        /// <returns>Current page-group page-number-array.</returns>
+        public int[] GetCurrentPageGroupPageNumberArray() {
+            return ConvertListToIntArray(GetCurrentPageGroupPageNumberList());
+        }
+
+        /// <summary>
+        /// Is existing previous page-group?
+        /// Using values are currentPageNumber and pageGroupSize.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsExistPrePageGroup() {
+            return (_currentPageNumber > _pageGroupSize);
+        }
+
+        /// <summary>
+        /// Is existing next page-group?
+        /// Using values are currentPageNumber and pageGroupSize and allPageCount.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsExistNextPageGroup() {
+            int currentPageGroupStartPageNumber = CalculateCurrentPageGroupStartPageNumber();
+            if (!(currentPageGroupStartPageNumber > 0)) {
+                String msg = "currentPageGroupStartPageNumber should be greater than 0. {> 0} But:";
+                msg = msg + " currentPageGroupStartPageNumber=" + currentPageGroupStartPageNumber;
+                throw new SystemException(msg);
+            }
+            int nextPageGroupStartPageNumber = currentPageGroupStartPageNumber + _pageGroupSize;
+            return (nextPageGroupStartPageNumber <= this.AllPageCount);
+        }
+
+        // -------------------------------------------
+        //                                  Page Range
+        //                                  ----------
+        /// <summary>
+        /// Get current page-range page-number-list.
+        /// Using values are currentPageNumber and pageRangeSize and allPageCount.
+        /// </summary>
+        /// <returns>Current page-range page-number-list.</returns>
+        public System.Collections.IList GetCurrentPageRangePageNumberList() {
+            int pageRangeSize = _pageRangeSize;
+            if (pageRangeSize == 0) {
+                String msg = "The pageRangeSize should be greater than 1. But the value is zero.";
+                msg = msg + " pageRangeSize=" + pageRangeSize;
+                throw new SystemException(msg);
+            }
+            int allPageCount = this.AllPageCount;
+            int currentPageNumber = _currentPageNumber;
+
+            System.Collections.IList resultList = new System.Collections.ArrayList();
+
+            for (int i = currentPageNumber - pageRangeSize; i < currentPageNumber; i++) {
+                if (i < 1) {
+                    continue;
+                }
+                resultList.Add(i);
+            }
+
+            resultList.Add(currentPageNumber);
+
+            int endPageNumber = (currentPageNumber + pageRangeSize);
+            for (int i=currentPageNumber+1 ; i <= endPageNumber; i++) {
+                if (i > allPageCount) {
+                    break;
+                }
+                resultList.Add(i);
+            }
+            return resultList;
+        }
+
+        /// <summary>
+        /// Get current page-range page-number-array.
+        /// Using values are currentPageNumber and pageRangeSize and allPageCount.
+        /// </summary>
+        /// <returns>Current page-range page-number-array.</returns>
+        public int[] GetCurrentPageRangePageNumberArray() {
+            return ConvertListToIntArray(GetCurrentPageRangePageNumberList());
+        }
+
+        /// <summary>
+        /// Get current page-range page-number-array.
+        /// Using values are currentPageNumber and pageRangeSize and allPageCount.
+        /// </summary>
+        /// <returns>Current page-range page-number-array.</returns>
+        protected int[] ConvertListToIntArray(System.Collections.IList ls) {
+            int[] resultArray = new int[ls.Count];
+            ls.CopyTo(resultArray, 0);
+            return resultArray;
+        }
+
+        /// <summary>
+        /// Is existing previous page-range?
+        /// Using values are currentPageNumber and pageGroupSize.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsExistPrePageRange() {
+            int[] array = GetCurrentPageRangePageNumberArray();
+            if (array.Length == 0) {
+                return false;
+            }
+            return array[0] > 1;
+        }
+
+        /// <summary>
+        /// Is existing next page-range?
+        /// Using values are currentPageNumber and pageGroupSize and allPageCount.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsExistNextPageRange() {
+            int[] array = GetCurrentPageRangePageNumberArray();
+            if (array.Length == 0) {
+                return false;
+            }
+            return array[array.Length-1] < this.AllPageCount;
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                 Basic-Override Method
+        //                                                                 =====================
+        /// <summary>
+        /// This method overrides the method that is declared at super.
+        /// </summary>
+        /// <returns>View-string of all-columns value.</returns>
+        public override String ToString() {
+            StringBuilder sb = new StringBuilder();
+
+            sb.Append(this.CurrentPageNumber).Append("/").Append(this.AllPageCount);
+            sb.Append(" ").Append(this.AllRecordCount);
+            sb.Append(" listSize=").Append((this.SelectedList != null ? ""+this.SelectedList.Count : null));
+            sb.Append(" pageSize=").Append(this.PageSize);
+            sb.Append(" page:{").Append(IsExistPrePage()).Append("/").Append(IsExistNextPage()).Append("}");
+            sb.Append(" groupSize=").Append(this.PageGroupSize);
+            sb.Append(" rangeSize=").Append(this.PageRangeSize);
+
+            return sb.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SelectResource.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SelectResource.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SelectResource.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,14 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The select-resource as marker-interface.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glSelectResourceInterfaceName} {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimpleOrderByBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimpleOrderByBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimpleOrderByBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,110 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The order-by-bean as simple.
+    /// 
+    /// This bean is supported:
+    ///   o OrderBy
+    /// 
+    /// - ${glSimpleOrderByBeanName} pb = new ${glSimpleOrderByBeanName}();
+    /// - pb.FetchFirst(1);
+    /// - pb.RegisterOrderByAsc("BOOK_ID");
+    /// - ...
+    /// 
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${glSimpleOrderByBeanName} : ${glOrderByBeanInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        /** SQL clause instance. */
+        protected readonly ${glSqlClauseName} _sqlClause;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /**
+         * Constructor.
+         */
+        public ${glSimpleOrderByBeanName}() {
+            _sqlClause = new ${glSqlClauseName}${database.DaoGenDbName}("Dummy");
+        }
+
+        protected ${glSqlClauseName} SqlClause {
+            get { return _sqlClause; }
+        }
+
+	    /**
+	     * Get order-by clause.
+	     * 
+	     * @return Order-by clause. (NotNull)
+	     */
+	    public String OrderByClause { get { return this.SqlClause.GetOrderByClause(); } }
+
+        // =====================================================================================
+        //                                                                               OrderBy
+        //                                                                               =======
+        /// <summary>
+        /// The property of sql component of order-by clause.
+        /// </summary>
+        public ${glOrderByClauseName} SqlComponentOfOrderByClause {
+            get { return this.SqlClause.GetSqlComponentOfOrderByClause(); }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} ClearOrderBy() {
+            this.SqlClause.ClearOrderBy();
+            return this;
+        }
+
+	    /**
+	     * ${database.ImplementComment}
+	     * 
+	     * @return this. (NotNull)
+	     */
+        public ${glOrderByBeanInterfaceName} IgnoreOrderBy() {
+            this.SqlClause.IgnoreOrderBy();
+            return this;
+        }
+
+	    /**
+	     * ${database.ImplementComment}
+	     * 
+	     * @return this. (NotNull)
+	     */
+        public ${glOrderByBeanInterfaceName} MakeOrderByEffective() {
+            this.SqlClause.MakeOrderByEffective();
+            return this;
+        }
+
+	    public ${glOrderByBeanInterfaceName} RegisterOrderByAsc(String orderByProperty) {
+	        this.SqlClause.RegisterOrderBy(orderByProperty, null, true);
+	        return this;
+	    }
+
+	    public ${glOrderByBeanInterfaceName} RegisterOrderByDesc(String orderByProperty) {
+	        this.SqlClause.RegisterOrderBy(orderByProperty, null, false);
+	        return this;
+	    }
+
+	    public ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByAsc(String orderByProperty) {
+	        this.SqlClause.ReverseOrderBy_Or_OverrideOrderBy(orderByProperty, null, true);
+	        return this;
+	    }
+
+	    public ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByDesc(String orderByProperty) {
+	        this.SqlClause.ReverseOrderBy_Or_OverrideOrderBy(orderByProperty, null, false);
+	        return this;
+	    }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimplePagingBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimplePagingBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/SimplePagingBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,272 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCommonCBean} {
+
+    /// <summary>
+    /// The condition-bean as interface.
+    /// 
+    /// This bean is supported:
+    ///   o FetchNarrowing
+    ///   o Paging
+    ///   o OrderBy
+    /// 
+    /// - ${glSimplePagingBeanName} pb = new ${glSimplePagingBeanName}();
+    /// - pb.FetchFirst(1);
+    /// - pb.RegisterOrderByAsc("BOOK_ID");
+    /// - ...
+    /// 
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${glSimplePagingBeanName} : ${glPagingBeanInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        /** SQL clause instance. */
+        protected readonly ${glSqlClauseName} _sqlClause;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /**
+         * Constructor.
+         */
+        public ${glSimplePagingBeanName}() {
+            _sqlClause = new ${glSqlClauseName}${database.DaoGenDbName}("Dummy");
+        }
+
+        protected ${glSqlClauseName} SqlClause {
+            get { return _sqlClause; }
+        }
+
+        // =====================================================================================
+        //                                                                                Paging
+        //                                                                                ======
+        /// <summary>
+        /// Fetch first.
+        /// If you invoke this, your SQL returns [fetch-size] records from first.
+        /// </summary>
+        /// <param name="fetchSize">Fetch-size. (NotMinus & NotZero)</param>
+        /// <returns>this. (NotNull)</returns>
+        public ${glPagingBeanInterfaceName} FetchFirst(int fetchSize) {
+            this.SqlClause.FetchFirst(fetchSize);
+            return this;
+        }
+
+        /// <summary>
+        /// Fetch scope.
+        /// If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index].
+        /// </summary>
+        /// <param name="fetchStartIndex">Fetch-start-index. 0 origin. (NotMinus)</param>
+        /// <param name="fetchSize">Fetch-size. (NotMinus & NotZero)</param>
+        /// <returns>this. (NotNull)</returns>
+        public ${glPagingBeanInterfaceName} FetchScope(int fetchStartIndex, int fetchSize) {
+            this.SqlClause.FetchScope(fetchStartIndex, fetchSize);
+            return this;
+        }
+
+        /// <summary>
+        /// Fetch page.
+        /// When you invoke this, it is normally necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that.
+        /// But you also can use default-fetch-size without invoking 'fetchFirst()' or 'fetchScope()'.
+        /// If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index] calculated by [fetch-page-number].
+        /// </summary>
+        /// <param name="fetchPageNumber">Fetch-page-number. 1 origin. (NotMinus & NotZero)</param>
+        /// <returns>this. (NotNull)</returns>
+        public ${glPagingBeanInterfaceName} FetchPage(int fetchPageNumber) {
+            this.SqlClause.FetchPage(fetchPageNumber);
+            return this;
+        }
+
+        public int FetchStartIndex {
+            get { return this.SqlClause.FetchStartIndex; }
+        }
+
+        public int FetchSize {
+            get { return this.SqlClause.FetchSize; }
+        }
+
+        public int FetchPageNumber {
+            get { return this.SqlClause.FetchPageNumber; }
+        }
+
+        /**
+         * Get page start index.
+         * 
+         * @return Page start index. 0 origin. (NotMinus)
+         */
+        public int PageStartIndex {
+            get { return this.SqlClause.PageStartIndex; }
+        }
+
+        /**
+         * Get page end index.
+         * 
+         * @return Page end index. 0 origin. (NotMinus)
+         */
+        public int PageEndIndex {
+            get { return this.SqlClause.PageEndIndex; }
+        }
+
+        /**
+         * Is fetch scope effective?
+         * 
+         * @return Determination.
+         */
+        public bool IsFetchScopeEffective {
+            get { return this.SqlClause.IsFetchScopeEffective; }
+        }
+
+        // =====================================================================================
+        //                                                                        FetchNarrowing
+        //                                                                        ==============
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch-narrowing start-index.
+         */
+        public int FetchNarrowingSkipStartIndex { get { return this.SqlClause.FetchNarrowingSkipStartIndex; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch-narrowing size.
+         */
+        public int FetchNarrowingLoopCount { get { return this.SqlClause.FetchNarrowingLoopCount; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public bool IsFetchNarrowingSkipStartIndexEffective { get { return !this.SqlClause.IsFetchStartIndexSupported; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public bool IsFetchNarrowingLoopCountEffective { get { return !this.SqlClause.IsFetchSizeSupported; } }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determiantion.
+         */
+        public bool IsFetchNarrowingEffective { get { return this.SqlClause.IsFetchNarrowingEffective; } }
+
+
+        // =====================================================================================
+        //                                                                                Clause
+        //                                                                                ======
+	    /**
+	     * Get select-hint.
+	     * 
+	     * @return Select-hint. (NotNull)
+	     */
+	    public String SelectHint { get { return this.SqlClause.GetSelectHint(); } }
+
+        /**
+         * Get from-base-table-hint. {select * from table [from-base-table-hint] where ...}
+         * 
+         * @return From-base-table-hint. (NotNull)
+         */
+        public String FromBaseTableHint { get { return this.SqlClause.GetFromBaseTableHint(); } }
+
+	    /**
+	     * Get from-hint.
+	     * 
+	     * @return From-hint. (NotNull)
+	     */
+	    public String FromHint { get { return this.SqlClause.GetFromHint(); } }
+
+	    /**
+	     * Get sql-suffix.
+	     * 
+	     * @return Sql-suffix. (NotNull)
+	     */
+	    public String SqlSuffix { get { return this.SqlClause.GetSqlSuffix(); } }
+
+	    /**
+	     * Get order-by clause.
+	     * 
+	     * @return Order-by clause. (NotNull)
+	     */
+	    public String OrderByClause { get { return this.SqlClause.GetOrderByClause(); } }
+
+        // =====================================================================================
+        //                                                                               OrderBy
+        //                                                                               =======
+        /// <summary>
+        /// The property of sql component of order-by clause.
+        /// </summary>
+        public ${glOrderByClauseName} SqlComponentOfOrderByClause {
+            get { return this.SqlClause.GetSqlComponentOfOrderByClause(); }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glOrderByBeanInterfaceName} ClearOrderBy() {
+            this.SqlClause.ClearOrderBy();
+            return this;
+        }
+
+	    /**
+	     * ${database.ImplementComment}
+	     * 
+	     * @return this. (NotNull)
+	     */
+        public ${glOrderByBeanInterfaceName} IgnoreOrderBy() {
+            this.SqlClause.IgnoreOrderBy();
+            return this;
+        }
+
+	    /**
+	     * ${database.ImplementComment}
+	     * 
+	     * @return this. (NotNull)
+	     */
+        public ${glOrderByBeanInterfaceName} MakeOrderByEffective() {
+            this.SqlClause.MakeOrderByEffective();
+            return this;
+        }
+
+	    /**
+	     * Register order-by-asc.
+	     * 
+	     * @param columnFullName Column-full-name. ([table-name].[column-name]) (NotNull)
+	     * @return this. (NotNull)
+	     */
+	    public ${glOrderByBeanInterfaceName} RegisterOrderByAsc(String columnFullName) {
+	        this.SqlClause.RegisterOrderBy(columnFullName, null, true);
+	        return this;
+	    }
+
+	    /**
+	     * Register order-by-desc.
+	     * 
+	     * @param columnFullName Column-full-name. ([table-name].[column-name]) (NotNull)
+	     * @return this. (NotNull)
+	     */
+	    public ${glOrderByBeanInterfaceName} RegisterOrderByDesc(String columnFullName) {
+	        this.SqlClause.RegisterOrderBy(columnFullName, null, false);
+	        return this;
+	    }
+
+	    public ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByAsc(String columnFullName) {
+	        this.SqlClause.ReverseOrderBy_Or_OverrideOrderBy(columnFullName, null, true);
+	        return this;
+	    }
+
+	    public ${glOrderByBeanInterfaceName} ReverseOrderBy_Or_OverrideOrderByDesc(String columnFullName) {
+	        this.SqlClause.ReverseOrderBy_Or_OverrideOrderBy(columnFullName, null, false);
+	        return this;
+	    }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,227 @@
+#set ($myClassName = "${glConditionKeyName}")
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The abstract class of condition-key.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public abstract class ${myClassName} {
+
+        /** Mark of replaced value. */
+        public static readonly String MARK_OF_REPLACED_VALUE = "ReplacedValue";
+
+        /** The condition key of equal. */
+        public static readonly ${myClassName} CK_EQUAL = new ${myClassName}Equal();
+
+        /** The condition key of notEqual. */
+        public static readonly ${myClassName} CK_NOT_EQUAL = new ${myClassName}NotEqual();
+
+        /** The condition key of greaterThan. */
+        public static readonly ${myClassName} CK_GREATER_THAN = new ${myClassName}GreaterThan();
+
+        /** The condition key of lessrThan. */
+        public static readonly ${myClassName} CK_LESS_THAN = new ${myClassName}LessThan();
+
+        /** The condition key of greaterEqual. */
+        public static readonly ${myClassName} CK_GREATER_EQUAL = new ${myClassName}GreaterEqual();
+
+        /** The condition key of lessEqual. */
+        public static readonly ${myClassName} CK_LESS_EQUAL = new ${myClassName}LessEqual();
+
+        /** The condition key of prefixSearch. */
+        public static readonly ${myClassName} CK_PREFIX_SEARCH = new ${myClassName}PrefixSearch();
+
+        /** The condition key of inScope. */
+        public static readonly ${myClassName} CK_IN_SCOPE = new ${myClassName}InScope();
+
+        /** The condition key of notInScope. */
+        public static readonly ${myClassName} CK_NOT_IN_SCOPE = new ${myClassName}NotInScope();
+
+        /** The condition key of isNull. */
+        public static readonly ${myClassName} CK_IS_NULL = new ${myClassName}IsNull();
+
+        /** The condition key of isNotNull. */
+        public static readonly ${myClassName} CK_IS_NOT_NULL = new ${myClassName}IsNotNull();
+
+        /** Dummy-object for IsNull and IsNotNull and so on... */
+        protected static readonly Object DUMMY_OBJECT = new Object();
+
+        /** Condition-key. */
+        protected String _conditionKey;
+
+        /** Operand. */
+        protected String _operand;
+
+        /**
+         * Get condition-key.
+         * 
+         * @return Condition-key.
+         */
+        public String GetConditionKey() {
+            // Because initial charactor of property name is capital in dotNet world.
+            return (_conditionKey != null ? _conditionKey.Substring(0, 1).ToUpper() + _conditionKey.Substring(1) : null);
+        }
+
+        /**
+         * Get operand.
+         * 
+         * @return Operand.
+         */
+        public String GetOperand() {
+            return _operand;
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        abstract public bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName);
+
+        /**
+         * Add where clause.
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         * @return this.
+         */
+        public ${myClassName} AddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value == null) {
+                String msg = "Argument[value] must not be null:";
+                throw new ArgumentNullException(msg + " value=" + value + " this.ToString()=" + ToString());
+            }
+            DoAddWhereClause(conditionList, columnName, value);
+            return this;
+        }
+
+        /**
+         * Do add where clause.
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        abstract protected void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value);
+
+        /**
+         * Setup condition value.
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (Nullable)
+         * @param location Location. (Nullable)
+         * @return Condition value. (The same as argument[conditionValue]) (NotNull)
+         */
+        public ${glConditionValueName} SetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            if (conditionValue == null) {
+                String msg = "Argument[conditionValue] must not be null:";
+                throw new ArgumentNullException(msg + " value=" + value + " this.ToString()=" + ToString());
+            }
+            DoSetupConditionValue(conditionValue, value, location);
+            return conditionValue;
+        }
+
+        /**
+         * Do setup condition value.
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        abstract protected void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location);
+
+        /**
+         * Build bind clause. (for s2dao)
+         * 
+         * @param columnName Column name. (NotNull)
+         * @param location Location. (NotNull)
+         * @return Bind clause. (NotNull)
+         */
+        protected String BuildBindClause(String columnName, String location) {
+            return columnName + " " + GetOperand() + " " + "/*dto." + location + "*/null";
+        }
+
+        /**
+         * Build bind clause. (for s2dao)
+         * 
+         * @param columnName Column name. (NotNull)
+         * @param location Location. (NotNull)
+         * @param dummyValue Dummy value. (NotNull)
+         * @return Bind clause. (NotNull)
+         */
+        protected String BuildBindClause(String columnName, String location, String dummyValue) {
+            return columnName + " " + GetOperand() + " " + "/*dto." + location + "*/" + dummyValue;
+        }
+
+        /**
+         * Build clause without value.
+         * 
+         * @param columnName Column name. (NotNull)
+         * @return Clause without value. (NotNull)
+         */
+        protected String BuildClauseWithoutValue(String columnName) {
+            return columnName + " " + GetOperand();
+        }
+
+        /**
+         * Get wild-card.
+         * 
+         * @return Wild-card.
+         */
+        protected String GetWildCard() {
+            return "${database.WildCard}";
+        }
+
+        protected bool isNullableTypeNull(Object obj) {
+            if (obj != null && obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+
+        /**
+         * ${database.OverrideComment}
+         * Returns hash-code of this condition-key string.
+         * 
+         * @return HashCode.
+         */
+        public override int GetHashCode() {
+            return GetConditionKey().GetHashCode();
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * If the condition-key of the other is same as this one, returns true.
+         * 
+         * @param other Other entity. (Nullable)
+         * @return Comparing result. If other is null, returns false.
+         */
+        public override bool Equals(Object other) {
+            if (other is ${myClassName}) {
+                if (this.GetConditionKey().Equals(((${myClassName})other).GetConditionKey())) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return View-string of condition key information.
+         */
+        public override String ToString() {
+            return "${myClassName}: " + GetConditionKey() + " " + GetOperand() + " wild-card=[" + GetWildCard() + "]";
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_equal.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_equal.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_equal.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,77 @@
+#set ($myClassName = "${glConditionKeyName}Equal")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of equal.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "equal";
+            _operand = "=";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            Object valueObject = conditionValue.Equal;
+            if (valueObject != null && !isNullableTypeNull(valueObject) && valueObject.Equals(value)) {
+                _log.Warn("The value has already registered at " + callerName + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.Equal == null) {
+                return;
+            }
+            Object valueObject = value.Equal;
+            if (isNullableTypeNull(valueObject)) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetEqualLocation()));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.Equal = value;
+            conditionValue.SetEqualLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterEqual.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterEqual.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterEqual.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,77 @@
+#set ($myClassName = "${glConditionKeyName}GreaterEqual")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of greaterEqual.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "greaterEqual";
+            _operand = ">=";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            Object valueObject = conditionValue.GreaterEqual;
+            if (valueObject != null && !isNullableTypeNull(valueObject) && valueObject.Equals(value)) {
+                _log.Warn("The value has already registered at " + callerName + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.GreaterEqual == null) {
+                return;
+            }
+            Object valueObject = value.GreaterEqual;
+            if (isNullableTypeNull(valueObject)) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetGreaterEqualLocation()));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.GreaterEqual = value;
+            conditionValue.SetGreaterEqualLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterThan.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterThan.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_greaterThan.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,77 @@
+#set ($myClassName = "${glConditionKeyName}GreaterThan")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of greaterThan.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "greaterThan";
+            _operand = ">";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            Object valueObject = conditionValue.GreaterThan;
+            if (valueObject != null && !isNullableTypeNull(valueObject) && valueObject.Equals(value)) {
+                _log.Warn("The value has already registered at " + callerName + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.GreaterThan == null) {
+                return;
+            }
+            Object valueObject = value.GreaterThan;
+            if (isNullableTypeNull(valueObject)) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetGreaterThanLocation()));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.GreaterThan = value;
+            conditionValue.SetGreaterThanLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_inScope.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_inScope.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_inScope.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,82 @@
+#set ($myClassName = "${glConditionKeyName}InScope")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of inScope.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "inScope";
+            _operand = "in";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            if (value is System.Collections.IList && ((System.Collections.IList)value).Count == 0) {
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.InScope == null) {
+                return;
+            }
+            System.Collections.IList valueList = value.InScope;
+            System.Collections.IList checkedValueList = new System.Collections.ArrayList();
+            foreach (Object checkTargetValue in valueList) {
+                if (checkTargetValue == null) {
+                    continue;
+                }
+                if (isNullableTypeNull(checkTargetValue)) {
+                    continue;
+                }
+                checkedValueList.Add(checkTargetValue);
+            }
+            if (checkedValueList.Count == 0) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetInScopeLocation(), "('a1', 'a2')"));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.InScope = (System.Collections.IList)value;
+            conditionValue.SetInScopeLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNotNull.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNotNull.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNotNull.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,70 @@
+#set ($myClassName = "${glConditionKeyName}IsNotNull")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of isNotNull.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "isNotNull";
+            _operand = "is not null";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            Object valueObject = conditionValue.IsNotNull;
+            if (valueObject != null) {
+                _log.Warn("The value has already registered at " + _conditionKey + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.IsNotNull == null) {
+                return;
+            }
+            conditionList.Add(BuildClauseWithoutValue(columnName));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.IsNotNull = DUMMY_OBJECT;
+            conditionValue.SetIsNotNullLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNull.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNull.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_isNull.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,70 @@
+#set ($myClassName = "${glConditionKeyName}IsNull")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of isNull.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "isNull";
+            _operand = "is null";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            Object valueObject = conditionValue.IsNull;
+            if (valueObject != null) {
+                _log.Warn("The value has already registered at " + _conditionKey + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.IsNull == null) {
+                return;
+            }
+            conditionList.Add(BuildClauseWithoutValue(columnName));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.IsNull = DUMMY_OBJECT;
+            conditionValue.SetIsNullLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessEqual.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessEqual.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessEqual.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,77 @@
+#set ($myClassName = "${glConditionKeyName}LessEqual")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of lessEqual.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "lessEqual";
+            _operand = "<=";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            Object valueObject = conditionValue.LessEqual;
+            if (valueObject != null && !isNullableTypeNull(valueObject) && valueObject.Equals(value)) {
+                _log.Warn("The value has already registered at " + callerName + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.LessEqual == null) {
+                return;
+            }
+            Object valueObject = value.LessEqual;
+            if (isNullableTypeNull(valueObject)) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetLessEqualLocation()));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.LessEqual = value;
+            conditionValue.SetLessEqualLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessThan.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessThan.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_lessThan.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,77 @@
+#set ($myClassName = "${glConditionKeyName}LessThan")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of equal.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "lessThan";
+            _operand = "<";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            Object valueObject = conditionValue.LessThan;
+            if (valueObject != null && !isNullableTypeNull(valueObject) && valueObject.Equals(value)) {
+                _log.Warn("The value has already registered at " + callerName + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.LessThan == null) {
+                return;
+            }
+            Object valueObject = value.LessThan;
+            if (isNullableTypeNull(valueObject)) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetLessThanLocation()));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.LessThan = value;
+            conditionValue.SetLessThanLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notEqual.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notEqual.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notEqual.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,77 @@
+#set ($myClassName = "${glConditionKeyName}NotEqual")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of equal.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "notEqual";
+            _operand = "!=";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            Object valueObject = conditionValue.NotEqual;
+            if (valueObject != null && !isNullableTypeNull(valueObject) && valueObject.Equals(value)) {
+                _log.Warn("The value has already registered at " + callerName + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.NotEqual == null) {
+                return;
+            }
+            Object valueObject = value.NotEqual;
+            if (isNullableTypeNull(valueObject)) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetNotEqualLocation()));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.NotEqual = value;
+            conditionValue.SetNotEqualLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notInScope.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notInScope.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_notInScope.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,82 @@
+#set ($myClassName = "${glConditionKeyName}NotInScope")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of notInScope.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "notInScope";
+            _operand = "not in";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            if (value is System.Collections.IList && ((System.Collections.IList)value).Count == 0) {
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.NotInScope == null) {
+                return;
+            }
+            System.Collections.IList valueList = value.NotInScope;
+            System.Collections.IList checkedValueList = new System.Collections.ArrayList();
+            foreach (Object checkTargetValue in valueList) {
+                if (checkTargetValue == null) {
+                    continue;
+                }
+                if (isNullableTypeNull(checkTargetValue)) {
+                    continue;
+                }
+                checkedValueList.Add(checkTargetValue);
+            }
+            if (checkedValueList.Count == 0) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetNotInScopeLocation(), "('a1', 'a2')"));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.NotInScope = ((System.Collections.IList)value);
+            conditionValue.SetNotInScopeLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_prefixSearch.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_prefixSearch.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/ckey/ConditionKey_prefixSearch.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,77 @@
+#set ($myClassName = "${glConditionKeyName}PrefixSearch")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonCKey} {
+
+    /// <summary>
+    /// The condition-key of prefixSearch.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glConditionKeyName} {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+            _conditionKey = "prefixSearch";
+            _operand = "like";
+        }
+
+        /**
+         * Is valid registration?
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param callerName Caller name. (NotNull)
+         * @return Determination.
+         */
+        public override bool IsValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+            if (value == null || isNullableTypeNull(value)) {
+                return false;
+            }
+            Object valueObject = conditionValue.PrefixSearch;
+            if (valueObject != null && !isNullableTypeNull(valueObject) && valueObject.Equals(value + GetWildCard())) {
+                _log.Warn("The value has already registered at " + callerName + ": " + valueObject + " = " + value);
+                return false;
+            }
+            return true;
+        }
+
+        /**
+         * This method implements super#doAddWhereClause().
+         * 
+         * @param conditionList Condition list. (NotNull)
+         * @param columnName Column name. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        protected override void DoAddWhereClause(System.Collections.IList conditionList, String columnName, ${glConditionValueName} value) {
+            if (value.PrefixSearch == null) {
+                return;
+            }
+            Object valueObject = value.PrefixSearch;
+            if (isNullableTypeNull(valueObject)) {
+                return;
+            }
+            conditionList.Add(BuildBindClause(columnName, value.GetPrefixSearchLocation()));
+        }
+
+        /**
+         * This method implements super#doSetupConditionValue().
+         * 
+         * @param conditionValue Condition value. (NotNull)
+         * @param value Value. (NotNull)
+         * @param location Location. (NotNull)
+         */
+        protected override void DoSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+            conditionValue.PrefixSearch = (value != null ? value + GetWildCard() : null);
+            conditionValue.SetPrefixSearchLocation(location);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/cvalue/ConditionValue.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/cvalue/ConditionValue.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/cvalue/ConditionValue.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,412 @@
+#set ($myClassName = "${glConditionValueName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonCValue} {
+
+    /// <summary>
+    /// Condition value.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} {
+
+        /** Value of equal. */
+        protected Object _equalValue;
+
+        /**
+         * Get the value of equal.
+         * 
+         * @return The value of equal. (Nullable)
+         */
+        public Object Equal {
+            get { return _equalValue; }
+            set { _equalValue = value; }
+        }
+
+        /** Location of equal. */
+        protected String _equalLocation;
+
+        /**
+         * Get the location of equal.
+         * 
+         * @return The location of equal. (Nullable)
+         */
+        public String GetEqualLocation() {
+            return _equalLocation;
+        }
+
+        /**
+         * Set the location of equal.
+         * 
+         * @param location The location of equal. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetEqualLocation(String location) {
+            _equalLocation = location;
+            return this;
+        }
+
+        /** Value of notEqual. */
+        protected Object _notEqualValue;
+
+        /**
+         * Get the value of notEqual.
+         * 
+         * @return The value of notEqual. (Nullable)
+         */
+        public Object NotEqual {
+            get { return _notEqualValue; }
+            set { _notEqualValue = value; }
+        }
+
+        /** Location of notEqual. */
+        protected String _notEqualLocation;
+
+        /**
+         * Get the location of notEqual.
+         * 
+         * @return The location of notEqual. (Nullable)
+         */
+        public String GetNotEqualLocation() {
+            return _notEqualLocation;
+        }
+
+        /**
+         * Set the location of notEqual.
+         * 
+         * @param location The location of notEqual. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetNotEqualLocation(String location) {
+            _notEqualLocation = location;
+            return this;
+        }
+
+        /** Value of greaterThan. */
+        protected Object _greaterThanValue;
+
+        /**
+         * Get the value of greaterThan.
+         * 
+         * @return The value of greaterThan. (Nullable)
+         */
+        public Object GreaterThan {
+            get { return _greaterThanValue; }
+            set { _greaterThanValue = value; }
+        }
+
+        /** Location of GreaterThan. */
+        protected String _greaterThanLocation;
+
+        /**
+         * Get the location of greaterThan.
+         * 
+         * @return The location of greaterThan. (Nullable)
+         */
+        public String GetGreaterThanLocation() {
+            return _greaterThanLocation;
+        }
+
+        /**
+         * Set the location of greaterThan.
+         * 
+         * @param location The location of greaterThan. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetGreaterThanLocation(String location) {
+            _greaterThanLocation = location;
+            return this;
+        }
+
+        /** Value of lessThan. */
+        protected Object _lessThanValue;
+
+        /**
+         * Get the value of lessThan.
+         * 
+         * @return The value of lessThan. (Nullable)
+         */
+        public Object LessThan {
+            get { return _lessThanValue; }
+            set { _lessThanValue = value; }
+        }
+
+        /** Location of lessThan. */
+        protected String _lessThanLocation;
+
+        /**
+         * Get the location of lessThan.
+         * 
+         * @return The location of lessThan. (Nullable)
+         */
+        public String GetLessThanLocation() {
+            return _lessThanLocation;
+        }
+
+        /**
+         * Set the location of lessThan.
+         * 
+         * @param location The location of lessThan. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetLessThanLocation(String location) {
+            _lessThanLocation = location;
+            return this;
+        }
+
+        /** Value of greaterEqual. */
+        protected Object _greaterEqualValue;
+
+        /**
+         * Get the value of greaterEqual.
+         * 
+         * @return The value of greaterEqual. (Nullable)
+         */
+        public Object GreaterEqual {
+            get { return _greaterEqualValue; }
+            set { _greaterEqualValue = value; }
+        }
+
+        /** Location of greaterEqual. */
+        protected String _greaterEqualLocation;
+
+        /**
+         * Get the location of greaterEqual.
+         * 
+         * @return The location of greaterEqual. (Nullable)
+         */
+        public String GetGreaterEqualLocation() {
+            return _greaterEqualLocation;
+        }
+
+        /**
+         * Set the location of greaterEqual.
+         * 
+         * @param location The location of greaterEqual. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetGreaterEqualLocation(String location) {
+            _greaterEqualLocation = location;
+            return this;
+        }
+
+        /** Value of lessEqual. */
+        protected Object _lessEqualValue;
+
+        /**
+         * Get the value of lessEqual.
+         * 
+         * @return The value of lessEqual. (Nullable)
+         */
+        public Object LessEqual {
+            get { return _lessEqualValue; }
+            set { _lessEqualValue = value; }
+        }
+
+        /** Location of lessEqual. */
+        protected String _lessEqualLocation;
+
+        /**
+         * Get the location of lessEqual.
+         * 
+         * @return The location of lessEqual. (Nullable)
+         */
+        public String GetLessEqualLocation() {
+            return _lessEqualLocation;
+        }
+
+        /**
+         * Set the location of lessEqual.
+         * 
+         * @param location The location of lessEqual. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetLessEqualLocation(String location) {
+            _lessEqualLocation = location;
+            return this;
+        }
+
+        /** Value of prefixSearch. */
+        protected Object _prefixSearch;
+
+        /**
+         * Get the value of prefixSearch.
+         * 
+         * @return The value of prefixSearch. (Nullable)
+         */
+        public Object PrefixSearch {
+            get { return _prefixSearch; }
+            set { _prefixSearch = value; }
+        }
+
+        /** Location of prefixSearch. */
+        protected String _prefixSearchLocation;
+
+        /**
+         * Get the location of prefixSearch.
+         * 
+         * @return The location of prefixSearch. (Nullable)
+         */
+        public String GetPrefixSearchLocation() {
+            return _prefixSearchLocation;
+        }
+
+        /**
+         * Set the location of prefixSearch.
+         * 
+         * @param location The location of prefixSearch. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetPrefixSearchLocation(String location) {
+            _prefixSearchLocation = location;
+            return this;
+        }
+
+        /** Value of inScope. */
+        protected System.Collections.IList _inScope;
+
+        /**
+         * Get the value of inScope.
+         * 
+         * @return The value of inScope. (Nullable)
+         */
+        public System.Collections.IList InScope {
+            get { return _inScope; }
+            set { _inScope = value; }
+        }
+
+        /** Location of InScope. */
+        protected String _inScopeLocation;
+
+        /**
+         * Get the location of inScope.
+         * 
+         * @return The location of inScope. (Nullable)
+         */
+        public String GetInScopeLocation() {
+            return _inScopeLocation;
+        }
+
+        /**
+         * Set the location of inScope.
+         * 
+         * @param location The location of inScope. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetInScopeLocation(String location) {
+            _inScopeLocation = location;
+            return this;
+        }
+
+        /** Value of notInScope. */
+        protected System.Collections.IList _notInScope;
+
+        /**
+         * Get the value of notInScope.
+         * 
+         * @return The value of notInScope. (Nullable)
+         */
+        public System.Collections.IList NotInScope {
+            get { return _notInScope; }
+            set { _notInScope = value; }
+        }
+
+        /** Location of notInScope. */
+        protected String _notInScopeLocation;
+
+        /**
+         * Get the location of notInScope.
+         * 
+         * @return The location of notInScope. (Nullable)
+         */
+        public String GetNotInScopeLocation() {
+            return _notInScopeLocation;
+        }
+
+        /**
+         * Set the location of notInScope.
+         * 
+         * @param location The location of notInScope. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetNotInScopeLocation(String location) {
+            _notInScopeLocation = location;
+            return this;
+        }
+
+        /** Value of isNull. */
+        protected Object _isNullValue;
+
+        /**
+         * Get the value of isNull.
+         * 
+         * @return The value of isNull. (Nullable)
+         */
+        public Object IsNull {
+            get { return _isNullValue; }
+            set { _isNullValue = value; }
+        }
+
+        /** Location of isNull. */
+        protected String _isNullLocation;
+
+        /**
+         * Get the location of isNull.
+         * 
+         * @return The location of isNull. (Nullable)
+         */
+        public String GetIsNullLocation() {
+            return _isNullLocation;
+        }
+
+        /**
+         * Set the location of isNull.
+         * 
+         * @param location The location of isNull. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetIsNullLocation(String location) {
+            _isNullLocation = location;
+            return this;
+        }
+
+        /** Value of isNotNull. */
+        protected Object _isNotNullValue;
+
+        /**
+         * Get the value of isNotNull.
+         * 
+         * @return The value of isNotNull. (Nullable)
+         */
+        public Object IsNotNull {
+            get { return _isNotNullValue; }
+            set { _isNotNullValue = value; }
+        }
+
+        /** Location of isNotNull. */
+        protected String _isNotNullLocation;
+
+        /**
+         * Get the location of isNotNull.
+         * 
+         * @return The location of isNotNull. (Nullable)
+         */
+        public String GetIsNotNullLocation() {
+            return _isNotNullLocation;
+        }
+
+        /**
+         * Set the location of isNotNull.
+         * 
+         * @param location The location of isNotNull. (Nullable)
+         * @return this. (NotNull)
+         */
+        public ${myClassName} SetIsNotNullLocation(String location) {
+            _isNotNullLocation = location;
+            return this;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/AbstractSqlClause.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/AbstractSqlClause.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/AbstractSqlClause.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,847 @@
+#set ($myClassName = "${glSqlClauseAbstractName}")
+
+using System;
+using System.Collections;
+using System.Text;
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCKey};
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// The abstract class of SqlClause.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public abstract class ${myClassName} : ${glSqlClauseInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        /** Target table name. */
+        protected String _tableName;
+
+        /** Included select column map. */
+        protected System.Collections.IDictionary _includedSelectColumnMap = new System.Collections.Hashtable();
+
+        /** Outer join map. */
+        protected System.Collections.IDictionary _outerJoinMap = new System.Collections.Hashtable();
+
+        /** Outer join list. (For order guarantee) */
+        protected System.Collections.IList _outerJoinList = new System.Collections.ArrayList();
+
+        /** Where list. */
+        protected System.Collections.IList _whereList = new System.Collections.ArrayList();
+
+        /** Inline where list for BaseTable. */
+        protected System.Collections.IList _baseTableInlineWhereList = new System.Collections.ArrayList();
+
+        /** Order by clause. */
+        protected ${glOrderByClauseName} _orderByClause = new ${glOrderByClauseName}();
+
+        /** Is incoluded-select-column effective? Default value is false. */
+        protected bool _isIncludedSelectColumnEffective = false;
+
+        /** Is order-by effective? Default value is false. */
+        protected bool _isOrderByEffective = false;
+
+        /** Fetch start index. (for fetchXxx()) */
+        protected int _fetchStartIndex = 0;
+
+        /** Fetch size. (for fetchXxx()) */
+        protected int _fetchSize = 0;
+
+        /** Fetch page number. (for fetchXxx()) This value should be plus. */
+        protected int _fetchPageNumber = 1;
+
+        /** Is fetch-narrowing effective? Default value is false. */
+        protected bool _isFetchScopeEffective = false;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName) {
+            if (tableName == null) {
+                String msg = "Argument[tableName] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            _tableName = tableName;
+        }
+
+        // =====================================================================================
+        //                                                                                Clause
+        //                                                                                ======
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Clause string. (NotNull)
+         */
+        public String GetClause() {
+            StringBuilder sb = new StringBuilder(128);
+            if (_isIncludedSelectColumnEffective && _includedSelectColumnMap.Count != 0) {
+                sb.Append(" ").Append(GetIncludedSelectColumnClause());
+            }
+            sb.Append(" ");
+            sb.Append(GetFromClause());
+            sb.Append(" ");
+            sb.Append(GetFromHint());
+            sb.Append(" ");
+            sb.Append(GetWhereClause());
+
+            if (_isOrderByEffective && !_orderByClause.IsEmpty()) {
+                sb.Append(" ");
+                sb.Append(GetOrderByClause());
+            }
+            sb.Append(" ");
+            sb.Append(GetSqlSuffix());
+            return sb.ToString();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return select-hint. {select [select-hint] * from table...}
+         */
+        public String GetSelectHint() {
+            return CreateSelectHint();
+        }
+
+        public String GetIncludedSelectColumnClause() {
+            StringBuilder sb = new StringBuilder();
+            System.Collections.ICollection keySet = _includedSelectColumnMap.Keys;
+            foreach (String aliasName in keySet) {
+                String realColumnName = (String)_includedSelectColumnMap[aliasName];
+                sb.Append(", ").Append(realColumnName).Append(" as ").Append(aliasName);
+            }
+            return sb.ToString();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From clause. (NotNull)
+         */
+        public String GetFromClause() {
+            StringBuilder sb = new StringBuilder(128);
+            sb.Append("from ");
+            if (_baseTableInlineWhereList.Count == 0) {
+                sb.Append(_tableName);
+            } else {
+                sb.Append(GetInlineViewClause(_tableName, _baseTableInlineWhereList)).Append(" ").Append(_tableName);
+            }
+            sb.Append(GetFromBaseTableHint());
+            sb.Append(GetLeftOuterJoinClause());
+            return sb.ToString();
+        }
+
+        protected String GetLeftOuterJoinClause() {
+            StringBuilder sb = new StringBuilder();
+            foreach (String aliasName in _outerJoinList) {
+                LeftOuterJoinInfo joinInfo = (LeftOuterJoinInfo)_outerJoinMap[aliasName];
+                String joinTableName = joinInfo.JoinTableName;
+                System.Collections.IList inlineWhereClauseList = joinInfo.InlineWhereClauseList;
+                System.Collections.IDictionary joinOnMap = joinInfo.JoinOnMap;
+                AssertJoinOnMapNotEmpty(joinOnMap, aliasName);
+
+                sb.Append(" left outer join ");
+                if (inlineWhereClauseList.Count == 0) {
+                    sb.Append(joinTableName);
+                } else {
+                    sb.Append(GetInlineViewClause(joinTableName, inlineWhereClauseList));
+                }
+                sb.Append(" ").Append(aliasName).Append(" on ");
+                int count = 0;
+                System.Collections.ICollection localColumnNameSet = joinOnMap.Keys;
+                foreach (String localColumnName in localColumnNameSet) {
+                    String foreignColumnName = (String)joinOnMap[localColumnName];
+                    if (count != 0) {
+                        sb.Append(" and ");
+                    }
+                    sb.Append(localColumnName).Append(" = ").Append(foreignColumnName);
+                    count++;
+                }
+            }
+            return sb.ToString();
+        }
+
+        protected String GetInlineViewClause(String joinTableName, System.Collections.IList inlineWhereClauseList) {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("(select * from ").Append(joinTableName).Append(" where ");
+            int count = 0;
+            foreach (String whereClause in inlineWhereClauseList) {
+                if (count > 0) {
+                    sb.Append(" and ");
+                }
+                sb.Append(whereClause);
+                ++count;
+            }
+            sb.Append(")");
+            return sb.ToString();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return from-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        public String GetFromBaseTableHint() {
+            return CreateFromBaseTableHint();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return from-hint. {select * from table [from-hint] where ...} (NotNull)
+         */
+        public String GetFromHint() {
+            return CreateFromHint();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Where clause. (NotNull)
+         */
+        public String GetWhereClause() {
+            StringBuilder sb = new StringBuilder(128);
+            int count = 0;
+            foreach (String clause in _whereList) {
+                if (count == 0) {
+                    sb.Append("where ").Append(clause);
+                } else {
+                    sb.Append(" and ").Append(clause);
+                }
+                count++;
+            }
+            return sb.ToString();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Order-by clause. (NotNull)
+         */
+        public String GetOrderByClause() {
+            return _orderByClause.GetOrderByClause();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return from-hint. {select * from table where ... order by ... [sql-suffix]}
+         */
+        public String GetSqlSuffix() {
+            return CreateSqlSuffix();
+        }
+
+        // =====================================================================================
+        //                                                                  IncludedSelectColumn
+        //                                                                  ====================
+        public void MakeIncludedSelectColumnEffective() {
+            _isIncludedSelectColumnEffective = true;
+        }
+
+        public void IgnoreIncludedSelectColumn() {
+            _isIncludedSelectColumnEffective = false;
+        }
+
+        public void RegisterIncludedSelectColumn(String aliasName, String realColumnName) {
+            _isIncludedSelectColumnEffective = true;
+            _includedSelectColumnMap.Add(aliasName, realColumnName);
+        }
+
+        // =====================================================================================
+        //                                                                             OuterJoin
+        //                                                                             =========
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param joinTableName Join table name(outer join [joinTableName]). (NotNull)
+         * @param aliasName Alias name of join table. (NotNull and Unique per invoking method.)
+         * @param joinOnMap Map that has conditions of 'on' clause. (NotNull)
+         */
+        public void RegisterOuterJoin(String joinTableName, String aliasName, System.Collections.IDictionary joinOnMap) {
+            AssertAlreadyOuterJoin(aliasName);
+            AssertJoinOnMapNotEmpty(joinOnMap, aliasName);
+            LeftOuterJoinInfo joinInfo = new LeftOuterJoinInfo();
+            joinInfo.AliasName = aliasName;
+            joinInfo.JoinTableName = joinTableName;
+            joinInfo.JoinOnMap = joinOnMap;
+            _outerJoinMap.Add(aliasName, joinInfo);
+            _outerJoinList.Add(aliasName);// For order guarantee
+        }
+
+        public class LeftOuterJoinInfo {
+            protected String _aliasName;
+            protected String _joinTableName;
+            protected System.Collections.IList _inlineWhereClauseList = new System.Collections.ArrayList();
+            protected System.Collections.IDictionary _joinOnMap;
+            public String AliasName {
+                get { return _aliasName; }
+                set { _aliasName = value; }
+            }
+            public String JoinTableName {
+                get { return _joinTableName; }
+                set { _joinTableName = value; }
+            }
+            public System.Collections.IList InlineWhereClauseList {
+                get { return _inlineWhereClauseList; }
+            }
+            public void AddInlineWhereClause(String value) {
+                _inlineWhereClauseList.Add(value);
+            }
+            public System.Collections.IDictionary JoinOnMap {
+                get { return _joinOnMap; }
+                set { _joinOnMap = value; }
+            }
+        }
+
+        protected void AssertAlreadyOuterJoin(String aliasName) {
+            if (_outerJoinMap.Contains(aliasName)) {
+                String msg = "The alias name have already registered in outer join: " + aliasName;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        protected void AssertJoinOnMapNotEmpty(System.Collections.IDictionary joinOnMap, String aliasName) {
+            if (joinOnMap.Count == 0) {
+                String msg = "The joinOnMap should not be empty: aliasName=" + aliasName;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        // =====================================================================================
+        //                                                                                 Where
+        //                                                                                 =====
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param columnName Column name([table-name].[column-name]). (NotNull)
+         * @param key Condition key. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        public void RegisterWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value) {
+            AssertStringNotNullAndNotTrimmedEmpty("columnName", columnName);
+            key.AddWhereClause(_whereList, columnName, value);
+        }
+
+        /**
+         * Register where clause.
+         * 
+         * @param clause Where clause. (NotNull)
+         * @return this. (NotNull)
+         */
+        public void RegisterWhereClause(String clause) {
+            AssertStringNotNullAndNotTrimmedEmpty("clause", clause);
+            _whereList.Add(clause);
+        }
+
+        // =====================================================================================
+        //                                                                           InlineWhere
+        //                                                                           ===========
+        public void RegisterBaseTableInlineWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value) {
+            RegisterWhereClause(columnName, key, value);
+            String inlineWhereClause = (String)_whereList[_whereList.Count-1];
+            _whereList.RemoveAt(_whereList.Count-1);
+            _baseTableInlineWhereList.Add(inlineWhereClause);
+        }
+
+        public void RegisterBaseTableInlineWhereClause(String value) {
+            _baseTableInlineWhereList.Add(value);
+        }
+
+        public void RegisterOuterJoinInlineWhereClause(String aliasName, String columnName, ${glConditionKeyName} key, ${glConditionValueName} value) {
+            AssertNotYetOuterJoin(aliasName);
+            LeftOuterJoinInfo joinInfo = (LeftOuterJoinInfo)_outerJoinMap[aliasName];
+            RegisterWhereClause(columnName, key, value);
+            String inlineWhereClause = (String)_whereList[_whereList.Count-1];
+            _whereList.RemoveAt(_whereList.Count-1);
+            joinInfo.AddInlineWhereClause(inlineWhereClause);
+        }
+
+        public void RegisterOuterJoinInlineWhereClause(String aliasName, String value) {
+            AssertNotYetOuterJoin(aliasName);
+            LeftOuterJoinInfo joinInfo = (LeftOuterJoinInfo)_outerJoinMap[aliasName];
+            joinInfo.AddInlineWhereClause(value);
+        }
+
+        /**
+         * Assert whether the alias name have already registered in outer join.
+         * 
+         * @param aliasName Alias name.
+         */
+        protected void AssertNotYetOuterJoin(String aliasName) {
+            if (!_outerJoinMap.Contains(aliasName)) {
+                String msg = "The alias name have not registered in outer join yet: " + aliasName;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        // =====================================================================================
+        //                                                                               OrderBy
+        //                                                                               =======
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glOrderByClauseName} GetSqlComponentOfOrderByClause() {
+            return _orderByClause;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glSqlClauseInterfaceName} ClearOrderBy() {
+            _isOrderByEffective = false;
+            _orderByClause.Clear();
+            return this;
+        }
+
+       /**
+        * ${database.ImplementComment}
+        * 
+        * @return this. (NotNull)
+        */
+        public ${glSqlClauseInterfaceName} IgnoreOrderBy() {
+            _isOrderByEffective = false;
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glSqlClauseInterfaceName} MakeOrderByEffective() {
+            _isOrderByEffective = true;
+            return this;
+        }
+
+        public void ReverseOrderBy_Or_OverrideOrderBy(String columnFullName, bool isAsc) {
+            ReverseOrderBy_Or_OverrideOrderBy(columnFullName, null, isAsc);
+        }
+
+        public void ReverseOrderBy_Or_OverrideOrderBy(String columnFullName, String registeredColumnFullName, bool isAsc) {
+            _isOrderByEffective = true;
+            if (!_orderByClause.IsSameOrderByColumn(columnFullName)) {
+                ClearOrderBy();
+                RegisterOrderBy(columnFullName, registeredColumnFullName, isAsc);
+            } else {
+                _orderByClause.ReverseAll();
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param columnFullName Column-full-name. ([table-name].[column-name]) (NotNull)
+         * @param registeredColumnFullName Registered-column-full-name. ([table-name].[column-name]) (Nullable)
+         */
+        public void RegisterOrderBy(String columnFullName, bool isAsc) {
+            RegisterOrderBy(columnFullName, null, isAsc);
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param columnFullName Column-full-name. ([table-name].[column-name]) (NotNull)
+         * @param registeredColumnFullName Registered-column-full-name. ([table-name].[column-name]) (Nullable)
+         */
+        public void RegisterOrderBy(String columnFullName, String registeredColumnFullName, bool isAsc) {
+            try {
+                String[] orderByArray = columnFullName.Split('/');
+                if (registeredColumnFullName == null || registeredColumnFullName.Trim().Length ==0) {
+                    registeredColumnFullName = columnFullName;
+                }
+                String[] registeredOrderByArray = registeredColumnFullName.Split('/');
+                int count = 0;
+                foreach (String orderBy in orderByArray) {
+                    String registeredOrderBy = registeredOrderByArray[count];
+
+                    _isOrderByEffective = true;
+                    String aliasName = null;
+                    String columnName = null;
+                    String registeredAliasName = null;
+                    String registeredColumnName = null;
+
+                    if (orderBy.IndexOf(".") < 0) {
+                        columnName = orderBy;
+                    } else {
+                        aliasName = orderBy.Substring(0, orderBy.LastIndexOf("."));
+                        columnName = orderBy.Substring(orderBy.LastIndexOf(".") + 1);
+                    }
+
+                    if (registeredOrderBy.IndexOf(".") < 0) {
+                        registeredColumnName = registeredOrderBy;
+                    } else {
+                        registeredAliasName = registeredOrderBy.Substring(0, registeredOrderBy.LastIndexOf("."));
+                        registeredColumnName = registeredOrderBy.Substring(registeredOrderBy.LastIndexOf(".") + 1);
+                    }
+
+                    ${glOrderByElementName} element = new ${glOrderByElementName}();
+                    element.AliasName = aliasName;
+                    element.ColumnName = columnName;
+                    element.RegisteredAliasName = registeredAliasName;
+                    element.RegisteredColumnName = registeredColumnName;
+                    if (isAsc) {
+                        element.SetupAsc();
+                    } else {
+                        element.SetupDesc();
+                    }
+                    _orderByClause.AddOrderByElement(element);
+
+                    count++;
+                }
+            } catch (Exception e) {
+                String msg = "RegisterOrderBy() threw the exception: columnFullName=" + columnFullName;
+                msg = msg + " registeredColumnFullName=" + registeredColumnFullName;
+                msg = msg + " isAsc=" + isAsc;
+                msg = msg + " sqlClause=" + this.ToString();
+                throw new SystemException(msg, e);
+            }
+        }
+
+        // =====================================================================================
+        //                                                                               Advance
+        //                                                                               =======
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param fetchSize Fetch-size. (NotMinus & NotZero)
+         * @return this. (NotNull)
+         */
+        public ${glSqlClauseInterfaceName} FetchFirst(int fetchSize) {
+            _isFetchScopeEffective = true;
+            if (fetchSize <= 0) {
+                String msg = "Argument[fetchSize] must be plus: " + fetchSize;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+            _fetchStartIndex = 0;
+            _fetchSize = fetchSize;
+            _fetchPageNumber = 1;
+            DoClearFetchPageClause();
+            DoFetchFirst();
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+         * @param fetchSize Fetch size. (NotMinus)
+         * @return this. (NotNull)
+         */
+        public ${glSqlClauseInterfaceName} FetchScope(int fetchStartIndex, int fetchSize) {
+            _isFetchScopeEffective = true;
+            if (fetchStartIndex < 0) {
+                String msg = "Argument[fetchStartIndex] must be plus or zero: " + fetchStartIndex;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+            if (fetchSize <= 0) {
+                String msg = "Argument[fetchSize] must be plus: " + fetchSize;
+                throw new ArgumentOutOfRangeException(msg);
+            }
+            _fetchStartIndex = fetchStartIndex;
+            _fetchSize = fetchSize;
+            return FetchPage(1);
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @param fetchPageNumber Page-number. 1 origin. (NotMinus & NotZero: If minus or zero, set one.)
+         * @return this. (NotNull)
+         */
+        public ${glSqlClauseInterfaceName} FetchPage(int fetchPageNumber) {
+            _isFetchScopeEffective = true;
+            if (fetchPageNumber <= 0) {
+                fetchPageNumber = 1;
+            }
+            if (_fetchSize <= 0) {
+                String msg = "Fetch size should not be minus or zero when you invoke this method. ";
+                msg = msg + "When you invoke this method, it is necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that. ";
+                msg = msg + ": fetchPageNumber=" + fetchPageNumber + " _fetchSize=" + _fetchSize;
+                throw new SystemException(msg);
+            }
+            _fetchPageNumber = fetchPageNumber;
+            if (_fetchPageNumber == 1 && _fetchStartIndex == 0) {
+                return FetchFirst(_fetchSize);
+            }
+            DoClearFetchPageClause();
+            DoFetchPage();
+            return this;
+        }
+
+        /**
+         * Do fetch first.
+         */
+        abstract protected void DoFetchFirst();
+
+        /**
+         * Do fetch page.
+         */
+        abstract protected void DoFetchPage();
+
+        /**
+         * Do clear fetch-page clause.
+         */
+        abstract protected void DoClearFetchPageClause();
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch start index.
+         */
+        public int FetchStartIndex {
+            get {
+                return _fetchStartIndex;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch size.
+         */
+        public int FetchSize {
+            get {
+                return _fetchSize;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch page number.
+         */
+        public int FetchPageNumber {
+            get {
+                return _fetchPageNumber;
+            }
+        }
+
+        /**
+         * Get page start index.
+         * 
+         * @return Page start index. 0 origin. (NotMinus)
+         */
+        public int PageStartIndex {
+            get {
+                if (_fetchPageNumber <= 0) {
+                    String msg = "_fetchPageNumber must be plus: " + _fetchPageNumber;
+                    throw new SystemException(msg);
+                }
+                return _fetchStartIndex + (_fetchSize * (_fetchPageNumber - 1));
+            }
+        }
+
+        /**
+         * Get page end index.
+         * 
+         * @return Page end index. 0 origin. (NotMinus)
+         */
+        public int PageEndIndex {
+            get {
+                if (_fetchPageNumber <= 0) {
+                    String msg = "_fetchPageNumber must be plus: " + _fetchPageNumber;
+                    throw new SystemException(msg);
+                }
+                return _fetchStartIndex + (_fetchSize * _fetchPageNumber);
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glSqlClauseInterfaceName} IgnoreFetchScope() {
+            _isFetchScopeEffective = false;
+            DoClearFetchPageClause();
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public ${glSqlClauseInterfaceName} MakeFetchScopeEffective() {
+            _isFetchScopeEffective = true;
+            if (this.FetchSize > 0 && this.FetchPageNumber > 0) {
+                FetchPage(this.FetchPageNumber);
+            }
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determiantion.
+         */
+        public bool IsFetchScopeEffective {
+            get {
+                return _isFetchScopeEffective;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public virtual bool IsFetchStartIndexSupported {
+            get {
+                return true; // Default
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public virtual bool IsFetchSizeSupported {
+            get {
+                return true; // Default
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        abstract public ${glSqlClauseInterfaceName} LockForUpdate();
+
+        /**
+         * Create select-hint.
+         * 
+         * @return Select-hint. {select [select-hint] * from table...} (NotNull)
+         */
+        abstract protected String CreateSelectHint();
+
+        /**
+         * Create from-base-table-hint.
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        abstract protected String CreateFromBaseTableHint();
+
+        /**
+         * Create from-hint.
+         * 
+         * @return From-hint. {select * from table [from-hint] where ...} (NotNull)
+         */
+        abstract protected String CreateFromHint();
+
+        /**
+         * Create sql-suffix.
+         * 
+         * @return Sql-suffix. {select * from table where ... order by ... [sql-suffix]} (NotNull)
+         */
+        abstract protected String CreateSqlSuffix();
+
+        // =====================================================================================
+        //                                                                        FetchNarrowing
+        //                                                                        ==============
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch-narrowing start-index.
+         */
+        public int FetchNarrowingSkipStartIndex {
+            get {
+                if (this.IsFetchStartIndexSupported) {
+                    return 0;
+                } else {
+                    return this.PageStartIndex;
+                }
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Fetch-narrowing size.
+         */
+        public int FetchNarrowingLoopCount {
+            get {
+                return this.FetchSize;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determiantion.
+         */
+        public bool IsFetchNarrowingEffective {
+            get {
+                return _isFetchScopeEffective;
+            }
+        }
+
+
+        // ----------------------------------------------------------------
+        //                                                    Assert Object
+        //                                                    -------------
+        #region Assert Object
+
+        /**
+         * Assert that the argument is not null.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertObjectNotNull(String variableName, Object arg) {
+            if (variableName == null) {
+                String msg = "Argument[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (arg == null) {
+                String msg = "Argument[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+        }
+
+        #endregion
+
+        // ----------------------------------------------------------------
+        //                                                    Assert String
+        //                                                    -------------
+        #region Assert String
+
+        /**
+         * Assert that the string is not null and not trimmed empty.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+            if (variableName == null) {
+                String msg = "Variable[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value == null) {
+                String msg = "Variable[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value.Trim().Length == 0) {
+                String msg = "Variable[" + variableName + "] should not be empty: [" + value + "]";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        #endregion
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByClause.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByClause.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByClause.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,226 @@
+
+#set ($myClassName = "${glOrderByClauseName}")
+
+using System;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /**
+     * The paging-result-bean of ${myClassName}.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    [System.Serializable]
+    public class ${myClassName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        protected System.Collections.Generic.IList<${glOrderByElementName}> _orderByList = new System.Collections.Generic.List<${glOrderByElementName}>();
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+        }
+
+        // =====================================================================================
+        //                                                                              Behavior
+        //                                                                              ========
+        public void AddOrderByElement(${glOrderByElementName} value) {
+            _orderByList.Add(value);
+        }
+
+        public void ReverseAll() {
+            foreach (${glOrderByElementName} element in _orderByList) {
+                element.Reverse();
+            }
+        }
+
+        /**
+         * Get the value of allRecordCount.
+         * 
+         * @return The value of allRecordCount.
+         */
+        public System.Collections.Generic.IList<${glOrderByElementName}> GetOrderByList() {
+            return _orderByList;
+        }
+
+        public String GetOrderByClause() {
+            if (_orderByList.Count == 0) {
+                return "";
+            }
+            StringBuilder sb = new StringBuilder();
+            String delimiter = ", ";
+            foreach (${glOrderByElementName} element in _orderByList) {
+                sb.Append(delimiter).Append(element.GetElementClause());
+            }
+            sb.Remove(0, delimiter.Length).Insert(0, "order by ");
+            return sb.ToString();
+        }
+
+        public String GetFirstElementColumnFullName() {
+            if (IsEmpty()) {
+                String msg = "This order-by clause is empty: " + ToString();
+                throw new SystemException(msg);
+            }
+            ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[0];
+            return element.GetColumnFullName();
+        }
+
+        public String GetFirstElementRegisteredColumnFullName() {
+            if (IsEmpty()) {
+                String msg = "This order-by clause is empty: " + ToString();
+                throw new SystemException(msg);
+            }
+            ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[0];
+            return element.GetRegisteredColumnFullName();
+        }
+
+        public bool IsSameOrderByColumn(String columnFullName) {
+            String[] columnFullNameArray = columnFullName.Split('/');
+            if (_orderByList.Count != columnFullNameArray.Length) {
+                return false;
+            }
+            int count = 0;
+            foreach (String columnFullNameElement in columnFullNameArray) {
+                ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[count];
+                if (!element.GetColumnFullName().ToLower().Equals(columnFullNameElement.ToLower())) {
+                    return false;
+                }
+                count++;
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// Is first element asc?
+        /// If order-by list is empty, throws exception.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsFirstElementAsc() {
+            if (IsEmpty()) {
+                String msg = "This order-by clause is empty: " + ToString();
+                throw new SystemException(msg);
+            }
+            ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[0];
+            return element.IsAsc();
+        }
+
+        /// <summary>
+        /// Is first element desc?
+        /// If order-by list is empty, throws exception.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsFirstElementDesc() {
+            return !IsFirstElementAsc();
+        }
+
+        /// <summary>
+        /// Is same as first element alias-name?
+        /// If order-by list is empty, throws exception.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSameAsFirstElementAliasName(String expectedAliasName) {
+            if (IsEmpty()) {
+                String msg = "This order-by clause is empty: " + ToString();
+                throw new SystemException(msg);
+            }
+            ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[0];
+            String actualAliasName = element.AliasName;
+            if (actualAliasName != null && expectedAliasName != null) {
+                return actualAliasName.Equals(expectedAliasName);
+            } else {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Is same as first element column-name?
+        /// If order-by list is empty, throws exception.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSameAsFirstElementColumnName(String expectedColumnName) {
+            if (IsEmpty()) {
+                String msg = "This order-by clause is empty: " + ToString();
+                throw new SystemException(msg);
+            }
+            ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[0];
+            String actualColumnName = element.ColumnName;
+            if (actualColumnName != null && expectedColumnName != null) {
+                return actualColumnName.Equals(expectedColumnName);
+            } else {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Is same as first element registered alias-name?
+        /// If order-by list is empty, throws exception.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSameAsFirstElementRegisteredAliasName(String expectedRegisteredAliasName) {
+            if (IsEmpty()) {
+                String msg = "This order-by clause is empty: " + ToString();
+                throw new SystemException(msg);
+            }
+            ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[0];
+            String actualRegisteredAliasName = element.RegisteredAliasName;
+            if (actualRegisteredAliasName != null && expectedRegisteredAliasName != null) {
+                return actualRegisteredAliasName.Equals(expectedRegisteredAliasName);
+            } else {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Is same as first element registered column-name?
+        /// If order-by list is empty, throws exception.
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSameAsFirstElementRegisteredColumnName(String expectedRegisteredColumnName) {
+            if (IsEmpty()) {
+                String msg = "This order-by clause is empty: " + ToString();
+                throw new SystemException(msg);
+            }
+            ${glOrderByElementName} element = (${glOrderByElementName})_orderByList[0];
+            String actualRegisteredColumnName = element.RegisteredColumnName;
+            if (actualRegisteredColumnName != null && expectedRegisteredColumnName != null) {
+                return actualRegisteredColumnName.Equals(expectedRegisteredColumnName);
+            } else {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// Is order-by list empty?
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsEmpty() {
+            return _orderByList.Count == 0;
+        }
+
+        /// <summary>
+        /// Clear order-by list.
+        /// </summary>
+        public void Clear() {
+            _orderByList.Clear();
+        }
+
+        // =====================================================================================
+        //                                                                 Basic-Override Method
+        //                                                                 =====================
+        /**
+         * This method overrides the method that is declared at super.
+         * 
+         * @return View-string of all-columns value.
+         */
+        public override String ToString() {
+            return _orderByList.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByElement.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByElement.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/OrderByElement.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,162 @@
+
+#set ($myClassName = "${glOrderByElementName}")
+
+using System;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// Order-by element.
+    /// <![CDATA[
+    ///   For example, if you make order-by 'order BOOK.BOOK_ID asc', the way is as follows:
+    ///       /-----------------------------------------------------
+    ///       ${myClassName} orderByElement = new ${myClassName}();
+    ///       orderByElement.AliasName = "BOOK";
+    ///       orderByElement.ColumnName = "BOOK_ID";
+    ///       orderByElement.SetupAsc();
+    ///       -------------/
+    /// ]]>
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        /** The value of alias name. */
+        protected String _aliasName;
+
+        /** The value of column name. */
+        protected String _columnName;
+
+        /** The value of registered alias name. */
+        protected String _registeredAliasName;
+
+        /** The value of registered column name. */
+        protected String _registeredColumnName;
+
+        /** The value of ascDesc. */
+        protected String _ascDesc = "asc";
+
+        // =====================================================================================
+        //                                                                          GetterSetter
+        //                                                                          ============
+        public String AliasName {
+            get { return _aliasName; }
+            set { _aliasName = value; }
+        }
+        public String ColumnName {
+            get { return _columnName; }
+            set { _columnName = value; }
+        }
+        public String RegisteredAliasName {
+            get { return _registeredAliasName; }
+            set { _registeredAliasName = value; }
+        }
+        public String RegisteredColumnName {
+            get { return _registeredColumnName; }
+            set { _registeredColumnName = value; }
+        }
+        public String AscDesc {
+            get { return _ascDesc; }
+            set { _ascDesc = value; }
+        }
+
+        // =====================================================================================
+        //                                                                              Behavior
+        //                                                                              ========
+        public void SetupAsc() {
+            _ascDesc = "asc";
+        }
+
+        public void SetupDesc() {
+            _ascDesc = "desc";
+        }
+
+        public void Reverse() {
+            if (_ascDesc == null) {
+                String msg = "The attribute[ascDesc] should not be null.";
+                throw new SystemException(msg);
+            }
+            if (_ascDesc.Equals("asc")) {
+                _ascDesc = "desc";
+            } else if (_ascDesc.Equals("desc")) {
+                _ascDesc = "asc";
+            } else {
+                String msg = "The attribute[ascDesc] should be asc or desc: but ascDesc=" + _ascDesc;
+                throw new SystemException(msg);
+            }
+        }
+
+        public bool IsAsc() {
+            if (_ascDesc == null) {
+                String msg = "The attribute[ascDesc] should not be null.";
+                throw new SystemException(msg);
+            }
+            if (_ascDesc.Equals("asc")) {
+                return true;
+            } else if (_ascDesc.Equals("desc")) {
+                return false;
+            } else {
+                String msg = "The attribute[ascDesc] should be asc or desc: but ascDesc=" + _ascDesc;
+                throw new SystemException(msg);
+            }
+        }
+
+        public String GetColumnFullName() {
+            StringBuilder sb = new StringBuilder();
+            if (_aliasName != null) {
+                sb.Append(_aliasName).Append(".");
+            }
+            if (_columnName == null) {
+                String msg = "The attribute[columnName] should not be null.";
+                throw new SystemException(msg);
+            }
+            sb.Append(_columnName);
+            return sb.ToString();
+        }
+
+        public String GetRegisteredColumnFullName() {
+            StringBuilder sb = new StringBuilder();
+            if (_registeredAliasName != null) {
+                sb.Append(_registeredAliasName).Append(".");
+            }
+            if (_registeredColumnName == null) {
+                String msg = "The attribute[registeredColumnName] should not be null.";
+                throw new SystemException(msg);
+            }
+            sb.Append(_registeredColumnName);
+            return sb.ToString();
+        }
+
+        public String GetElementClause() {
+            if (_ascDesc == null) {
+                String msg = "The attribute[ascDesc] should not be null.";
+                throw new SystemException(msg);
+            }
+            StringBuilder sb = new StringBuilder();
+            sb.Append(GetColumnFullName()).Append(" ").Append(_ascDesc);
+            return sb.ToString();
+        }
+
+        // =====================================================================================
+        //                                                                        Basic Override
+        //                                                                        ==============
+        /**
+         * This method overrides the method that is declared at super.
+         * 
+         * @return View-string of all-columns value.
+         */
+        public override String ToString() {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("aliasName=").Append(_aliasName);
+            sb.Append(" columnName=").Append(_columnName);
+            sb.Append(" registeredAliasName=").Append(_registeredAliasName);
+            sb.Append(" registeredColumnName=").Append(_registeredColumnName);
+            sb.Append(" ascDesc=").Append(_ascDesc);
+            return sb.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,318 @@
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommonCKey};
+using ${glPackageBaseCommonCValue};
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// The interface of SqlClause.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glSqlClauseInterfaceName} {
+
+        // =====================================================================================
+        //                                                                                Clause
+        //                                                                                ======
+        /**
+         * Get clause string.
+         * <p>
+         * <pre>
+         * EX.
+         * # from [base-table] left outer join [fk-table] [fk-alias] on [join-condition]
+         * # where [base-table].[column] = [value] and [fk-alias].[column] is null
+         * # order by [base-table].[column] asc, [fk-alias].[column] desc
+         * # for update
+         * </pre>
+         *
+         * @return Clause string. (NotNull)
+         */
+        String GetClause();
+
+        String GetIncludedSelectColumnClause();
+
+        /**
+         * Get select-hint. This is an internal method.
+         * 
+         * @return select-hint. {select [select-hint] * from table...}
+         */
+        String GetSelectHint();
+
+        /**
+         * Get from clause. {from table left outer join foreign-table on ...}
+         * 
+         * @return From clause. (NotNull)
+         */
+        String GetFromClause();
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return from-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        String GetFromBaseTableHint();
+
+        /**
+         * Get from-hint. This is an internal method.
+         * 
+         * @return from-hint. {select * from table [from-hint] where ...}
+         */
+        String GetFromHint();
+
+        /**
+         * Get where clause. {where [base-table].[column] = [value] and [fk-alias].[column] is null}
+         * 
+         * @return Where clause. (NotNull)
+         */
+        String GetWhereClause();
+
+        /**
+         * Get order-by clause. {order by [base-table].[column] asc, [fk-alias].[column] desc}
+         * 
+         * @return Order-by clause. (NotNull)
+         */
+        String GetOrderByClause();
+
+        /**
+         * Get sql-suffix. This is an internal method.
+         * 
+         * @return sql-suffix. {select * from table where ... order by ... [sql-suffix]}
+         */
+        String GetSqlSuffix();
+
+        // =====================================================================================
+        //                                                                  IncludedSelectColumn
+        //                                                                  ====================
+        void MakeIncludedSelectColumnEffective();
+        void IgnoreIncludedSelectColumn();
+        void RegisterIncludedSelectColumn(String aliasName, String realColumnName);
+
+        // =====================================================================================
+        //                                                                                 Where
+        //                                                                                 =====
+        /**
+         * Register where clause.
+         * 
+         * @param columnName Column name([table-name].[column-name]). (NotNull)
+         * @param key Condition key. (NotNull)
+         * @param value Condition value. (NotNull)
+         */
+        void RegisterWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value);
+
+        /**
+         * Register where clause.
+         * 
+         * @param clause Where clause. (NotNull)
+         */
+        void RegisterWhereClause(String clause);
+
+        // =====================================================================================
+        //                                                                           InlineWhere
+        //                                                                           ===========
+        void RegisterBaseTableInlineWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value);
+        void RegisterBaseTableInlineWhereClause(String value);
+        void RegisterOuterJoinInlineWhereClause(String aliasName, String columnName, ${glConditionKeyName} key, ${glConditionValueName} value);
+        void RegisterOuterJoinInlineWhereClause(String aliasName, String value);
+
+        // =====================================================================================
+        //                                                                               OrderBy
+        //                                                                               =======
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        ${glOrderByClauseName} GetSqlComponentOfOrderByClause();
+
+        /**
+         * Clear order-by.
+         * 
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} ClearOrderBy();
+
+        /**
+         * Ignore order-by.
+         * 
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} IgnoreOrderBy();
+
+        /**
+         * Make order-by effective.
+         * 
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} MakeOrderByEffective();
+
+        void ReverseOrderBy_Or_OverrideOrderBy(String columnFullName, bool isAsc);
+
+        void ReverseOrderBy_Or_OverrideOrderBy(String columnFullName, String registeredColumnFullName, bool isAsc);
+
+        /**
+         * Register order-by-asc.
+         * 
+         * @param columnFullName Column-full-name([table-name].[column-name]). (NotNull)
+         */
+        void RegisterOrderBy(String columnFullName, bool isAsc);
+
+        /**
+         * Register order-by-asc.
+         * 
+         * @param columnFullName Column-full-name([table-name].[column-name]). (NotNull)
+         */
+        void RegisterOrderBy(String columnFullName, String registeredColumnFullName, bool isAsc);
+
+        /**
+         * Register outer join.
+         * 
+         * @param joinTableName Join table name(outer join [joinTableName]). (NotNull)
+         * @param aliasName Alias name of join table. (NotNull and Unique per invoking method.)
+         * @param joinOnMap Map that has conditions of 'on' clause. (NotNull)
+         */
+        void RegisterOuterJoin(String joinTableName, String aliasName, System.Collections.IDictionary joinOnMap);
+
+        // =====================================================================================
+        //                                                                               Advance
+        //                                                                               =======
+        /**
+         * Fetch first.
+         * <p>
+         * If you invoke this, your SQL returns [fetch-size] records from first.
+         * If you invoke this, instance-variable[_fetchPageNumber] is initialized as one.
+         * 
+         * @param fetchSize Fetch-size. (NotMinus)
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} FetchFirst(int fetchSize);
+
+        /**
+         * Fetch scope.
+         * <p>
+         * If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index].
+         * If you invoke this, instance-variable[_fetchPageNumber] is initialized as one.
+         * 
+         * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+         * @param fetchSize Fetch-size. (NotMinus)
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} FetchScope(int fetchStartIndex, int fetchSize);
+
+        /**
+         * Fetch page.
+         * <p>
+         * When you invoke this, it is normally necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that.
+         * But you also can use default-fetch-size without invoking 'fetchFirst()' or 'fetchScope()'.
+         * If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index] calculated by [fetch-page-number].
+         * 
+         * @param fetchPageNumber Fetch-page-number. 1 origin. (NotMinus & NotZero)
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} FetchPage(int fetchPageNumber);
+
+        /**
+         * Get fetch start index.
+         * 
+         * @return Fetch start index.
+         */
+        int FetchStartIndex { get; }
+
+        /**
+         * Get fetch size.
+         * 
+         * @return Fetch size.
+         */
+        int FetchSize { get; }
+
+        /**
+         * Get fetch page number.
+         * 
+         * @return Fetch page number.
+         */
+        int FetchPageNumber { get; }
+
+        /**
+         * Get page start index.
+         * 
+         * @return Page start index. 0 origin. (NotMinus)
+         */
+        int PageStartIndex { get; }
+
+        /**
+         * Get page end index.
+         * 
+         * @return Page end index. 0 origin. (NotMinus)
+         */
+        int PageEndIndex { get; }
+
+        /**
+         * Ignore fetch-narrowing.
+         * 
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} IgnoreFetchScope();
+
+        /**
+         * Make fetch-narrowing effective.
+         * 
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} MakeFetchScopeEffective();
+
+        /**
+         * Is fetch scope effective?
+         * 
+         * @return Determination.
+         */
+        bool IsFetchScopeEffective { get; }
+
+        /**
+         * Is fetch start index supported?
+         * 
+         * @return Determination.
+         */
+        bool IsFetchStartIndexSupported { get; }
+
+        /**
+         * Is fetch size supported?
+         * 
+         * @return Determination.
+         */
+        bool IsFetchSizeSupported { get; }
+
+        /**
+         * Lock for update.
+         * <p>
+         * If you invoke this, your SQL lock target records for update.
+         * It depends whether this method supports this on the database type.
+         * 
+         * @return this. (NotNull)
+         */
+        ${glSqlClauseInterfaceName} LockForUpdate();
+
+        // =====================================================================================
+        //                                                                        FetchNarrowing
+        //                                                                        ==============
+        /**
+         * Get fetch-narrowing start-index.
+         * 
+         * @return Fetch-narrowing start-index.
+         */
+        int FetchNarrowingSkipStartIndex { get; }
+
+        /**
+         * Get fetch-narrowing size.
+         * 
+         * @return Fetch-narrowing size.
+         */
+        int FetchNarrowingLoopCount { get; }
+
+        /**
+         * Is fetch-narrowing effective?
+         * 
+         * @return Determiantion.
+         */
+        bool IsFetchNarrowingEffective { get; }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_db2.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_db2.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_db2.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,116 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for MSSQL.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+        /** String of fetch-first as sql-suffix. */
+        protected String _fetchFirstSqlSuffix = "";
+
+        /** String of lock as from-hint. */
+        protected String _lockSqlSuffix = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+            if (IsFetchSizeSupported) {
+                _fetchFirstSqlSuffix = " fetch first " + this.FetchSize + " rows only";
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+            if (IsFetchSizeSupported) {
+                if (IsFetchStartIndexSupported) {
+                    _fetchFirstSqlSuffix = " fetch first " + this.FetchSize + " rows only";
+                } else {
+                    _fetchFirstSqlSuffix = " fetch first " + this.PageEndIndex + " rows only";
+                }
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+            _fetchFirstSelectHint = "";
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return Determination.
+         */
+        public override bool IsFetchStartIndexSupported {
+            get {
+                return false; // Default
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockSqlSuffix = " for update with RS";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return _fetchFirstSqlSuffix + _lockSqlSuffix;;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_default.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_default.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_default.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,110 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for Default.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return Determination.
+         */
+        public override bool IsFetchStartIndexSupported {
+            get {
+                return false; // Default
+            }
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return Determination.
+         */
+        public override bool IsFetchSizeSupported {
+            get {
+                return false; // Default
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            String msg = "LockForUpdate-SQL is unsupported in the database. Sorry...: " + ToString();
+            throw new SystemException(msg);
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return "";
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_derby.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_derby.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_derby.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,113 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for Apache Derby.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+        /** String of lock as sql-suffix. */
+        protected String _lockSqlSuffix = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return Determination.
+         */
+        public override bool IsFetchStartIndexSupported {
+            get {
+                return false; // Default
+            }
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return Determination.
+         */
+        public override bool IsFetchSizeSupported {
+            get {
+                return false; // Default
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockSqlSuffix = " for update";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return _fetchFirstSelectHint;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return _lockSqlSuffix;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_firebird.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_firebird.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_firebird.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,107 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for MSSQL.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+        /** String of fetch-scope as select-hint. */
+        protected String _fetchScopeSelectHint = "";
+
+        /** String of lock as sql-suffix. */
+        protected String _lockSqlSuffix = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+            if (this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " first " + this.FetchSize;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+            if (this.IsFetchStartIndexSupported && this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " first " + this.FetchSize + " skip " + this.PageStartIndex;
+            }
+            if (this.IsFetchStartIndexSupported && !this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " skip " + this.PageStartIndex;
+            }
+            if (!this.IsFetchStartIndexSupported && this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " first " + this.PageEndIndex;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+            _fetchScopeSelectHint = "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockSqlSuffix = " for update with lock";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return _fetchScopeSelectHint;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return _lockSqlSuffix;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_interbase.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_interbase.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_interbase.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,107 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for Interbase.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+        /** String of fetch-scope as select-hint. */
+        protected String _fetchScopeSelectHint = "";
+
+        /** String of lock as sql-suffix. */
+        protected String _lockSqlSuffix = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+            if (this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " first " + this.FetchSize;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+            if (this.IsFetchStartIndexSupported && this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " first " + this.FetchSize + " skip " + this.PageStartIndex;
+            }
+            if (this.IsFetchStartIndexSupported && !this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " skip " + this.PageStartIndex;
+            }
+            if (!this.IsFetchStartIndexSupported && this.IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " first " + this.PageEndIndex;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+            _fetchScopeSelectHint = "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockSqlSuffix = " for update with lock";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return _fetchScopeSelectHint;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return _lockSqlSuffix;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mssql.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mssql.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mssql.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,116 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for MSSQL.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+        /** String of fetch-first as select-hint. */
+        protected String _fetchFirstSelectHint = "";
+
+        /** String of lock as from-hint. */
+        protected String _lockFromHint = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+            if (this.IsFetchSizeSupported) {
+                _fetchFirstSelectHint = " top " + this.FetchSize;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+            if (this.IsFetchSizeSupported) {
+                if (this.IsFetchStartIndexSupported) {
+                    _fetchFirstSelectHint = " top " + this.FetchSize;
+                } else {
+                    _fetchFirstSelectHint = " top " + this.PageEndIndex;
+                }
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+            _fetchFirstSelectHint = "";
+        }
+
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return Determination.
+         */
+        public override bool IsFetchStartIndexSupported {
+            get {
+                return false; // Default
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockFromHint = " with (updlock)";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return _fetchFirstSelectHint;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return _lockFromHint;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return "";
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mysql.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mysql.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_mysql.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,97 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for Apache Derby.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+	    /** String of fetch-scope as sql-suffix. */
+	    protected String _fetchScopeSqlSuffix = "";
+
+	    /** String of lock as sql-suffix. */
+	    protected String _lockSqlSuffix = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+            DoFetchPage();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+            _fetchScopeSqlSuffix = " limit " + this.PageStartIndex + ", " + this.FetchSize;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+            _fetchScopeSqlSuffix = "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockSqlSuffix = " for update";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return _fetchScopeSqlSuffix + _lockSqlSuffix;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_oracle.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_oracle.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_oracle.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,118 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for Apache Derby.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+        /** String of fetch-scope as select-hint. */
+        protected String _fetchScopeSelectHint = "";
+
+        /** String of fetch-scope as sql-suffix. */
+        protected String _fetchScopeSqlSuffix = "";
+
+        /** String of lock as sql-suffix. */
+        protected String _lockSqlSuffix = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+            if (IsFetchSizeSupported) {
+                _fetchScopeSelectHint = " * from (select";
+                _fetchScopeSqlSuffix = ") where rownum <= " + this.FetchSize;
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+            if (!IsFetchStartIndexSupported && !IsFetchSizeSupported) {
+                return;
+            }
+            _fetchScopeSelectHint = " * from (select";
+            _fetchScopeSqlSuffix = "";
+            if (IsFetchStartIndexSupported) {
+                _fetchScopeSqlSuffix = ") where rownum > " + this.PageStartIndex;
+            }
+            if (IsFetchSizeSupported) {
+                if (IsFetchStartIndexSupported) {
+                    _fetchScopeSqlSuffix = _fetchScopeSqlSuffix + " and rownum <= " + this.PageEndIndex;
+                } else {
+                    _fetchScopeSqlSuffix = ") where rownum <= " + this.FetchSize;
+                }
+            }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+            _fetchScopeSelectHint = "";
+            _fetchScopeSqlSuffix = "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockSqlSuffix = " for update";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return _fetchFirstSelectHint;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return _fetchScopeSelectHint;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return _fetchScopeSqlSuffix + _lockSqlSuffix;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_postgresql.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_postgresql.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/cbean/sqlclause/SqlClause_postgresql.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,97 @@
+#set ($myClassName = "${glSqlClauseInterfaceName}${database.DaoGenDbName}")
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace ${glPackageBaseCommonSqlClause} {
+
+    /// <summary>
+    /// SqlClause for Apache Derby.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glSqlClauseAbstractName} {
+
+	    /** String of fetch-scope as sql-suffix. */
+	    protected String _fetchScopeSqlSuffix = "";
+
+	    /** String of lock as sql-suffix. */
+	    protected String _lockSqlSuffix = "";
+
+        /**
+         * Constructor.
+         * 
+         * @param tableName Table name. (NotNull)
+         **/
+        public ${myClassName}(String tableName)
+            : base(tableName) {}
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchFirst() {
+            DoFetchPage();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoFetchPage() {
+            _fetchScopeSqlSuffix = " offset " + this.PageStartIndex + " limit " + this.getFetchSize;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         */
+        protected override void DoClearFetchPageClause() {
+            _fetchScopeSqlSuffix = "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return this. (NotNull)
+         */
+        public override ${glSqlClauseInterfaceName} LockForUpdate() {
+            _lockSqlSuffix = " for update";
+            return this;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Select-hint. (NotNull)
+         */
+        protected override String CreateSelectHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+         */
+        protected override String CreateFromBaseTableHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return From-hint. (NotNull)
+         */
+        protected override String CreateFromHint() {
+            return "";
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Sql-suffix. (NotNull)
+         */
+        protected override String CreateSqlSuffix() {
+            return _fetchScopeSqlSuffix + _lockSqlSuffix;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/AbstractDBMeta.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/AbstractDBMeta.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/AbstractDBMeta.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,427 @@
+
+#set ($myClassName = "${glDBMetaAbstractName}")
+
+using System;
+using System.Text;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+
+namespace ${glPackageBaseCommonDBMeta} {
+
+    /// <summary>
+    /// The abstract class of dbmeta.
+    /// Author : ${database.ClassAuthor}
+    /// </summary>
+    public abstract class ${myClassName} : ${glDBMetaInterfaceName} {
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Table db-name. (NotNull)</returns>
+        abstract public String GetTableDbName();
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Table cap-prop-name. (NotNull)</returns>
+        abstract public String GetTableCapPropName();
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <returns>Table uncap-prop-name. (NotNull)</returns>
+        abstract public String GetTableUncapPropName();
+
+        // =====================================================================================
+        //                                                                        DB-Name Method
+        //                                                                        ==============
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="dbName">Db-name. (NotNull)</param>
+        /// <returns>Determination.</returns>
+        public bool IsExistDbName(String dbName) {
+            return GetDbNameCapPropNameMap().ContainsKey(dbName);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="capPropName">Capitalized property-name. (NotNull)</param>
+        /// <returns>Determination.</returns>
+        public bool IsExistCapPropName(String capPropName) {
+            return GetCapPropNameDbNameMap().ContainsKey(capPropName);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="unCapPropName">Uncapitalized property-name. (NotNull)</param>
+        /// <returns>Determination.</returns>
+        public bool IsExistUncapPropName(String unCapPropName) {
+            return GetUncapPropNameDbNameMap().ContainsKey(unCapPropName);
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Determination.</returns>
+        public bool IsExistMultiName(String multiName) {
+            if (IsExistDbName(multiName)) {
+                return true;
+            }
+            if (IsExistCapPropName(multiName)) {
+                return true;
+            }
+            if (IsExistUncapPropName(multiName)) {
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <param name="unCapPropName">Uncapitalized property-name. (NotNull)</param>
+        /// <returns>{db-name : cap-prop-name} map.</returns>
+        public String GetDbNameByUncapPropName(String unCapPropName) {
+            AssertStringNotNullAndNotTrimmedEmpty("unCapPropName", unCapPropName);
+            String dbName = null;
+            try {
+                dbName = (String)GetUncapPropNameDbNameMap()[unCapPropName];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The propertyNameDbNameMap didn't contain the key of '" + unCapPropName + "': ";
+                throw new ArgumentOutOfRangeException(msg + Seasar.Framework.Util.ToStringUtil.ToString(GetUncapPropNameDbNameMap()), e);
+            }
+            return dbName;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <param name="dbName">Db-name. (NotNull)</param>
+        /// <returns>Uncapitalized property-name. (NotNull)</returns>
+        public String GetUncapPropNameByDbName(String dbName) {
+            AssertStringNotNullAndNotTrimmedEmpty("dbName", dbName);
+            if (dbName == null) {
+                String msg = "The argument[dbName] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            String unCapPropName = null;
+            try {
+                unCapPropName = (String)GetDbNameUncapPropNameMap()[dbName];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The dbNameUncapPropNameMap didn't contain the key of '" + dbName + "': ";
+                throw new ArgumentOutOfRangeException(msg + Seasar.Framework.Util.ToStringUtil.ToString(GetDbNameUncapPropNameMap()), e);
+            }
+            return unCapPropName;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </samarry> 
+        /// <param name="capPropName">Capitalized property-name. (NotNull)</param>
+        /// <returns>Db-name.</returns>
+        public String GetDbNameByCapPropName(String capPropName) {
+            AssertStringNotNullAndNotTrimmedEmpty("capPropName", capPropName);
+            String dbName = null;
+            try {
+                dbName = (String)GetCapPropNameDbNameMap()[capPropName];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The capPropNameDbNameMap didn't contain the key of '" + capPropName + "': ";
+                throw new ArgumentOutOfRangeException(msg + Seasar.Framework.Util.ToStringUtil.ToString(GetCapPropNameDbNameMap()), e);
+            }
+            return dbName;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="dbName">Db-name. (NotNull)</param>
+        /// <returns>Capitalized property-name.</returns>
+        public String GetCapPropNameByDbName(String dbName) {
+            AssertStringNotNullAndNotTrimmedEmpty("dbName", dbName);
+            String capPropName = null;
+            try {
+                capPropName = (String)GetDbNameCapPropNameMap()[dbName];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The dbNameCapPropNameMap didn't contain the key of '" + dbName + "': ";
+                throw new ArgumentOutOfRangeException(msg + Seasar.Framework.Util.ToStringUtil.ToString(GetDbNameCapPropNameMap()), e);
+            }
+            return capPropName;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <param name="unCapProp">Uncap-prop-name. (NotNull)</param>
+        /// <returns>Capitalized property-name. (NotNull)</returns>
+        public String GetCapPropNameByUncapPropName(String unCapProp) {
+            AssertStringNotNullAndNotTrimmedEmpty("unCapProp", unCapProp);
+            String capPropName = null;
+            try {
+                capPropName = (String)GetUncapPropNameCapPropNameMap()[unCapProp];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The uncapPropNameCapPropNameMap didn't contain the key of '" + unCapProp + "': ";
+                throw new ArgumentOutOfRangeException(msg + Seasar.Framework.Util.ToStringUtil.ToString(GetUncapPropNameCapPropNameMap()), e);
+            }
+            return capPropName;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <param name="capProp">Cap-prop-name. (NotNull)</param>
+        /// <returns>Uncapitalized property-name. (NotNull)</returns>
+        public String GetUncapPropNameByCapPropName(String capProp) {
+            AssertStringNotNullAndNotTrimmedEmpty("capProp", capProp);
+            String uncapPropName = null;
+            try {
+                uncapPropName = (String)GetCapPropNameUncapPropNameMap()[capProp];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The capPropNameCapPropNameMap didn't contain the key of '" + capProp + "': ";
+                throw new ArgumentOutOfRangeException(msg + Seasar.Framework.Util.ToStringUtil.ToString(GetCapPropNameUncapPropNameMap()), e);
+            }
+            return uncapPropName;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Db-name.</returns>
+        public String GetDbNameByMultiName(String multiName) {
+            AssertStringNotNullAndNotTrimmedEmpty("multiName", multiName);
+            if (IsExistDbName(multiName)) {
+                return multiName;
+            }
+            if (IsExistCapPropName(multiName)) {
+                return GetDbNameByCapPropName(multiName);
+            }
+            if (IsExistUncapPropName(multiName)) {
+                return GetDbNameByUncapPropName(multiName);
+            }
+            String msg = "The multi-name is invalid: multiName=" + multiName;
+            throw new ArgumentOutOfRangeException(msg);
+        }
+
+        /// <summary>
+        /// Get cap-prop-name by multi-name.
+        /// </summary> 
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Cap-prop-name. (NotNull)</returns>
+        public String GetCapPropNameByMultiName(String multiName) {
+            AssertStringNotNullAndNotTrimmedEmpty("multiName", multiName);
+            if (IsExistDbName(multiName)) {
+                return GetCapPropNameByDbName(multiName);
+            }
+            if (IsExistCapPropName(multiName)) {
+                return multiName;
+            }
+            if (IsExistUncapPropName(multiName)) {
+                return GetCapPropNameByUncapPropName(multiName);
+            }
+            String msg = "The multi-name is invalid: multiName=" + multiName;
+            throw new ArgumentOutOfRangeException(msg);
+        }
+
+        /// <summary>
+        /// Get uncap-prop-name by multi-name.
+        /// </summary> 
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Uncap-prop-name. (NotNull)</returns>
+        public String GetUncapPropNameByMultiName(String multiName) {
+            AssertStringNotNullAndNotTrimmedEmpty("multiName", multiName);
+            if (IsExistDbName(multiName)) {
+                return GetUncapPropNameByDbName(multiName);
+            }
+            if (IsExistCapPropName(multiName)) {
+                return GetUncapPropNameByCapPropName(multiName);
+            }
+            if (IsExistUncapPropName(multiName)) {
+                return multiName;
+            }
+            String msg = "The multi-name is invalid: multiName=" + multiName;
+            throw new ArgumentOutOfRangeException(msg);
+        }
+
+        // =====================================================================================
+        //                                                                    DB-Name-Map Getter
+        //                                                                    ==================
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{uncap-prop-name : db-name} map.</returns>
+        abstract public System.Collections.Generic.IDictionary<String, String> GetUncapPropNameDbNameMap();
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <returns>{db-name : uncap-prop-name} map.</returns>
+        abstract public System.Collections.Generic.IDictionary<String, String> GetDbNameUncapPropNameMap();
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <returns>{cap-prop-name : db-name} map.</returns>
+        abstract public System.Collections.Generic.IDictionary<String, String> GetCapPropNameDbNameMap();
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <returns>{db-name : cap-prop-name} map.</returns>
+        abstract public System.Collections.Generic.IDictionary<String, String> GetDbNameCapPropNameMap();
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{cap-prop-name : uncap-prop-name} map.</returns>
+        abstract public System.Collections.Generic.IDictionary<String, String> GetCapPropNameUncapPropNameMap();
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{uncap-prop-name : cap-prop-name} map.</returns>
+        abstract public System.Collections.Generic.IDictionary<String, String> GetUncapPropNameCapPropNameMap();
+
+        // =====================================================================================
+        //                                                                           Type Getter
+        //                                                                           ===========
+        /**
+         * Get the type of dao.
+         * 
+         * @return The type of dao. (NotNull)
+         */
+        abstract public Type GetDaoType();
+
+        /**
+         * Get the type of entity.
+         * 
+         * @return The type of entity. (NotNull)
+         */
+        abstract public Type GetEntityType();
+
+        /**
+         * Get the type of condition-bean.
+         * 
+         * @return The type of condition-bean. (NotNull)
+         */
+        abstract public Type GetConditionBeanType();
+
+        // =====================================================================================
+        //                                                                       Instance Getter
+        //                                                                       ===============
+        /**
+         * New the instance of entity.
+         * 
+         * @return The instance of entity. (NotNull)
+         */
+        abstract public ${glEntityInterfaceName} NewEntity();
+
+        /**
+         * New the instance of condition-bean.
+         * 
+         * @return The instance of condition-bean. (NotNull)
+         */
+        abstract public ${glConditionBeanInterfaceName} NewConditionBean();
+#if ($database.isMakeDeprecated())
+
+        // =====================================================================================
+        //                                                                   Entity PropertyInfo
+        //                                                                   ===================
+        #region Entity PropertyInfo
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Entity property-info. (NotNull)</returns>
+        [Obsolete("There is more available object. {org.seasar.framework.beans.factory.BeanDescFactory}")]
+        abstract public System.Reflection.PropertyInfo GetEntityPropertyInfoByMultiName(String multiName);
+        #endregion
+#end
+
+        // =====================================================================================
+        //                                                                        Foreign DBMeta
+        //                                                                        ==============
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="foreignPropertyName">Foreign-property-name(Both OK - InitCap or not). (NotNull)</param>
+        /// <returns>Foreign DBMeta. (NotNull)</returns>
+        abstract public ${glDBMetaInterfaceName} GetForeignDBMeta(String foreignPropertyName);
+
+        // =====================================================================================
+        //                                                                         Determination
+        //                                                                         =============
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        abstract public bool HasTwoOrMorePrimaryKeys { get; }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        abstract public bool HasCommonColumn { get; }
+
+        // ----------------------------------------------------------------
+        //                                                    Assert Object
+        //                                                    -------------
+        #region Assert Object
+
+        /**
+         * Assert that the argument is not null.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertObjectNotNull(String variableName, Object arg) {
+            if (variableName == null) {
+                String msg = "Argument[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (arg == null) {
+                String msg = "Argument[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+        }
+
+        #endregion
+
+        // ----------------------------------------------------------------
+        //                                                    Assert String
+        //                                                    -------------
+        #region Assert Argument
+
+        /**
+         * Assert that the string is not null and not trimmed empty.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param arg Argument. (NotNull)
+         */
+        protected void AssertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+            if (variableName == null) {
+                String msg = "Variable[variableName] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value == null) {
+                String msg = "Variable[" + variableName + "] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (value.Trim().Length == 0) {
+                String msg = "Variable[" + variableName + "] should not be empty: [" + value + "]";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+        }
+
+        #endregion
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMeta.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMeta.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMeta.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,253 @@
+#set ($myClassName = "${glDBMetaInterfaceName}")
+
+using System;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+
+namespace ${glPackageBaseCommonDBMeta} {
+
+    /// <summary>
+    /// The interface of dbmeta.
+    /// Author : ${database.ClassAuthor}
+    /// </summary>
+    public interface ${myClassName} {
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        /// <summary>
+        /// Get table db-name.
+        /// </summary> 
+        /// <returns>Table db-name. (NotNull)</returns>
+        String GetTableDbName();
+
+        /// <summary>
+        /// Get table cap-prop-name.
+        /// </summary> 
+        /// <returns>Table cap-prop-name. (NotNull)</returns>
+        String GetTableCapPropName();
+
+        /// <summary>
+        /// Get table uncap-prop-name.
+        /// </summary> 
+        /// <returns>Table uncap-prop-name. (NotNull)</returns>
+        String GetTableUncapPropName();
+
+        // =====================================================================================
+        //                                                                        DB-Name Method
+        //                                                                        ==============
+        /// <summary>
+        /// Is existing db-name.
+        /// </summary> 
+        /// <param name="dbName">Db-name. (NotNull)</param>
+        /// <returns>Determination.</returns>
+        bool IsExistDbName(String dbName);
+
+        /// <summary>
+        /// Is existing cap-prop-name.
+        /// </summary> 
+        /// <param name="capPropName">Capitalized property-name. (NotNull)</param>
+        /// <returns>Determination.</returns>
+        bool IsExistCapPropName(String capPropName);
+
+        /// <summary>
+        /// Is existing un-cap-prop-name.
+        /// </summary> 
+        /// <param name="unCapPropName">Uncapitalized property-name. (NotNull)</param>
+        /// <returns>Determination.</returns>
+        bool IsExistUncapPropName(String unCapProp);
+
+        /// <summary>
+        /// Is existing multi-name.
+        /// </summary> 
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Determination. (NotNull)</returns>
+        bool IsExistMultiName(String multiName);
+
+        /// <summary>
+        /// Get db-name by un-cap-prop-name.
+        /// </summary> 
+        /// <param name="unCapPropName">Uncapitalized property-name. (NotNull)</param>
+        /// <returns>Db-name. (NotNull)</returns>
+        String GetDbNameByUncapPropName(String unCapProp);
+
+        /// <summary>
+        /// Get un-cap-prop-name by db-name.
+        /// </summary> 
+        /// <param name="dbName">Db-name.</param>
+        /// <returns>Uncapitalized property-name. (NotNull)</returns>
+        String GetUncapPropNameByDbName(String dbName);
+
+        /// <summary>
+        /// Get db-name by cap-prop-name.
+        /// </summary> 
+        /// <param name="capPropName">Capitalized property-name. (NotNull)</param>
+        /// <returns>Db-name.</returns>
+        String GetDbNameByCapPropName(String capPropName);
+
+        /// <summary>
+        /// Get cap-prop-name by db-name.
+        /// </summary> 
+        /// <param name="dbName">Db-name. (NotNull)</param>
+        /// <returns>Capitalized property-name. (NotNull)</returns>
+        String GetCapPropNameByDbName(String dbName);
+
+        /// <summary>
+        /// Get cap-prop-name by uncap-prop-name.
+        /// </summary> 
+        /// <param name="unCapProp">Uncap-prop-name. (NotNull)</param>
+        /// <returns>Capitalized property-name. (NotNull)</returns>
+        String GetCapPropNameByUncapPropName(String unCapProp);
+
+        /// <summary>
+        /// Get uncap-prop-name by cap-prop-name.
+        /// </summary> 
+        /// <param name="capProp">Cap-prop-name. (NotNull)</param>
+        /// <returns>Uncapitalized property-name. (NotNull)</returns>
+        String GetUncapPropNameByCapPropName(String capProp);
+
+        /// <summary>
+        /// Get db-name by property-name.
+        /// </summary> 
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Db-name. (NotNull)</returns>
+        String GetDbNameByMultiName(String multiName);
+
+        /// <summary>
+        /// Get cap-prop-name by multi-name.
+        /// </summary> 
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Cap-prop-name. (NotNull)</returns>
+        String GetCapPropNameByMultiName(String multiName);
+
+        /// <summary>
+        /// Get uncap-prop-name by multi-name.
+        /// </summary> 
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Uncap-prop-name. (NotNull)</returns>
+        String GetUncapPropNameByMultiName(String multiName);
+
+        // =====================================================================================
+        //                                                                    DB-Name-Map Getter
+        //                                                                    ==================
+        /// <summary>
+        /// Get uncap-prop-name db-name map.
+        /// </summary> 
+        /// <returns>{un-cap-prop-name : db-name} map.</returns>
+        System.Collections.Generic.IDictionary<String, String> GetUncapPropNameDbNameMap();
+
+        /// <summary>
+        /// Get db-name uncap-prop-name map.
+        /// </summary> 
+        /// <returns>{db-name : un-cap-prop-name} map.</returns>
+        System.Collections.Generic.IDictionary<String, String> GetDbNameUncapPropNameMap();
+
+        /// <summary>
+        /// Get cap-prop-name db-name map.
+        /// </summary> 
+        /// <returns>{cap-prop-name : db-name} map.</returns>
+        System.Collections.Generic.IDictionary<String, String> GetCapPropNameDbNameMap();
+
+        /// <summary>
+        /// Get db-name cap-prop-name map.
+        /// </summary> 
+        /// <returns>{db-name : cap-prop-name} map.</returns>
+        System.Collections.Generic.IDictionary<String, String> GetDbNameCapPropNameMap();
+
+        /// <summary>
+        /// Get cap-prop-name uncap-prop-name map.
+        /// </summary>
+        /// <returns>{cap-prop-name : uncap-prop-name} map.</returns>
+        System.Collections.Generic.IDictionary<String, String> GetCapPropNameUncapPropNameMap();
+
+        /// <summary>
+        /// Get uncap-prop-name cap-prop-name map.
+        /// </summary>
+        /// <returns>{uncap-prop-name : cap-prop-name} map.</returns>
+        System.Collections.Generic.IDictionary<String, String> GetUncapPropNameCapPropNameMap();
+
+        // =====================================================================================
+        //                                                                           Type Getter
+        //                                                                           ===========
+        /**
+         * Get the type of dao.
+         * 
+         * @return The type of dao. (NotNull)
+         */
+        Type GetDaoType();
+
+        /**
+         * Get the type of entity.
+         * 
+         * @return The type of entity. (NotNull)
+         */
+        Type GetEntityType();
+
+        /**
+         * Get the type of condition-bean.
+         * 
+         * @return The type of condition-bean. (NotNull)
+         */
+        Type GetConditionBeanType();
+
+        // =====================================================================================
+        //                                                                       Instance Getter
+        //                                                                       ===============
+        /**
+         * New the instance of entity.
+         * 
+         * @return The instance of entity. (NotNull)
+         */
+        ${glEntityInterfaceName} NewEntity();
+
+        /**
+         * New the instance of condition-bean.
+         * 
+         * @return The instance of condition-bean. (NotNull)
+         */
+        ${glConditionBeanInterfaceName} NewConditionBean();
+#if ($database.isMakeDeprecated())
+
+        // =====================================================================================
+        //                                                                   Entity PropertyInfo
+        //                                                                   ===================
+        #region Entity PropertyInfo
+        /// <summary>
+        /// Get entity property-info by multi-name.
+        /// </summary>
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Entity property-info of entity. (NotNull)</returns>
+        [Obsolete("There is more available object. {org.seasar.framework.beans.factory.BeanDescFactory}")]
+        System.Reflection.PropertyInfo GetEntityPropertyInfoByMultiName(String multiName);
+        #endregion
+#end
+
+        // =====================================================================================
+        //                                                                        Foreign DBMeta
+        //                                                                        ==============
+        /// <summary>
+        /// Get foreign dbmeta.
+        /// </summary>
+        /// <param name="foreignPropertyName">Foreign-property-name(Both OK - InitCap or not). (NotNull)</param>
+        /// <returns>Foreign DBMeta. (NotNull)</returns>
+        ${myClassName} GetForeignDBMeta(String foreignPropertyName);
+
+        // =====================================================================================
+        //                                                                         Determination
+        //                                                                         =============
+        /**
+         * Has two or more primary-keys?
+         * 
+         * @return Determination.
+         */
+        bool HasTwoOrMorePrimaryKeys { get; }
+
+        /**
+         * Has common column?
+         * 
+         * @return Determination.
+         */
+        bool HasCommonColumn { get; }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMetaInstanceHandler.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMetaInstanceHandler.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/dbmeta/DBMetaInstanceHandler.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,179 @@
+
+#set ($myClassName = "${glDBMetaInstanceHandlerName}")
+#set ($instanceMapGenericDefinition = "String, ${glDBMetaInterfaceName}")
+
+using System;
+using System.Collections.Generic;
+
+namespace ${glPackageBaseCommonDBMeta} {
+
+    /// <sumarry>
+    /// DBMeta instance handler.
+    /// Author : ${database.ClassAuthor}
+    public class ${myClassName} {
+
+        /// <sumarry>Table db-name instance map.</sumarry>
+        protected static readonly IDictionary<String, ${glDBMetaInterfaceName}> _tableDbNameInstanceMap;
+
+        /// <sumarry>Table cap-prop-name instance map.</sumarry>
+        protected static readonly IDictionary<String, ${glDBMetaInterfaceName}> _tableCapPropNameInstanceMap;
+
+        /// <sumarry>Table uncap-prop-name instance map.</sumarry>
+        protected static readonly IDictionary<String, ${glDBMetaInterfaceName}> _tableUncapPropNameInstanceMap;
+
+        static ${myClassName}() {
+            {
+                IDictionary<String, ${glDBMetaInterfaceName}> tmpMap = new Dictionary<String, ${glDBMetaInterfaceName}>();
+
+    #foreach ($table in $database.Tables)
+
+                tmpMap.Add("${table.Name}", GetDBMeta("${glPackageBaseDBMeta}.${glProjectPrefix}${table.JavaName}Dbm"));
+    #end
+
+                _tableDbNameInstanceMap = tmpMap;//java.util.Collections.unmodifiableMap(tmpMap);
+            }
+
+            {
+                IDictionary<String, ${glDBMetaInterfaceName}> tmpMap = new Dictionary<String, ${glDBMetaInterfaceName}>();
+
+    #foreach ($table in $database.Tables)
+
+                tmpMap.Add("${table.JavaName}", GetDBMeta("${glPackageBaseDBMeta}.${glProjectPrefix}${table.JavaName}Dbm"));
+    #end
+
+                _tableCapPropNameInstanceMap = tmpMap;//java.util.Collections.unmodifiableMap(tmpMap);
+            }
+
+            {
+                IDictionary<String, ${glDBMetaInterfaceName}> tmpMap = new Dictionary<String, ${glDBMetaInterfaceName}>();
+
+    #foreach ($table in $database.Tables)
+
+                tmpMap.Add("${table.UncapitalisedJavaName}", GetDBMeta("${glPackageBaseDBMeta}.${glProjectPrefix}${table.JavaName}Dbm"));
+    #end
+
+                _tableUncapPropNameInstanceMap = tmpMap;//java.util.Collections.unmodifiableMap(tmpMap);
+            }
+        }
+
+        protected static ${glDBMetaInterfaceName} GetDBMeta(String className) {
+            Seasar.Framework.Xml.S2Section config = Seasar.Framework.Xml.S2SectionHandler.GetS2Section();
+            Type clazz = ForName(className, config.Assemblys);
+            if (clazz == null) {
+                String msg = "The className was not found: " + className + " assemblys=";
+                msg = msg + Seasar.Framework.Util.ToStringUtil.ToString(config.Assemblys);
+                throw new SystemException(msg);
+            }
+            System.Reflection.MethodInfo method = clazz.GetMethod("GetInstance");
+            return (${glDBMetaInterfaceName})method.Invoke(null, null);
+        }
+
+        protected static Type ForName(string className, System.Collections.IList assemblys) {
+            Type type = Type.GetType(className);
+            if(type != null) return type;
+            foreach(String assemblyName in assemblys) {
+                System.Reflection.Assembly assembly = System.Reflection.Assembly.Load(assemblyName);
+                if (assembly == null) {
+                    String msg = "The assemblyName was not found: " + assemblyName + " assemblys=";
+                    msg = msg + Seasar.Framework.Util.ToStringUtil.ToString(assemblys);
+                    throw new SystemException(msg);
+                }
+                type = assembly.GetType(className);
+                if(type != null) return type;
+            }
+            return type;
+        }
+
+        /// <sumarry>
+        /// Get instance by table db-name.
+        /// </sumarry> 
+        /// <param name="tableDbName">Table db-name. (NotNull)</param>
+        /// <returns>Instance. (NotNull)</returns>
+        public static ${glDBMetaInterfaceName} GetInstanceByTableDbName(String tableDbName) {
+            AssertObjectNotNull("tableDbName", tableDbName);
+            try {
+                return (${glDBMetaInterfaceName})_tableDbNameInstanceMap[tableDbName];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The tableDbNameInstanceMap didn't contain the key of '" + tableDbName + "': ";
+                throw new ArgumentOutOfRangeException(msg + _tableDbNameInstanceMap, e);
+            }
+        }
+
+        /// <sumarry>
+        /// Get instance by table cap-prop-name.
+        /// </sumarry> 
+        /// <param name="tableCapPropName">Table cap-prop-name. (NotNull)</param>
+        /// <returns>Instance. (NotNull)</returns>
+        public static ${glDBMetaInterfaceName} GetInstanceByTableCapPropName(String tableCapPropName) {
+            AssertObjectNotNull("tableCapPropName", tableCapPropName);
+            try {
+                return (${glDBMetaInterfaceName})_tableCapPropNameInstanceMap[tableCapPropName];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The tableCapPropNameInstanceMap didn't contain the key of '" + tableCapPropName + "': ";
+                throw new ArgumentOutOfRangeException(msg + _tableCapPropNameInstanceMap, e);
+            }
+        }
+
+        /// <sumarry>
+        /// Get instance by table uncap-prop-name.
+        /// </sumarry> 
+        /// <param name="tableUncapPropName">Table uncap-prop-name. (NotNull)</param>
+        /// <returns>Instance. (NotNull)</returns>
+        public static ${glDBMetaInterfaceName} GetInstanceByTableUncapPropName(String tableUncapPropName) {
+            AssertObjectNotNull("tableUncapPropName", tableUncapPropName);
+            try {
+                return (${glDBMetaInterfaceName})_tableUncapPropNameInstanceMap[tableUncapPropName];
+            } catch (System.Collections.Generic.KeyNotFoundException e) {
+                String msg = "The tableUncapPropNameInstanceMap didn't contain the key of '" + tableUncapPropName + "': ";
+                throw new ArgumentOutOfRangeException(msg + _tableUncapPropNameInstanceMap, e);
+            }
+        }
+
+        /// <sumarry>
+        /// Get instance by table multi-name.
+        /// </sumarry> 
+        /// <param name="tableMultiName">Table multi-name. (NotNull)</param>
+        /// <returns>Instance. (NotNull)</returns>
+        public static ${glDBMetaInterfaceName} GetInstanceByTableMultiName(String tableMultiName) {
+            AssertObjectNotNull("tableMultiName", tableMultiName);
+            
+            try {
+                return (${glDBMetaInterfaceName})_tableDbNameInstanceMap[tableMultiName];
+            } catch (System.Collections.Generic.KeyNotFoundException) {
+            }
+            try {
+                return (${glDBMetaInterfaceName})_tableCapPropNameInstanceMap[tableMultiName];
+            } catch (System.Collections.Generic.KeyNotFoundException) {
+            }
+            try {
+                return (${glDBMetaInterfaceName})_tableUncapPropNameInstanceMap[tableMultiName];
+            } catch (System.Collections.Generic.KeyNotFoundException) {
+            }
+
+            String msg = "The tableMultiName does not exist in all-instance-map: tableMultiName=" + tableMultiName;
+            msg = msg + " tableDbNameInstanceMap=" + Seasar.Framework.Util.ToStringUtil.ToString(_tableDbNameInstanceMap);
+            msg = msg + " tableCapPropNameInstanceMap=" + Seasar.Framework.Util.ToStringUtil.ToString(_tableCapPropNameInstanceMap);
+            msg = msg + " tableUncapPropNameInstanceMap=" + Seasar.Framework.Util.ToStringUtil.ToString(_tableUncapPropNameInstanceMap);
+            throw new ArgumentOutOfRangeException(msg);
+        }
+
+        // ----------------------------------------------------------------
+        //                                                  Assert Argument
+        //                                                  ---------------
+        /// <sumarry>
+        /// Assert that the object is not null.
+        /// </sumarry> 
+        /// <param name="variableName">Variable name. (NotNull)</param>
+        /// <param name="arg">Argument. (NotNull)</param>
+        protected static void AssertObjectNotNull(String variableName, Object arg) {
+            if (variableName == null) {
+                String msg = "Argument[variableName] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (arg == null) {
+                String msg = "Argument[" + variableName + "] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/DaoExceptionContext.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/DaoExceptionContext.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/DaoExceptionContext.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,107 @@
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace ${glPackageBaseCommonException} {
+
+/**
+ * Dao-exception context. (referring to s2pager)
+ * 
+ * @author ${database.ClassAuthor}
+ */
+    public static class ${glDaoExceptionContextName} {
+
+        /** The thread-local for this. */
+        private static LocalDataStoreSlot _slot = Thread.AllocateDataSlot();
+
+        /** Key of sql. */
+        public static readonly String KEY_SQL = "sql";
+
+        /** Key of exception. */
+        public static readonly String KEY_EXCEPTION = "exception";
+
+        /**
+         * Get condition-bean context on thread.
+         * 
+         * @return Condition-bean. (Nullable)
+         */
+        public static IDictionary<String, Object> GetInformationMapOnThread() {
+            return (IDictionary<String, Object>)Thread.GetData(_slot);
+        }
+
+        /**
+         * Get sql on thread.
+         * 
+         * @return SQL. (NotNull)
+         */
+        public static String GetSqlOnThread() {
+            if (GetInformationMapOnThread() == null) {
+                return null;
+            }
+            return (String)GetInformationMapOnThread()[KEY_SQL];
+        }
+
+        /**
+         * Set sql on thread.
+         * 
+         * @param sql SQL. (NotNull)
+         */
+        public static void SetSqlOnThread(String sql) {
+            if (sql == null) {
+                String msg = "The argument[sql] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (GetInformationMapOnThread() == null) {
+                IDictionary<String, Object> contextMap = new Dictionary<String, Object>();
+                Thread.SetData(_slot, contextMap);
+            }
+            GetInformationMapOnThread().Add(KEY_SQL, sql);
+        }
+
+        /**
+         * Get exception on thread.
+         * 
+         * @return Exception. (NotNull)
+         */
+        public static Exception GetExceptionOnThread() {
+            if (GetInformationMapOnThread() == null) {
+                return null;
+            }
+            return (Exception)GetInformationMapOnThread()[KEY_EXCEPTION];
+        }
+
+        /**
+         * Set exception on thread.
+         * 
+         * @param exception Exception. (NotNull)
+         */
+        public static void SetExceptionOnThread(Exception exception) {
+            if (exception == null) {
+                String msg = "The argument[exception] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (GetInformationMapOnThread() == null) {
+                IDictionary<String, Object> contextMap = new Dictionary<String, Object>();
+                Thread.SetData(_slot, contextMap);
+            }
+            GetInformationMapOnThread().Add(KEY_EXCEPTION, exception);
+        }
+
+        /**
+         * Clear dao-exception context on thread.
+         */
+        public static void ClearDaoExceptionOnThread() {
+            Thread.SetData(_slot, null);
+        }
+
+        /**
+         * Is existing dao-exception context on thread?
+         * 
+         * @return Determination.
+         */
+        public static bool IsExistDaoExceptionOnThread() {
+            return (Thread.GetData(_slot) != null);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasAlreadyBeenDeletedException.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasAlreadyBeenDeletedException.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasAlreadyBeenDeletedException.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,20 @@
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommonException} {
+
+    /// <summary>
+    /// The exception when the record has already been deleted (by other thread).
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${glRecordHasAlreadyBeenDeletedException} : ApplicationException {
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param="msg">Exception message.</param>
+        public ${glRecordHasAlreadyBeenDeletedException}(String msg)
+        : base(msg) {}
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasOverlappedException.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasOverlappedException.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/RecordHasOverlappedException.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,20 @@
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommonException} {
+
+    /// <summary>
+    /// The exception when the record has overlapped.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${glRecordHasOverlappedException} : ApplicationException {
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param="msg">Exception message.</param>
+        public ${glRecordHasOverlappedException}(String msg)
+        : base(msg) {}
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/SelectedCountExceedMaxCountException.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/SelectedCountExceedMaxCountException.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/exception/SelectedCountExceedMaxCountException.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,49 @@
+
+using System;
+using System.Collections;
+
+namespace ${glPackageBaseCommonException} {
+
+    /// <summary>
+    /// The exception when selected count exceeds max count.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${glSelectedCountExceedMaxCountExceptionName} : ApplicationException {
+
+        /** Selected count. */
+        protected int _selectedCount;
+
+        /** Max count. */
+        protected int _maxCount;
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param="msg">Exception message.</param>
+        /// <param="maxCount">Max count.</param>
+        /// <param="selectedCount">Selected count.</param>
+        public ${glSelectedCountExceedMaxCountExceptionName}(String msg, int selectedCount, int maxCount)
+        : base(msg) {
+            _selectedCount = selectedCount;
+            _maxCount = maxCount;
+        }
+
+        /**
+         * Get selected count.
+         * 
+         * @return Selected count. (Nullable)
+         */
+        public int GetSelectedCount() {
+            return _selectedCount;
+        }
+
+        /**
+         * Get max count.
+         * 
+         * @return Max count. (Nullable)
+         */
+        public int GetMaxCount() {
+            return _maxCount;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListString.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListString.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListString.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ${glPackageBaseCommonHelper} {
+
+    public interface ${glMapListStringName} {
+
+        string NEW_LINE { get;}
+
+        string DEFAULT_MAP_MARK { get;}
+
+        string DEFAULT_LIST_MARK { get;}
+
+        string DEFAULT_DELIMITER { get;}
+
+        string DEFAULT_START_BRACE { get;}
+
+        string DEFAULT_END_BRACE { get;}
+
+        string DEFAULT_EQUAL { get;}
+
+        String MapMark { get; set; }
+
+        String ListMark { get; set; }
+
+        String StartBrace { get; set; }
+
+        String EndBrace { get; set; }
+
+        String Delimiter { get; set; }
+
+        String Equal { get; set; }
+
+        // ==========================================================================================
+        //                                                                                   Generate
+        //                                                                                   ========
+        /**
+         * Generate map from map-string.
+         * 
+         * @param mapString Map-string (NotNull)
+         * @return Generated map. (NotNull)
+         */
+        Dictionary<String, Object> generateMap(String mapString);
+
+        /**
+         * Generate map from list-string. {Implement}
+         * 
+         * @param listString List-string (NotNull)
+         * @return Generated list. (NotNull)
+         */
+        List<Object> generateList(String listString);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListStringImpl.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListStringImpl.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapListStringImpl.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,925 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ${glPackageBaseCommonHelper}
+{
+    public class IllegalStateException : ApplicationException
+    {
+        public IllegalStateException(string message)
+            : base(message)
+        {
+        }
+    }
+
+    public class IllegalArgumentException : ApplicationException
+    {
+        public IllegalArgumentException(string message)
+            : base(message)
+        {
+        }
+    }
+
+    public class ${glMapListStringImplName} : ${glMapListStringName}
+    {
+        public  string NEW_LINE
+        {
+            get { return "\n"; }
+        }
+
+        public   string DEFAULT_MAP_MARK 
+        {
+            get
+            {
+                return  "map:";
+            }
+        }
+
+        public   string DEFAULT_LIST_MARK 
+        {
+            get
+            {
+                return  "list:";
+            }
+        }
+
+        public   string DEFAULT_DELIMITER 
+        {
+            get
+            {
+                return  ";";
+            }
+        }
+
+        public   string DEFAULT_START_BRACE 
+        {
+            get
+            {
+                return  "{";
+            }
+        }
+
+        public   string DEFAULT_END_BRACE 
+        {
+            get
+            {
+                return  "}";
+            }
+        }
+
+        public   string DEFAULT_EQUAL 
+        {
+            get
+            {
+                return "=";
+            }
+        }
+
+        /** Map-mark. */
+        protected String _mapMark;
+
+        /** List-mark. */
+        protected String _listMark;
+
+        /** Start-brace. */
+        protected String _startBrace;
+
+        /** End-brace. */
+        protected String _endBrace;
+
+        /** Delimiter. */
+        protected String _delimiter;
+
+        /** Equal. */
+        protected String _equal;
+
+        /** Remainder string. */
+        protected String _topString;
+
+        /** Remainder string. */
+        protected String _remainderString;
+
+        public ${glMapListStringImplName}()
+        {
+            _mapMark = DEFAULT_MAP_MARK;
+            _listMark = DEFAULT_LIST_MARK;
+            _startBrace = DEFAULT_START_BRACE;
+            _endBrace = DEFAULT_END_BRACE;
+            _delimiter = DEFAULT_DELIMITER;
+            _equal = DEFAULT_EQUAL;
+        }
+
+        public String MapMark {
+            get { return _mapMark; }
+            set { _mapMark = value ; }
+        }
+
+        public String ListMark {
+            get { return _listMark; }
+            set { _listMark = value ; }
+        }
+
+        public String StartBrace {
+            get { return _startBrace; }
+            set { _startBrace = value ; }
+        }
+
+        public String EndBrace {
+            get { return _endBrace; }
+            set { _endBrace = value ; }
+        }
+
+        public String Delimiter {
+            get { return _delimiter; }
+            set { _delimiter = value ; }
+        }
+
+        public String Equal {
+            get { return _equal; }
+            set { _equal = value ; }
+        }
+
+        // ****************************************************************************************************
+        //                                                                                          Main Method
+        //                                                                                          ***********
+
+        // ==========================================================================================
+        //                                                                                   Generate
+        //                                                                                   ========
+        /**
+         * Generate map from map-string. {Implement}
+         * 
+         * @param mapString Map-string (NotNull)
+         * @return Generated map. (NotNull)
+         */
+        public Dictionary<String, Object> generateMap(string mapString)
+        {
+            assertMapString(mapString);
+
+            _topString = mapString;
+            _remainderString = mapString;
+
+            removeBothSideSpaceAndTabAndNewLine();
+            removePrefixMapMarkAndStartBrace();
+
+            Dictionary<String, Object> generatedMap = newStringObjectMap();
+            parseRemainderMapString(generatedMap);
+            if (!"".Equals(_remainderString) && !_endBrace.Equals(_remainderString))
+            {
+                string msg = "remainderString must be empty or end-brace string:";
+                msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString;
+                msg = msg + getNewLineAndIndent() + " # generatedMap --> " + generatedMap;
+                throw new IllegalStateException(msg);
+            }
+            return generatedMap;
+        }
+
+        /**
+         * Generate map from list-string. {Implement}
+         * 
+         * @param listString List-string (NotNull)
+         * @return Generated list. (NotNull)
+         */
+        public List<Object> generateList(string listString)
+        {
+            assertListString(listString);
+
+            _topString = listString;
+            _remainderString = listString;
+
+            removeBothSideSpaceAndTabAndNewLine();
+            removePrefixListMarkAndStartBrace();
+
+            List<Object> generatedList = newObjectList();
+            parseRemainderListString(generatedList);
+            if (!"".Equals(_remainderString) && !_endBrace.Equals(_remainderString))
+            {
+                string msg = "rRemainderString must be empty or end-brace string:";
+                msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+                msg = msg + getNewLineAndIndent() + " # listString --> " + listString;
+                msg = msg + getNewLineAndIndent() + " # generatedList --> " + generatedList;
+                throw new IllegalStateException(msg);
+            }
+            return generatedList;
+        }
+
+        // ==========================================================================================
+        //                                                                                      Parse
+        //                                                                                      =====
+        protected void parseRemainderMapString(Dictionary<String, Object> currentMap)
+        {
+            while (true)
+            {
+                if (initializeAtLoopBeginning())
+                {
+                    return;
+                }
+
+                // *** Now, _remainderString should starts with the key of the map. ***
+
+                int equalIndex = _remainderString.IndexOf(_equal);
+                assertEqualIndex(_remainderString, equalIndex, _topString, currentMap);
+                string mapKey = _remainderString.Substring(0, equalIndex).Trim();
+                removePrefixTargetIndexPlus(equalIndex, _equal.Length);
+                removeBothSideSpaceAndTabAndNewLine();
+
+                // *** Now, _remainderString should starts with the value of the map. ***
+
+                if (isStartsWithMapPrefix(_remainderString))
+                {
+                    removePrefixMapMarkAndStartBrace();
+                    parseRemainderMapString(setupNestMap(currentMap, mapKey));
+                    if (closingAfterParseNestMapList())
+                    {
+                        return;
+                    }
+                    continue;
+                }
+
+                if (isStartsWithListPrefix(_remainderString))
+                {
+                    removePrefixListMarkAndStartBrace();
+                    parseRemainderListString(setupNestList(currentMap, mapKey));
+                    if (closingAfterParseNestMapList())
+                    {
+                        return;
+                    }
+                    continue;
+                }
+
+                int delimiterIndex = _remainderString.IndexOf(_delimiter);
+                int endBraceIndex = _remainderString.IndexOf(_endBrace);
+                assertEndBracekIndex(_remainderString, endBraceIndex, _topString, currentMap);
+
+                // If delimiter exists and delimiter is closer than end brace, 
+                // Everything from the head of the present remainder string to the delimiter becomes map value.
+                //   ex) value1,key2=value2}
+                if (delimiterIndex >= 0 && delimiterIndex < endBraceIndex)
+                {
+                    string mapValue = _remainderString.Substring(0, delimiterIndex);
+                    currentMap.Add(mapKey, filterMapListValue(mapValue));
+
+                    // Because the map element continues since the delimiter, skip the delimiter and continue the loop.
+                    removePrefixTargetIndexPlus(delimiterIndex, _delimiter.Length);
+                    continue;
+                }
+
+                // Everything from the head of the present remainder string to the delimiter becomes map value.
+                //   ex) value1}, key2=value2}
+                string mapValue2 = _remainderString.Substring(0, endBraceIndex);
+                currentMap.Add(mapKey, filterMapListValue(mapValue2));
+
+                // Analyzing map is over. So closing and return.
+                closingByEndBraceIndex(endBraceIndex);
+                return;
+            }
+        }
+
+        protected void parseRemainderListString(List<Object> currentList)
+        {
+            while (true)
+            {
+                if (initializeAtLoopBeginning())
+                {
+                    return;
+                }
+
+                // *** Now, _remainderString should starts with the value of the list. ***
+
+                if (isStartsWithMapPrefix(_remainderString))
+                {
+                    removePrefixMapMarkAndStartBrace();
+                    parseRemainderMapString(setupNestMap(currentList));
+                    if (closingAfterParseNestMapList())
+                    {
+                        return;
+                    }
+                    continue;
+                }
+
+                if (isStartsWithListPrefix(_remainderString))
+                {
+                    removePrefixListMarkAndStartBrace();
+                    parseRemainderListString(setupNestList(currentList));
+                    if (closingAfterParseNestMapList())
+                    {
+                        return;
+                    }
+                    continue;
+                }
+
+                int delimiterIndex = _remainderString.IndexOf(_delimiter);
+                int endBraceIndex = _remainderString.IndexOf(_endBrace);
+                assertEndBraceIndex(_remainderString, endBraceIndex, _topString, currentList);
+
+                // If delimiter exists and delimiter is closer than end brace, 
+                // Everything from the head of the present remainder string to the delimiter becomes list value.
+                //   ex) value1,value2,value3}
+                if (delimiterIndex >= 0 && delimiterIndex < endBraceIndex)
+                {
+                    string listValue = _remainderString.Substring(0, delimiterIndex);
+                    currentList.Add(filterMapListValue(listValue));
+
+                    // Because the list element continues since the delimiter, skip the delimiter and continue the loop.
+                    removePrefixTargetIndexPlus(delimiterIndex, _delimiter.Length);
+                    continue;
+                }
+
+                // Everything from the head of the present remainder string to the delimiter becomes list value.
+                //   ex) value1}, value2, }
+                string listValue2 = _remainderString.Substring(0, endBraceIndex);
+                currentList.Add(filterMapListValue(listValue2));
+
+                // Analyzing list is over. So closing and return.
+                closingByEndBraceIndex(endBraceIndex);
+                return;
+            }
+        }
+
+        /**
+         * @return Is return?
+         */
+        protected bool initializeAtLoopBeginning()
+        {
+            // Remove prefix delimiter. (Result string is always trimmed.)
+            removePrefixAllDelimiter();
+
+            // If the remainder string is empty-string, Analyzing is over!
+            if (_remainderString.Equals(""))
+            {
+                return true;
+            }
+
+            // If the remainder string starts with end-brace, Analyzing current map is over!
+            // And then remove the end-brace.
+            if (isStartsWithEndBrace(_remainderString))
+            {
+                removePrefixEndBrace();
+                return true;
+            }
+            return false;
+        }
+
+        /**
+         * @return Is return?
+         */
+        protected bool closingAfterParseNestMapList()
+        {
+            // If the remainder string starts with end-brace, remove it and return true.
+            if (isStartsWithEndBrace(_remainderString))
+            {
+                removePrefixEndBrace();
+                return true;
+            }
+            return false;
+        }
+
+        protected void closingByEndBraceIndex(int endBraceIndex)
+        {
+            // Remove the value that was finished analyzing and end-brace.
+            _remainderString = _remainderString.Substring(endBraceIndex);
+            removePrefixEndBrace();
+        }
+
+        // ****************************************************************************************************
+        //                                                                                      StateFul Method
+        //                                                                                      ***************
+
+        // ==========================================================================================
+        //                                                                                     Remove
+        //                                                                                     ======
+        protected void removePrefixMapMarkAndStartBrace()
+        {
+            removePrefix(_mapMark + _startBrace);
+        }
+
+        protected void removePrefixListMarkAndStartBrace()
+        {
+            removePrefix(_listMark + _startBrace);
+        }
+
+        protected void removePrefixDelimiter()
+        {
+            removePrefix(_delimiter);
+        }
+
+        protected void removePrefixEndBrace()
+        {
+            removePrefix(_endBrace);
+        }
+
+        protected void removePrefix(String prefixString)
+        {
+            if (_remainderString == null)
+            {
+                String msg = "Argument[remainderString] must not be null: " + _remainderString;
+                throw new IllegalArgumentException(msg);
+            }
+            removeBothSideSpaceAndTabAndNewLine();
+            if (prefixString == null)
+            {
+                String msg = "Argument[prefixString] must not be null: " + prefixString;
+                throw new IllegalArgumentException(msg);
+            }
+            if (_remainderString.Length < prefixString.Length)
+            {
+                String msg = "Argument[remainderString] length must be larger than Argument[prefixString] length:";
+                msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+                msg = msg + getNewLineAndIndent() + " # prefixString=" + prefixString;
+                throw new IllegalArgumentException(msg);
+            }
+            if (!_remainderString.StartsWith(prefixString))
+            {
+                String msg = "Argument[remainderString] must start with Argument[prefixString:]";
+                msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+                msg = msg + getNewLineAndIndent() + " # prefixString --> " + prefixString;
+                throw new IllegalArgumentException(msg);
+            }
+            
+            _remainderString = _remainderString.Substring(prefixString.Length);
+            removeBothSideSpaceAndTabAndNewLine();
+        }
+
+        protected void removePrefixAllDelimiter()
+        {
+            removeBothSideSpaceAndTabAndNewLine();
+
+            while (true)
+            {
+                if (!isStartsWithDelimiter(_remainderString))
+                {
+                    break;
+                }
+
+                if (isStartsWithDelimiter(_remainderString))
+                {
+                    removePrefixDelimiter();
+                    removeBothSideSpaceAndTabAndNewLine();
+                }
+            }
+        }
+
+        protected void removeBothSideSpaceAndTabAndNewLine()
+        {
+            _remainderString = _remainderString.Trim();
+        }
+
+        protected void removePrefixTargetIndexPlus(int index, int plusCount)
+        {
+            _remainderString = _remainderString.Substring(index + plusCount);
+        }
+
+        // ****************************************************************************************************
+        //                                                                                     StateLess Method
+        //                                                                                     ****************
+
+        // ==========================================================================================
+        //                                                                                     Assert
+        //                                                                                     ======
+        protected void assertMapString(String mapString)
+        {
+            if (mapString == null)
+            {
+                String msg = "Argument[mapString] must not be null: ";
+                throw new IllegalArgumentException(msg + "mapString=" + mapString);
+            }
+            mapString = mapString.Trim();
+            if (!isStartsWithMapPrefix(mapString))
+            {
+                String msg = "Argument[mapString] must start with '" + _mapMark + _startBrace + "': ";
+                throw new IllegalArgumentException(msg + "mapString=" + mapString);
+            }
+            if (!isEndsWithEndMark(mapString))
+            {
+                String msg = "Argument[mapString] must end with '" + _endBrace + "': ";
+                throw new IllegalArgumentException(msg + "mapString=" + mapString);
+            }
+
+            int startBraceCount = getDelimiterCount(mapString, _startBrace);
+            int endBraceCount = getDelimiterCount(mapString, _endBrace);
+            if (startBraceCount != endBraceCount)
+            {
+                String msg = "It is necessary to have braces of the same number on start and end:";
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString;
+                msg = msg + getNewLineAndIndent() + " # startBraceCount --> " + startBraceCount;
+                msg = msg + getNewLineAndIndent() + " # endBraceCount --> " + endBraceCount;
+                throw new IllegalArgumentException(msg);
+            }
+        }
+
+        protected void assertListString(String listString)
+        {
+            if (listString == null)
+            {
+                String msg = "Argument[listString] must not be null: ";
+                throw new IllegalArgumentException(msg + "liststring=" + listString);
+            }
+            listString = listString.Trim();
+            if (!isStartsWithListPrefix(listString))
+            {
+                string msg = "Argument[listString] must start with '" + _mapMark + "': ";
+                throw new IllegalArgumentException(msg + "listString=" + listString);
+            }
+            if (!isEndsWithEndMark(listString))
+            {
+                string msg = "Argument[listString] must end with '" + _endBrace + "': ";
+                throw new IllegalArgumentException(msg + "listString=" + listString);
+            }
+
+            int startBraceCount = getDelimiterCount(listString, _startBrace);
+            int endBraceCount = getDelimiterCount(listString, _endBrace);
+            if (startBraceCount != endBraceCount)
+            {
+                string msg = "It is necessary to have braces of the same number on start and end:";
+                msg = msg + getNewLineAndIndent() + " # listString --> " + listString;
+                msg = msg + getNewLineAndIndent() + " # startBraceCount --> " + startBraceCount;
+                msg = msg + getNewLineAndIndent() + " # endBraceCount --> " + endBraceCount;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+        }
+
+        protected void assertEqualIndex(string remainderMapString, int equalIndex, string mapString4Log, Dictionary<string,object> currentMap4Log)
+        {
+            if (remainderMapString == null)
+            {
+                string msg = "Argument[remainderMapString] must not be null:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString4Log --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap4Log --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            if (equalIndex < 0)
+            {
+                string msg = "Argument[equalIndex] must be plus or zero:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString4Log --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap4Log --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            if (remainderMapString.Length < equalIndex)
+            {
+                string msg = "Argument[remainderMapString] length must be larger than equalIndex value:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString4Log --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap4Log --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            String expectedAsEndMark = remainderMapString.Substring(equalIndex, _equal.Length);
+            if (!expectedAsEndMark.Equals(_equal))
+            {
+                string msg = "Argument[remainderMapString] must have '" + _equal + "' at Argument[equalIndex]:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+                msg = msg + getNewLineAndIndent() + " # expectedAsEndMark --> " + expectedAsEndMark;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+        }
+
+        protected void assertEndBracekIndex(string remainderMapString, int endBraceIndex, string mapString4Log,
+                Dictionary<string, object> currentMap4Log)
+        {
+            if (remainderMapString == null)
+            {
+                string msg = "Argument[remainderMapString] must not be null:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            if (endBraceIndex < 0)
+            {
+                string msg = "Argument[endMarkIndex] must be plus or zero:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString --> =" + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            if (remainderMapString.Length < endBraceIndex)
+            {
+                string msg = "Argument[remainderMapString] length must be larger than endMarkIndex value:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            String expectedAsEndMark = remainderMapString.Substring(endBraceIndex, _endBrace.Length);
+            if (!expectedAsEndMark.Equals(_endBrace))
+            {
+                string msg = "Argument[remainderMapString] must have '" + _endBrace + "' at Argument[endBraceIndex]:";
+                msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # expectedAsEndMark --> " + expectedAsEndMark;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+        }
+
+        protected void assertEndBraceIndex(string remainderListString, int endBraceIndex, string mapString4Log,
+                List<Object> currentList4Log)
+        {
+            if (remainderListString == null)
+            {
+                string msg = "Argument[remainderMapString] must not be null:";
+                msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            if (endBraceIndex < 0)
+            {
+                string msg = "Argument[endMarkIndex] must be plus or zero:";
+                msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            if (remainderListString.Length < endBraceIndex)
+            {
+                string msg = "Argument[remainderMapString] length must be larger than endMarkIndex value:";
+                msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+
+            String expectedAsEndBrace = remainderListString.Substring(endBraceIndex,  _endBrace.Length);
+            if (!expectedAsEndBrace.Equals(_endBrace))
+            {
+                string msg = "Argument[remainderMapString] must have '" + _endBrace + "' at Argument[endBraceIndex]:";
+                msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+                msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+                msg = msg + getNewLineAndIndent() + " # expectedAsEndBrace --> " + expectedAsEndBrace;
+                msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+                msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+                msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+                msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+                msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+                msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+                throw new IllegalArgumentException(msg);
+            }
+        }
+
+        // ==========================================================================================
+        //                                                                                     Filter
+        //                                                                                     ======
+        /**
+         * Filter map or list value.
+         * <p>
+         * <pre>
+         * # The value is trimmed.
+         * # If the value is null, this returns null.
+         * # If the value is 'null', this returns null.
+         * # If the trimmed value is empty string, this returns null.
+         * </pre>
+         * @param value value. (Nullable)
+         * @return Filtered value. (Nullable)
+         */
+        protected String filterMapListValue(string value)
+        {
+            if (value == null)
+            {
+                return null;
+            }
+            value = value.Trim();
+            return (("".Equals(value) || "null".Equals(value)) ? null : value);
+        }
+
+        // ==========================================================================================
+        //                                                                                  Judgement
+        //                                                                                  =========
+        protected bool isStartsWithMapPrefix(string targetString)
+        {
+            if (targetString == null)
+            {
+                string msg = "Argument[targetString] must not be null: " + targetString;
+                throw new IllegalArgumentException(msg);
+            }
+            targetString = targetString.Trim();
+            if (targetString.StartsWith(_mapMark + _startBrace))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        protected bool isStartsWithListPrefix(string targetString)
+        {
+            if (targetString == null)
+            {
+                string msg = "Argument[targetString] must not be null: " + targetString;
+                throw new IllegalArgumentException(msg);
+            }
+            targetString = targetString.Trim();
+            if (targetString.StartsWith(_listMark + _startBrace))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        protected bool isStartsWithDelimiter(string targetString)
+        {
+            if (targetString == null)
+            {
+                string msg = "Argument[targetString] must not be null: " + targetString;
+                throw new IllegalArgumentException(msg);
+            }
+            targetString = targetString.Trim();
+            if (targetString.StartsWith(_delimiter))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        protected bool isStartsWithEndBrace(string targetString)
+        {
+            if (targetString == null)
+            {
+                string msg = "Argument[targetString] must not be null: " + targetString;
+                throw new IllegalArgumentException(msg);
+            }
+            targetString = targetString.Trim();
+            if (targetString.StartsWith(_endBrace))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        protected bool isEndsWithEndMark(string targetString)
+        {
+            if (targetString == null)
+            {
+                string msg = "Argument[targetString] must not be null: " + targetString;
+                throw new IllegalArgumentException(msg);
+            }
+            targetString = targetString.Trim();
+            if (targetString.EndsWith(_endBrace))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        // ==========================================================================================
+        //                                                                                      Other
+        //                                                                                      =====
+        protected Dictionary<String, Object> setupNestMap(Dictionary<String, Object> currentMap, string mapKey)
+        {
+            Dictionary<String, Object> nestMap = newStringObjectMap();
+            currentMap.Add(mapKey, nestMap);
+            return nestMap;
+        }
+
+        protected Dictionary<String, Object> setupNestMap(List<Object> currentList)
+        {
+            Dictionary<String, Object> nestMap = newStringObjectMap();
+            currentList.Add(nestMap);
+            return nestMap;
+        }
+
+        protected List<Object> setupNestList(Dictionary<String, Object> currentMap, string mapKey)
+        {
+            List<Object> nestList = newObjectList();
+            currentMap.Add(mapKey, nestList);
+            return nestList;
+        }
+
+        protected List<Object> setupNestList(List<Object> currentList)
+        {
+            List<Object> nestList = newObjectList();
+            currentList.Add(nestList);
+            return nestList;
+        }
+
+        protected Dictionary<String, Object> newStringObjectMap()
+        {
+            return new Dictionary<String, Object>();
+        }
+
+        protected List<Object> newObjectList()
+        {
+            return new List<Object>();
+        }
+
+        protected String getNewLineAndIndent()
+        {
+            return NEW_LINE + "    ";
+        }
+
+        /**
+         * Get count that target string exist in the base string.
+         * 
+         * @param targetString ‘Ώە¶Žš—ñ
+         * @param delimiter ƒfƒŠƒ~ƒ^
+         * @return Žc‚è‚Ì•¶Žš—ñ‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚éƒfƒŠƒ~ƒ^‚̐”
+         */
+        protected int getDelimiterCount(string targetString, string delimiter)
+        {
+            int result = 0;
+            for (int i = 0; ; )
+            {
+                if (targetString.IndexOf(delimiter, i) != -1)
+                {
+                    result++;
+                    i = targetString.IndexOf(delimiter, i) + 1;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            if (result == 0)
+            {
+                result = -1;
+            }
+            return result;
+        }
+
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilder.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilder.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilder.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ${glPackageBaseCommonHelper} {
+
+    /// <summary>
+    /// The interface of map-string-builder. (by kotani)
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public interface ${glMapStringBuilderName} {
+
+        /// <summary>
+        /// The property of column-name array.
+        /// </summary>
+        String[] ColumnNames { set; }
+
+        /// <summary>
+        /// The property of map-mark for map-string.
+        /// </summary>
+        String MapStringMapMark { set; }
+
+        /// <summary>
+        /// The property of delimiter for map-string.
+        /// </summary>
+        String MapStringDelimiter { set; }
+
+        /// <summary>
+        /// The property of equal for map-string .
+        /// </summary>
+        String MapStringEqual { set; }
+
+        /// <summary>
+        /// The property of start-brace for map-string.
+        /// </summary>
+        String MapStringStartBrace { set; }
+
+        /// <summary>
+        /// The property of end-brace for map-string.
+        /// </summary>
+        String MapStringEndBrace { set; }
+
+        /// <summary>
+        /// Build by delimiter.
+        /// </summary>
+        /// <param name="values">String separated by delimiter. (NotNull)</param>
+        /// <param name="delimiter">Delimiter. (NotNull)</param>
+        /// <returns>Map-string. (NotNull)</returns>
+        /// <exception cref="DifferentDelimiterCountException"></exception>
+        String BuildByDelimiter(String values, String delimiter);
+    }
+
+    public class DifferentDelimiterCountException : ApplicationException {
+        protected String[] _columnNames;
+        protected String[] _values;
+        public DifferentDelimiterCountException(String msg, String[] columnNames, String[] values) 
+        : base(msg) {
+            _columnNames = columnNames;
+            _values = values;
+        }
+        public String[] getColumnNames() {
+            return _columnNames;
+        }
+        public String[] getValues() {
+            return _values;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilderImpl.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilderImpl.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/helper/MapStringBuilderImpl.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,167 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace ${glPackageBaseCommonHelper} {
+
+    /// <summary>
+    /// The implementation of map-string-builder.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${glMapStringBuilderImplName} : ${glMapStringBuilderName} {
+
+        /// <summary>The instance of regular-expressions.</summary>
+        protected Regex _regDelimiter;
+
+        /// <summary>The array of column-name.</summary>
+        protected String[] _columnNames;
+
+        /// <summary>The value of map-mark for map-string.</summary>
+        protected String _msMapMark;
+
+        /// <summary>The value of delimiter for map-string.</summary>
+        protected String _msDelimiter;
+
+        /// <summary>The value of equal for map-string.</summary>
+        protected String _msEqual;
+
+        /// <summary>The value of start-brace for map-string.</summary>
+        protected String _msStartBrace;
+
+        /// <summary>The value of end-brace for map-string.</summary>
+        protected String _msEndBrace;
+
+        /// <summary>
+        /// The property of column-name.
+        /// </summary>
+        public String[] ColumnNames {
+            set{ _columnNames = value; }
+        }
+
+        /// <summary>
+        /// The property of map-mark for map-string.
+        /// </summary>
+        public String MapStringMapMark {
+            set { _msMapMark = value; }
+        }
+
+        /// <summary>
+        /// The property of delimiter for map-string.
+        /// </summary>
+        public String MapStringDelimiter {
+            set { _msDelimiter = value; _regDelimiter = new Regex(String.Format("({0})$", _msDelimiter)); }
+        }
+
+        /// <summary>
+        /// The property of equal for map-string.
+        /// </summary>
+        public String MapStringEqual {
+            set { _msEqual = value; }
+        }
+
+        /// <summary>
+        /// The property of start-brace for map-string.
+        /// </summary>
+        public String MapStringStartBrace {
+            set { _msStartBrace = value; }
+        }
+
+        /// <summary>
+        /// The property of end-brace for map-string.
+        /// </summary>
+        public String MapStringEndBrace {
+            set { _msEndBrace = value; }
+        }
+
+        /// <summary>
+        /// Build by delimiter.
+        /// </summary>
+        /// <param name="values">String separated by delimiter. (NotNull)</param>
+        /// <param name="delimiter">Delimiter. (NotNull)</param>
+        /// <returns>Map-string. (NotNull)</returns>
+        /// <exception cref="DifferentDelimiterCountException"></exception>
+        public String BuildByDelimiter(String values, String delimiter) {
+            if (values == null) {
+                String msg = "The argument[values] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (delimiter == null) {
+                String msg = "The argument[delimiter] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            AssertStringComponent();
+
+            String[] valueArray = values.Split(delimiter.ToCharArray());
+            AssertValueArray(_columnNames, valueArray);
+
+            StringBuilder builder = new StringBuilder();
+            builder.Append(_msMapMark + _msStartBrace);
+            for (int i = 0; i < _columnNames.Length; i++ ) {
+                builder.AppendFormat("{0}{1}{2} {3}", _columnNames[i], _msEqual, valueArray[i], _msDelimiter);
+            }
+
+            return String.Format("{0}{1}", _regDelimiter.Replace(builder.ToString(), ""),  _msEndBrace); 
+        }
+
+        protected void AssertStringComponent() {
+            if (_columnNames == null) {
+                String msg = "The columnNames should not be null.";
+                throw new SystemException(msg);
+            }
+            if (_columnNames.Length == 0) {
+                String msg = "The columnNames should not be empty-array.";
+                throw new SystemException(msg);
+            }
+            if (_msMapMark == null) {
+                String msg = "The msMapMark should not be null.";
+                throw new SystemException(msg);
+            }
+            if (_msDelimiter == null) {
+                String msg = "The msDelimiter should not be null.";
+                throw new SystemException(msg);
+            }
+            if (_msEqual == null) {
+                String msg = "The msEqual should not be null.";
+                throw new SystemException(msg);
+            }
+            if (_msStartBrace == null) {
+                String msg = "The msStartBrace should not be null.";
+                throw new SystemException(msg);
+            }
+            if (_msEndBrace == null) {
+                String msg = "The msEndBrace should not be null.";
+                throw new SystemException(msg);
+            }
+        }
+
+        /// <summary>
+        /// Assert
+        /// </summary>
+        /// <param name="expected">The expected columns. (NotNull)</param>
+        /// <param name="actual">The actual values. (NotNull)</param>
+        /// <exception cref="DifferentDelimiterCountException"></exception>
+        protected void AssertValueArray(String[] expected, String[] actual) {
+            if (expected.Length != actual.Length) {
+                String msg = String.Format("StringArray's length is difference. ({0}, {1}) by Kotan",  expected.Length, actual.Length);
+                {
+                    StringBuilder sb = new StringBuilder();
+                    foreach (String str in expected) {
+                        sb.Append(", ").Append(str);
+                    }
+                    sb.Remove(0, ", ".Length);
+                    msg = msg + " expectedNames=" + sb.ToString();
+                }
+                {
+                    StringBuilder sb = new StringBuilder();
+                    foreach (String str in actual) {
+                        sb.Append(", ").Append(str);
+                    }
+                    sb.Remove(0, ", ".Length);
+                    msg = msg + " actualValues=" + sb.ToString();
+                }
+                throw new DifferentDelimiterCountException(msg, expected, actual);
+            }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,100 @@
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Text;
+
+using ${glPackageBaseCommon};
+
+namespace ${glPackageBaseCommonInterceptor} {
+
+    /// <sumarry>
+    /// CommonColumn-Setup Abstract Interceptor.
+    /// Author : ${database.ClassAuthor}
+    /// </sumarry> 
+    public abstract class ${glCommonColumnSetupAbstractInterceptor} : Seasar.Framework.Aop.Interceptors.AbstractInterceptor {
+
+        /// <sumarry>Log-instance.</sumarry>
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /// <sumarry>
+        /// Invoke.
+        /// </sumarry> 
+        /// <param name="invocation"> Method invocation.</param>
+        /// <returns>Result of the method.</returns>
+        /// <exception cref="Throwable"></exception>
+        public override object Invoke(Seasar.Framework.Aop.IMethodInvocation invocation) {
+            MethodBase method = invocation.Method;
+            Object[] args = invocation.Arguments;
+
+            if (!(args != null && args.Length != 0)) {
+                return invocation.Proceed();
+            }
+            Object firstArgument = args[0];
+            if (IsEntityDefinedCommonColumn(firstArgument)) {
+                ${glEntityDefinedCommonColumnInterfaceName} entity = (${glEntityDefinedCommonColumnInterfaceName})firstArgument;
+                if (_log.IsDebugEnabled) {
+                    String methodName = method.DeclaringType.Name + "." + method.Name;
+                    _log.Debug("Intercepted the method '" + methodName + "()': entity=" + entity.ExtractPrimaryKeyMapString());
+                }
+                SetupEntity(entity);
+                return invocation.Proceed();
+            } else if (IsListSaveEntityDefinedCommonColumn(firstArgument)) {
+                IList ls = (IList)firstArgument;
+                if (_log.IsDebugEnabled) {
+                    String methodName = method.DeclaringType.Name + "." + method.Name;
+                    _log.Debug("Intercepted the method '" + methodName + "()': entityList.Count=" + ls.Count);
+                }
+                foreach (${glEntityDefinedCommonColumnInterfaceName} entity in ls) {
+                    SetupEntity(entity);
+                }
+                return invocation.Proceed();
+            } else {
+                return invocation.Proceed();
+            }
+        }
+
+        /// <sumarry>
+        /// Is the object entity defined common column?
+        /// </sumarry>
+        /// <param name="obj">Object. If the object is null, returns false. (Nullable)</param>
+        /// <returns>Determination.</returns>
+        protected bool IsEntityDefinedCommonColumn(Object obj) {
+            if (obj == null) {
+                return false;
+            }
+            if (obj is ${glEntityDefinedCommonColumnInterfaceName}) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        /// <sumarry>
+        /// Is the object list that saves entity defined common column?
+        /// </sumarry> 
+        /// <param name="obj">Object. If the object is null, returns false. (Nullable)</param>
+        /// <returns>Determination.</returns>
+        protected bool IsListSaveEntityDefinedCommonColumn(Object obj) {
+            if (obj == null) {
+                return false;
+            }
+            if (!(obj is IList)) {
+                return false;
+            }
+            IList ls = (IList)obj;
+            foreach (Object currentObj in ls) {
+                if (!(currentObj is ${glEntityDefinedCommonColumnInterfaceName})) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        /// <sumarry>
+        /// Set up the entity.
+        /// </sumarry>
+        /// <param name="entity">Entity. (Nullable).</param>
+        abstract protected void SetupEntity(${glEntityDefinedCommonColumnInterfaceName} entity);
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,57 @@
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+
+namespace ${glPackageBaseCommonInterceptor} {
+
+    /// <sumarry>
+    /// CommonColumn-Setup-before-Delete Interceptor.
+    /// Author : ${database.ClassAuthor}
+    /// </sumarry> 
+    public class ${glCommonColumnSetupBeforeDeleteInterceptor} : ${glCommonColumnSetupAbstractInterceptor} {
+
+        /// <sumarry>Log-instance.</sumarry>
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+
+        /// <sumarry>
+        /// Set up the entity.
+        /// </sumarry> 
+        /// <param name="entity">Entity. (Nullable)</param>
+        protected override void SetupEntity(${glEntityDefinedCommonColumnInterfaceName} entity) {
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    before setup : " + entity.ExtractCommonColumnValueMapString());
+            }
+    #foreach ($columnName in ${database.CommonColumnNameList})
+      #set ($entityCommonColumnMap = ${database.CommonColumnMap})
+      #set ($columnType = ${entityCommonColumnMap.get(${columnName})})
+      #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+      #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${columnName})})
+      #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${columnName})})
+      #if (${database.containsValidColumnNameKeyCommonColumnSetupBeforeDeleteInterceptorLogicMap(${columnName})})
+        #set ($logic = ${database.getCommonColumnSetupBeforeDeleteInterceptorLogicByColumnName(${columnName})})
+        #if ($database.isCommonColumnSetupInvokingLogic($logic))
+          #set ($filteredLogic = $database.removeCommonColumnSetupInvokingMark($logic))
+
+            ${filteredLogic}
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    ${columnName} has been set up: invoking=${filteredLogic}");
+            }
+        #else
+
+            ${javaNative} ${uncapitalisedJavaName} = ${logic};
+            entity.${javaName} = ${uncapitalisedJavaName};
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    ${columnName} has been set up: value=" + ${uncapitalisedJavaName});
+            }
+        #end
+      #end
+    #end
+
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    after setup  : " + entity.ExtractCommonColumnValueMapString());
+            }
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,57 @@
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+
+namespace ${glPackageBaseCommonInterceptor} {
+
+    /// <sumarry>
+    /// CommonColumn-Setup-before-Insert Interceptor.
+    /// Author : ${database.ClassAuthor}
+    /// </sumarry>
+    public class ${glCommonColumnSetupBeforeInsertInterceptor} : ${glCommonColumnSetupAbstractInterceptor} {
+
+        /// <sumarry>Log-instance.</sumarry>
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+
+        /// <sumarry>
+        /// Set up the entity.
+        /// </sumarry> 
+        /// <param name="entity"Entity. (Nullable)</param>
+        protected override void SetupEntity(${glEntityDefinedCommonColumnInterfaceName} entity) {
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    before setup : " + entity.ExtractCommonColumnValueMapString());
+            }
+    #foreach ($columnName in ${database.CommonColumnNameList})
+      #set ($entityCommonColumnMap = ${database.CommonColumnMap})
+      #set ($columnType = ${entityCommonColumnMap.get(${columnName})})
+      #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+      #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${columnName})})
+      #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${columnName})})
+      #if (${database.containsValidColumnNameKeyCommonColumnSetupBeforeInsertInterceptorLogicMap(${columnName})})
+        #set ($logic = ${database.getCommonColumnSetupBeforeInsertInterceptorLogicByColumnName(${columnName})})
+        #if ($database.isCommonColumnSetupInvokingLogic($logic))
+          #set ($filteredLogic = $database.removeCommonColumnSetupInvokingMark($logic))
+
+            ${filteredLogic}
+            if (_log.IsDebugEnabled) {
+                _log.Debug("  CommonColumnSetup - ${columnName} has been set up: invoking=${filteredLogic}");
+            }
+        #else
+
+            ${javaNative} ${uncapitalisedJavaName} = ${logic};
+            entity.${javaName} = ${uncapitalisedJavaName};
+            if (_log.IsDebugEnabled) {
+                _log.Debug("  CommonColumnSetup - ${columnName} has been set up: value=" + ${uncapitalisedJavaName});
+            }
+        #end
+      #end
+    #end
+
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    after setup  : " + entity.ExtractCommonColumnValueMapString());
+            }
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,57 @@
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+
+namespace ${glPackageBaseCommonInterceptor} {
+
+    /// <sumarry>
+    /// CommonColumn-Setup-before-Update Interceptor.
+    /// Author : ${database.ClassAuthor}
+    /// </sumarry>
+    public class ${glCommonColumnSetupBeforeUpdateInterceptor} : ${glCommonColumnSetupAbstractInterceptor} {
+
+        /// <sumarry>Log-instance.</sumarry>
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+
+        /// <sumarry>
+        /// Set up the entity.
+        /// </sumarry> 
+        /// <param name="entity"Entity. (Nullable)</param>
+        protected override void SetupEntity(${glEntityDefinedCommonColumnInterfaceName} entity) {
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    before setup : " + entity.ExtractCommonColumnValueMapString());
+            }
+    #foreach ($columnName in ${database.CommonColumnNameList})
+      #set ($entityCommonColumnMap = ${database.CommonColumnMap})
+      #set ($columnType = ${entityCommonColumnMap.get(${columnName})})
+      #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+      #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${columnName})})
+      #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${columnName})})
+      #if (${database.containsValidColumnNameKeyCommonColumnSetupBeforeUpdateInterceptorLogicMap(${columnName})})
+        #set ($logic = ${database.getCommonColumnSetupBeforeUpdateInterceptorLogicByColumnName(${columnName})})
+        #if ($database.isCommonColumnSetupInvokingLogic($logic))
+          #set ($filteredLogic = $database.removeCommonColumnSetupInvokingMark($logic))
+
+            ${filteredLogic}
+            if (_log.IsDebugEnabled) {
+                _log.Debug("  CommonColumnSetup - ${columnName} has been set up: invoking=${filteredLogic}");
+            }
+        #else
+
+            ${javaNative} ${uncapitalisedJavaName} = ${logic};
+            entity.${javaName} = ${uncapitalisedJavaName};
+            if (_log.IsDebugEnabled) {
+                _log.Debug("  CommonColumnSetup - ${columnName} has been set up: value=" + ${uncapitalisedJavaName});
+            }
+        #end
+      #end
+    #end
+
+            if (_log.IsDebugEnabled) {
+                _log.Debug("    after setup  : " + entity.ExtractCommonColumnValueMapString());
+            }
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetFactory.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetFactory.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetFactory.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,124 @@
+
+using System;
+using System.Reflection;
+using System.Text;
+
+using ${glPackageBaseCommonCBean};
+
+namespace ${glPackageBaseCommonS2Dao} {
+
+    /**
+     * Fetch page result set factory.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public class ${glFetchNarrowingResultSetFactory} : Seasar.Extension.ADO.IDataReaderFactory {
+
+        /// <summary>Log instance.</summary>
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /// <summary>Is internal-debug enabled?</summary>
+        private bool _isInternalDebugEnabled = false;
+
+        /**
+         * Constructor.
+         */
+        public ${glFetchNarrowingResultSetFactory}() {
+        }
+
+        /**
+         * Create result set.
+         * 
+         * @param ps Prepared statement.
+         * @return Result set. (NotNull)
+         */
+        public System.Data.IDataReader CreateDataReader(Seasar.Extension.ADO.IDataSource dataSource, System.Data.IDbCommand cmd) {
+            if (_isInternalDebugEnabled) {
+                if (_log.IsDebugEnabled) {
+                    _log.Debug("ExecuteReader(dataSource, cmd). dataSource=" + dataSource + " cmd=" + cmd);
+                }
+            }
+
+            DateTime before = DateTime.Now;
+            System.Data.IDataReader dataReader = Seasar.Framework.Util.CommandUtil.ExecuteReader(dataSource, cmd);
+            DateTime after = DateTime.Now;
+            if (_log.IsDebugEnabled) {
+                _log.Debug("SQL Finished! (" + GetPerformanceView(before, after) + ")");
+            }
+
+            if (!${glFetchNarrowingBeanContextName}.IsExistFetchNarrowingBeanOnThread()) {
+                return dataReader;// If the first argument is not condition-bean...
+            }
+            ${glFetchNarrowingBeanInterfaceName} ${glAttachedCBArgsVariableName} = ${glFetchNarrowingBeanContextName}.GetFetchNarrowingBeanOnThread();
+
+            if (!${glAttachedCBArgsVariableName}.IsFetchNarrowingEffective) {
+                return dataReader;// It is not necessary to control.
+            }
+            if (!${glAttachedCBArgsVariableName}.IsFetchNarrowingSkipStartIndexEffective && !${glAttachedCBArgsVariableName}.IsFetchNarrowingLoopCountEffective) {
+                return dataReader;// It is not necessary to control. The sql already have been controlled.
+            }
+
+            if (_isInternalDebugEnabled) {
+                if (_log.IsDebugEnabled) {
+                    _log.Debug("Necessary to control fetch-narrowing! ${glAttachedCBArgsVariableName}=" + ${glAttachedCBArgsVariableName});
+                }
+            }
+            return new ${glFetchNarrowingResultSetWrapper}(dataReader, ${glAttachedCBArgsVariableName});
+        }
+
+        /**
+         * Get performance-view
+         * 
+         * @param mil Millisecond
+         * @return ex)o1m23s456msp(NotNull)
+         */
+        protected String GetPerformanceView(DateTime before, DateTime after) {
+            long beforeMil = 0;
+            {
+                String hour = (before.Hour < 10 ? "0" + before.Hour : "" + before.Hour);
+                String minute = (before.Minute < 10 ? "0" + before.Minute : "" + before.Minute);
+                String secound = (before.Second < 10 ? "0" + before.Second : "" + before.Second);
+                String millisecond = (before.Millisecond < 10 ? "00" + before.Millisecond : (before.Millisecond < 100 ? "0" + before.Millisecond : "" + before.Millisecond));
+                beforeMil = long.Parse(hour + minute + secound + millisecond);
+            }
+            long afterMil = 0;
+            {
+                String hour = (after.Hour < 10 ? "0" + after.Hour : "" + after.Hour);
+                String minute = (after.Minute < 10 ? "0" + after.Minute : "" + after.Minute);
+                String secound = (after.Second < 10 ? "0" + after.Second : "" + after.Second);
+                String millisecond = (after.Millisecond < 10 ? "00" + after.Millisecond : (after.Millisecond < 100 ? "0" + after.Millisecond : "" + after.Millisecond));
+                afterMil = long.Parse(hour + minute + secound + millisecond);
+            }
+            long mil = afterMil - beforeMil;
+            if (mil < 0) {
+                return "minus mil: " + after + "-" + before;
+            }
+
+            long sec = mil / 1000;
+            long min = sec / 60;
+            sec = sec % 60;
+            mil = mil % 1000;
+
+            StringBuilder sb = new StringBuilder();
+            if (min >= 10) { // Minute
+                sb.Append(min).Append("m");
+            } else if (min < 10 && min >= 0) {
+                sb.Append("0").Append(min).Append("m");
+            }
+            if (sec >= 10) { // Secound
+                sb.Append(sec).Append("s");
+            } else if (sec < 10 && sec >= 0) {
+                sb.Append("0").Append(sec).Append("s");
+            }
+            if (mil >= 100) { // Millisecond
+                sb.Append(mil).Append("ms");
+            } else if (mil < 100 && mil >= 10) {
+                sb.Append("0").Append(mil).Append("ms");
+            } else if (mil < 10 && mil >= 0) {
+                sb.Append("00").Append(mil).Append("ms");
+            }
+
+            return sb.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetWrapper.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetWrapper.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/FetchNarrowingResultSetWrapper.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,311 @@
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+
+namespace ${glPackageBaseCommonS2Dao} {
+
+    /**
+     * Fetch pageƒy[ƒWƒƒ—p‚ÌResultSetƒ‰ƒbƒp[B<p>
+     * ŒŸõðŒƒIƒuƒWƒFƒNƒg‚ÌoffsetˆÊ’u‚©‚çAlimit‚܂ł͈̔͂̌‹‰Ê‚ð
+     * nextƒƒ\ƒbƒh‚Å•Ô‚µ‚Ü‚·B<p>
+     * limit‚ª-1‚̏ꍇA‘S‚Ä‚ÌŒ‹‰Ê‚ðnextƒƒ\ƒbƒh‚Å•Ô‚µ‚Ü‚·B
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public class ${glFetchNarrowingResultSetWrapper} : System.Data.IDataReader {
+
+        /// <summary>Log instance.</summary>
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /// <summary>Is internal-debug enabled?</summary>
+        private bool _isInternalDebugEnabled = false;
+
+        /** Original data-reader. */
+        protected System.Data.IDataReader _dataReader;
+
+        /** FetchNarrowing-bean. */
+        protected ${glFetchNarrowingBeanInterfaceName} _${glAttachedCBArgsVariableName};
+
+        /** Fetch counter. */
+        protected long _counter;
+
+        /**
+         * Constructor.
+         * 
+         * @param dataReader Original data-reader. (NotNull)
+         * @param ${glAttachedCBArgsVariableName} FetchNarrowing-bean. (NotNull)
+         */
+        public ${glFetchNarrowingResultSetWrapper}(System.Data.IDataReader dataReader, ${glFetchNarrowingBeanInterfaceName} ${glAttachedCBArgsVariableName}) {
+            _dataReader = dataReader;
+            _${glAttachedCBArgsVariableName} = ${glAttachedCBArgsVariableName};
+
+            if (_isInternalDebugEnabled) {
+                if (_log.IsDebugEnabled) {
+                    String msg = "    IsFetchNarrowingSkipStartIndexEffective=" + GetFetchNarrowingBean().IsFetchNarrowingSkipStartIndexEffective;
+                    _log.Debug(msg);
+                    msg = "    IsFetchNarrowingLoopCountEffective=" + GetFetchNarrowingBean().IsFetchNarrowingLoopCountEffective;
+                    _log.Debug(msg);
+                    msg = "    GetFetchNarrowingSkipStartIndex()=" + GetFetchNarrowingSkipStartIndex();
+                    _log.Debug(msg);
+                    msg = "    GetFetchNarrowingLoopCount()=" + GetFetchNarrowingLoopCount();
+                    _log.Debug(msg);
+                }
+            }
+
+            MoveToFetchStartIndex();
+        }
+
+        /**
+         * Move to fetch-start-index.
+         */
+        private void MoveToFetchStartIndex() {
+            if (!GetFetchNarrowingBean().IsFetchNarrowingSkipStartIndexEffective) {
+                return;
+            }
+            if (IsCursorUsed()) {
+//                if (0 == GetFetchNarrowingSkipStartIndex()) {
+//                    GetDataReader().beforeFirst();
+//                } else {
+//                    GetDataReader().absolute(GetFetchNarrowingSkipStartIndex());
+//                }
+//                _counter = GetDataReader().getRow();
+                throw new NotSupportedException("Cursor is unsupported!!!");
+            } else {
+                while (_counter < GetFetchNarrowingSkipStartIndex() && GetDataReader().Read()) {
+                    ++_counter;
+                }
+            }
+            if (_isInternalDebugEnabled) {
+                if (_log.IsDebugEnabled) {
+                    _log.Debug("    After moving to fetch-start-index, counter=" + _counter);
+                }
+            }
+        }
+
+        /**
+         * Read.
+         * 
+         * @return Does the result set have next record?
+         * @throws SQLException
+         */
+        public bool Read() {
+            bool hasNext = GetDataReader().Read();
+            if (!GetFetchNarrowingBean().IsFetchNarrowingLoopCountEffective) {
+                return hasNext;
+            }
+            if (hasNext && _counter < GetFetchNarrowingSkipStartIndex() + GetFetchNarrowingLoopCount()) {
+                ++_counter;
+                return true;
+            } else {
+                if (_isInternalDebugEnabled) {
+                    if (_log.IsDebugEnabled) {
+                        String msg = "    Finally the result of Read() is false! Because counter is greater-equal";
+                        msg = msg + " than 'fetch-start-index + real-fetch-size'.";
+                        msg = msg + " " + _counter + " >= " + GetFetchNarrowingSkipStartIndex() + " + " + GetFetchNarrowingLoopCount();
+                        _log.Debug(msg);
+                    }
+                }
+                return false;
+            }
+        }
+
+        /**
+         * Get result set.
+         * 
+         * @return Result set.
+         */
+        protected System.Data.IDataReader GetDataReader() {
+            return _dataReader;
+        }
+
+        /**
+         * Get condition-bean.
+         * 
+         * @return FetchNarrowing-bean.
+         */
+        protected ${glFetchNarrowingBeanInterfaceName} GetFetchNarrowingBean() {
+            return _${glAttachedCBArgsVariableName};
+        }
+
+        /**
+         * Get fetch-narrowing start-index from condition-bean.
+         * 
+         * @return Fetch-narrowing start-index.
+         */
+        protected int GetFetchNarrowingSkipStartIndex() {
+            return GetFetchNarrowingBean().FetchNarrowingSkipStartIndex;
+        }
+
+        /**
+         * Get fetch-narrowing size from condition-bean.
+         * 
+         * @return Fetch-narrowing size.
+         */
+        protected int GetFetchNarrowingLoopCount() {
+            return _${glAttachedCBArgsVariableName}.FetchNarrowingLoopCount;
+        }
+
+        /**
+         * Is cursor used?
+         * 
+         * @return Determination.
+         */
+        protected bool IsCursorUsed() {
+            return IsCursorSupported(GetDataReader());
+        }
+
+        /**
+         * Is cursor supported?
+         * 
+         * @param resultSet ResultSet
+         * @return Determation.
+         */
+        public static bool IsCursorSupported(System.Data.IDataReader dataReader) {
+            return false;// Is Cursor Unsupported at C#?
+        }
+
+#region IDataReader ƒƒ“ƒo
+
+        void System.Data.IDataReader.Close() {
+            GetDataReader().Close();
+        }
+
+        int System.Data.IDataReader.Depth {
+            get { return GetDataReader().Depth; }
+        }
+
+        System.Data.DataTable System.Data.IDataReader.GetSchemaTable() {
+            return GetDataReader().GetSchemaTable();
+        }
+
+        bool System.Data.IDataReader.IsClosed {
+            get { return GetDataReader().IsClosed; }
+        }
+
+        bool System.Data.IDataReader.NextResult() {
+            return GetDataReader().NextResult();
+        }
+
+        int System.Data.IDataReader.RecordsAffected {
+            get { return GetDataReader().RecordsAffected; }
+        }
+
+        #endregion
+
+        #region IDisposable ƒƒ“ƒo
+
+        void System.IDisposable.Dispose() {
+            GetDataReader().Dispose();
+        }
+
+        #endregion
+
+        #region IDataRecord ƒƒ“ƒo
+
+        int System.Data.IDataRecord.FieldCount {
+            get { return GetDataReader().FieldCount; }
+        }
+
+        bool System.Data.IDataRecord.GetBoolean(int i) {
+            return GetDataReader().GetBoolean(i);
+        }
+
+        byte System.Data.IDataRecord.GetByte(int i) {
+            return GetDataReader().GetByte(i);
+        }
+
+        long System.Data.IDataRecord.GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) {
+            return GetDataReader().GetBytes(i, fieldOffset, buffer, bufferoffset, length);
+        }
+
+        char System.Data.IDataRecord.GetChar(int i) {
+            return GetDataReader().GetChar(i);
+        }
+
+        long System.Data.IDataRecord.GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) {
+            return GetDataReader().GetChars(i, fieldoffset, buffer, bufferoffset, length);
+        }
+
+        System.Data.IDataReader System.Data.IDataRecord.GetData(int i) {
+            return GetDataReader().GetData(i);
+        }
+
+        string System.Data.IDataRecord.GetDataTypeName(int i) {
+            return GetDataReader().GetDataTypeName(i);
+        }
+
+        System.DateTime System.Data.IDataRecord.GetDateTime(int i) {
+            return GetDataReader().GetDateTime(i);
+        }
+
+        decimal System.Data.IDataRecord.GetDecimal(int i) {
+            return GetDataReader().GetDecimal(i);
+        }
+
+        double System.Data.IDataRecord.GetDouble(int i) {
+            return GetDataReader().GetDouble(i);
+        }
+
+        System.Type System.Data.IDataRecord.GetFieldType(int i) {
+            return GetDataReader().GetFieldType(i);
+        }
+
+        float System.Data.IDataRecord.GetFloat(int i) {
+            return GetDataReader().GetFloat(i);
+        }
+
+        System.Guid System.Data.IDataRecord.GetGuid(int i) {
+            return GetDataReader().GetGuid(i);
+        }
+
+        short System.Data.IDataRecord.GetInt16(int i) {
+            return GetDataReader().GetInt16(i);
+        }
+
+        int System.Data.IDataRecord.GetInt32(int i) {
+            return GetDataReader().GetInt32(i);
+        }
+
+        long System.Data.IDataRecord.GetInt64(int i) {
+            return GetDataReader().GetInt64(i);
+        }
+
+        string System.Data.IDataRecord.GetName(int i) {
+            return GetDataReader().GetName(i);
+        }
+
+        int System.Data.IDataRecord.GetOrdinal(string name) {
+            return GetDataReader().GetOrdinal(name);
+        }
+
+        string System.Data.IDataRecord.GetString(int i) {
+            return GetDataReader().GetString(i);
+        }
+
+        object System.Data.IDataRecord.GetValue(int i) {
+            return GetDataReader().GetValue(i);
+        }
+
+        int System.Data.IDataRecord.GetValues(object[] values) {
+            return GetDataReader().GetValues(values);
+        }
+
+        bool System.Data.IDataRecord.IsDBNull(int i) {
+            return GetDataReader().IsDBNull(i);
+        }
+
+        object System.Data.IDataRecord.this[string name] {
+            get { return GetDataReader()[name]; }
+        }
+
+        object System.Data.IDataRecord.this[int i] {
+            get { return GetDataReader()[i]; }
+        }
+
+        #endregion
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoInterceptor.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoInterceptor.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoInterceptor.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,334 @@
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Text;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonException};
+
+namespace ${glPackageBaseCommonS2Dao} {
+
+    /**
+     * My-DaoInterceptor.
+     * Customises original class 'S2DaoInterceptor'.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public class ${glDaoInterceptor} : Seasar.Framework.Aop.Interceptors.AbstractInterceptor {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        /** Dao meta data factory. */
+        private Seasar.Dao.IDaoMetaDataFactory daoMetaDataFactory_;
+
+        /**
+         * Constructor.
+         * 
+         * @param daoMetaDataFactory Dao meta data factory.
+         */
+        public ${glDaoInterceptor}(Seasar.Dao.IDaoMetaDataFactory daoMetaDataFactory) {
+            daoMetaDataFactory_ = daoMetaDataFactory;
+        }
+
+        /**
+         * Invoke.
+         * 
+         * @param invocation Method invocation.
+         * @return Result of the method.
+         * @throws Throwable
+         */
+        public override object Invoke(Seasar.Framework.Aop.IMethodInvocation invocation) {
+            System.Reflection.MethodBase method = invocation.Method;
+            if (!method.IsAbstract) {
+                return invocation.Proceed();
+            }
+            TraceMethod(invocation);
+            DateTime before = DateTime.Now;
+
+            Type targetType = GetComponentDef(invocation).ComponentType;
+            Seasar.Dao.ISqlCommand cmd = null;
+            {
+                DateTime beforeCmd = DateTime.Now;
+                Seasar.Dao.IDaoMetaData dmd = null;
+                try {
+                    dmd = daoMetaDataFactory_.GetDaoMetaData(targetType);
+                } catch (Exception e) {
+                    _log.Warn("IDaoMetaDataFactory#GetDaoMetaData() threw the exception: targetType=" + targetType, e);
+                    throw;
+                }
+                try {
+                    cmd = dmd.GetSqlCommand(method.Name);
+                } catch (Exception e) {
+                    _log.Warn("IDaoMetaData#GetSqlCommand() threw the exception: dmd=" + dmd + " methodName=" + method.Name, e);
+                    throw;
+                }
+                DateTime afterCmd = DateTime.Now;
+                TraceSqlCommand(invocation, cmd, beforeCmd, afterCmd);
+            }
+
+            ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName} = null;
+            try {
+                ${glAttachedCBArgsVariableName} = PreprocessConditionBean(invocation, cmd);
+            } catch (Exception e) {
+                _log.Warn("${glDaoInterceptor}#PreprocessConditionBean() threw the exception: ", e);
+                throw;
+            }
+
+            object ret = null;
+            try {
+                ret = cmd.Execute(invocation.Arguments);
+            } catch (Exception e) {
+                if (e is Seasar.Dao.NotSingleRowUpdatedRuntimeException) {
+                    if (_log.IsInfoEnabled) {
+                        _log.Info("Dao threw the exception: NotSingleRowUpdatedRuntimeException - " + e.Message);
+                    }
+                    throw;
+                }
+                _log.Info(" ");
+                _log.Info("/ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @");
+                _log.Info("Dao threw the exception: " + e.GetType() + " msg=" + e.Message);
+                _log.Info("    method   --> " + invocation.Method);
+                _log.Info("    argument --> " + GetObjectArrayString(invocation.Arguments));
+                if (e is Seasar.Framework.Exceptions.SQLRuntimeException) {
+                    String sql = ((Seasar.Framework.Exceptions.SQLRuntimeException)e).Sql;
+                    _log.Info("    sql      --> " + sql);
+                }
+                _log.Info("@ @ @ @ @ @ @ @ @ @ @ /");
+                _log.Info(" ");
+                throw;
+            }
+            PostprocessConditionBean(invocation, ${glAttachedCBArgsVariableName});
+            DateTime after = DateTime.Now;
+
+            Type retType = ((MethodInfo) method).ReturnType;
+            ret = Seasar.Framework.Util.ConversionUtil.ConvertTargetType(ret, retType);
+
+            TraceReturn(invocation, retType, ret, before, after);
+            return ret;
+        }
+
+        protected void TraceMethod(Seasar.Framework.Aop.IMethodInvocation invocation) {
+            if (_log.IsDebugEnabled) {
+                System.Reflection.MethodBase method = invocation.Method;
+                String invokeName = method.DeclaringType.Name + "." + method.Name;
+                int length = invokeName.Length;
+                StringBuilder sb = new StringBuilder();
+                for (int i=0; i < length; i++) {
+                    sb.Append("=");
+                }
+                _log.Debug("/=====================================================" + sb.ToString() + "==");
+                _log.Debug("                                                      " + invokeName + "()");
+                _log.Debug("                                                      " + sb.ToString() + "=/");
+            }
+        }
+
+        protected void TraceSqlCommand(Seasar.Framework.Aop.IMethodInvocation invocation, Seasar.Dao.ISqlCommand cmd, DateTime beforeCmd, DateTime afterCmd) {
+            if (_log.IsDebugEnabled) {
+                _log.Debug("SqlCommand Initialization Cost: [" + GetPerformanceView(beforeCmd, afterCmd) + "]");
+            }
+        }
+
+        protected void TraceReturn(Seasar.Framework.Aop.IMethodInvocation invocation, Type retType, Object ret, DateTime before, DateTime after) {
+            if (_log.IsDebugEnabled) {
+                System.Reflection.MethodBase method = invocation.Method;
+                try {
+                    String daoResultPrefix = "===========/ [" + GetPerformanceView(before, after) + " - ";
+                    if (typeof(System.Collections.IList).IsAssignableFrom(retType)) {
+                        if (ret == null) {
+                            _log.Debug(daoResultPrefix + "Selected count: null]");
+                        } else {
+                            System.Collections.IList ls = (System.Collections.IList)ret;
+                            if (ls.Count == 0) {
+                                _log.Debug(daoResultPrefix + "Selected count: 0]");
+                            } else {
+                                _log.Debug(daoResultPrefix + "Selected count: " + ls.Count + " first=" + ls[0] + "]");
+                            }
+                        }
+                    } else if (typeof(${glEntityInterfaceName}).IsAssignableFrom(retType)) {
+                        if (ret == null) {
+                            _log.Debug(daoResultPrefix + "Selected entity: null" + "]");
+                        } else {
+                            ${glEntityInterfaceName} entity = (${glEntityInterfaceName})ret;
+                            _log.Debug(daoResultPrefix + "Selected entity: " + entity + "]");
+                        }
+                    } else {
+                        if (IsSelectCountIgnoreFetchScopeMethod(invocation)) {
+                            _log.Debug(daoResultPrefix + "Selected count: " + ret + "]");
+                        } else {
+                            _log.Debug(daoResultPrefix + "Result: " + ret + "]");
+                        }
+                    }
+                    _log.Debug(" ");
+                } catch (Exception e) {
+                    String msg = "Result object debug threw the exception: methodName=" + method.Name + " retType=" + retType;
+                    msg = msg + " ret=" + ret;
+                    _log.Warn(msg, e);
+                    throw;
+                }
+            }
+        }
+
+        /**
+         * Preprocess condition-bean.
+         * <p>
+         * If this method is condition bean select target, make dynamic sql.
+         * Else nothing.
+         * 
+         * @param invocation Method invocation. (NotNull)
+         * @param cmd Sql command. (NotNull)
+         * @return Condition-bean. (Nullable)
+         */
+        protected ${glConditionBeanInterfaceName} PreprocessConditionBean(Seasar.Framework.Aop.IMethodInvocation invocation, Seasar.Dao.ISqlCommand cmd) {
+            ClearThreadLocal();
+
+            Object[] args = invocation.Arguments;
+            if (args == null || !(args.Length >= 1)) {
+                return null;
+            }
+            if (args[0] == null) {
+                return null;
+            }
+
+            if (!${glConditionBeanContextName}.IsTheArgumentConditionBean(args[0])) {// The argument is not condition-bean...
+                if (${glFetchNarrowingBeanContextName}.IsTheArgumentFetchNarrowingBean(args[0]) && !IsSelectCountIgnoreFetchScopeMethod(invocation)) {
+                    // Fetch-narrowing-bean and Not select count!
+                    ${glFetchNarrowingBeanContextName}.SetFetchNarrowingBeanOnThread((${glFetchNarrowingBeanInterfaceName})args[0]);
+                }
+                return null;
+            }
+
+            ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName} = (${glConditionBeanInterfaceName})args[0];
+
+            if (!(cmd is ${glSelectDynamicCommand})) {// The argument is condition-bean, but this method using outer-file-sql...
+                ${glFetchNarrowingBeanContextName}.SetFetchNarrowingBeanOnThread((${glFetchNarrowingBeanInterfaceName})args[0]);
+                return null;
+            }
+
+	        if (IsSelectCountIgnoreFetchScopeMethod(invocation)) {
+	            ${glAttachedCBArgsVariableName}.SetupSelectCountIgnoreFetchScope();
+	        } else {
+	            ${glFetchNarrowingBeanContextName}.SetFetchNarrowingBeanOnThread(cb);
+	        }
+
+	        ${glConditionBeanContextName}.SetConditionBeanOnThread(cb);
+	        return ${glAttachedCBArgsVariableName};
+        }
+
+        /**
+         * Postprocess condition-bean.
+         * 
+         * @param invocation Method invocation. (NotNull)
+         * @param ${glAttachedCBArgsVariableName} Condition-bean. (Nullable)
+         */
+        public void PostprocessConditionBean(Seasar.Framework.Aop.IMethodInvocation invocation, ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName}) {
+            ClearThreadLocal();
+
+            if (${glAttachedCBArgsVariableName} == null) {
+                return;
+            }
+            if (IsSelectCountIgnoreFetchScopeMethod(invocation)) {
+                ${glAttachedCBArgsVariableName}.AfterCareSelectCountIgnoreFetchScope();
+            }
+        }
+
+        protected void ClearThreadLocal() {
+            if (${glFetchNarrowingBeanContextName}.IsExistFetchNarrowingBeanOnThread()) {
+                ${glFetchNarrowingBeanContextName}.ClearFetchNarrowingBeanOnThread();
+            }
+	        if (${glConditionBeanContextName}.IsExistConditionBeanOnThread()) {
+	            ${glConditionBeanContextName}.ClearConditionBeanOnThread();
+	        }
+        }
+
+        /**
+         * Is select-count-ignore-fetch-scope method?
+         * 
+         * @param invocation Method invocation. (NotNull)
+         * @return Determination.
+         */
+        protected bool IsSelectCountIgnoreFetchScopeMethod(Seasar.Framework.Aop.IMethodInvocation invocation) {
+            String name = invocation.Method.Name;
+            if (name.StartsWith("ReadCount")
+                    || name.StartsWith("SelectCount")
+                    || name.StartsWith("SelectCountIgnoreFetchScope")
+                    || name.StartsWith("SelectCountIgnoreFetchScope")) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        protected String GetPerformanceView(DateTime before, DateTime after) {
+            long beforeMil = 0;
+            {
+                String hour = (before.Hour < 10 ? "0" + before.Hour : "" + before.Hour);
+                String minute = (before.Minute < 10 ? "0" + before.Minute : "" + before.Minute);
+                String secound = (before.Second < 10 ? "0" + before.Second : "" + before.Second);
+                String millisecond = (before.Millisecond < 10 ? "00" + before.Millisecond : (before.Millisecond < 100 ? "0" + before.Millisecond : "" + before.Millisecond));
+                beforeMil = long.Parse(hour + minute + secound + millisecond);
+            }
+            long afterMil = 0;
+            {
+                String hour = (after.Hour < 10 ? "0" + after.Hour : "" + after.Hour);
+                String minute = (after.Minute < 10 ? "0" + after.Minute : "" + after.Minute);
+                String secound = (after.Second < 10 ? "0" + after.Second : "" + after.Second);
+                String millisecond = (after.Millisecond < 10 ? "00" + after.Millisecond : (after.Millisecond < 100 ? "0" + after.Millisecond : "" + after.Millisecond));
+                afterMil = long.Parse(hour + minute + secound + millisecond);
+            }
+            long mil = afterMil - beforeMil;
+            if (mil < 0) {
+                return "minus mil: " + after + "-" + before;
+            }
+
+            long sec = mil / 1000;
+            long min = sec / 60;
+            sec = sec % 60;
+            mil = mil % 1000;
+
+            StringBuilder sb = new StringBuilder();
+            if (min >= 10) { // Minute
+                sb.Append(min).Append("m");
+            } else if (min < 10 && min >= 0) {
+                sb.Append("0").Append(min).Append("m");
+            }
+            if (sec >= 10) { // Secound
+                sb.Append(sec).Append("s");
+            } else if (sec < 10 && sec >= 0) {
+                sb.Append("0").Append(sec).Append("s");
+            }
+            if (mil >= 100) { // Millisecond
+                sb.Append(mil).Append("ms");
+            } else if (mil < 100 && mil >= 10) {
+                sb.Append("0").Append(mil).Append("ms");
+            } else if (mil < 10 && mil >= 0) {
+                sb.Append("00").Append(mil).Append("ms");
+            }
+
+            return sb.ToString();
+        }
+
+        /**
+         * Change object array to string divided with comma.
+         * 
+         * @param objArray Object array. (Nullable)
+         * @return String (NotNull: If the argument is null, returns empty string.)
+         */
+        protected String GetObjectArrayString(Object[] objArray) {
+            if (objArray == null) {
+                return "";
+            }
+            StringBuilder sb = new StringBuilder();
+            for (int i = 0; i < objArray.Length; i++) {
+                if (i == 0) {
+                    sb.Append(objArray[i]);
+                } else {
+                    sb.Append(", ").Append(objArray[i]);
+                }
+            }
+            return sb.ToString();
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataExtension.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataExtension.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataExtension.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,459 @@
+
+using System;
+using System.Collections;
+using System.Data;
+using System.Text;
+using System.Reflection;
+
+using Seasar.Dao;
+using Seasar.Dao.Attrs;
+using Seasar.Dao.Dbms;
+using Seasar.Dao.Impl;
+using Seasar.Extension.ADO;
+using Seasar.Extension.ADO.Impl;
+using Seasar.Extension.ADO.Types;
+using Seasar.Framework.Beans;
+using Seasar.Framework.Util;
+
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonAnnotation};
+
+namespace ${glPackageBaseCommonS2Dao} {
+
+    public class ${glDaoMetaDataExtension} : Seasar.Dao.Impl.DaoMetaDataImpl {
+
+        public ${glDaoMetaDataExtension}(Type daoType, IDataSource dataSource,ICommandFactory commandFactory,
+            IDataReaderFactory dataReaderFactory, IDatabaseMetaData dbMetaData)
+            : base(daoType, dataSource, commandFactory, dataReaderFactory, dbMetaData) {}
+
+        public override void Initialize()
+        {
+            daoInterface = GetDaoInterface(daoType);
+            annotationReader = AnnotationReaderFactory.CreateDaoAnnotationReader(daoType);
+            beanType = annotationReader.GetBeanType();
+            dbms = DbmsManager.GetDbms(dataSource);
+            BeanMetaDataExtension bmdExt = new BeanMetaDataExtension(beanType, annotationReaderFactory, false);
+            bmdExt.Initialize(dbMetaData, dbms);
+            beanMetaData = bmdExt;
+            SetupSqlCommand();
+        }
+
+        // =====================================================================================
+        //                                                            Outside Sql Check Override
+        //                                                            ==========================
+        protected override void SetupMethodByAuto(MethodInfo mi) {
+            ${glOutsideSqlAnnotation} outsideSql = Attribute.GetCustomAttribute(mi, typeof(${glOutsideSqlAnnotation})) as ${glOutsideSqlAnnotation};
+            if (outsideSql != null) {
+                String msg = "This method '" + mi.Name + "()' should use Outside Sql but the file was not found!";
+                msg = msg + " Expected sql file name is '" + mi.DeclaringType.Name + "_" + mi.Name + ".sql'";
+                throw new SystemException(msg);
+            }
+            base.SetupMethodByAuto(mi);
+        }
+
+        // =====================================================================================
+        //                                                                ConditionBean Override
+        //                                                                ======================
+        protected override void SetupSelectMethodByAuto(MethodInfo methodInfo) {
+            String query = annotationReader.GetQuery(methodInfo.Name);
+            IDataReaderHandler handler = CreateDataReaderHandler(methodInfo);
+            SelectDynamicCommand cmd = null;
+            String[] argNames = MethodUtil.GetParameterNames(methodInfo);
+            Type[] argTypes = MethodUtil.GetParameterTypes(methodInfo);
+            if (query != null && !StartsWithOrderBy(query)) {
+                cmd = CreateSelectDynamicCommand(handler, query);
+            } else {
+                cmd = CreateSelectDynamicCommand(handler);
+                String sql = null;
+                if (argTypes.Length == 1 && ValueTypes.GetValueType(argTypes[0]) == ValueTypes.OBJECT) {
+                    argNames = new String[] { "dto" };
+                    // /----------------------------------------------------- [MyExtension]
+                    if (${glConditionBeanContextName}.IsTheTypeConditionBean(argTypes[0])) {
+                        ${glSelectDynamicCommand} dynamicCommand = NewMySelectDynamicCommand(handler);
+                        String sqlNormal = GetSelectClause();
+                        String sqlPKOnly = GetSelectClausePKOnly();
+                        sql = sqlNormal;
+                        cmd = dynamicCommand;
+                        dynamicCommand.SetSelectClause(sqlNormal);
+                        dynamicCommand.SetSelectClausePKOnly(sqlPKOnly);
+                        dynamicCommand.ArgNames4Nest = argNames;// Oops!
+                        dynamicCommand.ArgTypes4Nest = argTypes;// Oops!
+                    } else {
+                        if (typeof(${glSelectResourceInterfaceName}).IsAssignableFrom(argTypes[0])) {
+                            String msg = "If the first argument type is select-resource(and not condition-bean), ";
+                            msg = msg + "the method should not use auto-select-sql-by-dto.";
+                            msg = msg + " (Do you want to use outer-file-sql? Please check your sql-file-name and build-action!)";
+                            msg = msg + ": dao=" + methodInfo.DeclaringType + " method=" + methodInfo.Name + "()";
+                            msg = msg + " firstArgument=" + argTypes[0] + " argTypes.Length=" + argTypes.Length;
+                            throw new SystemException(msg);
+                        }
+                        sql = CreateAutoSelectSqlByDto(argTypes[0]);
+                    }
+                    // -----------/
+                } else {
+                    // /----------------------------------------------------- [MyExtension]
+                    if (argTypes.Length > 1 && ValueTypes.GetValueType(argTypes[0]) == ValueTypes.OBJECT) {
+                        if (typeof(${glSelectResourceInterfaceName}).IsAssignableFrom(argTypes[0])) {
+                            String msg = "If the number of argument is more than 1 and the first argument type is select-resource, ";
+                            msg = msg + "the method should not use auto-select-sql.";
+                            msg = msg + " (Do you want to use outer-file-sql? Please check your sql-file-name and build-action!)";
+                            msg = msg + ": dao=" + methodInfo.DeclaringType + " method=" + methodInfo.Name + "()";
+                            msg = msg + " firstArgument=" + argTypes[0] + " argTypes.Length=" + argTypes.Length;
+                            throw new SystemException(msg);
+                        }
+                    }
+                    // -----------/
+                    sql = CreateAutoSelectSql(argNames, argTypes);
+                }
+                if (query != null) {
+                    sql = sql + " " + query;
+                }
+                cmd.Sql = sql;
+            }
+            cmd.ArgNames = argNames;
+            cmd.ArgTypes = argTypes;
+            sqlCommands[methodInfo.Name] = cmd;
+        }
+
+        protected String GetSelectClausePKOnly() {
+            StringBuilder sb = new StringBuilder(100);
+            sb.Append("select/*$dto.SelectHint*/ ");
+
+            StringBuilder sbMySelectList = new StringBuilder(100);
+            for (int i = 0; i < beanMetaData.PropertyTypeSize; ++i) {
+                IPropertyType pt = beanMetaData.GetPropertyType(i);
+                if (pt.IsPersistent && pt.IsPrimaryKey) {
+                    if (sbMySelectList.Length != 0) {
+                        sbMySelectList.Append(", ");
+                    }
+                    sbMySelectList.Append(beanMetaData.TableName);
+                    sbMySelectList.Append(".");
+                    sbMySelectList.Append(pt.ColumnName);
+                }
+            }
+            sb.Append(sbMySelectList);
+
+            return sb.ToString();
+        }
+
+        protected String GetSelectClause() {
+            StringBuilder sb = new StringBuilder(100);
+            sb.Append("select/*$dto.SelectHint*/ ");
+
+            StringBuilder sbMySelectList = new StringBuilder(100);
+            for (int i = 0; i < beanMetaData.PropertyTypeSize; ++i) {
+                IPropertyType pt = beanMetaData.GetPropertyType(i);
+                if (pt.IsPersistent) {
+                    if (sbMySelectList.Length != 0) {
+                        sbMySelectList.Append(", ");
+                    }
+                    sbMySelectList.Append(beanMetaData.TableName);
+                    sbMySelectList.Append(".");
+                    sbMySelectList.Append(pt.ColumnName);
+                }
+            }
+            sb.Append(sbMySelectList);
+
+            SetupRelationSelectClause(sb, beanMetaData, "", "", 1);
+            return sb.ToString();
+        }
+
+        protected void SetupRelationSelectClause(StringBuilder sb, IBeanMetaData baseBmd, String judgeProp, String preNoSuffix, int cqNestNo) {
+            for (int i = 0; i < baseBmd.RelationPropertyTypeSize; ++i) {
+                StringBuilder sbYourSelectList = new StringBuilder(100);
+                IRelationPropertyType rpt = baseBmd.GetRelationPropertyType(i);
+                if (rpt == null) {
+                    String msg = "The baseBmd.GetRelationPropertyType(" + i + ") returned null";
+                    msg = msg + ": baseBmd.TableName=" + baseBmd.TableName;
+                    msg = msg + ": baseBmd.RelationPropertyTypeSize=" + baseBmd.RelationPropertyTypeSize;
+                    throw new SystemException(msg);
+                }
+
+                IBeanMetaData relationBmd = rpt.BeanMetaData;
+                String initCapPropertyName = rpt.PropertyName;
+                String ifComment = "/*IF dto." + judgeProp + "IsSelect" + initCapPropertyName + "*/";
+                String endComment = "/*END*/";
+                for (int j = 0; j < relationBmd.PropertyTypeSize; ++j) {
+                    IPropertyType pt = relationBmd.GetPropertyType(j);
+                    String tableAliasName = rpt.PropertyName + (cqNestNo > 1 ? "_n" + cqNestNo : "");
+                    if (pt.IsPersistent) {
+                        String columnName = pt.ColumnName;
+                        sbYourSelectList.Append(", ");
+                        sbYourSelectList.Append(tableAliasName).Append(".").Append(columnName);
+                        sbYourSelectList.Append(" AS ");
+                        sbYourSelectList.Append(pt.ColumnName).Append(preNoSuffix).Append("_").Append(rpt.RelationNo);
+                    }
+                }
+                if (relationBmd.RelationPropertyTypeSize > 0) {
+                    String nssString = "Nss" + initCapPropertyName + ".";
+                    String nextPreNoSuffix = preNoSuffix + "_" + rpt.RelationNo;
+                    int nextCQNestNo = cqNestNo + 1;
+                    SetupRelationSelectClause(sbYourSelectList, relationBmd, nssString, nextPreNoSuffix, nextCQNestNo);
+                }
+                sb.Append(ifComment).Append(sbYourSelectList).Append(endComment);
+            }
+        }
+
+        protected ${glSelectDynamicCommand} NewMySelectDynamicCommand(IDataReaderHandler handler) {// for condition-bean
+            return new ${glSelectDynamicCommand}(dataSource, commandFactory, handler, dataReaderFactory);
+        }
+
+        // =====================================================================================
+        //                                                                      Command Override
+        //                                                                      ================
+        protected override SelectDynamicCommand CreateSelectDynamicCommand(IDataReaderHandler drh) {// for all except condition-bean
+            return new SelectDynamicCommandExtension(dataSource, commandFactory, drh, dataReaderFactory);
+        }
+
+        // =====================================================================================
+        //                                                                     ByManual Override
+        //                                                                     =================
+        protected override void SetupSelectMethodByManual(MethodInfo mi, string sql) {
+            IBeanMetaData myMetaData = BuildBeanMetaData(mi, dbMetaData, dbms);
+            SelectDynamicCommand cmd = CreateSelectDynamicCommand(CreateDataReaderHandler4SelectMethodByManual(mi, myMetaData));
+            cmd.Sql = sql;
+            cmd.ArgNames = MethodUtil.GetParameterNames(mi);
+            cmd.ArgTypes = MethodUtil.GetParameterTypes(mi);
+            sqlCommands[mi.Name] = cmd;
+        }
+
+        protected IBeanMetaData BuildBeanMetaData(MethodInfo mi, IDatabaseMetaData databaseMetaData, Seasar.Dao.IDbms dbInfo) {
+            Type beanClass4SelectMethodByManual = GetBeanClass4SelectMethodByManual(mi);
+            if (beanClass4SelectMethodByManual.Equals(beanType)) {
+                return beanMetaData;
+            }
+            BeanMetaDataExtension bmdExt = new BeanMetaDataExtension(beanClass4SelectMethodByManual, annotationReaderFactory, false);
+            bmdExt.Initialize(databaseMetaData, dbInfo);
+            return bmdExt;
+        }
+
+        protected Type GetBeanClass4SelectMethodByManual(MethodInfo mi) {
+            Type retType = mi.ReturnType;
+            if (retType.IsGenericType && (retType.GetGenericTypeDefinition().Equals(typeof(System.Collections.Generic.IList<>)))) {
+                return retType.GetGenericArguments()[0];
+            } else if (!retType.IsGenericType && typeof(System.Collections.IList).IsAssignableFrom(retType)) {
+                return beanType;
+            } else if (retType.IsArray) {
+                return retType.GetElementType();
+            } else if (ValueTypes.GetValueType(retType) != ValueTypes.OBJECT) {
+                return beanType;
+            } else {
+                return retType;
+            }
+        }
+
+        protected IDataReaderHandler CreateDataReaderHandler4SelectMethodByManual(MethodInfo mi, IBeanMetaData bmd)
+        {
+            Type retType = mi.ReturnType;
+
+            if (retType.IsArray) {
+                return CreateBeanArrayMetaDataDataReaderHandler(bmd);
+            } else if (!retType.IsGenericType && typeof(IList).IsAssignableFrom(retType)) {
+                return CreateBeanListMetaDataDataReaderHandler(bmd);
+            } else if (IsBeanTypeAssignable4SelectMethodByManual(retType, bmd)) {
+                return CreateBeanMetaDataDataReaderHandler(bmd);
+            } else if (Array.CreateInstance(beanType, 0).GetType().IsAssignableFrom(retType)) {
+                return CreateBeanArrayMetaDataDataReaderHandler(bmd);
+            } else if(retType.IsGenericType && (retType.GetGenericTypeDefinition().Equals(typeof(System.Collections.Generic.IList<>))
+                    || retType.GetGenericTypeDefinition().Equals(typeof(System.Collections.Generic.List<>)))) {
+                return CreateBeanGenericListMetaDataDataReaderHandler(bmd);
+            } else {
+                return CreateObjectDataReaderHandler();
+            }
+        }
+
+        protected bool IsBeanTypeAssignable4SelectMethodByManual(Type type, IBeanMetaData bmd) {
+            return bmd.BeanType.IsAssignableFrom(type) || type.IsAssignableFrom(bmd.BeanType);
+        }
+
+        // =====================================================================================
+        //                                                                ReaderHandler Override
+        //                                                                ======================
+        protected override BeanListMetaDataDataReaderHandler CreateBeanListMetaDataDataReaderHandler(IBeanMetaData bmd) {
+            return new BeanListMetaDataDataReaderHandlerExtension(bmd);
+        }
+
+        protected override BeanMetaDataDataReaderHandler CreateBeanMetaDataDataReaderHandler(IBeanMetaData bmd) {
+            return new BeanMetaDataDataReaderHandlerExtension(bmd);
+        }
+
+        protected override BeanArrayMetaDataDataReaderHandler CreateBeanArrayMetaDataDataReaderHandler(IBeanMetaData bmd) {
+            return new BeanArrayMetaDataDataReaderHandlerExtension(bmd);
+        }
+
+        protected override BeanGenericListMetaDataDataReaderHandler CreateBeanGenericListMetaDataDataReaderHandler(IBeanMetaData bmd) {
+            return new BeanGenericListMetaDataDataReaderHandlerExtension(bmd);
+        }
+
+        protected override ObjectDataReaderHandler CreateObjectDataReaderHandler() {
+            return new ObjectDataReaderHandler();
+        }
+    }
+
+    // =====================================================================================
+    //                                                                       Extension Class
+    //                                                                       ===============
+    public class SelectDynamicCommandExtension : SelectDynamicCommand {
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        private readonly IDataReaderHandler _dataReaderHandler;
+        private readonly IDataReaderFactory _dataReaderFactory;
+
+        public SelectDynamicCommandExtension(IDataSource dataSource,
+            ICommandFactory commandFactory,
+            IDataReaderHandler dataReaderHandler, IDataReaderFactory dataReaderFactory)
+            : base(dataSource, commandFactory, dataReaderHandler, dataReaderFactory) {
+            _dataReaderHandler = dataReaderHandler;
+            _dataReaderFactory = dataReaderFactory;
+        }
+
+        public override object Execute(object[] args) {
+            ICommandContext ctx = Apply(args);
+            BasicSelectHandler selectHandler = new BasicSelectHandler(DataSource,
+                ctx.Sql, _dataReaderHandler, CommandFactory, _dataReaderFactory);
+#if ($database.isSelectQueryTimeoutValid())
+
+            int timeout = ${database.SelectQueryTimeout};
+            if (_log.IsDebugEnabled) {
+                _log.Debug("@SelectDynamicCommand: selectHandler.CommandTimeout = " + timeout + ";// from SelectQueryTimeout");
+            }
+            selectHandler.CommandTimeout = timeout;
+#end
+
+            return selectHandler.Execute(ctx.BindVariables, ctx.BindVariableTypes);
+        }
+    }
+
+    public class BeanListMetaDataDataReaderHandlerExtension : BeanListMetaDataDataReaderHandler {
+        public BeanListMetaDataDataReaderHandlerExtension(IBeanMetaData beanMetaData)
+            : base(beanMetaData) {
+        }
+        protected RelationRowCreator _creator = new RelationRowCreator();
+        protected override object CreateRelationRow(IDataReader reader, IRelationPropertyType rpt, IList columnNames, Hashtable relKeyValues) {
+            return _creator.CreateRelationRow(reader, rpt, columnNames, relKeyValues, "");
+        }
+    }
+    public class BeanMetaDataDataReaderHandlerExtension : BeanMetaDataDataReaderHandler {
+        public BeanMetaDataDataReaderHandlerExtension(IBeanMetaData beanMetaData)
+            : base(beanMetaData) {
+        }
+        protected RelationRowCreator _creator = new RelationRowCreator();
+        protected override object CreateRelationRow(IDataReader reader, IRelationPropertyType rpt, IList columnNames, Hashtable relKeyValues) {
+            return _creator.CreateRelationRow(reader, rpt, columnNames, relKeyValues, "");
+        }
+    }
+    public class BeanArrayMetaDataDataReaderHandlerExtension : BeanArrayMetaDataDataReaderHandler {
+        public BeanArrayMetaDataDataReaderHandlerExtension(IBeanMetaData beanMetaData)
+            : base(beanMetaData) {
+        }
+        protected RelationRowCreator _creator = new RelationRowCreator();
+        protected override object CreateRelationRow(IDataReader reader, IRelationPropertyType rpt, IList columnNames, Hashtable relKeyValues) {
+            return _creator.CreateRelationRow(reader, rpt, columnNames, relKeyValues, "");
+        }
+    }
+    public class BeanGenericListMetaDataDataReaderHandlerExtension : BeanGenericListMetaDataDataReaderHandler {
+        public BeanGenericListMetaDataDataReaderHandlerExtension(IBeanMetaData beanMetaData)
+            : base(beanMetaData) {
+        }
+        protected RelationRowCreator _creator = new RelationRowCreator();
+        protected override object CreateRelationRow(IDataReader reader, IRelationPropertyType rpt, IList columnNames, Hashtable relKeyValues) {
+            return _creator.CreateRelationRow(reader, rpt, columnNames, relKeyValues, "");
+        }
+    }
+
+    public class BeanMetaDataExtension : BeanMetaDataImpl {
+        public BeanMetaDataExtension(Type beanType, IAnnotationReaderFactory annotationReaderFactory, bool relation) 
+            : base() {
+            this.BeanType = beanType;
+            this.relation = relation;
+            this.AnnotationReaderFactory = annotationReaderFactory;
+        }
+        protected int _nestNo;
+        public int NestNo {
+            get { return _nestNo; }
+            set { _nestNo = value; }
+        }
+        protected override IBeanMetaData CreateRelationBeanMetaData(PropertyInfo propertyInfo, IDatabaseMetaData dbMetaData, IDbms dbms) {
+            bool isRelation = false;
+            if (this.NestNo > 0) {
+                isRelation = true;
+            }
+            BeanMetaDataExtension bmdExt = new BeanMetaDataExtension(propertyInfo.PropertyType, this.AnnotationReaderFactory, isRelation);
+            bmdExt.NestNo = this.NestNo + 1;
+            bmdExt.Initialize(dbMetaData, dbms);
+            return bmdExt;
+        }
+    }
+
+    public class RelationRowCreator {
+        public virtual object CreateRelationRow(IDataReader reader, IRelationPropertyType rpt,
+                              IList columnNames, Hashtable relKeyValues, String preNoSuffix) {
+            object row = null;
+            IBeanMetaData bmd = rpt.BeanMetaData;
+            for (int i = 0; i < rpt.KeySize; ++i) {
+                string columnName = rpt.GetMyKey(i);
+                if (columnNames.Contains(columnName))
+                {
+                    if (row == null) row = CreateRelationRow(rpt);
+                    if (relKeyValues != null && relKeyValues.ContainsKey(columnName))
+                    {
+                        object value = relKeyValues[columnName];
+                        IPropertyType pt = bmd.GetPropertyTypeByColumnName(rpt.GetYourKey(i));
+                        PropertyInfo pi = pt.PropertyInfo;
+                        if (value != null) pi.SetValue(row, value, null);
+                    }
+                }
+                continue;
+            }
+            String relationNoSuffix = BuildRelationNoSuffix(preNoSuffix, rpt.RelationNo);
+            int existColumn = 0;
+            for (int i = 0; i < bmd.PropertyTypeSize; ++i) {
+                IPropertyType pt = bmd.GetPropertyType(i);
+                string columnName = pt.ColumnName + relationNoSuffix;
+                if (!columnNames.Contains(columnName)) continue;
+                existColumn++;
+                if (row == null) row = CreateRelationRow(rpt);
+                object value = null;
+                PropertyInfo pi = pt.PropertyInfo;
+                if (relKeyValues != null && relKeyValues.ContainsKey(columnName)) {
+                    value = relKeyValues[columnName];
+                } else {
+                    IValueType valueType = pt.ValueType;
+                    value = valueType.GetValue(reader, columnName);
+                }
+                if (value != null) pi.SetValue(row, value, null);
+            }
+            if (existColumn == 0) {
+                return null;
+            }
+            if (rpt.BeanMetaData.RelationPropertyTypeSize > 0) {
+                CreateParentRelationRow(reader, rpt.BeanMetaData, columnNames, relationNoSuffix, row);
+            }
+            return row;
+        }
+
+        protected virtual void CreateParentRelationRow(IDataReader reader, IBeanMetaData parentBmd, IList columnNames, String relationNoSuffix, Object row) {
+            for (int i = 0; i < parentBmd.RelationPropertyTypeSize; ++i) {
+                IRelationPropertyType parentParentRpt = parentBmd.GetRelationPropertyType(i);
+                if (parentParentRpt == null) {
+                    continue;
+                }
+                Object relationRow = CreateRelationRow(reader, parentParentRpt, columnNames, null, relationNoSuffix);
+                if (relationRow != null) {
+                    IPropertyType pt = parentBmd.GetRelationPropertyType(i);
+                    PropertyInfo pi = pt.PropertyInfo;
+                    pi.SetValue(row, relationRow, null);
+                }
+            }
+        }
+
+        protected virtual object CreateRelationRow(IRelationPropertyType rpt) {
+            return ClassUtil.NewInstance(rpt.PropertyInfo.PropertyType);
+        }
+
+        protected virtual String BuildRelationNoSuffix(String preNoSuffix, int relationNo) {
+            return preNoSuffix + "_" + relationNo;
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,57 @@
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+
+using Seasar.Extension.ADO;
+using Seasar.Extension.ADO.Impl;
+
+namespace ${glPackageBaseCommonS2Dao} {
+
+    /**
+     * My-DaoMetaDataFactoryImpl.
+     * Customises original class 'DaoMetaDataFactoryImpl'.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public class ${glDaoMetaDataFactoryImpl} : Seasar.Dao.IDaoMetaDataFactory {
+
+        private Hashtable daoMetaDataCache = new Hashtable();
+        private IDataSource dataSource;
+        private ICommandFactory commandFactory;
+        private IDataReaderFactory dataReaderFactory;
+        private IDatabaseMetaData dbMetaData;
+
+        public ${glDaoMetaDataFactoryImpl}(IDataSource dataSource,
+            ICommandFactory commandFactory, IDataReaderFactory dataReaderFactory) {
+            this.dataSource = dataSource;
+            this.commandFactory = commandFactory;
+            this.dataReaderFactory = dataReaderFactory;
+            this.dbMetaData = new DatabaseMetaDataImpl(dataSource);
+        }
+
+        /**
+         * Get data meta data.
+         * 
+         * @param daoType Dao class
+         * @return Data meta data.
+         */
+        public Seasar.Dao.IDaoMetaData GetDaoMetaData(Type daoType) {
+            lock(this) {
+                String key = daoType.Name;
+                Seasar.Dao.IDaoMetaData dmd = (Seasar.Dao.IDaoMetaData) daoMetaDataCache[key];
+                if (dmd != null) {
+                    return dmd;
+                }
+                
+                // /----------------------------------------------- [MyExtention]
+                dmd = new ${glDaoMetaDataExtension}(daoType, dataSource, commandFactory, dataReaderFactory, dbMetaData);
+                // --------------------/
+                
+                daoMetaDataCache[key] = dmd;
+                return dmd;
+            }
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoSelectDynamicCommand.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoSelectDynamicCommand.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/allcommon/s2dao/S2DaoSelectDynamicCommand.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,215 @@
+
+using System;
+using System.Reflection;
+using System.Collections.Generic;
+using System.Text;
+
+using Seasar.Extension.ADO;
+using Seasar.Extension.ADO.Impl;
+using Seasar.Dao;
+
+using ${glPackageBaseCommonCBean};
+
+namespace ${glPackageBaseCommonS2Dao} {
+
+    /**
+     * My-SelectDynamicCommand.
+     * Overrides original class 'SelectDynamicCommand'.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public class ${glSelectDynamicCommand} : Seasar.Dao.Impl.SelectDynamicCommand {
+
+        /** Log-instance. */
+        private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+        private IDataReaderHandler dataReaderHandler;
+        private IDataReaderFactory dataReaderFactory;
+
+        /** Cache of select clause command. */
+        protected ${glSelectDynamicCommand} _selectClauseCommand;
+
+        /** Cache of select clause PK-only command. */
+        protected ${glSelectDynamicCommand} _selectClausePKOnlyCommand;
+
+        /**
+         * Constructor.
+         * 
+         * @param dataSource Data source.
+         * @param statementFactory Statement factory.
+         * @param resultSetHandler Result set handler.
+         * @param resultSetFactory Result set factory.
+         */
+        public ${glSelectDynamicCommand}(IDataSource dataSource, ICommandFactory commandFactory
+                , IDataReaderHandler dataReaderHandler, IDataReaderFactory dataReaderFactory)
+            : base(dataSource, commandFactory, dataReaderHandler, dataReaderFactory) {
+                this.dataReaderHandler = dataReaderHandler;
+                this.dataReaderFactory = dataReaderFactory;
+        }
+
+        /**
+         * Do apply. {for delegating to apply()}
+         * 
+         * @param args Arguments. (NotNull)
+         * @return Command context. (NotNull)
+         */
+        public ICommandContext DoApply(Object[] args) {
+            return Apply(args);
+        }
+
+        /**
+         * Set select clause.
+         * 
+         * @param value Select clause.
+         * @return this. (NotNull)
+         */
+        public ${glSelectDynamicCommand} SetSelectClause(String value) {
+            _selectClauseCommand = CreateMySelectDynamicCommand();
+            _selectClauseCommand.Sql = value;
+            return this;
+        }
+
+        /**
+         * Set select clause PK only.
+         * 
+         * @param value Select clause PK only.
+         * @return this. (NotNull)
+         */
+        public ${glSelectDynamicCommand} SetSelectClausePKOnly(String value) {
+            _selectClausePKOnlyCommand = CreateMySelectDynamicCommand();
+            _selectClausePKOnlyCommand.Sql = value;
+            return this;
+        }
+
+        protected ${glSelectDynamicCommand} CreateMySelectDynamicCommand() {
+            return new ${glSelectDynamicCommand}(DataSource, CommandFactory, dataReaderHandler, dataReaderFactory);
+        }
+
+        public string[] ArgNames4Nest {
+            set {
+                if (_selectClauseCommand != null) {
+                    _selectClauseCommand.ArgNames = value;
+                }
+                if (_selectClausePKOnlyCommand != null) {
+                    _selectClausePKOnlyCommand.ArgNames = value;
+                }
+            }
+        }
+
+        public Type[] ArgTypes4Nest {
+            set {
+                if (_selectClauseCommand != null) {
+                    _selectClauseCommand.ArgTypes = value;
+                }
+                if (_selectClausePKOnlyCommand != null) {
+                    _selectClausePKOnlyCommand.ArgTypes = value;
+                }
+            }
+        }
+
+        public override object Execute(object[] args) {
+            if (!${glConditionBeanContextName}.IsExistConditionBeanOnThread()) {
+                return base.Execute(args);
+            }
+            AssertSelectClauseCommand();
+            IList<Object> bindVariableList = new List<Object>();
+            IList<Type> bindVariableTypeList = new List<Type>();
+            IList<String> bindVariableNameList = new List<String>();
+
+            StringBuilder sb = new StringBuilder();
+            sb.Append(SetupRealSelectClause(args, bindVariableList, bindVariableTypeList, bindVariableNameList));
+            sb.Append(" ");
+            sb.Append(SetupRealFromWhereClause(args, bindVariableList, bindVariableTypeList, bindVariableNameList));
+
+            BasicSelectHandler selectHandler = CreateBasicSelectHandler(sb.ToString());
+#if ($database.isSelectQueryTimeoutValid())
+
+            int timeout = ${database.SelectQueryTimeout};
+            if (_log.IsDebugEnabled) {
+                _log.Debug("@SelectDynamicCommand: selectHandler.CommandTimeout = " + timeout + ";// from ${database.SelectQueryTimeout}");
+            }
+            selectHandler.CommandTimeout = timeout;
+#end
+
+            Object[] bindVariableArray = new Object[bindVariableList.Count];
+            bindVariableList.CopyTo(bindVariableArray, 0);
+            Type[] bindVariableTypeArray = new Type[bindVariableTypeList.Count];
+            bindVariableTypeList.CopyTo(bindVariableTypeArray, 0);
+            String[] bindVariableNameArray = new String[bindVariableNameList.Count];
+            bindVariableNameList.CopyTo(bindVariableNameArray, 0);
+            return selectHandler.Execute(bindVariableArray, bindVariableTypeArray, bindVariableNameArray);
+        }
+
+        protected String SetupRealSelectClause(Object[] args, IList<Object> bindVariableList, IList<Type> bindVariableTypeList, IList<String> bindVariableNameList) {
+            ${glConditionBeanInterfaceName} cb = ${glConditionBeanContextName}.GetConditionBeanOnThread();
+            if (cb.IsSelectCountIgnoreFetchScope()) {
+                return "select count(*)";
+            }
+            String realSelectClause;
+            {
+                ICommandContext ctx;
+                if (cb.IsLimitSelect_PKOnly()) {
+                    ctx = _selectClausePKOnlyCommand.DoApply(args);
+                } else {
+                    ctx = _selectClauseCommand.DoApply(args);
+                }
+                realSelectClause = ctx.Sql;
+                AddBindVariableInfo(ctx, bindVariableList, bindVariableTypeList, bindVariableNameList);
+            }
+            return realSelectClause;
+        }
+
+        protected String SetupRealFromWhereClause(Object[] args, IList<Object> bindVariableList, IList<Type> bindVariableTypeList, IList<String> bindVariableNameList) {
+            ${glConditionBeanInterfaceName} cb = ${glConditionBeanContextName}.GetConditionBeanOnThread();
+            String realFromWhereClause;
+            {
+                ${glSelectDynamicCommand} fromWhereCommand = CreateMySelectDynamicCommand();
+                fromWhereCommand.ArgNames = this.ArgNames;
+                fromWhereCommand.ArgTypes = this.ArgTypes;
+                fromWhereCommand.Sql = cb.GetClause();
+                ICommandContext ctx = fromWhereCommand.DoApply(args);
+                realFromWhereClause = ctx.Sql;
+                AddBindVariableInfo(ctx, bindVariableList, bindVariableTypeList, bindVariableNameList);
+            }
+            return realFromWhereClause;
+        }
+
+        protected BasicSelectHandler CreateBasicSelectHandler(String realSql) {
+            return new BasicSelectHandler(DataSource, realSql, dataReaderHandler, CommandFactory, dataReaderFactory);
+        }
+
+        protected void AddBindVariableInfo(ICommandContext ctx, IList<Object> bindVariableList, IList<Type> bindVariableTypeList, IList<String> bindVariableNameList) {
+            Object[] bindVariables = ctx.BindVariables;
+            AddBindVariableList(bindVariableList, bindVariables);
+            Type[] bindVariableTypes = ctx.BindVariableTypes;
+            AddBindVariableTypeList(bindVariableTypeList, bindVariableTypes);
+            String[] bindVariableNames = ctx.BindVariableNames;
+            AddBindVariableNameList(bindVariableNameList, bindVariableNames);
+        }
+
+        protected void AddBindVariableList(IList<Object> bindVariableList, Object[] bindVariables) {
+            for (int i=0; i < bindVariables.Length; i++) {
+                bindVariableList.Add(bindVariables[i]);
+            }
+        }
+
+        protected void AddBindVariableTypeList(IList<Type> bindVariableTypeList, Type[] bindVariableTypes) {
+            for (int i=0; i < bindVariableTypes.Length; i++) {
+                bindVariableTypeList.Add(bindVariableTypes[i]);
+            }
+        }
+
+        protected void AddBindVariableNameList(IList<String> bindVariableNameList, String[] bindVariableNames) {
+            for (int i=0; i < bindVariableNames.Length; i++) {
+                bindVariableNameList.Add(bindVariableNames[i]);
+            }
+        }
+
+        protected void AssertSelectClauseCommand() {
+            if (_selectClauseCommand == null) {
+                String msg = "Select clause command should not be null.";
+                throw new SystemException(msg);
+            }
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhv.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhv.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhv.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,451 @@
+#set ($myClassName = "${myExtendedBhvInterfaceName}")
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonBhv};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonDBMeta};
+using ${myDBMetaPackageName};
+using ${glPackageExtendedDao};
+using ${glPackageExtendedEntity};
+using ${glPackageCB};
+
+#set ($myExtendClassName = "")
+#if ($table.isWritable())
+  #set ($myExtendClassName = "${glBehaviorWritableInterfaceName}")
+#else
+  #set ($myExtendClassName = "${glBehaviorReadableInterfaceName}")
+#end
+
+namespace ${glPackageExtendedBhv} {
+
+    /// <summary>
+    /// The behavior-interface of ${table.Name}. (partial class for auto-generation)
+    /// Author : ${database.ClassAuthor}
+    /// </summary>
+    public partial interface ${myClassName} : ${glPackageBaseCommonBhv}.${myExtendClassName} {
+
+        // =====================================================================================
+        //                                                                                DBMeta
+        //                                                                                ======
+        #region DBMeta
+        /// <summary>
+        /// The property of my dbmeta.
+        /// </summary>
+        ${myDBMetaClassName} MyDBMeta { get; }
+        #endregion
+
+        // =====================================================================================
+        //                                                                      Dao GetterSetter
+        //                                                                      ================
+        #region Dao GetterSetter
+        /// <summary>
+        /// Get my dao.
+        /// </summary>
+        ${myExtendedDaoClassName} Dao { get; set; }
+        #endregion
+
+        // =====================================================================================
+        //                                                                          New Instance
+        //                                                                          ============
+        #region New Instance
+        /// <summary>
+        /// New my entity.
+        /// </summary>
+        /// <returns>My condition-bean. (NotNull)</returns>
+        ${myExtendedObjectClassName} NewMyEntity();
+
+        /// <summary>
+        /// New my condition-bean.
+        /// </summary>
+        /// <returns>My condition-bean. (NotNull)</returns>
+        ${myConditionBeanClassName} NewMyConditionBean();
+        #endregion
+
+        // =====================================================================================
+        //                                                                       Delegate-Method
+        //                                                                       ===============
+        #region Delegate-Method
+        /// <summary>
+        /// Select all list. (Delegate-Method)
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        int DelegateGetCountAll();
+
+        /// <summary>
+        /// Select all list. (Delegate-Method)
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        IList DelegateGetListAll();
+
+        /// <summary>
+        /// Select all list. (Delegate-Method)
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        IList DelegateSelectListAll();// for saving compatible
+#if ($table.hasPrimaryKey())
+
+        //
+        // Get entity. (Delegate-Method)
+        // 
+        // @param Primary-keys (NotNull)
+        // @return Entity. (NotNull)
+        //
+        ${myExtendedObjectClassName} DelegateGetEntity(${table.PrimaryKeyArgsString});
+#end
+
+        /// <summary>
+        /// Select count by condition-bean. (Delegate-Method)
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        int DelegateSelectCount(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+#if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Select count by condition-bean. (Delegate-Method)
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        [Obsolete("This method is deprecated. Please use DelegateSelectCount()")]
+        int DelegateSelectCountIgnoreFetchScope(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+#end
+
+        /// <summary>
+        /// Select entity by condition-bean. (Delegate-Method)
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected entity. If the select result is zero, it returns null. (Nullable)</returns>
+        ${myExtendedObjectClassName} DelegateSelectEntity(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+
+        /// <summary>
+        /// Select list by condition-bean. (Delegate-Method)
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        IList DelegateSelectList(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+
+    #if ($table.isUseSequence())
+
+        /// <summary>
+        /// Select next value as sequence. (Delegate-Method)
+        /// </summary>
+        /// <returns>Next value. (NotNull)</returns>
+        int DelegateSelectNextVal();
+    #end
+    #if ($table.isWritable())
+
+        /// <summary>
+        /// Insert one entity. (Delegate-Method)
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Inserted count.</returns>
+        int DelegateInsert(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Update one entity. (Delegate-Method)
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Updated count.</returns>
+        int DelegateUpdate(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Delete one entity. (Delegate-Method)
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Deleted count.</returns>
+        int DelegateDelete(${myExtendedObjectClassName} entity);
+
+    #end
+        #endregion
+
+        // =====================================================================================
+        //                                                                          Basic Select
+        //                                                                          ============
+        #region Basic Select
+        /// <summary>
+        /// Select count by condition-bean.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        int SelectCount(${myConditionBeanClassName} cb);
+
+        /// <summary>
+        /// Select entity by condition-bean.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Entity that is selected from database by select-for-update. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasOverlappedException}"></exception>
+        ${myExtendedObjectClassName} SelectEntity(${myConditionBeanClassName} cb);
+
+        /// <summary>
+        /// Select entity by condition-bean with deleted check.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Entity that is selected from database by select-for-update. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        ${myExtendedObjectClassName} SelectEntityWithDeletedCheck(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+    #if ($table.hasPrimaryKey())
+
+        ${myExtendedObjectClassName} SelectByPKValueWithDeletedCheck(${table.PrimaryKeyArgsString});
+    #end
+    #if ($table.hasPrimaryKey() && $database.isMakeBehaviorForUpdate())
+
+        ${myExtendedObjectClassName} SelectByPKValueWithDeletedCheckForUpdate(${table.PrimaryKeyArgsString});
+
+	  #if ($database.isMakeDeprecated())
+
+		//	K.Kotani Added.
+        [Obsolete("This method is deprecated. Please use SelectByPKValueWithDeletedCheck.")]
+        ${myExtendedObjectClassName} SelectForUpdateByPKMapStringWithDeletedCheck(String primaryKeyMapString);
+      #end
+    #end
+
+
+        /// <summary>
+        /// Select list as result-bean.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>List-result-bean. (NotNull)</returns>
+        ${glListResultBeanName} SelectList(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+
+        /// <summary>
+        /// Select page as result-bean.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected page. (NotNull)</returns>
+        ${glPagingResultBeanName} SelectPage(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+
+        /// <summary>
+        /// Select page as result-bean.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <param name="invoker">Select-page-invoker. (NotNull)</param>
+        /// <returns>Read page. (NotNull)</returns>
+        ${glPagingResultBeanName} SelectPage(${myConditionBeanClassName} ${glAttachedCBArgsVariableName}, SelectPageInvoker invoker);
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Select
+        //                                                                        ==============
+        #region Various Select
+    #if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Select list after checking count(ignore fetch scope).
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <param name="maxCount">Max count.</param>
+        /// <returns>List-result-bean. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}"></exception>
+        [Obsolete("This method is deprecated.")]
+        ${glListResultBeanName} SelectListAfterCheckingCountIgnoreFetchScope(${myConditionBeanClassName} ${glAttachedCBArgsVariableName}, int maxCount);
+    #end
+
+        /// <summary>
+        /// Select page as first.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <param name="fetchSize">Fetch-size.</param>
+        /// <returns>Selected page as first page. (NotNull)</returns>
+        ${glPagingResultBeanName} SelectPageAsFirst(${myConditionBeanClassName} ${glAttachedCBArgsVariableName}, int fetchSize);
+
+        /// <summary>
+        /// Select page by page-number.
+        /// If result-page is 'rb.getAllRecordCount > 0 && rb.getSelectedList().size() == 0', re-select as max-page.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <param name="fetchPageNumber">Fetch-page-number.</param>
+        /// <returns>Selected page as [fetchPageNumber] page. (NotNull)</returns>
+        ${glPagingResultBeanName} SelectPageByPageNumber(${myConditionBeanClassName} ${glAttachedCBArgsVariableName}, int fetchPageNumber);
+    #if ($table.hasPrimaryKey())
+      #if ($database.isMakeDeprecated())
+
+        [Obsolete("This method is deprecated. Please use SelectByPKMapStringWithDeletedCheck().")]
+        ${myExtendedObjectClassName} SelectForReadOnlyByPKValueWithDeletedCheck(${table.PrimaryKeyArgsString});
+      #end
+    #end
+    #if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Select for read only with deleted check.
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary-key map-string. (NotNull)</param>
+        /// <returns>Entity that is selected from database by select-for-update. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        [Obsolete("This class is deprecated. Please use SelectByPKMapStringWithDeletedCheck().")]
+        ${myExtendedObjectClassName} SelectForReadOnlyByPKMapStringWithDeletedCheck(String primaryKeyMapString);
+    #end
+
+        #endregion
+
+
+#if (${table.hasOnlyOnePrimaryKey()})
+
+        // =====================================================================================
+        //                                                                         Load Refferer
+        //                                                                         =============
+        #region Load Refferer
+  #foreach ($refferer in $table.Referrers)
+    #set ($reffererTable = $refferer.Table)
+    #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+    #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+    #set ($reffererBhvClassName = "${reffererEntityClassName}Bhv")
+    #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+    #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+    #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+    #set ($genericPKChildListMap = "${table.getPrimaryKeyJavaNativeAsOne()}, java.util.List${database.filterGenericsString(${reffererEntityClassName})}")
+
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   ReffererTable    = [${refferer.Table.Name}]
+        //   ReffererProperty = [${refferer.ReffererPropertyName}]
+        // * * * * * * * * */
+
+        /// <summary>
+        /// Load refferer of ${refferer.ReffererPropertyName}.
+        /// Default refferer condition is 'primary-key asc'.
+        /// </summary>
+        /// <param name="ls">Entity list of main table. (NotNull)</param>
+        void Load${refferer.ReffererPropertyNameInitCap}(System.Collections.IList ls);
+
+        /// <summary>
+        /// Load refferer of ${refferer.ReffererPropertyName}.
+        /// </summary>
+        /// <param name="ls">Entity list of main table. (NotNull)</param>
+        /// <param name="cbSetupper">Refferer condition-bean setupper instance for registering refferer condition. (NotNull)</param>
+        void Load${refferer.ReffererPropertyNameInitCap}(System.Collections.IList ls, ${reffererTable.JavaName}CBSetupper cbSetupper);
+  #end
+
+        #endregion
+#end
+    #if ($table.isWritable())
+
+        // =====================================================================================
+        //                                                                   Basic Entity Update
+        //                                                                   ===================
+        #region Basic Entity Update
+
+        /// <summary>
+        /// Insert.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        void Insert(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Update.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        void Update(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Update after select.
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        void UpdateAfterSelect(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Insert or update after select.
+        /// </summary>
+        /// <param name="entity"> Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        void InsertOrUpdateAfterSelect(${myExtendedObjectClassName} entity);
+      #if ($database.isMakeBehaviorForUpdate())
+
+        /// <summary>
+        /// Update after select-for-update.
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        void UpdateAfterSelectForUpdate(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Insert or update after select-for-update.
+        /// </summary>
+        /// <param name="entity"> Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        void InsertOrUpdateAfterSelectForUpdate(${myExtendedObjectClassName} entity);
+      #end
+
+        /// <summary>
+        /// Delete.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        void Delete(${myExtendedObjectClassName} entity);
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Insert
+        //                                                                        ==============
+        #region Various Insert
+      #if ($table.isUseIdentity())
+        #if ($table.hasPrimaryKey())
+
+        int CopyInsertByPKValueAfterSelect(${table.PrimaryKeyArgsString});
+        #end
+
+		#if ($database.isMakeDeprecated())
+
+		//	K.Kotani added.
+        /// <summary>
+        /// Select for read only by primary-key map-string with deleted check.
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary-key map-string. (NotNull)</param>
+        /// <returns>Entity that is selected from database by select-for-read-only. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        [Obsolete("This class is deprecated. Please use CopyInsertByPKValueAfterSelect().")]
+        int CopyInsertByPKMapStringAfterSelect(String primaryKeyMapString);
+    	#end
+      #end
+
+        #endregion
+    #end
+
+    }
+
+    /// <summary>
+    /// The interface of CBSetupper.
+    /// </summary>
+    public interface ${table.JavaName}CBSetupper : SimpleCBSetupper {
+        /// <summary>
+        /// Set up condition.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        void Setup(${myConditionBeanClassName} ${glAttachedCBArgsVariableName});
+    }
+
+    /// <summary>
+    /// The implementation of CBSetupper. {order by PK Asc}
+    /// </summary>
+    public class ${table.JavaName}CBSetupperPKAsc : ${table.JavaName}CBSetupper {
+        /// <summary>
+        /// Set up condition.
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        public void Setup(${myConditionBeanClassName} ${glAttachedCBArgsVariableName}) {
+            ${glAttachedCBArgsVariableName}.AddOrderBy_PK_Asc();
+        }
+    }
+
+#if (${table.hasOnlyOnePrimaryKey()})
+  #foreach ($refferer in $table.Referrers)
+    #set ($reffererTable = $refferer.Table)
+    #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+    #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+    #set ($reffererBhvClassName = "${reffererEntityClassName}Bhv")
+    #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+    #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+    #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+    #set ($genericPKChildListMap = "${table.getPrimaryKeyJavaNativeAsOne()}, java.util.List${database.filterGenericsString(${reffererEntityClassName})}")
+
+    [Obsolete("This class is deprecated. Please use ${reffererTable.JavaName}CBSetupper.")]
+    public interface ${table.JavaName}ReffererCondition${refferer.ReffererPropertyNameInitCap} : ${reffererTable.JavaName}CBSetupper {
+    }
+  #end
+#end
+
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhvImpl.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhvImpl.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsbhv/BaseBhvImpl.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,963 @@
+#set ($myClassName = "${myExtendedBhvClassName}")
+
+using System;
+using System.Collections;
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonBhv};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonDBMeta};
+using ${myDBMetaPackageName};
+using ${glPackageExtendedDao};
+using ${glPackageExtendedEntity};
+using ${glPackageCB};
+
+#set ($myExtendClassName = "")
+#if ($table.isWritable())
+  #set ($myExtendClassName = "${glBehaviorWritableAbstractName}")
+#else
+  #set ($myExtendClassName = "${glBehaviorReadableAbstractName}")
+#end
+
+namespace ${glPackageExtendedBhv} {
+
+    /// <summary>
+    /// The behavior of ${table.Name}. (partial class for auto-generation)
+    /// Author : ${database.ClassAuthor}
+    /// </summary>
+    partial class ${myClassName} : ${glPackageBaseCommonBhv}.${myExtendClassName}, ${myExtendedBhvInterfaceName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        #region Attribute
+        /// <summary>Dao instance.</summary>
+        protected ${myExtendedDaoClassName} _dao;
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        public ${myClassName}() {
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        #region Table Name
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public override String TableDbName {
+            get { return "${table.Name}"; }
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                                DBMeta
+        //                                                                                ======
+        #region DBMeta
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public override ${glDBMetaInterfaceName} DBMeta {
+            get { return ${myDBMetaClassName}.GetInstance(); }
+        }
+
+        /// <summary>
+        /// The property of my dbmeta.
+        /// </summary>
+        public ${myDBMetaClassName} MyDBMeta {
+            get { return ${myDBMetaClassName}.GetInstance(); }
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                       Self Dispatcher
+        //                                                                       ===============
+        #region Self Dispatcher
+        /// <summary>
+        /// Behavior's self-dispatch
+        /// </summary>
+        /// <returns>${myExtendedBhvInterfaceName}</returns>
+        protected ${myExtendedBhvInterfaceName} Self {
+            get {
+                if (this.DaoSelector == null) {
+                    String msg = "Behavior's property 'DaoSelector' should not be null. This should have been initialized!";
+                    throw new SystemException(msg);
+                }
+                return (${myExtendedBhvInterfaceName})this.DaoSelector.GetRBhv(typeof(${myExtendedBhvInterfaceName}));
+            }
+        }
+
+        /// <summary>
+        ///  ${database.OverrideComment}
+        /// </summary>
+        /// <returns>${glBehaviorReadableInterfaceName}</returns>
+        protected override ${glBehaviorReadableInterfaceName} SelfReadable {
+            get { return this.Self; }
+        }
+    #if ($table.isWritable())
+
+        /// <summary>
+        ///  ${database.OverrideComment}
+        /// </summary>
+        /// <returns>${glBehaviorWritableInterfaceName}</returns>
+        protected override ${glBehaviorWritableInterfaceName} SelfWritable {
+            get { return this.Self; }
+        }
+    #end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                          Dao Accessor
+        //                                                                          ============
+        #region Dao Accessor
+        /// <summary>
+        /// Get my dao.
+        /// </summary>
+        /// <returns>My dao.</returns>
+        public ${myExtendedDaoClassName} Dao {
+            get { return _dao; }
+            set { _dao = value; }
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Dao-readable. (NotNull)</returns>
+        public override ${glDaoReadableInterfaceName} GetDaoReadable() {
+            return this.Dao;
+        }
+    #if ($table.isWritable())
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Dao-writable. (NotNull)</returns>
+        public override ${glDaoWritableInterfaceName} GetDaoWritable() {
+            return this.Dao;
+        }
+    #end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                          New Instance
+        //                                                                          ============
+        #region New Instance
+        /// <summary>
+        /// New entity.
+        /// </summary>
+        /// <returns>Entity. (NotNull)</returns>
+        public override ${glEntityInterfaceName} NewEntity() {
+            return NewMyEntity();
+        }
+
+        /// <summary>
+        /// New condition-bean.
+        /// </summary>
+        /// <returns>Condition-bean. (NotNull)</returns>
+        public override ${glConditionBeanInterfaceName} NewConditionBean() {
+            return NewMyConditionBean();
+        }
+
+        /// <summary>
+        /// New my entity.
+        /// </summary>
+        /// <returns>My condition-bean. (NotNull)</returns>
+        public ${myExtendedObjectClassName} NewMyEntity() {
+            return new ${myExtendedObjectClassName}();
+        }
+
+        /// <summary>
+        /// New my condition-bean.
+        /// </summary>
+        /// <returns>My condition-bean. (NotNull)</returns>
+        public ${myConditionBeanClassName} NewMyConditionBean() {
+            return new ${myConditionBeanClassName}();
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                       Delegate Method
+        //                                                                       ===============
+        #region Delegate-Method
+        /// <summary>
+        /// Select all list. (Delegate-Method)
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        int ${myExtendedBhvInterfaceName}.DelegateGetCountAll() {
+            return this.Dao.GetCountAll();
+        }
+
+        /// <summary>
+        /// Select all list. (Delegate-Method)
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        IList ${myExtendedBhvInterfaceName}.DelegateGetListAll() {
+            return this.Dao.GetListAll();
+        }
+
+        /// <summary>
+        /// Select all list. (Delegate-Method)
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        IList ${myExtendedBhvInterfaceName}.DelegateSelectListAll() {// for saving compatible
+            return this.Dao.GetListAll();
+        }
+#if ($table.hasPrimaryKey())
+
+        //
+        // Get entity. (Delegate-Method)
+        // 
+        // @param Primary-keys (NotNull)
+        // @return Entity. (NotNull)
+        //
+        ${myExtendedObjectClassName} ${myExtendedBhvInterfaceName}.DelegateGetEntity(${table.PrimaryKeyArgsString}) {
+            return this.Dao.GetEntity(${table.getPrimaryKeyUncapitalisedJavaNameCommaString()});
+        }
+#end
+
+        /// <summary>
+        /// Select count by condition-bean. (Delegate-Method)
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        int ${myExtendedBhvInterfaceName}.DelegateSelectCount(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return this.Dao.SelectCount(cb);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        protected override int DoCallReadCount(${glConditionBeanInterfaceName} cb) {
+            return this.Self.DelegateSelectCount((${myConditionBeanClassName})cb);
+        }
+
+#if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Select count by condition-bean. (Delegate-Method)
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        [Obsolete("This method is deprecated. Please use DelegateSelectCount()")]
+        int ${myExtendedBhvInterfaceName}.DelegateSelectCountIgnoreFetchScope(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return this.Dao.SelectCountIgnoreFetchScope(cb);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        [Obsolete("This method is deprecated. Please don't use!")]
+        protected override int DoCallReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb) {
+            return this.Self.DelegateSelectCountIgnoreFetchScope((${myConditionBeanClassName})cb);
+        }
+#end
+
+        /// <summary>
+        /// Select entity by condition-bean. (Delegate-Method)
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected entity. If the select result is zero, it returns null. (Nullable)</returns>
+        ${myExtendedObjectClassName} ${myExtendedBhvInterfaceName}.DelegateSelectEntity(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return this.Dao.SelectEntity(cb);
+        }
+
+        /// <summary>
+        /// Select list by condition-bean. (Delegate-Method)
+        /// </summary> 
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        IList ${myExtendedBhvInterfaceName}.DelegateSelectList(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return this.Dao.SelectList(cb);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary> 
+        /// <returns>Selected all count. If the select result is zero, it returns empty list. (NotNull)</returns>
+        protected override int DoCallGetCountAll() {
+            return this.Self.DelegateGetCountAll();
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        protected override IList DoCallGetListAll() {
+            return this.Self.DelegateGetListAll();
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected entity. If the select result is zero, it returns null. (Nullable)</returns>
+        protected override ${glEntityInterfaceName} DoCallReadEntity(${glConditionBeanInterfaceName} cb) {
+            return this.Self.DelegateSelectEntity((${myConditionBeanClassName})cb);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary> 
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        protected override IList DoCallReadList(${glConditionBeanInterfaceName} cb) {
+            return this.Self.DelegateSelectList((${myConditionBeanClassName})cb);
+        }
+
+#if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary> 
+        /// <returns>Selected all list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        protected override IList DoDelegateReadAllList() {
+            return this.Self.DelegateGetListAll();
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        [Obsolete("This method is deprecated. Please don't use!")]
+        protected override int DoDelegateReadCountIgnoreFetchScope(${glConditionBeanInterfaceName} cb) {
+            return this.Self.DelegateSelectCountIgnoreFetchScope((${myConditionBeanClassName})cb);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected entity. If the select result is zero, it returns null. (Nullable)</returns>
+        protected override ${glEntityInterfaceName} DoDelegateReadEntity(${glConditionBeanInterfaceName} cb) {
+            return this.Self.DelegateSelectEntity((${myConditionBeanClassName})cb);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary> 
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        protected override IList DoDelegateReadList(${glConditionBeanInterfaceName} cb) {
+            return this.Self.DelegateSelectList((${myConditionBeanClassName})cb);
+        }
+#end
+
+    #if ($table.isUseSequence())
+
+        /// <summary>
+        /// Select next value as sequence. (Delegate-Method)
+        /// </summary>
+        /// <returns>Next value. (NotNull)</returns>
+        int ${myExtendedBhvInterfaceName}.DelegateSelectNextVal() {
+            return this.Dao.SelectNextVal();
+        }
+    #end
+
+    #if ($table.isWritable())
+
+        /// <summary>
+        /// Insert one entity. (Delegate-Method)
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Inserted count.</returns>
+        int ${myExtendedBhvInterfaceName}.DelegateInsert(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNull(entity);// If this table use identity, the entity does not have primary-key.
+            FilterEntityOfInsert(entity);
+            AssertEntityOfInsert(entity);
+            return this.Dao.Insert(entity);
+        }
+
+        /// <summary>
+        /// Update one entity. (Delegate-Method)
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Updated count.</returns>
+        int ${myExtendedBhvInterfaceName}.DelegateUpdate(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            FilterEntityOfUpdate(entity);
+            AssertEntityOfUpdate(entity);
+            return this.Dao.Update(entity);
+        }
+
+        /// <summary>
+        /// Delete one entity. (Delegate-Method)
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Deleted count.</returns>
+        int ${myExtendedBhvInterfaceName}.DelegateDelete(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            FilterEntityOfDelete(entity);
+            AssertEntityOfDelete(entity);
+            return this.Dao.Delete(entity);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Inserted count.</returns>
+        protected override int DoCallCreate(${glEntityInterfaceName} entity) {
+            return this.Self.DelegateInsert((${myExtendedObjectClassName})entity);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Updated count.</returns>
+        protected override int DoCallModify(${glEntityInterfaceName} entity) {
+            return this.Self.DelegateUpdate((${myExtendedObjectClassName})entity);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Deleted count.</returns>
+        protected override int DoCallRemove(${glEntityInterfaceName} entity) {
+            return this.Self.DelegateDelete((${myExtendedObjectClassName})entity);
+        }
+
+#if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Inserted count.</returns>
+        protected override int DoDelegateCreate(${glEntityInterfaceName} entity) {
+            return this.Self.DelegateInsert((${myExtendedObjectClassName})entity);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Updated count.</returns>
+        protected override int DoDelegateModify(${glEntityInterfaceName} entity) {
+            return this.Self.DelegateUpdate((${myExtendedObjectClassName})entity);
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Deleted count.</returns>
+        protected override int DoDelegateRemove(${glEntityInterfaceName} entity) {
+            return this.Self.DelegateDelete((${myExtendedObjectClassName})entity);
+        }
+#end
+
+    #end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                          Basic Select
+        //                                                                          ============
+        #region Basic Select
+
+        /// <summary>
+        /// Select count by condition-bean.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        public int SelectCount(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+	        return this.Self.DelegateSelectCount(cb);
+        }
+
+        /// <summary>
+        /// Select entity by condition-bean.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected entity. (Nullalble)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasOverlappedException}"></exception>
+        public ${myExtendedObjectClassName} SelectEntity(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            System.Collections.IList ls = this.Self.DelegateSelectList(cb);
+            if (ls.Count == 0) {
+                return null;
+            }
+            AssertRecordHasBeenSelectedAsOne(ls, cb);
+            return (${myExtendedObjectClassName})ls[0];
+        }
+
+        /// <summary>
+        /// Select entity by condition-bean with deleted check.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected entity. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasOverlappedException}"></exception>
+        public ${myExtendedObjectClassName} SelectEntityWithDeletedCheck(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            System.Collections.IList ls = this.Self.DelegateSelectList(cb);
+            AssertRecordHasNotBeenDeleted(ls, cb);
+            AssertRecordHasBeenSelectedAsOne(ls, cb);
+            return (${myExtendedObjectClassName})ls[0];
+        }
+
+    #if ($table.hasPrimaryKey())
+
+        public ${myExtendedObjectClassName} SelectByPKValueWithDeletedCheck(${table.PrimaryKeyArgsString}) {
+            ${myExtendedObjectClassName} entity = new ${myExtendedObjectClassName}();
+            ${table.getPrimaryKeyArgsSetupStringCSharp('entity')}
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            return this.Self.SelectEntityWithDeletedCheck(cb);
+        }
+    #end
+    #if ($table.hasPrimaryKey() && $database.isMakeBehaviorForUpdate())
+
+        public ${myExtendedObjectClassName} SelectByPKValueWithDeletedCheckForUpdate(${table.PrimaryKeyArgsString}) {
+            ${myExtendedObjectClassName} entity = new ${myExtendedObjectClassName}();
+            ${table.getPrimaryKeyArgsSetupStringCSharp('entity')}
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            cb.LockForUpdate();
+            return this.Self.SelectEntityWithDeletedCheck(cb);
+        }
+
+      #if ($database.isMakeDeprecated())
+
+		//	K.Kotani Added.
+        [Obsolete("This method is deprecated. Please use SelectByPKValueWithDeleteCheckForUpdate.")]
+        public ${myExtendedObjectClassName} SelectForUpdateByPKMapStringWithDeletedCheck(String primaryKeyMapString) {
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(primaryKeyMapString);
+            cb.LockForUpdate();
+            return this.Self.SelectEntityWithDeletedCheck(cb);
+        }
+      #end
+    #end
+
+
+        /// <summary>
+        /// Select list.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>List-result-bean. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}"></exception>
+        public ${glListResultBeanName} SelectList(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return new ResultBeanBuilder(this).BuildListResultBean(cb, this.Self.DelegateSelectList(cb));
+        }
+
+        /// <summary>
+        /// Select page.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <returns>Selected page. (NotNull)</returns>
+        public ${glPagingResultBeanName} SelectPage(${myConditionBeanClassName} cb) {
+            AssertConditionBeanNotNull(cb);
+            return this.Self.SelectPage(cb, new SelectPageSimpleInvoker(this));
+        }
+
+        /// <summary>
+        /// Select page.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="invoker">Select-page-invoker. (NotNull)</param>
+        /// <returns>Read page. (NotNull)</returns>
+        public ${glPagingResultBeanName} SelectPage(${myConditionBeanClassName} cb, SelectPageInvoker invoker) {
+            AssertConditionBeanNotNull(cb);
+            return invoker.InvokeSelectPage(new SelectPageSimpleCallback(cb, this));
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Select
+        //                                                                        ==============
+        #region Various Select
+    #if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Select list after checking count(ignore fetch scope).
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="maxCount">Max count.</param>
+        /// <returns>List-result-bean. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}"></exception>
+        [Obsolete("This method is deprecated.")]
+        public ${glListResultBeanName} SelectListAfterCheckingCountIgnoreFetchScope(${myConditionBeanClassName} cb, int maxCount) {
+            AssertConditionBeanNotNull(cb);
+            int selectedCount = this.Self.DelegateSelectCountIgnoreFetchScope(cb);
+            AssertSelectedCountHasNotExceededMaxCount(selectedCount, maxCount, cb);
+            return new ResultBeanBuilder(this).BuildListResultBean(cb, this.Self.DelegateSelectList(cb));
+        }
+    #end
+
+        /// <summary>
+        /// Select page as first.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="fetchSize">Fetch-size.</param>
+        /// <returns>Selected page as first page. (NotNull)</returns>
+        public ${glPagingResultBeanName} SelectPageAsFirst(${myConditionBeanClassName} cb, int fetchSize) {
+            AssertConditionBeanNotNull(cb);
+            cb.FetchFirst(fetchSize);
+            return this.Self.SelectPage(cb);
+        }
+
+        /// <summary>
+        /// Select page by page-number.
+        /// If result-page is 'rb.getAllRecordCount > 0 && rb.getSelectedList().size() == 0', re-select as max-page.
+        /// </summary>
+        /// <param name="cb">Condition-bean. (NotNull)</param>
+        /// <param name="fetchPageNumber">Fetch-page-number.</param>
+        /// <returns>Selected page as [fetchPageNumber] page. (NotNull)</returns>
+        public ${glPagingResultBeanName} SelectPageByPageNumber(${myConditionBeanClassName} cb, int fetchPageNumber) {
+            AssertConditionBeanNotNull(cb);
+            cb.FetchPage(fetchPageNumber);
+            return this.Self.SelectPage(cb);
+        }
+
+    #if ($table.hasPrimaryKey())
+      #if ($database.isMakeDeprecated())
+
+        [Obsolete("This class is deprecated. Please use SelectByPKMapStringWithDeletedCheck().")]
+        public ${myExtendedObjectClassName} SelectForReadOnlyByPKValueWithDeletedCheck(${table.PrimaryKeyArgsString}) {
+            ${myExtendedObjectClassName} entity = new ${myExtendedObjectClassName}();
+            ${table.getPrimaryKeyArgsSetupStringCSharp('entity')}
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            return SelectEntityWithDeletedCheck(cb);
+        }
+      #end
+    #end
+    #if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Select for read only by primary-key map-string with deleted check.
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary-key map-string. (NotNull)</param>
+        /// <returns>Entity that is selected from database by select-for-read-only. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        [Obsolete("This class is deprecated. Please use SelectByPKMapStringWithDeletedCheck().")]
+        public ${myExtendedObjectClassName} SelectForReadOnlyByPKMapStringWithDeletedCheck(String primaryKeyMapString) {
+            AssertStringNotNullAndNotTrimmedEmpty("primaryKeyMapString", primaryKeyMapString);
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(primaryKeyMapString);
+            ${glPackageExtendedEntity}.${myExtendedObjectClassName} currentEntity = this.Self.DelegateSelectEntity(cb);
+            AssertRecordHasNotBeenDeleted(currentEntity, primaryKeyMapString);
+            return currentEntity;
+        }
+    #end
+
+        #endregion
+#if (${table.hasOnlyOnePrimaryKey()})
+
+        // =====================================================================================
+        //                                                                         Load Refferer
+        //                                                                         =============
+        #region Load Refferer
+  #foreach ($refferer in $table.Referrers)
+    #set ($reffererTable = $refferer.Table)
+    #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+    #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+    #set ($reffererBhvClassName = "")
+    #set ($reffererBhvClassName = "${reffererEntityClassName}Bhv")
+    #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+    #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+    #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+    #set ($genericPKChildListMap = "${table.getPrimaryKeyJavaNativeAsOne()}, java.util.List${database.filterGenericsString(${reffererEntityClassName})}")
+
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   ReffererTable    = [${refferer.Table.Name}]
+        //   ReffererProperty = [${refferer.ReffererPropertyName}]
+        // * * * * * * * * */
+
+        /// <summary>
+        /// Load refferer of ${refferer.ReffererPropertyName}.
+        /// Default refferer condition is 'primary-key asc'.
+        /// </summary>
+        /// <param name="ls">Entity list of main table. (NotNull)</param>
+        public void Load${refferer.ReffererPropertyNameInitCap}(System.Collections.IList ls) {
+            Load${refferer.ReffererPropertyNameInitCap}(ls, new ${reffererTable.JavaName}CBSetupperPKAsc());
+        }
+
+        /// <summary>
+        /// Load refferer of ${refferer.ReffererPropertyName}.
+        /// </summary>
+        /// <param name="ls">Entity list of main table. (NotNull)</param>
+        /// <param name="cbSetupper">Refferer condition-bean setupper instance for registering refferer condition. (NotNull)</param>
+        public void Load${refferer.ReffererPropertyNameInitCap}(System.Collections.IList ls, ${reffererTable.JavaName}CBSetupper cbSetupper) {
+            AssertObjectNotNull("ls", ls);
+            AssertObjectNotNull("cbSetupper", cbSetupper);
+            if (ls.Count == 0) {
+                return;
+            }
+
+            System.Collections.IDictionary pkMyEntityMap = new System.Collections.Hashtable();
+            System.Collections.IList pkList = new System.Collections.ArrayList();
+            foreach (${myExtendedObjectClassName} entity in ls) {
+                pkList.Add(entity.${table.getPrimaryKeyJavaNameAsOne()});
+                if (pkMyEntityMap.Contains(entity.${table.getPrimaryKeyJavaNameAsOne()})) {
+                    pkMyEntityMap.Add(entity.${table.getPrimaryKeyJavaNameAsOne()}, entity);
+                }
+            }
+            ${reffererBhvClassName} reffererBhv = (${reffererBhvClassName})this.DaoSelector.GetRBhv(typeof(${reffererBhvClassName}));
+            ${reffererCBClassName} cb = reffererBhv.NewMyConditionBean();
+            cb.Query().Set${refferer.getLocalColumnJavaNameAsOne()}_InScope(pkList);
+            cb.Query().AddOrderBy_${refferer.getLocalColumnJavaNameAsOne()}_Asc();
+            cbSetupper.Setup(cb);
+            System.Collections.IList reffererList = reffererBhv.DelegateSelectList(cb);
+
+            System.Collections.IDictionary pkReffererListMap = new System.Collections.Hashtable();
+            foreach (${reffererEntityClassName} reffererEntity in reffererList) {
+                if (!pkReffererListMap.Contains(reffererEntity.${refferer.getLocalColumnJavaNameAsOne()})) {
+                    pkReffererListMap.Add(reffererEntity.${refferer.getLocalColumnJavaNameAsOne()}, new System.Collections.ArrayList());
+                }
+                ((System.Collections.IList)pkReffererListMap[reffererEntity.${refferer.getLocalColumnJavaNameAsOne()}]).Add(reffererEntity);
+
+                // for Reverse Reference.
+                ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})pkMyEntityMap[reffererEntity.${refferer.getLocalColumnJavaNameAsOne()}];
+                reffererEntity.${refferer.ForeignPropertyNameInitCap} = myEntity;
+            }
+
+            foreach (${myExtendedObjectClassName} entity in ls) {
+                if (pkReffererListMap.Contains(entity.${table.getPrimaryKeyJavaNameAsOne()})) {
+                    entity.${refferer.ReffererPropertyNameInitCap} = (System.Collections.IList)pkReffererListMap[entity.${table.getPrimaryKeyJavaNameAsOne()}];
+                } else {
+                    entity.${refferer.ReffererPropertyNameInitCap} = new System.Collections.ArrayList();
+                }
+            }
+        }
+
+        [Obsolete("This class is deprecated. Please use ${reffererTable.JavaName}CBSetupperPKAsc.")]
+        public class ${table.JavaName}ReffererCondition${refferer.ReffererPropertyNameInitCap}PKAsc : ${reffererTable.JavaName}CBSetupper {
+            public void Setup(${reffererCBClassName} cb) {
+                cb.AddOrderBy_PK_Asc();
+            }
+        }
+  #end
+
+        #endregion
+#end
+    #if ($table.isWritable())
+
+        // =====================================================================================
+        //                                                                   Basic Entity Update
+        //                                                                   ===================
+        #region Basic Entity Update
+        /// <summary>
+        /// Insert.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        public void Insert(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNull(entity);
+            this.Self.DelegateInsert(entity);
+        }
+
+        /// <summary>
+        /// Update.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        public void Update(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNull(entity);
+            int updatedCount = this.Self.DelegateUpdate(entity);
+            if (updatedCount != 1) {
+                throw new Seasar.Dao.NotSingleRowUpdatedRuntimeException(entity, updatedCount);
+            }
+        }
+
+        /// <summary>
+        /// Update after select.
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        public void UpdateAfterSelect(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            ${myExtendedObjectClassName} currentEntity = SelectEntityWithDeletedCheck(cb);
+            MergeEntity(entity, currentEntity);
+            this.Self.Update(currentEntity);
+        }
+
+        /// <summary>
+        /// Insert or update.
+        /// </summary>
+        /// <param name="entity"> Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+// TODO: @jflute - In development
+//        public void InsertOrUpdate(${myExtendedObjectClassName} entity) {
+//            AssertEntityNotNull(entity);
+//            if (!entity.HasPrimaryKeyValue) {
+//                this.Self.Insert(entity);
+//                return;
+//            }
+//            try {
+//                this.Self.Update(entity);
+//            } catch (Exception) {
+//                this.Self.Insert(entity);
+//                return;
+//            }
+//        }
+
+        /// <summary>
+        /// Insert or update after select.
+        /// </summary>
+        /// <param name="entity"> Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        public void InsertOrUpdateAfterSelect(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNull(entity);
+            if (!entity.HasPrimaryKeyValue) {
+                this.Self.Insert(entity);
+                return;
+            }
+            ${myExtendedObjectClassName} currentEntity = null;
+            try {
+                ${myConditionBeanClassName} cb = NewMyConditionBean();
+                cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+                currentEntity = SelectEntityWithDeletedCheck(cb);
+            } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}) {
+                this.Self.Insert(entity);
+                return;
+            }
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            MergeEntity(entity, currentEntity);
+            this.Self.Update(currentEntity);
+        }
+      #if ($database.isMakeBehaviorForUpdate())
+
+        /// <summary>
+        /// Update after select-for-update.
+        /// </summary>
+        /// <param name="entity">Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        public void UpdateAfterSelectForUpdate(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            cb.LockForUpdate();
+            ${myExtendedObjectClassName} currentEntity = SelectEntityWithDeletedCheck(cb);
+            MergeEntity(entity, currentEntity);
+            this.Self.Update(currentEntity);
+        }
+
+        /// <summary>
+        /// Insert or update after select-for-update.
+        /// </summary>
+        /// <param name="entity"> Entity. This must contain primary-key value at least. (NotNull)</param>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        public void InsertOrUpdateAfterSelectForUpdate(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNull(entity);
+            if (!entity.HasPrimaryKeyValue) {
+                this.Self.Insert(entity);
+                return;
+            }
+            ${myExtendedObjectClassName} currentEntity = null;
+            try {
+                ${myConditionBeanClassName} cb = NewMyConditionBean();
+                cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+                cb.LockForUpdate();
+                currentEntity = SelectEntityWithDeletedCheck(cb);
+            } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}) {
+                this.Self.Insert(entity);
+                return;
+            }
+            AssertEntityNotNullAndHasPrimaryKeyValue(entity);
+            MergeEntity(entity, currentEntity);
+            this.Self.Update(currentEntity);
+        }
+      #end
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="sourceEntity">Source entity. (NotNull)</param>
+        /// <param name="destinationEntity">Destination entity. (NotNull)</param>
+        protected override void MergeEntity(${glEntityInterfaceName} sourceEntity, ${glEntityInterfaceName} destinationEntity) {
+            AssertObjectNotNull("sourceEntity", sourceEntity);
+            AssertObjectNotNull("destinationEntity", destinationEntity);
+            ${myExtendedObjectClassName} sourceMyEntity = (${myExtendedObjectClassName})sourceEntity;
+            ${myExtendedObjectClassName} destinationMyEntity = (${myExtendedObjectClassName})destinationEntity;
+      #foreach ($col in $table.Columns)
+
+            if (sourceMyEntity.IsSetterInvoked${col.JavaName}()) {
+                destinationMyEntity.${col.JavaName} = sourceMyEntity.${col.JavaName};
+            }
+      #end
+
+        }
+
+        /// <summary>
+        /// Delete.
+        /// </summary>
+        /// <param name="entity"> Entity. (NotNull)</param>
+        public void Delete(${myExtendedObjectClassName} entity) {
+            AssertEntityNotNull(entity);
+            this.Self.DelegateDelete(entity);
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Various Insert
+        //                                                                        ==============
+        #region Various Insert
+      #if ($table.isUseIdentity())
+        #if ($table.hasPrimaryKey())
+
+        // <summary>
+        // Copy-insert after select-for-update.
+        // </summary>
+        // <param name="primaryKey">Primary-keys. (NotNull)</param>
+        // <returns>Inserted count.</returns>
+        // <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        public int CopyInsertByPKValueAfterSelect(${table.PrimaryKeyArgsString}) {
+            ${myExtendedObjectClassName} entity = new ${myExtendedObjectClassName}();
+            ${table.getPrimaryKeyArgsSetupStringCSharp('entity')}
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(entity.ExtractPrimaryKeyMapString());
+            ${myExtendedObjectClassName} currentEntity = SelectEntityWithDeletedCheck(cb);
+            FilterCopyInsertEntity(currentEntity);
+            return this.Self.DelegateInsert(currentEntity);
+        }
+		  #if ($database.isMakeDeprecated())
+
+		//	K.Kotani added.
+        /// <summary>
+        /// Select for read only by primary-key map-string with deleted check.
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary-key map-string. (NotNull)</param>
+        /// <returns>Entity that is selected from database by select-for-read-only. (NotNull)</returns>
+        /// <exception cref="${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}"></exception>
+        [Obsolete("This class is deprecated. Please use CopyInsertByPKValueAfterSelect().")]
+        public int CopyInsertByPKMapStringAfterSelect(String primaryKeyMapString) {
+            ${myConditionBeanClassName} cb = NewMyConditionBean();
+            cb.AcceptPrimaryKeyMapString(primaryKeyMapString);
+            ${myExtendedObjectClassName} currentEntity = SelectEntityWithDeletedCheck(cb);
+            FilterCopyInsertEntity(currentEntity);
+            return this.Self.DelegateInsert(currentEntity);
+        }
+    	  #end
+        #end
+      #end
+
+        #endregion
+    #end
+
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BaseDao.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BaseDao.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BaseDao.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,198 @@
+#set ($myClassName = "${myExtendedDaoClassName}")
+
+using System;
+using System.Collections;
+using ${myExtendedEntityPackageName};
+#set ($InterfaceName = "")
+#if ($table.hasPrimaryKey())
+  #set ($InterfaceName = "${glPackageBaseCommon}.${glDaoWritableInterfaceName}")
+#else
+  #set ($InterfaceName = "${glPackageBaseCommon}.${glDaoReadableInterfaceName}")
+#end
+
+namespace ${myExtendedDaoPackageName} {
+
+    /// <summary>
+    /// The dao interface of ${table.Name}. (partial interface for auto-generation)
+    /// 
+    /// [primary-key]
+    ///     ${table.PrimaryKeyNameCommaString}
+    /// 
+    /// [all-columns]
+    ///     ${table.ColumnNameCommaString}
+    /// 
+    /// [foreign-table]
+    ///     ${table.ForeignPropertyNameCommaString}
+    /// 
+    /// [refferer-table]
+    ///     ${table.ReferrerPropertyNameCommaString}
+    /// 
+    /// [sequence]
+    ///     ${table.DefinedSequenceName}
+    /// 
+    /// [identity]
+    ///     ${table.IdentityPropertyName}
+    /// 
+    /// [update-date]
+    ///     ${table.UpdateDateJavaName}
+    /// 
+    /// [version-no]
+    ///     ${table.VersionNoJavaName}
+    /// 
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [Seasar.Dao.Attrs.Bean(typeof(${myExtendedEntityPackageName}.${myExtendedObjectClassName}))]
+    public partial interface ${myClassName} : ${InterfaceName} {
+
+        /// <summary>
+        /// Get count of all records.
+        /// It is necessary that sub interface of this have SQL-Annotation.
+        /// </summary>
+        /// <returns>Count of all records.</returns>
+        [Seasar.Dao.Attrs.Sql("select count(*) from ${table.Name}")]
+        int GetCountAll();
+
+        /// <summary>
+        /// Get list of all records.
+        /// It is necessary that sub interface of this have SQL-Annotation.
+        /// </summary>
+        /// <returns>List of all records.</returns>
+        [Seasar.Dao.Attrs.Sql("select * from ${table.Name}")]
+        System.Collections.IList GetListAll();
+#if ($table.hasPrimaryKey())
+
+        [Seasar.Dao.Attrs.Sql("select * from ${table.Name} where ${table.PrimaryKeyWhereStringWithSqlComment}")]
+        ${myExtendedObjectClassName} GetEntity(${table.PrimaryKeyArgsString});
+#end
+
+        /// <summary>
+        /// Select count by condition-bean.
+        /// Ignore fetchFirst() and fetchScope() and fetchPage(). But the fetch status of the condition-bean remains as it is.
+        /// This select method generates SQL based on condition-bean.
+        /// <para>
+        /// Example)
+        ///   final ${myConditionBeanClassName} ${glAttachedCBArgsVariableName} = new ${myConditionBeanClassName}();
+        ///   ${glAttachedCBArgsVariableName}.query().setXxx_GreaterEqual(new BigDecimal(14));
+        ///   final int count = dao.${database.ConditionBeanSelectCountMethodName}(${glAttachedCBArgsVariableName});
+        /// </para>
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        int SelectCount(${myAttachedCBArgsString});
+
+        /// <summary>
+        /// Select count by condition-bean.
+        /// Ignore fetchFirst() and fetchScope() and fetchPage(). But the fetch status of the condition-bean remains as it is.
+        /// This select method generates SQL based on condition-bean.
+        /// <para>
+        /// Example)
+        ///   final ${myConditionBeanClassName} ${glAttachedCBArgsVariableName} = new ${myConditionBeanClassName}();
+        ///   ${glAttachedCBArgsVariableName}.query().setXxx_GreaterEqual(new BigDecimal(14));
+        ///   final int count = dao.${database.ConditionBeanSelectCountMethodName}(${glAttachedCBArgsVariableName});
+        /// </para>
+        /// </summary>
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected count. (NotNull)</returns>
+        [Obsolete("This method is deprecated. Please use SelectCount()")]
+        int SelectCountIgnoreFetchScope(${myAttachedCBArgsString});
+
+        /// <summary>
+        /// Select entity '${myExtendedObjectClassName}' by condition-bean.
+        /// This select method generates SQL based on condition-bean.
+        /// <para>
+        /// Example)
+        ///   final ${myConditionBeanClassName} ${glAttachedCBArgsVariableName} = new ${myConditionBeanClassName}();
+        ///   ${glAttachedCBArgsVariableName}.query().setXxxCode_Equal("abc");// It is assumed that this is the primary key...
+        ///   ${glAttachedCBArgsVariableName}.lockForUpdate();
+        ///   final ${myExtendedObjectClassName} entity = dao.selectEntity(${glAttachedCBArgsVariableName});
+        /// </para>
+        /// </summary> 
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected entity. If the select result is zero, it returns null. (Nullable)</returns>
+        ${myExtendedObjectClassName} SelectEntity(${myAttachedCBArgsString});
+
+        /// <summary>
+        /// Select list by condition-bean.
+        /// This select method generates SQL based on condition-bean.
+        /// <para>
+        /// Example)
+        ///   final ${myConditionBeanClassName} ${glAttachedCBArgsVariableName} = new ${myConditionBeanClassName}();
+        ///   ${glAttachedCBArgsVariableName}.setupSelect_Xxx(); // Including the foreign table in select clause
+        ///   ${glAttachedCBArgsVariableName}.query().setXxxName_PrefixSearch("abc");
+        ///   ${glAttachedCBArgsVariableName}.query().setXxxStartDate_IsNotNull();
+        ///   ${glAttachedCBArgsVariableName}.addOrderBy_PK_Asc().fetchFirst(20);
+        ///   final List resultList = dao.selectList(${glAttachedCBArgsVariableName});
+        /// </para>
+        /// </summary> 
+        /// <param name="${glAttachedCBArgsVariableName}">Condition-bean. (NotNull)</param>
+        /// <returns>Selected list. If the select result is zero, it returns empty list. (NotNull)</returns>
+        System.Collections.IList SelectList(${myAttachedCBArgsString});
+
+#if ($table.hasPrimaryKey())
+
+        /// <summary>
+        /// Insert one entity.
+        /// </summary>
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Inserted count.</returns>
+        int Insert(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Update one entity.
+        /// </summary> 
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Updated count.</returns>
+        int Update(${myExtendedObjectClassName} entity);
+
+        /// <summary>
+        /// Delete one entity.
+        /// </summary> 
+        /// <param name="entity">Entity. (NotNull)</param>
+        /// <returns>Deleted count.</returns>
+        int Delete(${myExtendedObjectClassName} entity);
+		
+        /// <summary>
+        /// Insert several entities.
+        /// </summary> 
+        /// <param name="entityList">Entity-list. (NotNull)</param>
+        /// <returns>Inserted count.</returns>
+/// TODO: This method has not been supported yet at S2Dao-dotNet. (2006/06/09)
+//        int InsertList(System.Collections.IList entityList);
+
+        /// <summary>
+        /// Update several entities.
+        /// </summary> 
+        /// <param name="entityList">Entity-list. (NotNull)</param>
+        /// <returns>Updated count.</returns>
+/// TODO: This method has not been supported yet at S2Dao-dotNet. (2006/06/09)
+//        int UpdateList(System.Collections.IList entityList);
+
+        /// <summary>
+        /// Delete several entities.
+        /// </summary> 
+        /// <param name="entityList">Entity-list. (NotNull)</param>
+        /// <returns>Deleted count.</returns>
+/// TODO: This method has not been supported yet at S2Dao-dotNet. (2006/06/09)
+//        int DeleteList(System.Collections.IList entityList);
+
+        /// <summary>
+        /// Delete all entities.
+        /// It is necessary that sub interface of this have SQL-Annotation.
+        /// </summary>
+        /// <returns>Deleted count.</returns>
+        [Seasar.Dao.Attrs.Sql("delete from ${table.Name}")]
+        int RemoveAll();
+#end
+
+#if ($table.isUseSequence())
+
+        /// <summary>
+        /// Select next value as sequence.
+        /// </summary>
+        /// <returns>Next value. (NotNull)</returns>
+        [Seasar.Dao.Attrs.Sql("${table.SequenceNextSql}")]
+        int SelectNextVal();
+#end
+
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BsParameterBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BsParameterBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/BsParameterBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,70 @@
+
+#set ($myClassName = "${myExtendedParameterBeanClassName}")
+
+using System;
+using System.Text;
+
+namespace ${glPackageExtendedParameterBean} {
+
+    /// <summary>
+    /// The parametaer-bean of ${pmbClassName}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public partial class ${myClassName} ${database.getPmbMetaDataSuperClassDefinition($pmbClassName)}{
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+#foreach ($propertyName in $database.getPmbMetaDataPropertySet($pmbClassName))
+  #set ($propertyType = $database.getPmbMetaDataPropertyType($pmbClassName, $propertyName))
+
+        /// <summary>The value of ${propertyName}. </summary>
+        protected ${propertyType} _${propertyName};
+#end
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /**
+         * Constructor.
+         */
+        public ${myClassName}() {
+        }
+
+        // =====================================================================================
+        //                                                                              Accessor
+        //                                                                              ========
+#foreach ($propertyName in $database.getPmbMetaDataPropertySet($pmbClassName))
+  #set ($propertyType = $database.getPmbMetaDataPropertyType($pmbClassName, $propertyName))
+
+        /**
+         * Get the value of ${propertyName}.
+         * 
+         * @return The value of ${propertyName}.
+         */
+        public ${propertyType} ${database.initCap($propertyName)} {
+            get { return _${propertyName}; }
+            set { _${propertyName} = value; }
+        }
+#end
+
+        // =====================================================================================
+        //                                                                 Basic Override Method
+        //                                                                 =====================
+        /**
+         * ${database.OverrideComment}
+         * 
+         * @return Property-string. (NotNull)
+         */
+        public override String ToString() {
+            StringBuilder sb = new StringBuilder();
+#foreach ($propertyName in $database.getPmbMetaDataPropertySet($pmbClassName))
+
+            sb.Append(" ${propertyName}=").Append(_${propertyName});
+#end
+
+            return sb.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/customize/BaseCustomizeDao.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/customize/BaseCustomizeDao.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsdao/customize/BaseCustomizeDao.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,28 @@
+#set ($myClassName = "${myExtendedDaoClassName}")
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+#foreach ($import in $table.getCustomizeDaoImportList())
+
+${import};
+#end
+
+namespace ${myExtendedDaoPackageName} {
+
+    /// <summary>
+    /// The customize-dao interface of ${table.Name}. (partial interface for auto-generation)
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [Seasar.Dao.Attrs.Bean(typeof(${myExtendedEntityPackageName}.${myExtendedObjectClassName}))]
+    public partial interface ${myClassName} : ${glDaoReadableInterfaceName} {
+
+#foreach ($methodName in $table.getCustomizeDaoMethodNameList())
+  #set ($argument = $table.getCustomizeDaoMethodMap().get($methodName))
+
+        ${table.getCustomizeDaoReturnTypeCSharp(${methodName})} ${methodName}(${argument});
+#end
+
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/BaseEntity.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/BaseEntity.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/BaseEntity.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,990 @@
+
+#set ($myClassName = "${myExtendedObjectClassName}")
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Text;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonDBMeta};
+using ${glPackageBaseCommonHelper};
+using ${myDBMetaPackageName};
+
+#set ($myEntityInterfaceName = "")
+#if (${table.hasAllCommonColumn()})
+  #set ($myEntityInterfaceName = ${glEntityDefinedCommonColumnInterfaceName})
+#else
+  #set ($myEntityInterfaceName = ${glEntityInterfaceName})
+#end
+
+namespace ${myExtendedEntityPackageName} {
+
+    [Seasar.Dao.Attrs.Table("${table.AnnotationTableName}")]
+
+#if ($table.isUseUpdateDate())
+    [Seasar.Dao.Attrs.TimestampProperty("${table.UpdateDateUncapitalisedJavaName}")]
+#end
+#if ($table.isUseVersionNo())
+
+    [Seasar.Dao.Attrs.VersionNoProperty("${table.VersionNoUncapitalisedJavaName}")]
+#end
+
+    [System.Serializable]
+    /// <summary>
+    /// The entity of ${table.Name}. (partial interface for auto-generation)
+    /// 
+    /// [primary-key]
+    ///     ${table.PrimaryKeyNameCommaString}
+    /// 
+    /// [all-columns]
+    ///     ${table.ColumnNameCommaString}
+    /// 
+    /// [foreign-table]
+    ///     ${table.ForeignPropertyNameCommaString}
+    /// 
+    /// [refferer-table]
+    ///     ${table.ReferrerPropertyNameCommaString}
+    /// 
+    /// [sequence]
+    ///     ${table.DefinedSequenceName}
+    /// 
+    /// [identity]
+    ///     ${table.IdentityPropertyName}
+    /// 
+    /// [update-date]
+    ///     ${table.UpdateDateJavaName}
+    /// 
+    /// [version-no]
+    ///     ${table.VersionNoJavaName}
+    /// 
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public partial class ${myClassName} : ${myEntityInterfaceName} {
+
+        // =====================================================================================
+        //                                                                            Definition
+        //                                                                            ==========
+        /** Map-string map-mark. */
+        public static readonly String MAP_STRING_MAP_MARK = "map:";
+
+        /** Map-string list-mark. */
+        public static readonly String MAP_STRING_LIST_MARK = "list:";
+
+        /** Map-string start-brace. */
+        public static readonly String MAP_STRING_START_BRACE = "${database.extractAcceptStartBrace}";
+
+        /** Map-string end-brace. */
+        public static readonly String MAP_STRING_END_BRACE = "${database.extractAcceptEndBrace}";
+
+        /** Map-string delimiter. */
+        public static readonly String MAP_STRING_DELIMITER = "${database.extractAcceptDelimiter}";
+
+        /** Map-string equal. */
+        public static readonly String MAP_STRING_EQUAL = "${database.extractAcceptEqual}";
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        #region Attribute
+
+#foreach ($col in $table.Columns)
+
+        /// <summary>The value of ${col.UncapitalisedJavaName}.</summary>
+        protected ${col.JavaNative} _${col.UncapitalisedJavaName};
+
+        /// <summary>Has the setter of ${col.UncapitalisedJavaName} been invoked?</summary>
+        protected bool _isSetterInvoked${col.JavaName};
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        public ${myClassName}() {
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        #region Table Name
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public String TableDbName {
+            get { return "${table.Name}"; }
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public String TableCapPropName {
+            get { return "${table.JavaName}"; }
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public String TableUncapPropName {
+            get { return "${table.UncapitalisedJavaName}"; }
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                                DBMeta
+        //                                                                                ======
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public ${glDBMetaInterfaceName} DBMeta {
+            get { return ${myDBMetaClassName}.GetInstance(); }
+        }
+
+        // =====================================================================================
+        //                                                                              Accessor
+        //                                                                              ========
+        #region Property
+#foreach ($col in $table.Columns)
+  #if ($col.isIdentity())
+
+        /// <summary>
+        /// The property of ${col.UncapitalisedJavaName}. This is identity.
+        /// </summary>
+        [Seasar.Dao.Attrs.ID("identity")]
+        [Seasar.Dao.Attrs.Column("${col.Name}")]
+        public ${col.JavaNative} ${col.JavaName} {
+            get { return _${col.UncapitalisedJavaName}; }
+            set { _isSetterInvoked${col.JavaName} = true; _${col.UncapitalisedJavaName} = value; }
+        }
+  #else
+
+        /// <summary>
+        /// The property of ${col.UncapitalisedJavaName}.
+        /// </summary>
+        public ${col.JavaNative} ${col.JavaName} {
+            get { return _${col.UncapitalisedJavaName}; }
+            set { _isSetterInvoked${col.JavaName} = true; _${col.UncapitalisedJavaName} = value; }
+        }
+  #end
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                Invoking Determination
+        //                                                                ======================
+        #region Invoking Determination
+#foreach ($col in $table.Columns)
+
+        /// <summary>
+        /// Has the setter of ${col.UncapitalisedJavaName} been invoked?
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSetterInvoked${col.JavaName}() {
+            return _isSetterInvoked${col.JavaName};
+        }
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                       Classify Method
+        //                                                                       ===============
+        #region Classify Method
+#foreach ($col in $table.Columns)
+  #if (${col.hasClassification()})
+    #foreach ($classificationMap in $col.ClassificationMapList)
+      #if (${col.hasClassificationName()})
+
+        /// <summary>
+        /// Classify the value of ${col.UncapitalisedJavaName} as ${classificationMap.get('name')}.
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        public void Classify${col.JavaName}${classificationMap.get('name')}() {
+            String code = ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+        #if (${col.isJavaNativeStringObject()})
+
+            ${col.JavaName} = code;
+        }
+        #else
+
+            ${col.JavaName} = ${col.JavaNative}.Parse(code);
+        }
+        #end
+      #else
+
+        /// <summary>
+        /// Classify the value of ${col.UncapitalisedJavaName} as ${classificationMap.get('name')}.
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        public void Classify${col.JavaName}_${classificationMap.get('name')}() {
+            String code = ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+        #if (${col.isJavaNativeStringObject()})
+
+            ${col.JavaName} = code;
+        }
+        #else
+
+            ${col.JavaName} = ${col.JavaNative}.Parse(code);
+        }
+        #end
+      #end
+    #end
+  #end
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                          Classification Determination
+        //                                                          ============================
+        #region Classification Determination
+#foreach ($col in $table.Columns)
+  #if (${col.hasClassification()})
+    #foreach ($classificationMap in $col.ClassificationMapList)
+      #if (${col.hasClassificationName()})
+
+        /// <summary>
+        /// Is the value of ${col.UncapitalisedJavaName} '${classificationMap.get('name')}'?
+        /// The difference of capital letters and small letters is NOT distinguished.
+        /// If the value is null, this method returns false!
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        /// <returns>Determanation.</returns>
+        public bool Is${col.JavaName}${classificationMap.get('name')}() {
+            if (_${col.UncapitalisedJavaName} == null) {
+                return false;
+            }
+            Object obj = _${col.UncapitalisedJavaName};
+            if (obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                return false;
+            }
+            String code = ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+            return code.ToLower().Equals(_${col.UncapitalisedJavaName}.ToString().ToLower());
+        }
+        #if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Is the value of ${col.UncapitalisedJavaName} '${classificationMap.get('name')}'?
+        /// The difference of capital letters and small letters is NOT distinguished.
+        /// If the value is null, this method throws exception!
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        /// <returns>Determanation.</returns>
+        [Obsolete("This method is deprecated. Sorry!")]
+        public bool Is${col.JavaName}${classificationMap.get('name')}IfNullException() {
+            if (_${col.UncapitalisedJavaName} == null) {
+                String msg = "If the value of ${col.UncapitalisedJavaName} is null, this method throws exception!";
+                throw new SystemException(msg + " ${col.UncapitalisedJavaName}=" + _${col.UncapitalisedJavaName});
+            }
+            Object obj = _${col.UncapitalisedJavaName};
+            if (obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                String msg = "If the nullable-type-value of ${col.UncapitalisedJavaName} does not have value, this method throws exception!";
+                throw new SystemException(msg + " ${col.UncapitalisedJavaName}=" + _${col.UncapitalisedJavaName});
+            }
+            return Is${col.JavaName}${classificationMap.get('name')}();
+        }
+        #end
+      #else
+
+        /// <summary>
+        /// Is the value of ${col.UncapitalisedJavaName} '${classificationMap.get('name')}'?
+        /// The difference of capital letters and small letters is NOT distinguished.
+        /// If the value is null, this method returns false!
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        /// <returns>Determanation.</returns>
+        public bool Is${col.JavaName}_${classificationMap.get('name')}() {
+            if (_${col.UncapitalisedJavaName} == null) {
+                return false;
+            }
+            Object obj = _${col.UncapitalisedJavaName};
+            if (obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                return false;
+            }
+            String code = ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+            return code.ToLower().Equals(_${col.UncapitalisedJavaName}.ToString().ToLower());
+        }
+        #if ($database.isMakeDeprecated())
+
+        /// <summary>
+        /// Is the value of ${col.UncapitalisedJavaName} '${classificationMap.get('name')}'?
+        /// The difference of capital letters and small letters is NOT distinguished.
+        /// If the value is null, this method throws exception!
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        /// <returns>Determanation.</returns>
+        [Obsolete("This method is deprecated. Sorry!")]
+        public bool Is${col.JavaName}_${classificationMap.get('name')}_IfNullException() {
+            if (_${col.UncapitalisedJavaName} == null) {
+                String msg = "If the value of ${col.UncapitalisedJavaName} is null, this method throws exception!";
+                throw new SystemException(msg + " ${col.UncapitalisedJavaName}=" + _${col.UncapitalisedJavaName});
+            }
+            Object obj = _${col.UncapitalisedJavaName};
+            if (obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                String msg = "If the nullable-type-value of ${col.UncapitalisedJavaName} does not have value, this method throws exception!";
+                throw new SystemException(msg + " ${col.UncapitalisedJavaName}=" + _${col.UncapitalisedJavaName});
+            }
+            return Is${col.JavaName}_${classificationMap.get('name')}();
+        }
+        #end
+      #end
+    #end
+  #end
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                 Classification Getter
+        //                                                                 =====================
+        #region Classification Getter
+#foreach ($col in $table.Columns)
+  #if (${col.hasClassification()})
+    #if (${col.hasClassificationName()})
+
+        /// <summary>
+        /// Get the value of ${col.UncapitalisedJavaName} as classification-name.
+        /// </summary>
+        /// <returns>The value of ${col.UncapitalisedJavaName} as classification-name.</returns>
+        public String Get${col.JavaName}Name() {
+            if (_${col.UncapitalisedJavaName} == null) {
+                return null;
+            }
+            Object obj = _${col.UncapitalisedJavaName};
+            if (obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                return null;
+            }
+            System.Collections.IDictionary hash = ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_NAME_MAP_${col.ClassificationName};
+            return (String)hash[_${col.UncapitalisedJavaName}.ToString()];
+        }
+    #end
+    #if (${col.hasClassificationAlias()})
+
+        /// <summary>
+        /// Get the value of ${col.UncapitalisedJavaName} as classification-alias.
+        /// </summary>
+        /// <returns>The value of ${col.UncapitalisedJavaName} as classification-alias.</returns>
+        public String Get${col.JavaName}Alias() {
+            if (_${col.UncapitalisedJavaName} == null) {
+                return null;
+            }
+            Object obj = _${col.UncapitalisedJavaName};
+            if (obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                return null;
+            }
+            System.Collections.IDictionary hash = ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_ALIAS_MAP_${col.ClassificationName};
+            return (String)hash[_${col.UncapitalisedJavaName}.ToString()];
+        }
+    #end
+  #end
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                         Foreign Table
+        //                                                                         =============
+        #region Foreign Table
+#set ($foreignKeysIndex = 0)
+#foreach ($foreignKeys in $table.ForeignKeys)
+  #set ($foreignVariableName = "${glParentVariablePrefix}${foreignKeys.foreignPropertyNameInitCap}")
+  #set ($foreignDaoClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}Dao")
+  #set ($foreignEntityClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}")
+  #set ($parentCBClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}${glConditionBeanInitialName}")
+
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   ForeignTable    = [${foreignKeys.foreignTable.name}]
+        //   ForeignProperty = [${foreignKeys.foreignPropertyName}]
+        // * * * * * * * * */
+
+        /// <summary>The entity of foreign table.</summary>
+        protected ${glPackageExtendedEntity}.${foreignEntityClassName} ${foreignVariableName};
+
+        /// <summary>
+        /// Property of ${foreignKeys.ForeignPropertyName} as the entity of foreign table.
+        /// </summary>
+        [Seasar.Dao.Attrs.Relno(${foreignKeysIndex}), Seasar.Dao.Attrs.Relkeys("$foreignKeys.RelationKeysCommaString")]
+        public ${glPackageExtendedEntity}.${foreignEntityClassName} ${foreignKeys.foreignPropertyNameInitCap} {
+            get { return ${foreignVariableName}; }
+            set { ${foreignVariableName} = value; }
+        }
+
+        public bool HasRelation${foreignKeys.foreignPropertyNameInitCap} {
+            get { return ${foreignVariableName} != null && ${foreignVariableName}.HasPrimaryKeyValue; }
+        }
+
+  #set ($foreignKeysIndex = $foreignKeysIndex + 1)
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                        Refferer Table
+        //                                                                        ==============
+        #region Refferer Table
+#foreach ($refferer in $table.Referrers)
+  #set ($reffererTable = $refferer.Table)
+  #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+  #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+  #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+  #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+  #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+
+  #if (${refferer.isOneToOne()})
+
+        // /* * * * * * * * * * * * * * * * * * * * * * * {one-to-one}
+        //   ReffererTable    = [${refferer.Table.Name}]
+        //   ReffererProperty = [${refferer.ReffererPropertyName}]
+        // * * * * * * * * */
+  #else
+
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   ReffererTable    = [${refferer.Table.Name}]
+        //   ReffererProperty = [${refferer.ReffererPropertyName}]
+        // * * * * * * * * */
+  #end
+
+        /// <summary>The list of refferer table.</summary>
+        protected System.Collections.IList $reffererVariableName;
+
+        /// <summary>
+        /// Property of ${refferer.ReffererPropertyName} as the list of refferer table.
+        /// </summary>
+        public System.Collections.IList ${refferer.ReffererPropertyNameInitCap} {
+            get { return ${reffererVariableName}; }
+            set {
+                if (value == null) {
+                    ${reffererVariableName} = null;
+                } else {
+                    ${reffererVariableName} = value;
+                }
+            }
+        }
+  #if (${refferer.isOneToOne()})
+
+        /// <summary>
+        /// Property of ${refferer.ReffererPropertyName} as one of refferer table.
+        /// </summary>
+        [Seasar.Dao.Attrs.Relno(${foreignKeysIndex}), Seasar.Dao.Attrs.Relkeys("$refferer.relationKeysCommaStringForOneToOneRefferer")]
+        public ${reffererEntityLongClassName} ${refferer.reffererPropertyNameInitCapAsOne} {
+            get {
+                System.Collections.IList ls = this.${refferer.reffererPropertyNameInitCap};
+                if (ls == null || ls.Count == 0) {
+                    return null;
+                }
+                if (ls.Count > 1) {
+                    String msg = "The size of the list must be one because this relation is 'one-to-one'";
+                    msg = msg + ": list=" + ls + ": ToString()=" + ToString();
+                    throw new SystemException(msg);
+                }
+                return (${reffererEntityLongClassName})ls[0];
+            }
+            set {
+                if (value == null) {
+                    ${reffererVariableName} = null;
+                    return;
+                }
+                System.Collections.IList ls = new System.Collections.ArrayList();
+                ls.Add(value);
+                ${reffererVariableName} = ls;
+            }
+        }
+
+        public bool HasRelation${refferer.reffererPropertyNameInitCapAsOne} {
+            get { return ${refferer.reffererPropertyNameInitCapAsOne} != null && ${refferer.reffererPropertyNameInitCapAsOne}.HasPrimaryKeyValue; }
+        }
+    #set ($foreignKeysIndex = $foreignKeysIndex + 1)
+  #end
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                                Accept
+        //                                                                                ======
+        #region Accept
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="primaryKeyMap">Primary-key map. (NotNull and NotEmpty)</param>
+        public void AcceptPrimaryKeyMap(System.Collections.Generic.IDictionary<String, Object> primaryKeyMap) {
+            if (primaryKeyMap == null) {
+                String msg = "The argument[primaryKeyMap] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (primaryKeyMap.Count == 0) {
+                String msg = "The argument[primaryKeyMap] should not be empty.";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+#if ($table.hasPrimaryKey())
+  #foreach ($col in $table.PrimaryKey)
+
+            if (!primaryKeyMap.ContainsKey("${col.Name}") || primaryKeyMap["${col.Name}"] == null) {
+                _${col.UncapitalisedJavaName} = null;
+                _isSetterInvoked${col.JavaName} = false;
+            } else {
+                Object obj = primaryKeyMap["${col.Name}"];
+                if (obj == null) {
+                    ${col.JavaName} = null;
+                } else {
+                    if (obj is ${col.JavaNative}) {
+                        ${col.JavaName} = (${col.JavaNative})obj;
+                    } else {
+                        if (!(obj is String)) {
+                            String msg = "The value should be ${col.JavaNative} or String: ";
+                            msg = msg + "valueType=" + obj.GetType() + " value=" + obj;
+                            throw new SystemException(msg);
+                        }
+                        String value = (String)obj;
+    #if ($col.isJavaNativeStringObject())
+
+                        ${col.JavaName} = value;
+                    }
+                }
+            }
+    #else
+      #if (${col.isJavaNativeBinaryObject()})
+
+                        ${col.JavaName} = null;// Binary as String is out of target.
+                    }
+                }
+            }
+      #else
+
+                        ${col.JavaName} = ${col.JavaNative}.Parse(value);
+                    }
+                }
+            }
+      #end
+    #end
+  #end
+#else
+  #foreach ($col in $table.Columns)
+
+            if (!primaryKeyMap.ContainsKey("${col.Name}") || primaryKeyMap["${col.Name}"] == null) {
+                _${col.UncapitalisedJavaName} = null;
+                _isSetterInvoked${col.JavaName} = false;
+            } else {
+                Object obj = primaryKeyMap["${col.Name}"];
+                if (obj == null) {
+                    ${col.JavaName} = null;
+                } else {
+                    if (obj is ${col.JavaNative}) {
+                        ${col.JavaName} = (${col.JavaNative})obj;
+                    } else {
+                        if (!(obj is String)) {
+                            String msg = "The value should be ${col.JavaNative} or String: ";
+                            msg = msg + "valueType=" + obj.GetType() + " value=" + obj;
+                            throw new SystemException(msg);
+                        }
+                        String value = (String)obj;
+    #if ($col.isJavaNativeStringObject())
+
+                        ${col.JavaName} = value;
+                    }
+                }
+            }
+    #else
+      #if (${col.isJavaNativeBinaryObject()})
+
+                        ${col.JavaName} = null;// Binary as String is out of target.
+                    }
+                }
+            }
+      #else
+
+                        ${col.JavaName} = ${col.JavaNative}.Parse(value);
+                    }
+                }
+            }
+      #end
+    #end
+  #end
+#end
+
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary-key map-string. (NotNull)</param>
+        public void AcceptPrimaryKeyMapString(String primaryKeyMapString) {
+            if (primaryKeyMapString == null) {
+                String msg = "The argument[primaryKeyMapString] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            String prefix = MAP_STRING_MAP_MARK + MAP_STRING_START_BRACE;
+            String suffix = MAP_STRING_END_BRACE;
+            if (!primaryKeyMapString.Trim().StartsWith(prefix)) {
+                primaryKeyMapString = prefix + primaryKeyMapString;
+            }
+            if (!primaryKeyMapString.Trim().EndsWith(suffix)) {
+                primaryKeyMapString = primaryKeyMapString + suffix;
+            }
+            ${glMapListStringName} mapListString = new ${glMapListStringImplName}();
+            mapListString.MapMark = MAP_STRING_MAP_MARK;
+            mapListString.ListMark = MAP_STRING_LIST_MARK;
+            mapListString.StartBrace = MAP_STRING_START_BRACE;
+            mapListString.EndBrace = MAP_STRING_END_BRACE;
+            mapListString.Delimiter = MAP_STRING_DELIMITER;
+            mapListString.Equal = MAP_STRING_EQUAL;
+            AcceptPrimaryKeyMap(mapListString.generateMap(primaryKeyMapString));
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="columnValueMap">Column-value map. (NotNull and NotEmpty)</param>
+        public void AcceptColumnValueMap(System.Collections.Generic.IDictionary<String, Object> columnValueMap) {
+            if (columnValueMap == null) {
+                String msg = "The argument[columnValueMap] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (columnValueMap.Count == 0) {
+                String msg = "The argument[columnValueMap] should not be empty.";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+  #foreach ($col in $table.Columns)
+
+            if (!columnValueMap.ContainsKey("${col.Name}") || columnValueMap["${col.Name}"] == null) {
+                _${col.UncapitalisedJavaName} = null;
+                _isSetterInvoked${col.JavaName} = false;
+            } else {
+                Object obj = columnValueMap["${col.Name}"];
+                if (obj == null) {
+                    ${col.JavaName} = null;
+                } else {
+                    if (obj is ${col.JavaNative}) {
+                        ${col.JavaName} = (${col.JavaNative})obj;
+                    } else {
+                        if (!(obj is String)) {
+                            String msg = "The value should be ${col.JavaNative} or String: ";
+                            msg = msg + "valueType=" + obj.GetType() + " value=" + obj;
+                            throw new SystemException(msg);
+                        }
+                        String value = (String)obj;
+    #if ($col.isJavaNativeStringObject())
+
+                        ${col.JavaName} = value;
+                    }
+                }
+            }
+    #else
+      #if (${col.isJavaNativeBinaryObject()})
+
+                        ${col.JavaName} = null;// Binary as String is out of target.
+                    }
+                }
+            }
+      #else
+
+                        ${col.JavaName} = ${col.JavaNative}.Parse(value);
+                    }
+                }
+            }
+      #end
+    #end
+  #end
+
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="columnValueMapString">Column-value map-string. (NotNull)</param>
+        public void AcceptColumnValueMapString(String columnValueMapString) {
+            if (columnValueMapString == null) {
+                String msg = "The argument[columnValueMapString] should not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            String prefix = MAP_STRING_MAP_MARK + MAP_STRING_START_BRACE;
+            String suffix = MAP_STRING_END_BRACE;
+            if (!columnValueMapString.Trim().StartsWith(prefix)) {
+                columnValueMapString = prefix + columnValueMapString;
+            }
+            if (!columnValueMapString.Trim().EndsWith(suffix)) {
+                columnValueMapString = columnValueMapString + suffix;
+            }
+            ${glMapListStringName} mapListString = new ${glMapListStringImplName}();
+            mapListString.MapMark = MAP_STRING_MAP_MARK;
+            mapListString.ListMark = MAP_STRING_LIST_MARK;
+            mapListString.StartBrace = MAP_STRING_START_BRACE;
+            mapListString.EndBrace = MAP_STRING_END_BRACE;
+            mapListString.Delimiter = MAP_STRING_DELIMITER;
+            mapListString.Equal = MAP_STRING_EQUAL;
+            AcceptColumnValueMap(mapListString.generateMap(columnValueMapString));
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                               Extract
+        //                                                                               =======
+        #region Extract
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Primary key map-string.</returns>
+        public String ExtractPrimaryKeyMapString() {
+#if ($table.hasPrimaryKey())
+
+            String startBrace = MAP_STRING_START_BRACE;
+            String endBrace = MAP_STRING_END_BRACE;
+            String delimiter = MAP_STRING_DELIMITER;
+            String equal = MAP_STRING_EQUAL;
+            String mapMarkAndStartBrace = MAP_STRING_MAP_MARK + startBrace;
+            StringBuilder sb = new StringBuilder();
+
+  #foreach ($col in $table.PrimaryKey)
+    
+            sb.Append(delimiter);
+            {
+                Object obj = _${col.UncapitalisedJavaName};
+                if (obj != null && (obj.GetType().IsPrimitive || obj is DateTime)) {
+                    sb.Append("${col.Name}").Append(equal).Append(obj);
+                } else {
+                    sb.Append("${col.Name}").Append(equal).Append((obj != null ? obj.ToString() : ""));
+                }
+            }
+  #end
+
+            sb.Remove(0, delimiter.Length).Insert(0, mapMarkAndStartBrace).Append(endBrace);
+            return sb.ToString();
+#else
+
+            return ExtractColumnValueMapString();
+#end
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Column-value map-string.</returns>
+        public String ExtractColumnValueMapString() {
+            String startBrace = MAP_STRING_START_BRACE;
+            String endBrace = MAP_STRING_END_BRACE;
+            String delimiter = MAP_STRING_DELIMITER;
+            String equal = MAP_STRING_EQUAL;
+            String mapMarkAndStartBrace = MAP_STRING_MAP_MARK + startBrace;
+            String listMarkAndStartBrace = MAP_STRING_LIST_MARK + startBrace;
+            StringBuilder sb = new StringBuilder();
+
+#foreach ($col in $table.Columns)
+    
+            sb.Append(delimiter);
+            {
+                Object obj = _${col.UncapitalisedJavaName};
+                if (obj != null && (obj.GetType().IsPrimitive || obj is DateTime)) {
+                    sb.Append("${col.Name}").Append(equal).Append(obj);
+                } else {
+                    sb.Append("${col.Name}").Append(equal).Append((obj != null ? obj.ToString() : ""));
+                }
+            }
+#end
+
+            sb.Remove(0, delimiter.Length).Insert(0, mapMarkAndStartBrace).Append(endBrace);
+            return sb.ToString();
+        }
+
+#if (${table.hasAllCommonColumn()})
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Common-column-value map-string.</returns>
+        public String ExtractCommonColumnValueMapString() {
+            String startBrace = MAP_STRING_START_BRACE;
+            String endBrace = MAP_STRING_END_BRACE;
+            String delimiter = MAP_STRING_DELIMITER;
+            String equal = MAP_STRING_EQUAL;
+            String mapMarkAndStartBrace = MAP_STRING_MAP_MARK + startBrace;
+            StringBuilder sb = new StringBuilder();
+
+  #foreach ($columnName in ${database.CommonColumnNameList})
+    #set ($col = $table.getColumnByFlexibleName($columnName))
+
+            sb.Append(delimiter);
+            {
+                Object obj = _${col.UncapitalisedJavaName};
+                if (obj != null && (obj.GetType().IsPrimitive || obj is DateTime)) {
+                    sb.Append("${columnName}").Append(equal).Append(obj);
+                } else {
+                    sb.Append("${columnName}").Append(equal).Append((obj != null ? obj.ToString() : ""));
+                }
+            }
+  #end
+
+            sb.Remove(0, delimiter.Length).Insert(0, mapMarkAndStartBrace).Append(endBrace);
+            return sb.ToString();
+        }
+#end
+
+        #endregion
+
+
+        // =====================================================================================
+        //                                                                         Determination
+        //                                                                         =============
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public bool HasPrimaryKeyValue {
+            get {
+  #foreach ($col in $table.PrimaryKey)
+
+                if (_${col.UncapitalisedJavaName} == null || IsNullableTypeNull(_${col.UncapitalisedJavaName})) {
+                    return false;
+                }
+  #end
+
+                return true;
+            }
+        }
+
+        // =====================================================================================
+        //                                                                        Basic Override
+        //                                                                        ==============
+        #region Basic Override Method
+#if ($table.hasPrimaryKey())
+    
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// If the primary-key of the other is same as this one, returns true.
+        /// </summary>
+        /// <param name="other">Other entity.</param>
+        /// <returns>Comparing result.</returns>
+        public override bool Equals(Object other) {
+            if (other == null) {
+                return false;
+            }
+            if (!(other is $myClassName)) {
+                return false;
+            }
+            $myClassName otherEntity = ($myClassName)other;
+  #foreach ($col in $table.PrimaryKey)
+
+            if (this.${col.JavaName} == null || !this.${col.JavaName}.Equals(otherEntity.${col.JavaName})) {
+                return false;
+            }
+  #end
+
+            return true;
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// Calculates hash-code from primary-key.
+        /// </summary>
+        /// <returns>Hash-code from primary-keys.</returns>
+        public override int GetHashCode() {
+            int result = 0;
+  #foreach ($col in $table.PrimaryKey)
+    #if (!${col.isJavaNativeNumberObject()})
+
+            if (_${col.UncapitalisedJavaName} != null) {
+                result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+            }
+    #else
+
+            result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+    #end
+  #end
+
+            return result;
+        }
+#else
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// If the all-column value of the other is same as this one, returns true.
+        /// </summary>
+        /// <param name="other">Other entity.</param>
+        /// <returns>Comparing result.</returns>
+        public override bool Equals(Object other) {
+            if (other == null) {
+                return false;
+            }
+            if (!(other is $myClassName)) {
+                return false;
+            }
+            $myClassName otherEntity = ($myClassName)other;
+  #foreach ($col in $table.Columns)
+
+            if (this.${col.JavaName} == null || !this.${col.JavaName}.Equals(otherEntity.${col.JavaName})) {
+                return false;
+            }
+  #end
+
+            return true;
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// Calculates hash-code from all-columns.
+        /// </summary>
+        /// <returns>Hash-code from all-columns.</returns>
+        public override int GetHashCode() {
+            int result = 0;
+  #foreach ($col in $table.Columns)
+    #if (!${col.isJavaNativeNumberObject()})
+
+            if (_${col.UncapitalisedJavaName} != null) {
+                result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+            }
+    #else
+
+            result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+    #end
+  #end
+     
+            return result;
+        }
+#end
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <returns>Column-map. (NotNull)</returns>
+        public override String ToString() {
+            String delimiter = ",";
+            StringBuilder sb = new StringBuilder();
+#foreach ($col in $table.Columns)
+
+            sb.Append(delimiter).Append(this.${col.JavaName});
+#end
+
+            sb.Remove(0, delimiter.Length);
+            sb.Insert(0, "{").Append("}");
+            return sb.ToString();
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                                Helper
+        //                                                                                ======
+        #region Helper
+        protected bool IsNullableTypeNull(Object obj) {
+            if (obj != null && obj is Nullables.INullableType && !((Nullables.INullableType)obj).HasValue) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+        #endregion
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/PlainBaseEntity.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/PlainBaseEntity.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/PlainBaseEntity.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,151 @@
+#set ($myClassName = "${myBaseObjectClassName}")
+
+using System;
+using System.Text;
+
+namespace ${myBaseEntityPackageName} {
+
+    /**
+     * The entity of ${table.Name}.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    public class ${myClassName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+#foreach ($col in $table.Columns)
+        
+        /** The value of ${col.UncapitalisedJavaName}. */
+        protected ${col.JavaNative} _${col.UncapitalisedJavaName};
+#end
+
+        // =====================================================================================
+        //                                                                              Accessor
+        //                                                                              ========
+#foreach ($col in $table.Columns)
+
+        public ${col.JavaNative} ${col.JavaName} {
+            get { return _${col.UncapitalisedJavaName}; }
+            set { _${col.UncapitalisedJavaName} = value; }
+        }
+#end
+
+        // =====================================================================================
+        //                                                                        Basic Override
+        //                                                                        ==============
+#if ($table.hasPrimaryKey())
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// If the primary-key of the other is same as this one, returns true.
+        /// </summary>
+        /// <param name="other">Other entity.</param>
+        /// <returns>Comparing result.</returns>
+        public override bool Equals(Object other) {
+            if (other == null) {
+                return false;
+            }
+            if (!(other is $myClassName)) {
+                return false;
+            }
+            $myClassName otherEntity = ($myClassName)other;
+  #foreach ($col in $table.PrimaryKey)
+
+            if (this.${col.JavaName} == null || !this.${col.JavaName}.Equals(otherEntity.${col.JavaName})) {
+                return false;
+            }
+  #end
+
+            return true;
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// Calculates hash-code from primary-key.
+        /// </summary>
+        /// <returns>Hash-code from primary-keys.</returns>
+        public override int GetHashCode() {
+            int result = 0;
+  #foreach ($col in $table.PrimaryKey)
+    #if (!${col.isJavaNativeNumberObject()})
+
+            if (_${col.UncapitalisedJavaName} != null) {
+                result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+            }
+    #else
+
+            result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+    #end
+  #end
+
+            return result;
+        }
+#else
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// If the all-column value of the other is same as this one, returns true.
+        /// </summary>
+        /// <param name="other">Other entity.</param>
+        /// <returns>Comparing result.</returns>
+        public override bool Equals(Object other) {
+            if (other == null) {
+                return false;
+            }
+            if (!(other is $myClassName)) {
+                return false;
+            }
+            $myClassName otherEntity = ($myClassName)other;
+  #foreach ($col in $table.Columns)
+
+            if (this.${col.JavaName} == null || !this.${col.JavaName}.Equals(otherEntity.${col.JavaName})) {
+                return false;
+            }
+  #end
+
+            return true;
+        }
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// Calculates hash-code from all-columns.
+        /// </summary>
+        /// <returns>Hash-code from all-columns.</returns>
+        public override int GetHashCode() {
+            int result = 0;
+  #foreach ($col in $table.Columns)
+    #if (!${col.isJavaNativeNumberObject()})
+
+            if (_${col.UncapitalisedJavaName} != null) {
+                result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+            }
+    #else
+
+            result = result + _${col.UncapitalisedJavaName}.GetHashCode();
+    #end
+  #end
+     
+            return result;
+        }
+#end
+
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <returns>Column-map. (NotNull)</returns>
+        public override String ToString() {
+            String delimiter = ",";
+            StringBuilder sb = new StringBuilder();
+#foreach ($col in $table.Columns)
+
+            sb.Append(delimiter).Append(this.${col.JavaName});
+#end
+
+            sb.Remove(0, delimiter.Length);
+            sb.Insert(0, "{").Append("}");
+            return sb.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/dbmeta/DBMetaImpl.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/dbmeta/DBMetaImpl.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/bsentity/dbmeta/DBMetaImpl.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,507 @@
+#set ($myClassName = "${myDBMetaClassName}")
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonDBMeta};
+using ${myExtendedEntityPackageName};
+#if (${isExistDao})
+
+using ${myExtendedDaoPackageName};
+#end
+#if (${isExistConditionBean})
+using ${glPackageCB};
+
+#end
+namespace ${myDBMetaPackageName} {
+
+    /// <summary>
+    /// The dbmeta of ${table.Name}.
+    /// 
+    /// [primary-key]
+    ///     ${table.PrimaryKeyNameCommaString}
+    /// 
+    /// [all-columns]
+    ///     ${table.ColumnNameCommaString}
+    /// 
+    /// [foreign-property]
+    ///     ${table.ForeignPropertyNameCommaString}
+    /// 
+    /// [refferer-property]
+    ///     ${table.ReferrerPropertyNameCommaString}
+    /// 
+    /// [sequence]
+    ///     ${table.DefinedSequenceName}
+    /// 
+    /// [identity]
+    ///     ${table.IdentityPropertyName}
+    /// 
+    /// [update-date]
+    ///     ${table.UpdateDateJavaName}
+    /// 
+    /// [version-no]
+    ///     ${table.VersionNoJavaName}
+    /// 
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    public class ${myClassName} : ${glDBMetaAbstractName} {
+
+        /// <summary>The type of entity.</summary>
+        public static readonly Type ENTITY_TYPE = typeof(${myExtendedObjectClassName});
+#if (${isExistDao})
+
+        /// <summary>The type of dao.</summary>
+        public static readonly Type DAO_TYPE = typeof(${myExtendedDaoClassName});
+#end
+#if (${isExistConditionBean})
+
+        /// <summary>The type of condition-bean.</summary>
+        public static readonly Type CONDITION_BEAN_TYPE = typeof(${myConditionBeanClassName});
+#end
+
+        /// <summary>Singleton instance.</summary>
+        private static readonly ${myClassName} _instance = new ${myClassName}();
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        private ${myClassName}() {
+        }
+
+        /// <summary>
+        /// Get instance.
+        /// </summary>
+        /// <returns>Singleton instance.</returns>
+        public static ${myClassName} GetInstance() {
+            return _instance;
+        }
+
+        // =====================================================================================
+        //                                                                                  Name
+        //                                                                                  ====
+        #region Name
+
+        /// <summary>Table db-name.</summary>
+        public static readonly String TABLE_DB_NAME = "$table.Name";
+
+        /// <summary>Table cap-prop-name.</summary>
+        public static readonly String TABLE_CAP_PROP_NAME = "$table.JavaName";
+
+        /// <summary>Table uncap-prop-name.</summary>
+        public static readonly String TABLE_UNCAP_PROP_NAME = "$table.UncapitalisedJavaName";
+
+    #foreach ($col in $table.Columns)
+
+        /// <summary>DB name of ${col.JavaName}.</summary>
+        public static readonly String COLUMN_DB_NAME_OF_${col.JavaName} = "$col.Name";
+    #end
+
+    #foreach ($col in $table.Columns)
+
+        /// <summary>Java name of ${col.JavaName}.</summary>
+        public static readonly String COLUMN_CAP_PROP_NAME_OF_${col.JavaName} = "$col.JavaName";
+    #end
+    #foreach ($foreignKeys in $table.ForeignKeys)
+
+        /// <summary>Java name of ${foreignKeys.ForeignPropertyName}.</summary>
+        public static readonly String COLUMN_CAP_PROP_NAME_OF_${foreignKeys.foreignPropertyNameInitCap} = "$foreignKeys.ForeignPropertyNameInitCap";
+    #end
+    #foreach ($children in $table.Referrers)
+
+        /// <summary>Java name of ${children.ReffererPropertyNameInitCap}.</summary>
+        public static readonly String COLUMN_CAP_PROP_NAME_OF_${children.ReffererPropertyNameInitCap} = "$children.ReffererPropertyNameInitCap";
+    #end
+
+    #foreach ($col in $table.Columns)
+
+        /// <summary>Property name of ${col.JavaName}.</summary>
+        public static readonly String COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName} = "$col.UncapitalisedJavaName";
+    #end
+    #foreach ($foreignKeys in $table.ForeignKeys)
+
+        /// <summary>Property name of ${foreignKeys.ForeignPropertyName}.</summary>
+        public static readonly String COLUMN_UNCAP_PROP_NAME_OF_${foreignKeys.foreignPropertyNameInitCap} = "$foreignKeys.ForeignPropertyName";
+    #end
+    #foreach ($children in $table.Referrers)
+
+        /// <summary>Property name of ${children.ReffererPropertyName}.</summary>
+        public static readonly String COLUMN_UNCAP_PROP_NAME_OF_${children.ReffererPropertyNameInitCap} = "$children.ReffererPropertyName";
+    #end
+
+        /// <summary>{uncap-prop-name : db-name} map.</summary>
+        protected static readonly System.Collections.Generic.IDictionary<String, String> _uncapPropNameDbNameMap;
+
+        /// <summary>{db-name : uncap-prop-name} map.</summary>
+        protected static readonly System.Collections.Generic.IDictionary<String, String> _dbNameUncapPropNameMap;
+
+        /// <summary>{cap-prop-name : db-name} map.</summary>
+        protected static readonly System.Collections.Generic.IDictionary<String, String> _capPropNameDbNameMap;
+
+        /// <summary>{db-name : cap-prop-name} map.</summary>
+        protected static readonly System.Collections.Generic.IDictionary<String, String> _dbNameCapPropNameMap;
+
+        /// <summary>{cap-prop-name : uncap-prop-name} map.</summary>
+        protected static readonly System.Collections.Generic.IDictionary<String, String> _capPropNameUncapPropNameMap;
+
+        /// <summary>{uncap-prop-name : cap-prop-name} map.</summary>
+        protected static readonly System.Collections.Generic.IDictionary<String, String> _uncapPropNameCapPropNameMap;
+
+        /// <summary>
+        /// Constractor
+        /// </summary>
+        static ${myClassName}() {
+            {
+                System.Collections.Generic.IDictionary<String, String> map = new System.Collections.Generic.Dictionary<String, String>();
+                map.Add(TABLE_UNCAP_PROP_NAME, TABLE_DB_NAME);
+    #foreach ($col in $table.Columns)
+
+                map.Add(COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName}, COLUMN_DB_NAME_OF_${col.JavaName});
+    #end
+
+                _uncapPropNameDbNameMap = map;
+            }
+            {
+                System.Collections.Generic.IDictionary<String, String> map = new System.Collections.Generic.Dictionary<String, String>();
+                map.Add(TABLE_DB_NAME, TABLE_UNCAP_PROP_NAME);
+    #foreach ($col in $table.Columns)
+
+                map.Add(COLUMN_DB_NAME_OF_${col.JavaName}, COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName});
+    #end
+
+                _dbNameUncapPropNameMap = map;
+            }
+            {
+                System.Collections.Generic.IDictionary<String, String> map = new System.Collections.Generic.Dictionary<String, String>();
+                map.Add(TABLE_CAP_PROP_NAME, TABLE_DB_NAME);
+    #foreach ($col in $table.Columns)
+
+                map.Add(COLUMN_CAP_PROP_NAME_OF_${col.JavaName}, COLUMN_DB_NAME_OF_${col.JavaName});
+    #end
+
+                _capPropNameDbNameMap = map;
+            }
+            {
+                System.Collections.Generic.IDictionary<String, String> map = new System.Collections.Generic.Dictionary<String, String>();
+                map.Add(TABLE_DB_NAME, TABLE_CAP_PROP_NAME);
+    #foreach ($col in $table.Columns)
+
+                map.Add(COLUMN_DB_NAME_OF_${col.JavaName}, COLUMN_CAP_PROP_NAME_OF_${col.JavaName});
+    #end
+
+                _dbNameCapPropNameMap = map;
+            }
+            {
+                System.Collections.Generic.IDictionary<String, String> map = new System.Collections.Generic.Dictionary<String, String>();
+                map.Add(TABLE_CAP_PROP_NAME, TABLE_UNCAP_PROP_NAME);
+    #foreach ($col in $table.Columns)
+
+                map.Add(COLUMN_CAP_PROP_NAME_OF_${col.JavaName}, COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName});
+    #end
+
+                _capPropNameUncapPropNameMap = map;
+            }
+            {
+                System.Collections.Generic.IDictionary<String, String> map = new System.Collections.Generic.Dictionary<String, String>();
+                map.Add(TABLE_UNCAP_PROP_NAME, TABLE_CAP_PROP_NAME);
+    #foreach ($col in $table.Columns)
+
+                map.Add(COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName}, COLUMN_CAP_PROP_NAME_OF_${col.JavaName});
+    #end
+
+                _uncapPropNameCapPropNameMap = map;
+            }
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        #region Table Name
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Table db-name. (NotNull)
+         */
+        public override String GetTableDbName() {
+            return TABLE_DB_NAME;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Table cap-prop-name. (NotNull)
+         */
+        public override String GetTableCapPropName() {
+            return TABLE_CAP_PROP_NAME;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Table uncap-prop-name. (NotNull)
+         */
+        public override String GetTableUncapPropName() {
+            return TABLE_UNCAP_PROP_NAME;
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                    DB-Name-Map Getter
+        //                                                                    ==================
+        #region DB-Name-Map Getter
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary> 
+        /// <returns>{property-name : db-name} map.</returns>
+        public override System.Collections.Generic.IDictionary<String, String> GetUncapPropNameDbNameMap() {
+            return _uncapPropNameDbNameMap;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{db-name : property-name} map.</returns>
+        public override System.Collections.Generic.IDictionary<String, String> GetDbNameUncapPropNameMap() {
+            return _dbNameUncapPropNameMap;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{cap-prop-name : db-name} map.</returns>
+        public override System.Collections.Generic.IDictionary<String, String> GetCapPropNameDbNameMap() {
+            return _capPropNameDbNameMap;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{db-name : cap-prop-name} map.</returns>
+        public override System.Collections.Generic.IDictionary<String, String> GetDbNameCapPropNameMap() {
+            return _dbNameCapPropNameMap;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{cap-prop-name : uncap-prop-name} map.</returns>
+        public override System.Collections.Generic.IDictionary<String, String> GetCapPropNameUncapPropNameMap() {
+            return _capPropNameUncapPropNameMap;
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>{uncap-prop-name : cap-prop-name} map.</returns>
+        public override System.Collections.Generic.IDictionary<String, String> GetUncapPropNameCapPropNameMap() {
+            return _uncapPropNameCapPropNameMap;
+        }
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Type Getter
+        //                                                                           ===========
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return The type of entity. (NotNull)
+         */
+        public override Type GetEntityType() {
+            return ENTITY_TYPE;
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return The type of dao. (NotNull)
+         */
+        public override Type GetDaoType() {
+#if (${isExistDao})
+
+            return DAO_TYPE;
+#else
+
+            String msg = "The entity does not have dao. So this method is invalid.";
+            throw new SystemException(msg + " dbmeta=" + ToString());
+#end
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return The type of condition-bean. (NotNull)
+         */
+        public override Type GetConditionBeanType() {
+#if (${isExistConditionBean})
+
+            return CONDITION_BEAN_TYPE;
+#else
+
+            String msg = "The entity does not have condition-bean. So this method is invalid.";
+            throw new SystemException(msg + " dbmeta=" + ToString());
+#end
+        }
+
+        // =====================================================================================
+        //                                                                       Instance Getter
+        //                                                                       ===============
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return The instance of entity. (NotNull)
+         */
+        public override ${glEntityInterfaceName} NewEntity() {
+            return NewMyEntity();
+        }
+
+        /**
+         * New the instance of my entity.
+         * 
+         * @return The instance of my entity. (NotNull)
+         */ 
+        public ${myExtendedObjectClassName} NewMyEntity() {
+            return new ${myExtendedObjectClassName}();
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return The instance of condition-bean. (NotNull)
+         */
+        public override ${glConditionBeanInterfaceName} NewConditionBean() {
+#if (${isExistConditionBean})
+
+            return NewMyConditionBean();
+#else
+
+            String msg = "The entity does not have condition-bean. So this method is invalid.";
+            throw new SystemException(msg + " dbmeta=" + ToString());
+#end
+        }
+#if (${isExistConditionBean})
+
+        /**
+         * New the instance of my condition-bean.
+         * 
+         * @return The instance of condition-bean. (NotNull)
+         */ 
+        public ${myConditionBeanClassName} NewMyConditionBean() {
+            return new ${myConditionBeanClassName}();
+        }
+#end
+#if ($database.isMakeDeprecated())
+
+        // =====================================================================================
+        //                                                                          PropertyInfo
+        //                                                                          ============
+        #region PropertyInfo
+
+#foreach ($col in $table.Columns)
+
+        /// <summary>The entity property-info of ${col.UncapitalisedJavaName}.</summary>
+        [Obsolete("There is more available object. {org.seasar.framework.beans.factory.BeanDescFactory}")]
+        public static readonly PropertyInfo ENTITY_PROPERTY_INFO_${col.JavaName} = ENTITY_TYPE.GetProperty(COLUMN_CAP_PROP_NAME_OF_${col.JavaName});
+#end
+
+#foreach ($col in $table.Columns)
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>The entity property-info of ${col.UncapitalisedJavaName}.</returns>
+        [Obsolete("There is more available object. {org.seasar.framework.beans.factory.BeanDescFactory}")]
+        public PropertyInfo GetEntityPropertyInfo_${col.JavaName}() {
+            return ENTITY_PROPERTY_INFO_${col.JavaName};
+        }
+#end
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="multiName">Multi-name. (NotNull)</param>
+        /// <returns>Entity property-info. (NotNull)</returns>
+        [Obsolete("There is more available object. {org.seasar.framework.beans.factory.BeanDescFactory}")]
+        public override PropertyInfo GetEntityPropertyInfoByMultiName(String multiName) {
+            String propertyName = GetCapPropNameByDbName(GetDbNameByMultiName(multiName));
+            MethodInfo method = this.GetType().GetMethod("GetEntityPropertyInfo_" + propertyName);
+            return (PropertyInfo)method.Invoke(this, null);
+        }
+
+        #endregion
+#end
+
+        // =====================================================================================
+        //                                                                        Foreign DBMeta
+        //                                                                        ==============
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="foreignPropertyName">Foreign-property-name(Both OK - InitCap or not). (NotNull)</param>
+        /// <returns>Foreign DBMeta. (NotNull)</returns>
+        public override ${glDBMetaInterfaceName} GetForeignDBMeta(String foreignPropertyName) {
+            AssertStringNotNullAndNotTrimmedEmpty("foreignPropertyName", foreignPropertyName);
+            String methodName = "GetForeignDBMeta_" + foreignPropertyName.Substring(0, 1) + foreignPropertyName.Substring(1);
+            MethodInfo method = this.GetType().GetMethod(methodName);
+            if (method == null) {
+                String msg = "The foreignPropertyName is not existing: foreignPropertyName=" + foreignPropertyName;
+                msg = msg + " tableName=" + TABLE_DB_NAME + " methodName=" + methodName;
+                throw new SystemException(msg);
+            }
+            return (${glDBMetaInterfaceName})method.Invoke(this, null);
+        }
+#foreach ($foreignKeys in $table.ForeignKeys)
+
+        /// <summary>
+        /// Get foreign dbmeta of ${foreignKeys.foreignPropertyNameInitCap}.
+        /// </summary>
+        /// <returns>Foreign DBMeta. (NotNull)</returns>
+        public ${glProjectPrefix}${foreignKeys.ForeignTable.JavaName}Dbm GetForeignDBMeta_${foreignKeys.foreignPropertyNameInitCap}() {
+            return ${glProjectPrefix}${foreignKeys.ForeignTable.JavaName}Dbm.GetInstance();
+        }
+#end
+#foreach ($refferer in $table.Referrers)
+  #set ($reffererTable = $refferer.Table)
+  #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+  #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+  #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+  #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+  #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+  #if (${refferer.isOneToOne()})
+
+        /// <summary>
+        /// Get foreign dbmeta of ${foreignKeys.reffererPropertyNameInitCapAsOne}.
+        /// </summary>
+        /// <returns>Foreign DBMeta. (NotNull)</returns>
+        public ${glProjectPrefix}${refferer.Table.JavaName}Dbm GetForeignDBMeta_${refferer.reffererPropertyNameInitCapAsOne}() {
+            return ${glProjectPrefix}${refferer.Table.JavaName}Dbm.GetInstance();
+        }
+  #end
+#end
+
+        // =====================================================================================
+        //                                                                         Determination
+        //                                                                         =============
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public override bool HasTwoOrMorePrimaryKeys {
+            get { return ${table.hasTwoOrMorePrimaryKeys()}; }
+        }
+
+        /**
+         * ${database.ImplementComment}
+         * 
+         * @return Determination.
+         */
+        public override bool HasCommonColumn {
+            get { return ${table.hasAllCommonColumn()}; }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/AbstractBsConditionQuery.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/AbstractBsConditionQuery.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/AbstractBsConditionQuery.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,543 @@
+#set ($myClassName = "${myAbstractBaseConditionQueryClassName}")
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonCKey};
+using ${glPackageBaseCommonCValue};
+using ${glPackageBaseCommonSqlClause};
+
+namespace ${glPackageBaseCQ} {
+
+    /// <summary>
+    /// The condition-query of {table.Name}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public abstract class ${myClassName} : ${glConditionQueryAbstractName} {
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="childQuery">Child query as interface. (Nullable: If null, this is base instance.)</param>
+        /// <param name="sqlClause">SQL clause instance. (NotNull)</param>
+        /// <param name="aliasName">My alias name. (NotNull)</param>
+        /// <param name="nestLevel">Nest level.</param>
+        public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel)
+            : base(childQuery, sqlClause, aliasName, nestLevel) {}
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public override String GetTableDbName() {
+            return "${table.Name}";
+        }
+
+        // =====================================================================================
+        //                                                                                 Query
+        //                                                                                 =====
+  ## --------------------------------------------------------------------------------
+  ##                                                  Make getter and setter methods.
+  ##                                                  -------------------------------
+
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   MyTable = [$table.Name]
+        // * * * * * * * * */
+
+  #foreach ($col in $table.Columns)
+    #set ($tmpJavaName = "${col.JavaName}")
+    #set ($tmpUncapitalisedJavaName = "${col.UncapitalisedJavaName}")
+    
+        /// <summary> Column db name of ${col.UncapitalisedJavaName}. </summary>
+        protected static readonly String COL_${col.Name} = "${col.Name}";
+
+        /// <summary> Column java name of ${col.UncapitalisedJavaName}. </summary>
+        protected static readonly String J_${col.JavaName} = "${col.JavaName}";
+
+        /// <summary> Column uncapitalised java name of ${col.UncapitalisedJavaName}. </summary>
+        protected static readonly String UJ_${col.UncapitalisedJavaName} = "${col.UncapitalisedJavaName}";
+    #if (${col.isJavaNativeStringObject()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as equal.</param>
+        public void Set${tmpJavaName}_Equal($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, FilterRemoveEmptyString(value));
+        }
+      #if ($database.isMakeConditionQueryEqualEmptyString())
+
+        /// <summary>
+        /// Set the empty-string of ${col.UncapitalisedJavaName} as equal. { = }
+        /// </summary>
+        /// <returns>this. (NotNull)</returns>
+        public void Set${tmpJavaName}_Equal_EmptyString() {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, "");
+        }
+      #end
+      #if (${col.hasClassification()})
+        #foreach ($classificationMap in $col.ClassificationMapList)
+
+        /// <summary>
+        /// Set the value od ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal. { = }
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        public void Set${tmpJavaName}_Equal_${classificationMap.get('name')}() {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')});
+        }
+        #end
+      #end
+      #if (${col.isAvailableStringNotEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notEqual. { != }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as notEqual.</param>
+        public void Set${tmpJavaName}_NotEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringGreaterThan()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterThan. { &gt; }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterThan.</param>
+        public void Set${tmpJavaName}_GreaterThan($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringLessThan()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessThan. { &lt; }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessThan.</param>
+        public void Set${tmpJavaName}_LessThan($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringGreaterEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterEqual. { &gt;= }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterEqual.</param>
+        public void Set${tmpJavaName}_GreaterEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringLessEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessEqual. { &lt;= }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessEqual.</param>
+        public void Set${tmpJavaName}_LessEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringPrefixSearch()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using prefixSearch. { like 'xxx%' }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as prefixSearch.</param>
+        public void Set${tmpJavaName}_PrefixSearch($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_PREFIX_SEARCH, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringInScope()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using inScope. { in ('a', 'b') }
+        /// If the element in the list is null or empty-string, the condition-element is ignored.
+        /// </summary>
+        /// <param name="valueList">The value of ${col.UncapitalisedJavaName} as inScope.</param>
+        public void Set${tmpJavaName}_InScope(System.Collections.IList valueList) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_IN_SCOPE, FilterRemoveEmptyStringFromList(valueList));
+        }
+      #end
+      #if (${col.isAvailableStringNotInScope()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notInScope. { not in ('a', 'b') }
+        /// If the element in the list is null or empty-string, the condition-element is ignored.
+        /// </summary>
+        /// <param name="valueList">The value of ${col.UncapitalisedJavaName} as notInScope.</param>
+        public void Set${tmpJavaName}_NotInScope(System.Collections.IList valueList) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_NOT_IN_SCOPE, FilterRemoveEmptyStringFromList(valueList));
+        }
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+        /// <summary>
+	    /// Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+	    /// { in (select xxx.${col.foreignKey.firstForeignColumnName} from ${col.foreignKey.foreignTable.Name} where ...) }
+	    /// This method use from clause and where clause of the sub-query instance.
+	    /// this query keep the sub-query instance for query-value.
+	    /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+	    /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)</param>
+	    public void Set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+	        AssertObjectNotNull("subQuery", subQuery);
+	        Keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+	        RegisterInScopeSubQuery(subQuery, COL_${col.Name}, "${col.foreignKey.firstForeignColumnName}", "${subQueryPropertyNameInitCap}");
+	    }
+
+        abstract public void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>
+        /// Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+        /// { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+        /// This method use from clause and where clause of the sub-query instance.
+        /// this query save the sub-query instance for query-value.
+        /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+        /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)</param>
+        public void Set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            AssertObjectNotNull("subQuery", subQuery);
+            Keep${subQueryPropertyNameInitCap}(subQuery);
+            RegisterInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyNameInitCap}");
+        }
+
+        abstract public void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>
+        /// Set the sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+        /// { exists (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+        /// This method use from clause and where clause of the sub-query instance.
+        /// this query save the sub-query instance for query-value.
+        /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+        /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery. (NotNull)</param>
+        public void Set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            AssertObjectNotNull("subQuery", subQuery);
+            Keep${subQueryPropertyNameInitCap}(subQuery);
+            RegisterExistsSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyNameInitCap}");
+        }
+
+        abstract public void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeNumberObject()})
+    
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as equal.</param>
+        public void Set${tmpJavaName}_Equal($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, value);
+        }
+      #if (${col.hasClassification()})
+        #foreach ($classificationMap in $col.ClassificationMapList)
+
+        /// <summary>
+        /// Set the value od ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal. { = }
+        /// ${classificationMap.get('comment')}
+        /// </summary>
+        public void Set${tmpJavaName}_Equal_${classificationMap.get('name')}() {
+            String code = ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+            Register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${col.JavaNative}.Parse(code));
+        }
+        #end
+      #end
+      #if (${col.isAvailableNumberNotEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notEqual. { != }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as notEqual.</param>
+        public void Set${tmpJavaName}_NotEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableNumberGreaterThan()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterThan. { &gt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterThan.</param>
+        public void Set${tmpJavaName}_GreaterThan($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableNumberLessThan()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessThan. { &lt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessThan.</param>
+        public void Set${tmpJavaName}_LessThan($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableNumberGreaterEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterEqual. { &gt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterEqual.</param>
+        public void Set${tmpJavaName}_GreaterEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableNumberLessEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessEqual. { &lt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessEqual.</param>
+        public void Set${tmpJavaName}_LessEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableNumberInScope()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using inScope. { in ('a', 'b') }
+        /// If the element in the list is null or empty-string, the condition-element is ignored.
+        /// </summary>
+        /// <param name="valueList">The value of ${col.UncapitalisedJavaName} as inScope.</param>
+        public void Set${tmpJavaName}_InScope(System.Collections.IList valueList) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_IN_SCOPE, FilterRemoveEmptyStringFromList(valueList));
+        }
+      #end
+      #if (${col.isAvailableNumberNotInScope()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notInScope. { not in ('a', 'b') }
+        /// If the element in the list is null or empty-string, the condition-element is ignored.
+        /// </summary>
+        /// <param name="valueList">The value of ${col.UncapitalisedJavaName} as notInScope.</param>
+        public void Set${tmpJavaName}_NotInScope(System.Collections.IList valueList) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_NOT_IN_SCOPE, FilterRemoveEmptyStringFromList(valueList));
+        }
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+        /// <summary>
+	    /// Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+	    /// { in (select xxx.${col.foreignKey.firstForeignColumnName} from ${col.foreignKey.foreignTable.Name} where ...) }
+	    /// This method use from clause and where clause of the sub-query instance.
+	    /// this query keep the sub-query instance for query-value.
+	    /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+	    /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)</param>
+	    public void Set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+	        AssertObjectNotNull("subQuery", subQuery);
+	        Keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+	        RegisterInScopeSubQuery(subQuery, COL_${col.Name}, "${col.foreignKey.firstForeignColumnName}", "${subQueryPropertyNameInitCap}");
+	    }
+
+        abstract public void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>
+        /// Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+        /// { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+        /// This method use from clause and where clause of the sub-query instance.
+        /// this query save the sub-query instance for query-value.
+        /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+        /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)</param>
+        public void Set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            AssertObjectNotNull("subQuery", subQuery);
+            Keep${subQueryPropertyNameInitCap}(subQuery);
+            RegisterInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyNameInitCap}");
+        }
+
+        abstract public void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>
+        /// Set the sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+        /// { exists (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+        /// This method use from clause and where clause of the sub-query instance.
+        /// this query save the sub-query instance for query-value.
+        /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+        /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery. (NotNull)</param>
+        public void Set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            AssertObjectNotNull("subQuery", subQuery);
+            Keep${subQueryPropertyNameInitCap}(subQuery);
+            RegisterExistsSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyNameInitCap}");
+        }
+
+        abstract public void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeDateObject()})
+    
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as equal.</param>
+        public void Set${tmpJavaName}_Equal($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, value);
+        }
+      #if (${col.isAvailableDateNotEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notEqual. { != }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as notEqual.</param>
+        public void Set${tmpJavaName}_NotEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableDateGreaterThan()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterThan. { &gt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterThan.</param>
+        public void Set${tmpJavaName}_GreaterThan($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableDateLessThan()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessThan. { &lt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessThan.</param>
+        public void Set${tmpJavaName}_LessThan($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableDateGreaterEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterEqual. { &gt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterEqual.</param>
+        public void Set${tmpJavaName}_GreaterEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableDateLessEqual()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessEqual. { &lt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessEqual.</param>
+        public void Set${tmpJavaName}_LessEqual($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, value);
+        }
+      #end
+    #end
+    #if (${col.isJavaNativeBooleanObject()})
+    
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as equal.</param>
+        public void Set${tmpJavaName}_Equal($col.JavaNative value) {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, value);
+        }
+    #end
+    #if (${col.isJavaNativeBinaryObject()})
+    #end
+    #if (!${col.isNotNull()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using isNull. { is null }
+        /// </summary>
+        public void Set${tmpJavaName}_IsNull() {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_IS_NULL, DUMMY_OBJECT);
+        }
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using isNotNull. { is not null }
+        /// </summary>
+        public void Set${tmpJavaName}_IsNotNull() {
+            Register${tmpJavaName}(${glConditionKeyName}.CK_IS_NOT_NULL, DUMMY_OBJECT);
+        }
+    #end
+    
+        /// <summary>
+        /// Register condition of ${col.UncapitalisedJavaName}.
+        /// </summary>
+        /// <param name="key">Condition key. (NotNull)</param>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName}. (Nullable)</param>
+        protected void Register${tmpJavaName}(${glConditionKeyName} key, Object value) {
+            RegisterQuery(key, value, GetCValue${tmpJavaName}(), COL_${col.Name}, J_${col.JavaName}, UJ_${col.UncapitalisedJavaName});
+        }
+
+        /// <summary>
+        /// Register inline condition of ${col.UncapitalisedJavaName}.
+        /// </summary>
+        /// <param name="key">Condition key. (NotNull)</param>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName}. (Nullable)</param>
+        /// <returns>this. (NotNull)</returns>
+        protected void RegisterInline${tmpJavaName}(${glConditionKeyName} key, Object value) {
+            RegisterInlineQuery(key, value, GetCValue${tmpJavaName}(), COL_${col.Name}, J_${col.JavaName}, UJ_${col.UncapitalisedJavaName});
+        }
+
+        abstract protected ${glConditionValueName} GetCValue${tmpJavaName}();
+  #end
+
+        // =====================================================================================
+        //                                                                 Basic-Override Method
+        //                                                                 =====================
+        /// <summary>
+        /// This method overrides the method that is declared at super.
+        /// </summary>
+        /// <returns>Clause string. (NotNull)</returns>
+        public override String ToString() {
+            return GetSqlClause().GetClause();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,389 @@
+#set ($myClassName = "${myBaseConditionBeanClassName}")
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonHelper};
+
+using ${glPackageCQ};
+using ${glPackageNss};
+
+namespace ${glPackageBaseCB} {
+
+    /// <summary>
+    /// The condition-bean of ${table.Name}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [Seasar.Dao.Attrs.Table("$table.Name")]
+    [System.Serializable]
+    public class ${myClassName} : ${glConditionBeanAbstractName} {
+
+        // =====================================================================================
+        //                                                                            Definition
+        //                                                                            ==========
+        /** Map-string map-mark. */
+        public static readonly String MAP_STRING_MAP_MARK = "map:";
+
+        /** Map-string list-mark. */
+        public static readonly String MAP_STRING_LIST_MARK = "list:";
+
+        /** Map-string start-brace. */
+        public static readonly String MAP_STRING_START_BRACE = "${database.extractAcceptStartBrace}";
+
+        /** Map-string end-brace. */
+        public static readonly String MAP_STRING_END_BRACE = "${database.extractAcceptEndBrace}";
+
+        /** Map-string delimiter. */
+        public static readonly String MAP_STRING_DELIMITER = "${database.extractAcceptDelimiter}";
+
+        /** Map-string equal. */
+        public static readonly String MAP_STRING_EQUAL = "${database.extractAcceptEqual}";
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        /// <summary> Condition query.</summary>
+        protected ${myConditionQueryClassName} _conditionQuery;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        public ${myClassName}() {
+        }
+
+        // =====================================================================================
+        //                                                                            Table Name
+        //                                                                            ==========
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        public override String GetTableDbName() {
+            return "${table.Name}";
+        }
+
+        // =====================================================================================
+        //                                                                         Accept-PK-Map
+        //                                                                         =============
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="primaryKeyMap">Primary key map. (NotNull and NotEmpty)</param>
+        public override void AcceptPrimaryKeyMap(System.Collections.Generic.IDictionary<String, Object> primaryKeyMap) {
+            if (primaryKeyMap == null) {
+                String msg = "The argument[primaryKeyMap] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            if (primaryKeyMap.Count == 0) {
+                String msg = "The argument[primaryKeyMap] must not be empty.";
+                throw new ArgumentOutOfRangeException(msg);
+            }
+#if ($table.hasPrimaryKey())
+  #foreach ($col in $table.PrimaryKey)
+
+            if (!primaryKeyMap.ContainsKey("${col.Name}")) {
+                String msg = "The primaryKeyMap must have the value of ${col.Name}";
+                throw new ArgumentOutOfRangeException(msg + ": primaryKeyMap --> " + primaryKeyMap);
+            }
+            {
+                Object obj = primaryKeyMap["${col.Name}"];
+                if (obj == null) {
+                    Query().Set${col.JavaName}_Equal(null);
+                } else {
+                    if (obj is ${col.JavaNative}) {
+                        Query().Set${col.JavaName}_Equal((${col.JavaNative})obj);
+                    } else {
+                        if (!(obj is String)) {
+                            String msg = "The value should be ${col.JavaNative} or String: ";
+                            msg = msg + "valueType=" + obj.GetType() + " value=" + obj;
+                            throw new SystemException(msg);
+                        }
+                        String value = (String)obj;
+    #if ($col.isJavaNativeStringObject())
+
+                        Query().Set${col.JavaName}_Equal(value);
+                    }
+                }
+            }
+    #else
+      #if (${col.isJavaNativeBinaryObject()})
+
+                        Query().Set${col.JavaName}_Equal(null);// Binary as String is out of target.
+                    }
+                }
+            }
+      #else
+
+                        Query().Set${col.JavaName}_Equal(${col.JavaNative}.Parse(value));
+                    }
+                }
+            }
+      #end
+    #end
+  #end
+#else
+  #foreach ($col in $table.Columns)
+
+            if (!primaryKeyMap.ContainsKey("${col.Name}")) {
+                String msg = "The primaryKeyMap must have the value of ${col.Name}";
+                throw new ArgumentOutOfRangeException(msg + ": primaryKeyMap --> " + primaryKeyMap);
+            }
+            {
+                Object obj = primaryKeyMap["${col.Name}"];
+                if (obj == null) {
+                    Query().Set${col.JavaName}_Equal(null);
+                } else {
+                    if (obj is ${col.JavaNative}) {
+                        Query().Set${col.JavaName}_Equal((${col.JavaNative})obj);
+                    } else {
+                        if (!(obj is String)) {
+                            String msg = "The value should be ${col.JavaNative} or String: ";
+                            msg = msg + "valueType=" + obj.GetType() + " value=" + obj;
+                            throw new SystemException(msg);
+                        }
+                        String value = (String)obj;
+    #if ($col.isJavaNativeStringObject())
+
+                        Query().Set${col.JavaName}_Equal(value);
+                    }
+                }
+            }
+    #else
+      #if (${col.isJavaNativeBinaryObject()})
+
+                        Query().Set${col.JavaName}_Equal(null);// Binary as String is out of target.
+                    }
+                }
+            }
+      #else
+
+                        Query().Set${col.JavaName}_Equal(${col.JavaNative}.Parse(value));
+                    }
+                }
+            }
+      #end
+    #end
+  #end
+#end
+
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <param name="primaryKeyMapString">Primary key map-string. (NotNull and NotEmpty)</param>
+        /// <returns>this. (NotNull)</returns>
+        public override void AcceptPrimaryKeyMapString(String primaryKeyMapString) {
+            if (primaryKeyMapString == null) {
+                String msg = "The argument[primaryKeyMapString] must not be null.";
+                throw new ArgumentNullException(msg);
+            }
+            String prefix = MAP_STRING_MAP_MARK + MAP_STRING_START_BRACE;
+            String suffix = MAP_STRING_END_BRACE;
+            if (!primaryKeyMapString.Trim().StartsWith(prefix)) {
+                primaryKeyMapString = prefix + primaryKeyMapString;
+            }
+            if (!primaryKeyMapString.Trim().EndsWith(suffix)) {
+                primaryKeyMapString = primaryKeyMapString + suffix;
+            }
+            ${glMapListStringName} mapListString = new ${glMapListStringImplName}();
+            mapListString.MapMark = MAP_STRING_MAP_MARK;
+            mapListString.ListMark = MAP_STRING_LIST_MARK;
+            mapListString.StartBrace = MAP_STRING_START_BRACE;
+            mapListString.EndBrace = MAP_STRING_END_BRACE;
+            mapListString.Delimiter = MAP_STRING_DELIMITER;
+            mapListString.Equal = MAP_STRING_EQUAL;
+            AcceptPrimaryKeyMap(mapListString.generateMap(primaryKeyMapString));
+        }
+
+        // =====================================================================================
+        //                                                                        Add-OrderBy-PK
+        //                                                                        ==============
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>this. (NotNull)</returns>
+        public override ${glConditionBeanInterfaceName} AddOrderBy_PK_Asc() {
+#if ($table.hasPrimaryKey())
+  #foreach ($col in $table.PrimaryKey)
+
+            Query().AddOrderBy_${col.JavaName}_Asc();
+  #end
+
+            return this;
+#else
+
+            String msg = "This method is unsupported in this table that doesn't have primary key: ";
+            throw new NotSupportedException(msg + ToString());
+#end
+
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>this. (NotNull)</returns>
+        public override ${glConditionBeanInterfaceName} AddOrderBy_PK_Desc() {
+#if ($table.hasPrimaryKey())
+  #foreach ($col in $table.PrimaryKey)
+
+            Query().AddOrderBy_${col.JavaName}_Desc();
+  #end
+
+            return this;
+#else
+
+            String msg = "This method is unsupported in this table that doesn't have primary key: ";
+            throw new NotSupportedException(msg + ToString());
+#end
+
+        }
+
+        // =====================================================================================
+        //                                                                                 Query
+        //                                                                                 =====
+        /// <summary>
+        /// Query.
+        /// </summary>
+        /// <returns>Instance of query. (NotNull)</returns>
+        public ${myConditionQueryClassName} Query() {
+            return this.ConditionQuery;
+        }
+
+        /// <summary>
+        /// The property of condition-query. {for SqlComment}
+        /// </summary>
+        /// <returns>Instance of condition query. (NotNull)</returns>
+        public ${myConditionQueryClassName} ConditionQuery {
+            get {
+                if (_conditionQuery == null) {
+                    _conditionQuery = new ${myConditionQueryClassName}(null, this.SqlClause, GetTableDbName(), 0);
+                }
+                return _conditionQuery;
+            }
+        }
+
+        /// <summary>
+        /// ${database.ImplementComment}
+        /// </summary>
+        /// <returns>Instance of condition-query. (NotNull)</returns>
+        public override ${glPackageBaseCommonCBean}.${glConditionQueryInterfaceName} ConditionQueryAsInterface {
+            get { return this.ConditionQuery; }
+        }
+
+#foreach ($foreignKeys in $table.ForeignKeys)
+  #set ($tmpPropertyName = "${foreignKeys.foreignPropertyName}")
+  #set ($tmpPropertyNameInitCap = "${foreignKeys.foreignPropertyNameInitCap}")
+  #set ($nestSelectSetuppperClassName = "${glProjectPrefix}${foreignKeys.foreignTable.javaName}Nss")
+
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   ForeignTable    = [${foreignKeys.foreignTable.Name}]
+        //   ForeignProperty = [${tmpPropertyName}]
+        // * * * * * * * * */
+
+        /// <summary>Is select for ${tmpPropertyName}?</summary>
+        protected bool _isSelect${tmpPropertyNameInitCap};
+        /// <summary>Nest select setupper for ${tmpPropertyName}.</summary>
+        protected ${nestSelectSetuppperClassName} _nss${tmpPropertyNameInitCap};
+        /// <summary>
+        /// Is select for ${tmpPropertyName}?
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSelect${tmpPropertyNameInitCap} {
+            get { return _isSelect${tmpPropertyNameInitCap}; }
+        }
+        /// <summary>
+        /// Get nest select setupper for ${tmpPropertyName}. {For Internal}
+        /// </summary>
+        /// <returns>Nest select setupper. (NotNull)</returns>
+        public ${nestSelectSetuppperClassName} Nss${tmpPropertyNameInitCap} {
+            get {
+                if (_nss${tmpPropertyNameInitCap} == null) {
+                    _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(null);// for Dummy
+                }
+                return _nss${tmpPropertyNameInitCap};
+            }
+        }
+        /// <summary>
+        /// Set up select for ${tmpPropertyName}.
+        /// If you invoke this, this entity is target of select.
+        /// </summary>
+        public ${nestSelectSetuppperClassName} SetupSelect_${tmpPropertyNameInitCap}() {
+            Query().Query${tmpPropertyNameInitCap}();// For setting outer join.
+            if (_nss${tmpPropertyNameInitCap} == null || !_nss${tmpPropertyNameInitCap}.HasConditionQuery) {
+                _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(Query().Query${tmpPropertyNameInitCap}());
+            }
+            // Set dummy string that means this foreign entity is target of select.
+            _isSelect${tmpPropertyNameInitCap} = true;
+            LimitSelect_Off();
+            return _nss${tmpPropertyNameInitCap};
+        }
+#end
+#foreach ($refferer in $table.Referrers)
+  #if (${refferer.isOneToOne()})
+    #set ($tmpPropertyName = "${refferer.ReffererPropertyNameAsOne}")
+    #set ($tmpPropertyNameInitCap = "${refferer.ReffererPropertyNameInitCapAsOne}")
+    #set ($nestSelectSetuppperClassName = "${glProjectPrefix}${refferer.table.javaName}Nss")
+
+        // /* * * * * * * * * * * * * * * * * * * * * * * {as one}
+        //   RefferTable    = [${refferer.Table.Name}]
+        //   RefferProperty = [${tmpPropertyName}]
+        // * * * * * * * * */
+
+        /// <summary> Is select for ${tmpPropertyName}?</summary>
+        protected bool _isSelect${tmpPropertyNameInitCap};
+        /// <summary>Nest select setupper for ${tmpPropertyName}.</summary>
+        protected ${nestSelectSetuppperClassName} _nss${tmpPropertyNameInitCap};
+        /// <summary>
+        /// Is select for ${tmpPropertyName}?
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSelect${tmpPropertyNameInitCap} {
+            get { return _isSelect${tmpPropertyNameInitCap}; }
+        }
+        /// <summary>
+        /// Get nest select setupper for ${tmpPropertyName}. {For Internal}
+        /// </summary>
+        /// <returns>Nest select setupper. (NotNull)</returns>
+        public ${nestSelectSetuppperClassName} Nss${tmpPropertyNameInitCap} {
+            get {
+                if (_nss${tmpPropertyNameInitCap} == null) {
+                    _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(null);// for Dummy
+                }
+                return _nss${tmpPropertyNameInitCap};
+            }
+        }
+        /// <summary>
+        /// Set up select for ${tmpPropertyName}.
+        /// If you invoke this, this entity is target of select.
+        /// </summary>
+        public ${nestSelectSetuppperClassName} SetupSelect_${tmpPropertyNameInitCap}() {
+            Query().Query${tmpPropertyNameInitCap}();// For setting outer join.
+            if (_nss${tmpPropertyNameInitCap} == null || !_nss${tmpPropertyNameInitCap}.HasConditionQuery) {
+                _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(Query().Query${tmpPropertyNameInitCap}());
+            }
+            // Set dummy string that means this foreign entity is target of select.
+            _isSelect${tmpPropertyNameInitCap} = true;
+            LimitSelect_Off();
+            return _nss${tmpPropertyNameInitCap};
+        }
+  #end
+#end
+
+        // =====================================================================================
+        //                                                                 Basic-Override Method
+        //                                                                 =====================
+        /// <summary>
+        /// This method overrides the method that is declared at super.
+        /// </summary>
+        /// <returns>Clause string. (NotNull)</returns>
+        override public String ToString() {
+            return GetClause();
+        }
+
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionInlineQuery.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionInlineQuery.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionInlineQuery.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,157 @@
+#set ($myClassName = "${myConditionInlineQueryClassName}")
+#set ($myCQClassName = "")
+#if ($database.isJavaDirOnlyOne())
+  #set ($myCQClassName = "${myBaseConditionQueryClassName}")
+#else
+  #set ($myCQClassName = "${myConditionQueryClassName}")
+#end
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonCKey};
+using ${glPackageBaseCommonCValue};
+using ${glPackageBaseCommonSqlClause};
+using ${glPackageBaseCQ};
+using ${glPackageCQ};
+
+namespace ${glPackageCIQ} {
+
+    /// <summary>
+    /// The condition-query of {table.Name}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${myAbstractBaseConditionQueryClassName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        protected ${myCQClassName} _myCQ;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="childQuery">Child query as interface. (Nullable: If null, this is base instance.)</param>
+        /// <param name="sqlClause">SQL clause instance. (NotNull)</param>
+        /// <param name="aliasName">My alias name. (NotNull)</param>
+        /// <param name="nestLevel">Nest level.</param>
+        /// <param name="myCQ">My condition-query. (NotNull)</param>
+        public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel, ${myCQClassName} myCQ)
+            : base(childQuery, sqlClause, aliasName, nestLevel) { _myCQ = myCQ; }
+
+        // =====================================================================================
+        //                                                                                 Query
+        //                                                                                 =====
+        protected override void RegisterQuery(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                                                 , String colName, String capPropName, String uncapPropName) {
+            RegisterInlineQuery(key, value, cvalue, colName, capPropName, uncapPropName);
+        }
+
+  ## --------------------------------------------------------------------------------
+  ##                                                  Make getter and setter methods.
+  ##                                                  -------------------------------
+
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   MyTable = [$table.Name]
+    // * * * * * * * * */
+
+  #foreach ($col in $table.Columns)
+    #set ($tmpJavaName = "${col.JavaName}")
+    #set ($tmpUncapitalisedJavaName = "${col.UncapitalisedJavaName}")
+
+	    protected override ${glConditionValueName} GetCValue${tmpJavaName}() {
+	        return _myCQ.${tmpJavaName};
+	    }
+
+    #if (${col.isJavaNativeStringObject()})
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+	    public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+	        _myCQ.Keep${subQueryPropertyNameInitCap}(subQuery);
+	    }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+	    public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+	        _myCQ.Keep${subQueryPropertyNameInitCap}(subQuery);
+	    }
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+	    public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            throw new SystemException("ExistsSubQuery at inline() is unsupported! Sorry!");
+	        // _myCQ.Keep${subQueryPropertyNameInitCap}(subQuery);
+	    }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeNumberObject()})
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+	    public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+	        _myCQ.Keep${subQueryPropertyNameInitCap}(subQuery);
+	    }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+	    public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+	        _myCQ.Keep${subQueryPropertyNameInitCap}(subQuery);
+	    }
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+	    public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            throw new SystemException("ExistsSubQuery at inline() is unsupported! Sorry!");
+	        // _myCQ.Keep${subQueryPropertyNameInitCap}(subQuery);
+	    }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeDateObject()})
+    #end
+    #if (${col.isJavaNativeBooleanObject()})
+    #end
+    #if (${col.isJavaNativeBinaryObject()})
+    #end
+    #if (!${col.isNotNull()})
+    #end
+    #if (!${col.isJavaNativeBinaryObject()})
+    #end
+  #end
+
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionQuery.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionQuery.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/BsConditionQuery.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,717 @@
+#set ($myClassName = "")
+#if ($database.isJavaDirOnlyOne())
+
+using ${glPackageCQ};
+  #set ($myClassName = "${myBaseConditionQueryClassName}")
+#else
+
+using ${glPackageBaseCQ};
+  #set ($myClassName = "${myConditionQueryClassName}")
+#end
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonCKey};
+using ${glPackageBaseCommonCValue};
+using ${glPackageBaseCommonSqlClause};
+
+using ${glPackageCIQ};
+
+#if ($database.isJavaDirOnlyOne())
+
+namespace ${glPackageBaseCQ} {
+#else
+
+namespace ${glPackageCQ} {
+#end
+
+    /// <summary>
+    /// The condition-query of {table.Name}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${myAbstractBaseConditionQueryClassName} {
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        protected ${myConditionInlineQueryClassName} _inlineQuery;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="childQuery">Child query as interfaec. (Nullable: If null, this is base instance.)</param>
+        /// <param name="sqlClause">SQL clause instance. (NotNull)</param>
+        /// <param name="aliasName">My alias name. (NotNull)</param>
+        /// <param name="nestLevel">Nest level.</param>
+        public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel)
+            : base(childQuery, sqlClause, aliasName, nestLevel) {}
+
+        // =====================================================================================
+        //                                                                                Inline
+        //                                                                                ======
+        /**
+         * Get inline query.
+         * 
+         * @return Inline query. (NotNull)
+         */
+        public ${myConditionInlineQueryClassName} Inline() {
+            if (_inlineQuery == null) {
+                _inlineQuery = new ${myConditionInlineQueryClassName}(GetChildQuery(), GetSqlClause(), GetAliasName(), GetNestLevel(), this);
+            }
+            return _inlineQuery;
+        }
+
+        // =====================================================================================
+        //                                                                         IncludeAsMine
+        //                                                                         =============
+  #foreach ($col in $table.Columns)
+
+        /// <summary>
+        /// Include select-column of ${col.UncapitalisedJavaName} as mine.
+        /// Alias name is java-name of this column.
+        /// Be careful to whether your table have the same column.
+        /// </summary>
+        public void IncludeAsMine_${col.JavaName}() {
+            RegisterIncludedSelectColumn("${col.JavaName}", GetRealColumnName("${col.Name}"));
+        }
+
+        /// <summary>
+        /// Include select-column of ${col.UncapitalisedJavaName} as mine.
+        /// </summary>
+        /// <param name="aliasName">Alias name. {select columnName as aliasName from ...} This should not contain comma. (NotNull)</param>
+        public void IncludeAsMine_${col.JavaName}(String aliasName) {
+            RegisterIncludedSelectColumn(aliasName, GetRealColumnName("${col.Name}"));
+        }
+  #end
+
+        // =====================================================================================
+        //                                                                                 Query
+        //                                                                                 =====
+  ## --------------------------------------------------------------------------------
+  ##                                                  Make getter and setter methods.
+  ##                                                  -------------------------------
+
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   MyTable = [$table.Name]
+        // * * * * * * * * */
+
+  #foreach ($col in $table.Columns)
+    #set ($tmpJavaName = "${col.JavaName}")
+    #set ($tmpUncapitalisedJavaName = "${col.UncapitalisedJavaName}")
+
+        /// <summary> The attribute of ${col.UncapitalisedJavaName}. </summary>
+        protected ${glConditionValueName} _${tmpUncapitalisedJavaName};
+
+        /// <summary>
+        /// Get the value of ${col.UncapitalisedJavaName}.
+        /// </summary>
+        /// <returns>The value of ${col.UncapitalisedJavaName}.</returns>
+        public ${glConditionValueName} ${tmpJavaName} {
+            get {
+                if (_${tmpUncapitalisedJavaName} == null) {
+                    _${tmpUncapitalisedJavaName} = new ${glConditionValueName}();
+                }
+                return _${tmpUncapitalisedJavaName};
+            }
+        }
+
+        protected override ${glConditionValueName} GetCValue${tmpJavaName}() {
+            return this.${tmpJavaName};
+        }
+
+    #if (${col.isJavaNativeStringObject()})
+      #if ($database.isMakeDeprecated())
+        #if (${col.isAvailableStringEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using equal as inline. { = }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as equal.</param>
+        public void Set${tmpJavaName}_Equal_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, FilterRemoveEmptyString(value));
+        }
+          #if (${col.hasClassification()})
+            #foreach ($classificationMap in $col.ClassificationMapList)
+
+        /// <summary>
+        /// Set the value od ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal as inline. { = }
+        /// </summary>
+        public void Set${tmpJavaName}_Equal_${classificationMap.get('name')}_AsInline() {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')});
+        }
+            #end
+          #end
+        #end
+      #if (${col.isAvailableStringNotEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notEqual as inline. { != }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as notEqual.</param>
+        public void Set${tmpJavaName}_NotEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringGreaterThanOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterThan as inline. { &gt; }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterThan.</param>
+        public void Set${tmpJavaName}_GreaterThan_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringLessThanOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessThan as inline. { &lt; }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessThan.</param>
+        public void Set${tmpJavaName}_LessThan_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringGreaterEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterEqual as inline. { &gt;= }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterEqual.</param>
+        public void Set${tmpJavaName}_GreaterEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringLessEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessEqual as inline. { &lt;= }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessEqual.</param>
+        public void Set${tmpJavaName}_LessEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, FilterRemoveEmptyString(value));
+        }
+      #end
+      #if (${col.isAvailableStringPrefixSearchOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using prefixSearch as inline. { like 'xxx%' }
+        /// If the value is null or empty-string, this condition is ignored.
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as prefixSearch.</param>
+        public void Set${tmpJavaName}_PrefixSearch_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_PREFIX_SEARCH, FilterRemoveEmptyString(value));
+        }
+      #end
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName};
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap} {
+            get { return _${subQueryPropertyName}; }
+        }
+
+        public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            _${subQueryPropertyName} = subQuery;
+        }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName};
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap} {
+            get { return _${subQueryPropertyName}; }
+        }
+
+        public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            _${subQueryPropertyName} = subQuery;
+        }
+          #if ($database.isMakeDeprecated())
+            #if (${col.isAvailableStringInScopeSubQueryOldAsInline()})
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName}_AsInline;
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap}_AsInline {
+            get { return _${subQueryPropertyName}_AsInline; }
+        }
+
+        /// <summary>
+        /// Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+        /// { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+        /// This method use from clause and where clause of the sub-query instance.
+        /// this query save the sub-query instance for query-value.
+        /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+        /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. (NotNull)</param>
+        public void Set${subQueryPropertyNameInitCap}_AsInline(${relatedCQClassName} subQuery) {
+            AssertObjectNotNull("subQuery", subQuery);
+            _${subQueryPropertyName}_AsInline = subQuery;// for saving query-value.
+            RegisterInlineInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyNameInitCap}_AsInline");
+        }
+            #end
+          #end
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName};
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap} {
+            get { return _${subQueryPropertyName}; }
+        }
+
+        public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            _${subQueryPropertyName} = subQuery;
+        }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeNumberObject()})
+      #if ($database.isMakeDeprecated())
+        #if (${col.isAvailableNumberEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using equal as inline. { = }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as equal.</param>
+        public void Set${tmpJavaName}_Equal_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, value);
+        }
+          #if (${col.hasClassification()})
+            #foreach ($classificationMap in $col.ClassificationMapList)
+
+        /// <summary>
+        /// Set the value od ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal as inline. { = }
+        /// </summary>
+        public void Set${tmpJavaName}_Equal_${classificationMap.get('name')}_AsInline() {
+            String code = ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${col.JavaNative}.Parse(code));
+        }
+            #end
+          #end
+        #end
+      #if (${col.isAvailableNumberNotEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notEqual as inline. { != }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as notEqual.</param>
+        public void Set${tmpJavaName}_NotEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableNumberGreaterThanOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterThan as inline. { &gt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterThan.</param>
+        public void Set${tmpJavaName}_GreaterThan_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableNumberLessThanOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessThan as inline. { &lt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessThan.</param>
+        public void Set${tmpJavaName}_LessThan_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableNumberGreaterEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterEqual as inline. { &gt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterEqual.</param>
+        public void Set${tmpJavaName}_GreaterEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableNumberLessEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessEqual as inline. { &lt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessEqual.</param>
+        public void Set${tmpJavaName}_LessEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, value);
+        }
+      #end
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName};
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap} {
+            get { return _${subQueryPropertyName}; }
+        }
+
+        public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            _${subQueryPropertyName} = subQuery;
+        }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName};
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap} {
+            get { return _${subQueryPropertyName}; }
+        }
+
+        public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            _${subQueryPropertyName} = subQuery;
+        }
+          #if ($database.isMakeDeprecated())
+            #if (${col.isAvailableNumberInScopeSubQueryOldAsInline()})
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName}_AsInline;
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap}_AsInline {
+            get { return _${subQueryPropertyName}_AsInline; }
+        }
+
+        /// <summary>
+        /// Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+        /// { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+        /// This method use from clause and where clause of the sub-query instance.
+        /// this query save the sub-query instance for query-value.
+        /// After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+        /// </summary>
+        /// <param name="subQuery">The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. (NotNull)</param>
+        public void Set${subQueryPropertyNameInitCap}_AsInline(${relatedCQClassName} subQuery) {
+            AssertObjectNotNull("subQuery", subQuery);
+            _${subQueryPropertyName}_AsInline = subQuery;// for saving query-value.
+            RegisterInlineInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyNameInitCap}_AsInline");
+        }
+            #end
+          #end
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+        /// <summary>The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.</summary>
+        protected ${relatedCQClassName} _${subQueryPropertyName};
+
+        /// <summary>
+        /// The property of sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+        /// </summary>
+        public ${relatedCQClassName} ${subQueryPropertyNameInitCap} {
+            get { return _${subQueryPropertyName}; }
+        }
+
+        public override void Keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+            _${subQueryPropertyName} = subQuery;
+        }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeDateObject()})
+      #if ($database.isMakeDeprecated())
+        #if (${col.isAvailableDateEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using equal as inline. { = }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as equal.</param>
+        public void Set${tmpJavaName}_Equal_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, value);
+        }
+        #end
+      #if (${col.isAvailableDateNotEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using notEqual as inline. { != }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as notEqual.</param>
+        public void Set${tmpJavaName}_NotEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableDateGreaterThanOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterThan as inline. { &gt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterThan.</param>
+        public void Set${tmpJavaName}_GreaterThan_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableDateLessThanOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessThan as inline. { &lt; }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessThan.</param>
+        public void Set${tmpJavaName}_LessThan_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, value);
+        }
+      #end
+      #if (${col.isAvailableDateGreaterEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using greaterEqual as inline. { &gt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as greaterEqual.</param>
+        public void Set${tmpJavaName}_GreaterEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, value);
+        }
+      #end
+      #if (${col.isAvailableDateLessEqualOldAsInline()})
+
+        /// <summary>
+        /// Set the value of ${col.UncapitalisedJavaName} using lessEqual as inline. { &lt;= }
+        /// </summary>
+        /// <param name="value">The value of ${col.UncapitalisedJavaName} as lessEqual.</param>
+        public void Set${tmpJavaName}_LessEqual_AsInline($col.JavaNative value) {
+            RegisterInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, value);
+        }
+      #end
+      #end
+    #end
+    #if (${col.isJavaNativeBooleanObject()})
+    #end
+    #if (${col.isJavaNativeBinaryObject()})
+    #end
+    #if (!${col.isNotNull()})
+    #end
+    #if (!${col.isJavaNativeBinaryObject()})
+
+        /// <summary>
+        /// Add order-by of ${col.UncapitalisedJavaName} as ASC. { ex) order by primaryKey asc }
+        /// </summary>
+        /// <returns>this. (NotNull)</returns>
+        public ${myClassName} AddOrderBy_${tmpJavaName}_Asc() {
+            GetSqlClause().RegisterOrderBy(GetRealColumnName(COL_${col.Name}), true);return this;
+        }
+
+        /// <summary>
+        /// Add order-by of ${col.UncapitalisedJavaName} as DESC. { ex) order by primaryKey desc }
+        /// </summary>
+        /// <returns>this. (NotNull)</returns>
+        public ${myClassName} AddOrderBy_${tmpJavaName}_Desc() {
+            GetSqlClause().RegisterOrderBy(GetRealColumnName(COL_${col.Name}), false);return this;
+        }
+
+        /// <summary>
+        /// Reverse order-by (between 'asc' and 'desc') or override order-by of ${col.UncapitalisedJavaName} as ASC.
+        /// </summary>
+        /// <returns>this. (NotNull)</returns>
+        public ${myClassName} ReverseOrderBy_Or_OverrideOrderByAsc_${tmpJavaName}() {
+            GetSqlClause().ReverseOrderBy_Or_OverrideOrderBy(GetRealColumnName(COL_${col.Name}), true);return this;
+        }
+
+        /// <summary>
+        /// Reverse order-by  (between 'asc' and 'desc') or override order-by of ${col.UncapitalisedJavaName} as DESC.
+        /// </summary>
+        /// <returns>this. (NotNull)</returns>
+        public ${myClassName} ReverseOrderBy_Or_OverrideOrderByDesc_${tmpJavaName}() {
+            GetSqlClause().ReverseOrderBy_Or_OverrideOrderBy(GetRealColumnName(COL_${col.Name}), false);return this;
+        }
+    #end
+  #end
+
+        // =====================================================================================
+        //                                                               Query-SetupOuter-Method
+        //                                                               =======================
+  #foreach ($foreignKeys in $table.ForeignKeys)
+    #set ($foreignCQClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}${glConditionQueryInitialName}")
+    
+        // /* * * * * * * * * * * * * * * * * * * * * * *
+        //   ForeignTable    = [${foreignKeys.ForeignTable.Name}]
+        //   ForeignProperty = [${foreignKeys.ForeignPropertyName}]
+        // * * * * * * * * */
+
+        /// <summary>
+        /// Query for ${foreignKeys.ForeignPropertyName}.
+        /// </summary>
+        /// <returns>Instance of ${foreignCQClassName} as ${foreignKeys.ForeignPropertyName}. (NotNull)</returns>
+        public ${foreignCQClassName} Query${foreignKeys.ForeignPropertyNameInitCap}() {
+            return this.ConditionQuery${foreignKeys.ForeignPropertyNameInitCap};
+        }
+
+        /// <summary>
+        /// Setup outer join for ${foreignKeys.ForeignPropertyName}.
+        /// </summary>
+        public void SetupOuterJoin_${foreignKeys.ForeignPropertyNameInitCap}() {
+            System.Collections.IDictionary joinOnMap = new System.Collections.Hashtable();
+            String key = null;
+            String value = null;
+    #foreach ($columnName in $foreignKeys.LocalColumns)
+      #set ($localColumn = $table.getColumn($columnName))
+      #set ($foreignColumnName = $foreignKeys.getLocalForeignMapping().get($columnName))
+
+            key = GetRealColumnName("${localColumn.Name}");
+            value = this.ConditionQuery${foreignKeys.ForeignPropertyNameInitCap}.GetRealColumnName("${foreignColumnName}");
+            joinOnMap.Add(key, value);
+    #end
+
+            String joinTableName = "${foreignKeys.foreignTable.Name}";
+            String aliasName = this.ConditionQuery${foreignKeys.ForeignPropertyNameInitCap}.GetRealAliasName();
+            GetSqlClause().RegisterOuterJoin(joinTableName, aliasName, joinOnMap);
+        }
+
+        /// <summary> Condition-query for ${foreignKeys.ForeignPropertyName}. */
+        protected ${foreignCQClassName} _conditionQuery${foreignKeys.ForeignPropertyNameInitCap};
+
+        /// <summary>
+        /// Get condition-query for ${foreignKeys.ForeignPropertyName}.
+        /// </summary>
+        /// <returns>Instance of ${foreignCQClassName} as ${foreignKeys.ForeignPropertyName}. (NotNull)</returns>
+        public ${foreignCQClassName} ConditionQuery${foreignKeys.ForeignPropertyNameInitCap} {
+            get {
+                if (_conditionQuery${foreignKeys.foreignPropertyNameInitCap} == null) {
+                    _conditionQuery${foreignKeys.foreignPropertyNameInitCap} = NewQuery${foreignKeys.ForeignPropertyNameInitCap}();
+                    SetupOuterJoin_${foreignKeys.foreignPropertyNameInitCap}();
+                }
+                return _conditionQuery${foreignKeys.ForeignPropertyNameInitCap};
+            }
+        }
+
+        /// <summary>
+        /// New query for ${foreignKeys.ForeignPropertyName}.
+        /// </summary>
+        /// <returns>Query for ${foreignKeys.ForeignPropertyName}. (NotNull)</returns>
+        protected ${foreignCQClassName} NewQuery${foreignKeys.ForeignPropertyNameInitCap}() {
+            return new ${foreignCQClassName}(this, GetSqlClause(), "${foreignKeys.ForeignPropertyNameInitCap}", GetNextNestLevel());
+        }
+  #end
+
+  #foreach ($refferer in $table.Referrers)
+    #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+    #if (${refferer.isOneToOne()})
+
+        // /* * * * * * * * * * * * * * * * * * * * * * * {as one}
+        //   ReffererTable    = [${refferer.Table.Name}]
+        //   ReffererProperty = [${refferer.ReffererPropertyNameAsOne}]
+        // * * * * * * * * */
+
+        /// <summary>
+        /// Query for ${refferer.ReffererPropertyNameAsOne}.
+        /// </summary>
+        /// <returns>Instance of ${relatedCQClassName} as ${refferer.ReffererPropertyNameAsOne}. (NotNull)</returns>
+        public ${relatedCQClassName} Query${refferer.ReffererPropertyNameInitCapAsOne}() {
+            return this.ConditionQuery${refferer.ReffererPropertyNameInitCapAsOne};
+        }
+
+        /// <summary>
+          /// Setup outer join for ${refferer.ReffererPropertyNameAsOne}.
+        /// </summary>
+        public void SetupOuterJoin_${refferer.ReffererPropertyNameInitCapAsOne}() {
+            System.Collections.IDictionary joinOnMap = new System.Collections.Hashtable();
+            String key = null;
+            String value = null;
+      #foreach ($columnName in $refferer.ForeignColumns)
+        #set ($foreignColumn = $table.getColumn($columnName))
+        #set ($reffererColumnName = $refferer.getLocalForeignMapping().get($columnName))
+
+            key = GetRealColumnName("${foreignColumn.Name}");
+            value = this.ConditionQuery${refferer.ReffererPropertyNameInitCapAsOne}.GetRealColumnName("${reffererColumnName}");
+            joinOnMap.Add(key, value);
+      #end
+
+            String joinTableName = "${refferer.Table.Name}";
+            String aliasName = this.ConditionQuery${refferer.ReffererPropertyNameInitCapAsOne}.GetRealAliasName();
+            GetSqlClause().RegisterOuterJoin(joinTableName, aliasName, joinOnMap);
+        }
+
+        /// <summary> Condition-query for ${refferer.ReffererPropertyNameAsOne}.    </summary>
+        protected ${relatedCQClassName} _conditionQuery${refferer.ReffererPropertyNameInitCapAsOne};
+
+        /// <summary>
+        /// Get condition-query for ${refferer.ReffererPropertyNameAsOne}.
+        /// </summary>
+        /// <returns>Instance of ${relatedCQClassName} as ${refferer.ReffererPropertyNameAsOne}. (NotNull)</returns>
+        public ${relatedCQClassName} ConditionQuery${refferer.ReffererPropertyNameInitCapAsOne} {
+            get {
+                if (_conditionQuery${refferer.ReffererPropertyNameInitCapAsOne} == null) {
+                    _conditionQuery${refferer.ReffererPropertyNameInitCapAsOne} = NewQuery${refferer.ReffererPropertyNameInitCapAsOne}();
+                    SetupOuterJoin_${refferer.ReffererPropertyNameInitCapAsOne}();
+                }
+                return _conditionQuery${refferer.ReffererPropertyNameInitCapAsOne};
+            }
+        }
+
+        /// <summary>
+        /// New query for ${refferer.ReffererPropertyNameAsOne}.
+        /// </summary>
+        /// <returns>Query for ${refferer.ReffererPropertyNameAsOne}. (NotNull)</returns>
+        protected ${relatedCQClassName} NewQuery${refferer.ReffererPropertyNameInitCapAsOne}() {
+            return new ${relatedCQClassName}(this, GetSqlClause(), "${refferer.ReffererPropertyNameInitCapAsOne}", GetNextNestLevel());
+        }
+    #end
+  #end
+
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,15 @@
+#set ($myClassName = "${myConditionBeanClassName}")
+
+using System;
+using System.Collections;
+
+namespace ${glPackageCB} {
+
+    /// <summary>
+    /// The condition-bean of ${table.Name}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${glPackageBaseCB}.${myBaseConditionBeanClassName} {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionQuery.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionQuery.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/ExConditionQuery.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,33 @@
+#set ($myClassName = "${myConditionQueryClassName}")
+
+using System;
+using System.Collections;
+
+using ${glPackageBaseCommon};
+using ${glPackageBaseCommonCBean};
+using ${glPackageBaseCommonSqlClause};
+using ${glPackageBaseCQ};
+
+namespace ${glPackageCQ} {
+
+    /// <summary>
+    /// The condition-query of {table.Name}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} : ${myBaseConditionQueryClassName} {
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="childQuery">Child query as interface. (Nullable: If null, this is base instance.)</param>
+        /// <param name="sqlClause">SQL clause instance. (NotNull)</param>
+        /// <param name="aliasName">My alias name. (NotNull)</param>
+        /// <param name="nestLevel">Nest level.</param>
+        public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel)
+            : base(childQuery, sqlClause, aliasName, nestLevel) {}
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/NestSelectSetupper.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/NestSelectSetupper.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/cbean/NestSelectSetupper.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,75 @@
+#set ($myClassName = "${myNestSelectSetupperClassName}")
+
+using System;
+
+using ${glPackageCQ};
+
+
+namespace ${glPackageNss} {
+
+    public class ${myClassName} {
+
+        /** Base query. */
+        protected ${myConditionQueryClassName} _query;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        public ${myClassName}(${myConditionQueryClassName} query) {
+            _query = query;
+        }
+
+        // =====================================================================================
+        //                                                                              Accessor
+        //                                                                              ========
+        public ${myConditionQueryClassName} Query() {
+            return _query;
+        }
+
+        public bool HasConditionQuery {
+            get { return _query != null; }
+        }
+
+        // =====================================================================================
+        //                                                                           SetupSelect
+        //                                                                           ===========
+    #foreach ($foreignKeys in $table.ForeignKeys)
+      #set ($tmpPropertyNameInitCap = "${foreignKeys.foreignPropertyNameInitCap}")
+
+        protected bool _isSelect${tmpPropertyNameInitCap};
+        public bool IsSelect${tmpPropertyNameInitCap} {
+            get { return _isSelect${tmpPropertyNameInitCap}; }
+        }
+        public void With${tmpPropertyNameInitCap}() {
+            AssertConditionQuery();
+            Query().Query${tmpPropertyNameInitCap}();
+            _isSelect${tmpPropertyNameInitCap} = true;
+        }
+    #end
+    #foreach ($refferer in $table.Referrers)
+      #if (${refferer.isOneToOne()})
+        #set ($tmpPropertyNameInitCap = "${refferer.ReffererPropertyNameInitCapAsOne}")
+
+        protected bool _isSelect${tmpPropertyNameInitCap};
+        public bool IsSelect${tmpPropertyNameInitCap} {
+            get { return _isSelect${tmpPropertyNameInitCap}; }
+        }
+        public void With${tmpPropertyNameInitCap}() {
+            AssertConditionQuery();
+            Query().Query${tmpPropertyNameInitCap}();
+            _isSelect${tmpPropertyNameInitCap} = true;
+        }
+      #end
+    #end
+
+        // =====================================================================================
+        //                                                                                Helper
+        //                                                                                ======
+        protected void AssertConditionQuery() {
+            if (!this.HasConditionQuery) {
+                String msg = "The query should not be null.";
+                throw new SystemException(msg);
+            }
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhv.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhv.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhv.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,14 @@
+#set ($myClassName = "${myExtendedBhvInterfaceName}")
+
+using System;
+using System.Collections;
+
+namespace ${glPackageExtendedBhv} {
+
+    /// <summary>
+    /// The behavior-interface of ${table.Name}. (partial class for customizing)
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    partial interface $myClassName {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhvImpl.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhvImpl.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exbhv/ExtendedBhvImpl.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,14 @@
+#set ($myClassName = "${myExtendedBhvClassName}")
+
+using System;
+using System.Collections;
+
+namespace ${glPackageExtendedBhv} {
+
+    /// <summary>
+    /// The behavior of ${table.Name}. (partial class for customizing)
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    partial class $myClassName {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExParameterBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExParameterBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExParameterBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,15 @@
+
+#set ($myClassName = "${myExtendedParameterBeanClassName}")
+
+using System;
+
+namespace ${glPackageExtendedParameterBean} {
+
+    /**
+     * The parameter-bean of ${pmbClassName}.
+     * 
+     * @author ${database.ClassAuthor}
+     */
+    partial class ${myClassName} {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExtendedDao.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExtendedDao.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exdao/ExtendedDao.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,14 @@
+#set ($myClassName = "${myExtendedDaoClassName}")
+
+using System;
+using System.Collections;
+
+namespace ${myExtendedDaoPackageName} {
+
+    /// <summary>
+    /// The dao interface of ${table.Name}. (partial interface for customizing)
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    partial interface ${myClassName} {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exentity/ExtendedEntity.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exentity/ExtendedEntity.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/exentity/ExtendedEntity.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,14 @@
+#set ($myClassName = "${myExtendedObjectClassName}")
+
+using System;
+using System.Collections;
+
+namespace ${myExtendedEntityPackageName} {
+
+    /// <summary>
+    /// The entity of ${table.Name}. (partial class for customizing)
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    partial class $myClassName {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/ArgumentBean.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/ArgumentBean.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/ArgumentBean.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,162 @@
+#set ($myClassName = "${myArgumentBeanClassName}")
+
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace ${glPackageArgumentBean} {
+
+    /// <summary>
+    /// The argument-bean of ${myArgumentBeanName}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public class ${myClassName} {
+
+        // =====================================================================================
+        //                                                                     Static Definition
+        //                                                                     =================
+        #region Static Definition
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+
+        /// <summary>The java name of ${propertyName}</summary>
+        public static readonly String JAVA_NAME_OF_${database.initCap($propertyName)} = "${database.initCap($propertyName)}";
+
+        /// <summary>The property name of ${propertyName}</summary>
+        public static readonly String PROPERTY_NAME_OF_${database.initCap($propertyName)} = "${propertyName}";
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        #region Attribute
+
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+  #if ($database.isArgumentBeanPropertyDefaultValueEffective($myArgumentBeanName, $propertyName))
+
+        /// <summary>The value of ${propertyName}. Default value is ${database.getArgumentBeanPropertyDefaultValue($myArgumentBeanName, $propertyName)}.</summary>
+        protected ${propertyJavaNative} _${propertyName} = ${database.getArgumentBeanPropertyDefaultValue($myArgumentBeanName, $propertyName)};
+  #else
+
+        /// <summary>The value of ${propertyName}.</summary>
+        protected ${propertyJavaNative} _${propertyName};
+  #end
+
+        /// <summary>Has the setter of ${col.UncapitalisedJavaName} been invoked?</summary>
+        protected bool _isSetterInvoked${database.initCap($propertyName)};
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        public ${myClassName}() {
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                              Property
+        //                                                                              ========
+        #region Property
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+        /// <summary>
+        /// The value of ${propertyName}.
+        /// </summary>
+        public virtual ${propertyJavaNative} ${database.initCap($propertyName)} {
+            get { return _${propertyName}; }
+            set { _isSetterInvoked${database.initCap($propertyName)} = true; _${propertyName} = value; }
+        }
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                Invoking Determination
+        //                                                                ======================
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+        /// <summary>
+        /// Has the setter of ${propertyName} been invoked?
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSetterInvoked${database.initCap($propertyName)}() {
+            return _isSetterInvoked${database.initCap($propertyName)};
+        }
+#end
+
+        // =====================================================================================
+        //                                                                 Property PropertyInfo
+        //                                                                 =====================
+        #region Property PropertyInfo
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+        /// <summary>
+        /// Get the propertyInfo of ${propertyName}.
+        /// </summary>
+        public PropertyInfo GetPropertyInfo${database.initCap($propertyName)}() {
+            return this.GetType().GetProperty("${database.initCap($propertyName)}");
+        }
+#end
+
+        #endregion
+
+#if (${database.isAvailableSqlParameterBeanGeneration()})
+
+        // =====================================================================================
+        //                                                                 Prepared SqlParameter
+        //                                                                 =====================
+        #region Prepared SqlParameter
+  #foreach ($sqlParameterName in $database.getArgumentBeanRelatedSqlParameterSqlParameterNameList($myArgumentBeanName))
+
+        /// <summary>
+        /// Get prepared parameter bean of ${sqlParameterName}.
+        /// </summary>
+        public ${glPackageExtendedSqlParameterBean}.${sqlParameterName} GeneratePreparedSqlParameter${sqlParameterName}() {
+            ${glPackageExtendedSqlParameterBean}.${sqlParameterName} pmb = new ${glPackageExtendedSqlParameterBean}.${sqlParameterName}();
+    #foreach ($propertyName in $propertyDefinitionMap.keySet())
+      #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+      #if ($database.isSqlParameterBeanHaveTheProperty($sqlParameterName, $propertyName))
+
+            pmb.${database.initCap($propertyName)} = this.${database.initCap($propertyName)};
+      #end
+    #end
+
+            return pmb;
+        }
+  #end
+
+        #endregion
+#end
+        // =====================================================================================
+        //                                                                 Basic-Override Method
+        //                                                                 =====================
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <returns>View-string of all-columns value.</returns>
+        public override String ToString() {
+            StringBuilder sb = new StringBuilder();
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+            sb.Append(" ${propertyName}=").Append(this.${database.initCap($propertyName)});
+#end
+
+            return sb.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanBs.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanBs.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanBs.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,135 @@
+#set ($myClassName = "${myExtendedSqlParameterClassName}")
+
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace ${glPackageExtendedSqlParameterBean} {
+
+    /// <summary>
+    /// The sql-parametaer-bean of ${mySqlParameterBeanName}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    [System.Serializable]
+    public partial class ${myClassName} {
+
+        // =====================================================================================
+        //                                                                     Static Definition
+        //                                                                     =================
+        #region Static Definition
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+
+        /// <summary>The java name of ${propertyName}</summary>
+        public static readonly String JAVA_NAME_OF_${database.initCap($propertyName)} = "${database.initCap($propertyName)}";
+
+        /// <summary>The property name of ${propertyName}</summary>
+        public static readonly String PROPERTY_NAME_OF_${database.initCap($propertyName)} = "${propertyName}";
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        #region Attribute
+
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+  #if ($database.isSqlParameterBeanPropertyDefaultValueEffective($mySqlParameterBeanName, $propertyName))
+
+        /// <summary>The value of ${propertyName}. Default value is ${database.getSqlParameterBeanPropertyDefaultValue($mySqlParameterBeanName, $propertyName)}.</summary>
+        protected ${propertyJavaNative} _${propertyName} = ${database.getSqlParameterBeanPropertyDefaultValue($mySqlParameterBeanName, $propertyName)};
+  #else
+
+        /// <summary>The value of ${propertyName}.</summary>
+        protected ${propertyJavaNative} _${propertyName};
+  #end
+
+        /// <summary>Has the setter of ${col.UncapitalisedJavaName} been invoked?</summary>
+        protected bool _isSetterInvoked${database.initCap($propertyName)};
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        #region Constructor
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        public ${myClassName}() {
+        }
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                              Property
+        //                                                                              ========
+        #region Property
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+        /// <summary>
+        /// The value of ${propertyName}.
+        /// </summary>
+        public ${propertyJavaNative} ${database.initCap($propertyName)} {
+            get { return _${propertyName}; }
+            set { _isSetterInvoked${database.initCap($propertyName)} = true; _${propertyName} = value; }
+        }
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                Invoking Determination
+        //                                                                ======================
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+        /// <summary>
+        /// Has the setter of ${propertyName} been invoked?
+        /// </summary>
+        /// <returns>Determination.</returns>
+        public bool IsSetterInvoked${database.initCap($propertyName)}() {
+            return _isSetterInvoked${database.initCap($propertyName)};
+        }
+#end
+
+        // =====================================================================================
+        //                                                                 Property PropertyInfo
+        //                                                                 =====================
+        #region Property PropertyInfo
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+        /// <summary>
+        /// Get the propertyInfo of ${propertyName}.
+        /// </summary>
+        public PropertyInfo GetPropertyInfo${database.initCap($propertyName)}() {
+            return this.GetType().GetProperty("${database.initCap($propertyName)}");
+        }
+#end
+
+        #endregion
+
+        // =====================================================================================
+        //                                                                 Basic-Override Method
+        //                                                                 =====================
+        /// <summary>
+        /// ${database.OverrideComment}
+        /// </summary>
+        /// <returns>View-string of all-columns value.</returns>
+        public override String ToString() {
+            StringBuilder sb = new StringBuilder();
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+            sb.Append(" ${propertyName}=").Append(this.${database.initCap($propertyName)});
+#end
+
+            return sb.ToString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanEx.vmnet
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanEx.vmnet	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/csharp/sbean/SqlParameterBeanEx.vmnet	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,15 @@
+#set ($myClassName = "${myExtendedSqlParameterClassName}")
+
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace ${glPackageExtendedSqlParameterBean} {
+
+    /// <summary>
+    /// The sql-parameter-bean of ${mySqlParameterBeanName}.
+    /// Author: ${database.ClassAuthor}
+    /// </summary>
+    partial class ${myClassName} {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/AccessContext.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/AccessContext.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/AccessContext.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,152 @@
+package ${glPackageBaseCommon};
+
+/**
+ * Access-Context.
+ * <pre>
+ * This access-context on the thread should be initialized at the beginning of access.
+ * The access is various. Web-Access, Batch-Access, JUnit-Access and so on...
+ * </pre>
+ * @author ${database.ClassAuthor}
+ */
+public class ${glAccessContextName} {
+
+    // ===================================================================================
+    //                                                                        Thread Local
+    //                                                                        ============
+    /** The thread-local for this. */
+    private static final ThreadLocal${database.filterGenericsString(${glAccessContextName})} threadLocal = new ThreadLocal${database.filterGenericsString(${glAccessContextName})}();
+
+    /**
+     * Get access-context on thread.
+     * 
+     * @return Access-context. (Nullable)
+     */
+    public static ${glAccessContextName} getAccessContextOnThread() {
+        return (${glAccessContextName}) threadLocal.get();
+    }
+
+    /**
+     * Set access-context on thread.
+     * 
+     * @param accessContext Access-context. (NotNull)
+     */
+    public static void setAccessContextOnThread(${glAccessContextName} accessContext) {
+        if (accessContext == null) {
+            String msg = "The argument[accessContext] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        threadLocal.set(accessContext);
+    }
+
+    /**
+     * Is existing access-context on thread?
+     * 
+     * @return Determination.
+     */
+    public static boolean isExistAccessContextOnThread() {
+        return (threadLocal.get() != null);
+    }
+
+    /**
+     * Clear access-context on thread.
+     */
+    public static void clearAccessContextOnThread() {
+        threadLocal.set(null);
+    }
+
+    // ===================================================================================
+    //                                                                  Access Information
+    //                                                                  ==================
+    /**
+     * Get access user on thread.
+     * <pre>
+     * If it can't get access user from access-context, 
+     * returns 'Anonymous' as default value!
+     * </pre>
+     * @return Access user. (NotNull)
+     */
+    public static String getAccessUserOnThread() {
+        if (isExistAccessContextOnThread()) {
+            final ${glAccessContextName} userContextOnThread = getAccessContextOnThread();
+            final String accessUser = userContextOnThread.getAccessUser();
+            if (accessUser != null) {
+                return accessUser;
+            }
+        }
+        return "Anonymous";// as Default
+    }
+
+    /**
+     * Get access module on thread.
+     * <pre>
+     * If it can't get access module from access-context, 
+     * returns 'Anonymous' as default value!
+     * </pre>
+     * @return Access module. (NotNull)
+     */
+    public static String getAccessModuleOnThread() {
+        if (isExistAccessContextOnThread()) {
+            final ${glAccessContextName} userContextOnThread = getAccessContextOnThread();
+            final String accessModule = userContextOnThread.getAccessModule();
+            if (accessModule != null) {
+                return accessModule;
+            }
+        }
+        return "Anonymous";// as Default
+    }
+
+    /**
+     * Get access timestamp on thread.
+     * <pre>
+     * If it can't get access timestamp from access-context, 
+     * returns application current time as default value!
+     * </pre>
+     * @return Access timestamp. (NotNull)
+     */
+    public static java.sql.Timestamp getAccessTimestampOnThread() {
+        if (isExistAccessContextOnThread()) {
+            final ${glAccessContextName} userContextOnThread = getAccessContextOnThread();
+            final java.sql.Timestamp accessTimestamp = userContextOnThread.getAccessTimestamp();
+            if (accessTimestamp != null) {
+                return accessTimestamp;
+            }
+        }
+        return new java.sql.Timestamp(System.currentTimeMillis());// as Default
+    }
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    protected String accessUser;
+
+    protected String accessModule;
+
+    protected java.sql.Timestamp accessTimestamp;
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+    public String getAccessUser() {
+        return accessUser;
+    }
+
+    public void setAccessUser(String accessUser) {
+        this.accessUser = accessUser;
+    }
+
+    public String getAccessModule() {
+        return accessModule;
+    }
+
+    public void setAccessModule(String accessModule) {
+        this.accessModule = accessModule;
+    }
+
+    public java.sql.Timestamp getAccessTimestamp() {
+        return accessTimestamp;
+    }
+
+    public void setAccessTimestamp(java.sql.Timestamp accessTimestamp) {
+        this.accessTimestamp = accessTimestamp;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/CacheDaoSelector.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/CacheDaoSelector.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/CacheDaoSelector.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,295 @@
+package ${glPackageBaseCommon};
+#if ($database.isAvailableBehaviorGeneration())
+
+import ${glPackageBaseCommonBhv}.${glBehaviorReadableInterfaceName};
+import ${glPackageBaseCommonBhv}.${glBehaviorWritableInterfaceName};
+#end
+
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInstanceHandlerName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+
+import org.seasar.framework.container.S2Container;
+
+/**
+ * The implementation of dao-selector.
+ * <pre>
+ * Long long ago this object have cache of dao and bhv.
+ * But the cache cause wrong performance when this is initialized.
+ * So now this object don't have cache.
+ * </pre>
+ * @author ${database.ClassAuthor}
+ */
+public class ${glCacheDaoSelectorName} implements ${glDaoSelectorInterfaceName} {
+
+    protected S2Container _container;
+
+    public void setContainer(S2Container container) {
+        this._container = container;
+    }
+
+#if ($database.isAvailableGenerics())
+    /**
+     * Get dao.
+     * 
+     * @param daoType Dao type. (NotNull)
+     * @return Dao. (NotNull)
+     */
+    public <DAO_TYPE extends ${glDaoReadableInterfaceName}> DAO_TYPE getDao(Class<DAO_TYPE> daoType) {
+        return (DAO_TYPE)_container.getComponent(daoType);
+    }
+
+    /**
+     * Get dao-readable.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Dao-readable. (NotNull)
+     */
+    public ${glDaoReadableInterfaceName} byNameAsDaoReadable(String tableMultiName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableMultiName(tableMultiName);
+        return getDao(getDaoType(dbmeta));
+    }
+
+#if ($database.isAvailableBehaviorGeneration())
+    /**
+     * Get behavior.
+     * 
+     * @param behaviorType Behavior type. (NotNull)
+     * @return Behavior. (NotNull)
+     */
+    public <BEHAVIOR_TYPE extends ${glBehaviorReadableInterfaceName}> BEHAVIOR_TYPE getBehavior(Class<BEHAVIOR_TYPE> behaviorType) {
+        return (BEHAVIOR_TYPE)_container.getComponent(behaviorType);
+    }
+
+    /**
+     * Get behavior-readable.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Behavior-readable. (NotNull)
+     */
+    public ${glBehaviorReadableInterfaceName} byNameAsBehaviorReadable(String tableMultiName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableMultiName(tableMultiName);
+        return getBehavior(getBehaviorType(dbmeta));
+    }
+#end
+#end
+
+    /**
+     * Get dao-readable by dao type.
+     * 
+     * @param daoType Dao type. (NotNull)
+     * @return Dao-readable. (NotNull)
+     */
+    public ${glDaoReadableInterfaceName} getRDao(Class daoType) {
+        assertObjectNotNull("daoType", daoType);
+        return (${glDaoReadableInterfaceName})_container.getComponent(daoType);
+    }
+
+    /**
+     * Get dao-readable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Dao-readable. (NotNull)
+     */
+    public ${glDaoReadableInterfaceName} getRDao(${glEntityInterfaceName} entity) {
+        assertObjectNotNull("entity", entity);
+        return getRDao(getDaoType(entity.getDBMeta()));
+    }
+
+    /**
+     * Get dao-readable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Dao-readable. (NotNull)
+     */
+    public ${glDaoReadableInterfaceName} getRDao(String tableMultiName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableMultiName(tableMultiName);
+        return getRDao(getDaoType(dbmeta));
+    }
+
+    /**
+     * Get dao-writable by dao type.
+     * 
+     * @param daoType Dao type. (NotNull)
+     * @return Dao-writable. (NotNull)
+     */
+    public ${glDaoWritableInterfaceName} getWDao(Class daoType) {
+        assertObjectNotNull("daoType", daoType);
+        return (${glDaoWritableInterfaceName})getRDao(daoType);
+    }
+
+    /**
+     * Get dao-writable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Dao-writable. (NotNull)
+     */
+    public ${glDaoWritableInterfaceName} getWDao(${glEntityInterfaceName} entity) {
+        assertObjectNotNull("entity", entity);
+        return (${glDaoWritableInterfaceName})getRDao(entity);
+    }
+
+    /**
+     * Get dao-writable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Dao-writable. (NotNull)
+     */
+    public ${glDaoWritableInterfaceName} getWDao(String tableMultiName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+        return (${glDaoWritableInterfaceName})getRDao(tableMultiName);
+    }
+#if ($database.isAvailableBehaviorGeneration())
+
+    /**
+     * Get bhv-readable by bhv type.
+     * 
+     * @param bhvType Bhv type. (NotNull)
+     * @return Bhv-readable. (NotNull)
+     */
+    public ${glBehaviorReadableInterfaceName} getRBhv(Class bhvType) {
+        assertObjectNotNull("bhvType", bhvType);
+        return (${glBehaviorReadableInterfaceName})_container.getComponent(bhvType);
+    }
+
+    /**
+     * Get bhv-readable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Bhv-readable. (NotNull)
+     */
+    public ${glBehaviorReadableInterfaceName} getRBhv(${glEntityInterfaceName} entity) {
+        assertObjectNotNull("entity", entity);
+        return getRBhv(getBehaviorType(entity.getDBMeta()));
+    }
+
+    /**
+     * Get bhv-readable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Bhv-readable. (NotNull)
+     */
+    public ${glBehaviorReadableInterfaceName} getRBhv(String tableMultiName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableMultiName(tableMultiName);
+        return getRBhv(getBehaviorType(dbmeta));
+    }
+
+    /**
+     * Get bhv-writable by bhv type.
+     * 
+     * @param bhvType Bhv type. (NotNull)
+     * @return Bhv-writable. (NotNull)
+     */
+    public ${glBehaviorWritableInterfaceName} getWBhv(Class bhvType) {
+        assertObjectNotNull("bhvType", bhvType);
+        return (${glBehaviorWritableInterfaceName})getRBhv(bhvType);
+    }
+
+    /**
+     * Get bhv-writable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Bhv-writable. (NotNull)
+     */
+    public ${glBehaviorWritableInterfaceName} getWBhv(${glEntityInterfaceName} entity) {
+        assertObjectNotNull("entity", entity);
+        return (${glBehaviorWritableInterfaceName})getRBhv(entity);
+    }
+
+    /**
+     * Get bhv-writable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Bhv-writable. (NotNull)
+     */
+    public ${glBehaviorWritableInterfaceName} getWBhv(String tableMultiName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+        return (${glBehaviorWritableInterfaceName})getRBhv(tableMultiName);
+    }
+
+    /**
+     * Get behavior-type by dbmeta.
+     * 
+     * @param dbmeta Dbmeta. (NotNull)
+     * @return Behavior-type. (NotNull)
+     */
+    protected Class getBehaviorType(${glDBMetaInterfaceName} dbmeta) {
+        final String behaviorTypeName = dbmeta.getBehaviorTypeName();
+        if (behaviorTypeName == null) {
+            String msg = "The dbmeta.getBehaviorTypeName() should not return null: dbmeta=" + dbmeta;
+            throw new IllegalStateException(msg);
+        }
+        final Class behaviorType;
+        try {
+            behaviorType = Class.forName(behaviorTypeName);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("The class does not exist: " + behaviorTypeName, e);
+        }
+        return behaviorType;
+    }
+#end
+
+    protected Class getDaoType(${glDBMetaInterfaceName} dbmeta) {
+        final String daoTypeName = dbmeta.getDaoTypeName();
+        if (daoTypeName == null) {
+            String msg = "The dbmeta.getDaoTypeName() should not return null: dbmeta=" + dbmeta;
+            throw new IllegalStateException(msg);
+        }
+        final Class daoType;
+        try {
+            daoType = Class.forName(daoTypeName);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("The class does not exist: " + daoTypeName, e);
+        }
+        return daoType;
+    }
+
+    // =====================================================================================
+    //                                                                               Destroy
+    //                                                                               =======
+    public void destroy() {
+        _container = null;
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the object is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertObjectNotNull(String variableName, Object value) {
+        if (variableName == null) {
+            String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "The value should not be null: variableName=" + variableName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the entity is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        assertObjectNotNull("variableName", variableName);
+        assertObjectNotNull("value", value);
+        if (value.trim().length() ==0) {
+            String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/ClassificationDefinition.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/ClassificationDefinition.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/ClassificationDefinition.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,115 @@
+package ${glPackageBaseCommon};
+
+#set ($myClassName = "${glClassificationDefinition}")
+
+/**
+ * The definition class that has classification.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // =====================================================================================
+    //                                                        Classification-Code-Definition
+    //                                                        ==============================
+#foreach ($classificationName in $database.ClassificationNameList)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+  #foreach ($classificationMap in $classificationMapList)
+
+    /**
+     * The classification code of ${classificationMap.get('name')}. <br />
+     * ${classificationMap.get('comment')} <br />
+     */
+    public static final String CODE_${classificationName}_${classificationMap.get('name')} = "$classificationMap.get('code')";
+  #end
+#end
+
+    // =====================================================================================
+    //                                                 Classification-CodeNameMap-Definition
+    //                                                 =====================================
+#foreach ($classificationName in $database.ClassificationNameListValidNameOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+
+    /** The classification code-name map of ${classificationName}. */
+    public static final java.util.Map${database.filterGenericsString('String, String')} CODE_NAME_MAP_${classificationName};
+    static {
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+  #foreach ($classificationMap in $classificationMapList)
+      map.put(CODE_${classificationName}_${classificationMap.get('name')}, "${classificationMap.get('name')}");
+  #end
+
+        CODE_NAME_MAP_${classificationName} = java.util.Collections.unmodifiableMap(map);
+    }
+#end
+
+#foreach ($classificationName in $database.ClassificationNameListValidAliasOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+
+    /** The classification code-alias map of ${classificationName}. */
+    public static final java.util.Map${database.filterGenericsString('String, String')} CODE_ALIAS_MAP_${classificationName};
+    static {
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+  #foreach ($classificationMap in $classificationMapList)
+      map.put(CODE_${classificationName}_${classificationMap.get('name')}, "${classificationMap.get('alias')}");
+  #end
+
+        CODE_ALIAS_MAP_${classificationName} = java.util.Collections.unmodifiableMap(map);
+    }
+#end
+
+
+    // =====================================================================================
+    //                                              Classification-ValueLabelList-Definition
+    //                                              ========================================
+#foreach ($classificationName in $database.ClassificationNameListValidNameOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+
+    /** The classification code-name map of ${classificationName}. */
+    public static final java.util.List${database.filterGenericsString('java.util.Map<String, String>')} VALUE_LABEL_NAME_LIST_${classificationName};
+    static {
+        final java.util.List${database.filterGenericsString('java.util.Map<String, String>')} list = new java.util.ArrayList${database.filterGenericsString('java.util.Map<String, String>')}();
+  #foreach ($classificationMap in $classificationMapList)
+      setupValueLabelElement(list, CODE_${classificationName}_${classificationMap.get('name')}, "${classificationMap.get('name')}");
+  #end
+
+        VALUE_LABEL_NAME_LIST_${classificationName} = java.util.Collections.unmodifiableList(list);
+    }
+    public static java.util.List${database.filterGenericsString('java.util.Map<String, String>')} createValueLabelNameList${classificationName}() {
+        return setupValueLabelList(VALUE_LABEL_NAME_LIST_${classificationName});
+    }
+#end
+#foreach ($classificationName in $database.ClassificationNameListValidAliasOnly)
+  #set ($classificationMapList = $database.ClassificationDefinitionMap.get($classificationName))
+
+    /** The classification code-name map of ${classificationName}. */
+    public static final java.util.List${database.filterGenericsString('java.util.Map<String, String>')} VALUE_LABEL_ALIAS_LIST_${classificationName};
+    static {
+        final java.util.List${database.filterGenericsString('java.util.Map<String, String>')} list = new java.util.ArrayList${database.filterGenericsString('java.util.Map<String, String>')}();
+  #foreach ($classificationMap in $classificationMapList)
+      setupValueLabelElement(list, CODE_${classificationName}_${classificationMap.get('name')}, "${classificationMap.get('alias')}");
+  #end
+
+        VALUE_LABEL_ALIAS_LIST_${classificationName} = java.util.Collections.unmodifiableList(list);
+    }
+    public static java.util.List${database.filterGenericsString('java.util.Map<String, String>')} createValueLabelAliasList${classificationName}() {
+        return setupValueLabelList(VALUE_LABEL_ALIAS_LIST_${classificationName});
+    }
+#end
+
+    protected static java.util.List${database.filterGenericsString('java.util.Map<String, String>')} setupValueLabelList(java.util.List${database.filterGenericsString('java.util.Map<String, String>')} ls) {
+        final java.util.List${database.filterGenericsString('java.util.Map<String, String>')} newList = new java.util.ArrayList${database.filterGenericsString('java.util.Map<String, String>')}();
+        for (final java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+            final java.util.Map${database.filterGenericsString('String, String')} map = (java.util.Map${database.filterGenericsString('String, String')})ite.next();
+            final java.util.Map${database.filterGenericsString('String, String')} newMap = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}(map);
+            newList.add(newMap);
+        }
+        return newList;
+    }
+
+    protected static void setupValueLabelElement(java.util.List${database.filterGenericsString('java.util.Map<String, String>')} ls, String value, String label) {
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        map.put("value", value);
+        map.put("label", label);
+        ls.add(java.util.Collections.unmodifiableMap(map));
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoDicon.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoDicon.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoDicon.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
+	"http://www.seasar.org/dtd/components21.dtd">
+
+<components namespace="${glDaoDiconNamespace}">
+#foreach ($includePath in $database.DBFluteDiconBeforeJ2eeIncludePathList)
+
+    <include path="${includePath}"/>
+#end
+
+    <include path="${glJdbcDiconResourceName}"/>
+#foreach ($includePath in $database.DBFluteDiconOtherIncludePathList)
+
+    <include path="${includePath}"/>
+#end
+
+
+    <!-- S2Dao component. -->
+    <component class="org.seasar.dao.impl.FieldAnnotationReaderFactory"/>
+    <component class="org.seasar.dao.impl.ValueTypeFactoryImpl"/>
+    <component class="${glPackageBaseCommonS2Dao}.${glDaoMetaDataFactoryImpl}"/>
+    <component name="interceptor" class="${glPackageBaseCommonS2Dao}.${glDaoInterceptor}"/>
+#if ($database.isVersionAfter1040())
+
+    <component class="${glPackageBaseCommonS2Dao}.${glBeanMetaDataFactoryImpl}"/>
+    <component class="org.seasar.dao.impl.DaoNamingConventionImpl"/>
+    <component class="org.seasar.dao.impl.BeanEnhancerImpl"/>
+#end
+
+    <!-- Common column setup interceptor. -->
+    <component name="commonColumnSetupBeforeInsertInterceptor" class="${glPackageBaseCommonInterceptor}.${glCommonColumnSetupBeforeInsertInterceptor}"/>
+    <component name="commonColumnSetupBeforeUpdateInterceptor" class="${glPackageBaseCommonInterceptor}.${glCommonColumnSetupBeforeUpdateInterceptor}"/>
+    <component name="commonColumnSetupBeforeDeleteInterceptor" class="${glPackageBaseCommonInterceptor}.${glCommonColumnSetupBeforeDeleteInterceptor}"/>
+
+    <!-- Dao selector. -->
+    <component name="daoSelector" class="${glPackageBaseCommon}.${glCacheDaoSelectorName}">
+        <destroyMethod name="destroy"/>
+    </component>
+
+
+    <!-- Original dao component. -->
+    #foreach ($componentName in $database.getOriginalDaoComponentComponentNameList())
+      #set ($className = ${database.getOriginalDaoComponentClassName($componentName)})
+      #if ($database.isDaoComponent($componentName))
+
+    <component name="${componentName}" class="${className}">
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+      #else
+
+    <component name="${componentName}" class="${className}"/>
+      #end
+    #end
+
+
+    <!-- Original behavior aspect. -->
+    #foreach ($componentName in $database.getOriginalBehaviorAspectComponentNameList())
+      #set ($className = ${database.getOriginalBehaviorAspectClassName($componentName)})
+
+    <component name="${componentName}" class="${className}"/>
+    #end
+
+#foreach ($table in $database.Tables)
+
+    <!-- ${table.Name} -->
+  #if (${database.isAvailableCommonColumnSetupInterceptorToDao()})
+
+    <component name="${database.filterProjectSuffixForComponentName($table.UncapitalisedJavaName)}Dao" class="${glPackageExtendedDao}.${glProjectPrefix}${table.JavaName}Dao">
+        <aspect pointcut="${database.ColumnSetupBeforeInsertInterceptorToDaoPointcut}">${glDaoDiconNamespace}.commonColumnSetupBeforeInsertInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeUpdateInterceptorToDaoPointcut}">${glDaoDiconNamespace}.commonColumnSetupBeforeUpdateInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeDeleteInterceptorToDaoPointcut}">${glDaoDiconNamespace}.commonColumnSetupBeforeDeleteInterceptor</aspect>
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+  #else
+
+    <component name="${database.filterProjectSuffixForComponentName($table.UncapitalisedJavaName)}Dao" class="${glPackageExtendedDao}.${glProjectPrefix}${table.JavaName}Dao">
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+  #end
+  #if (${database.isAvailableBehaviorGeneration()})
+    #if (${database.isAvailableCommonColumnSetupInterceptorToBehavior()})
+
+    <component name="${database.filterProjectSuffixForComponentName($table.UncapitalisedJavaName)}Bhv" class="${glPackageExtendedBhv}.${glProjectPrefix}${table.JavaName}Bhv">
+#if (${database.isAvailableBehaviorRequiresNewTx()})
+        <aspect pointcut="${database.RequiresNewTransactionToBehaviorPointcut}">${database.RequiresNewTxComponentName}</aspect>
+#end
+#if (${database.isAvailableBehaviorRequiredTx()})
+        <aspect pointcut="${database.RequiredTransactionToBehaviorPointcut}">${database.RequiredTxComponentName}</aspect>
+#end
+        <aspect pointcut="${database.ColumnSetupBeforeInsertInterceptorToBehaviorPointcut}">${glDaoDiconNamespace}.commonColumnSetupBeforeInsertInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeUpdateInterceptorToBehaviorPointcut}">${glDaoDiconNamespace}.commonColumnSetupBeforeUpdateInterceptor</aspect>
+        <aspect pointcut="${database.ColumnSetupBeforeDeleteInterceptorToBehaviorPointcut}">${glDaoDiconNamespace}.commonColumnSetupBeforeDeleteInterceptor</aspect>
+        #foreach ($componentName in $database.getOriginalBehaviorAspectComponentNameList())
+          #set ($pointcut = ${database.getOriginalBehaviorAspectPointcut($componentName)})
+
+        <aspect pointcut="${pointcut}">${glDaoDiconNamespace}.${componentName}</aspect>
+        #end
+
+    </component>
+    #else
+
+    <component name="${database.filterProjectSuffixForComponentName($table.UncapitalisedJavaName)}Bhv" class="${glPackageExtendedBhv}.${glProjectPrefix}${table.JavaName}Bhv">
+#if (${database.isAvailableBehaviorRequiresNewTx()})
+        <aspect pointcut="${database.RequiresNewTransactionToBehaviorPointcut}">${database.RequiresNewTxComponentName}</aspect>
+#end
+#if (${database.isAvailableBehaviorRequiredTx()})
+        <aspect pointcut="${database.RequiredTransactionToBehaviorPointcut}">${database.RequiredTxComponentName}</aspect>
+#end
+    #foreach ($componentName in $database.getOriginalBehaviorAspectComponentNameList())
+      #set ($pointcut = ${database.getOriginalBehaviorAspectPointcut($componentName)})
+
+        <aspect pointcut="${pointcut}">${glDaoDiconNamespace}.${componentName}</aspect>
+    #end
+
+    </component>
+    #end
+  #end
+#end
+
+#foreach ($table in $database.CustomizeTableList)
+
+    <!-- ${table.Name} (as customize dao) -->
+
+    <component name="${database.filterProjectSuffixForComponentName($table.UncapitalisedJavaName)}Dao" class="${glPackageExtendedCustomizeDao}.${glProjectPrefix}${table.JavaName}Dao">
+        <aspect>${glDaoDiconNamespace}.interceptor</aspect>
+    </component>
+#end
+
+</components>

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoReadable.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoReadable.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoReadable.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,12 @@
+package ${glPackageBaseCommon};
+
+/**
+ * The interface of dao-readable.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glDaoReadableInterfaceName} {
+    // [Developer's comment] (2006/06/08)
+    // It cannot be done for the convenience of s2dao though I want to define methods for condition-bean here.
+    // DTO argument as Interface is not accepted.
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoSelector.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoSelector.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoSelector.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,160 @@
+package ${glPackageBaseCommon};
+#if ($database.isAvailableBehaviorGeneration())
+
+import ${glPackageBaseCommonBhv}.${glBehaviorReadableInterfaceName};
+import ${glPackageBaseCommonBhv}.${glBehaviorWritableInterfaceName};
+#end
+
+/**
+ * The interface of dao-selector.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glDaoSelectorInterfaceName} {
+#if ($database.isAvailableGenerics())
+
+    /**
+     * Get dao.
+     * 
+     * @param daoType Dao type. (NotNull)
+     * @return Dao. (NotNull)
+     */
+    public <DAO_TYPE extends ${glDaoReadableInterfaceName}> DAO_TYPE getDao(Class<DAO_TYPE> daoType);
+
+    /**
+     * Get dao-readable.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Dao-readable. (NotNull)
+     */
+    public ${glDaoReadableInterfaceName} byNameAsDaoReadable(String tableMultiName);
+
+#if ($database.isAvailableBehaviorGeneration())
+    /**
+     * Get behavior.
+     * 
+     * @param behaviorType Behavior type. (NotNull)
+     * @return Behavior. (NotNull)
+     */
+    public <BEHAVIOR_TYPE extends ${glBehaviorReadableInterfaceName}> BEHAVIOR_TYPE getBehavior(Class<BEHAVIOR_TYPE> behaviorType);
+
+    /**
+     * Get behavior-readable.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Behavior-readable. (NotNull)
+     */
+    public ${glBehaviorReadableInterfaceName} byNameAsBehaviorReadable(String tableMultiName);
+#end
+#end
+
+    /**
+     * Get dao-readable by dao type.
+     * 
+     * @param daoType Dao type. (NotNull)
+     * @return Dao-readable. (NotNull)
+     * @deprecated
+     */
+    public ${glDaoReadableInterfaceName} getRDao(Class daoType);
+
+    /**
+     * Get dao-readable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Dao-readable. (NotNull)
+     * @deprecated
+     */
+    public ${glDaoReadableInterfaceName} getRDao(${glEntityInterfaceName} entity);
+
+    /**
+     * Get dao-readable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Dao-readable. (NotNull)
+     * @deprecated
+     */
+    public ${glDaoReadableInterfaceName} getRDao(String tableMultiName);
+
+    /**
+     * Get dao-writable by dao type.
+     * 
+     * @param daoType Dao type. (NotNull)
+     * @return Dao-writable. (NotNull)
+     * @deprecated
+     */
+    public ${glDaoWritableInterfaceName} getWDao(Class daoType);
+
+    /**
+     * Get dao-writable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Dao-writable. (NotNull)
+     * @deprecated
+     */
+    public ${glDaoWritableInterfaceName} getWDao(${glEntityInterfaceName} entity);
+
+    /**
+     * Get dao-writable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Dao-writable. (NotNull)]
+     * @deprecated
+     */
+    public ${glDaoWritableInterfaceName} getWDao(String tableMultiName);
+#if ($database.isAvailableBehaviorGeneration())
+
+    /**
+     * Get bhv-readable by bhv type.
+     * 
+     * @param bhvType Bhv type. (NotNull)
+     * @return Bhv-readable. (NotNull)
+     * @deprecated
+     */
+    public ${glBehaviorReadableInterfaceName} getRBhv(Class bhvType);
+
+    /**
+     * Get bhv-readable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Bhv-readable. (NotNull)
+     * @deprecated
+     */
+    public ${glBehaviorReadableInterfaceName} getRBhv(${glEntityInterfaceName} entity);
+
+    /**
+     * Get bhv-readable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Bhv-readable. (NotNull)
+     * @deprecated
+     */
+    public ${glBehaviorReadableInterfaceName} getRBhv(String tableMultiName);
+
+    /**
+     * Get bhv-writable by bhv type.
+     * 
+     * @param bhvType Bhv type. (NotNull)
+     * @return Bhv-writable. (NotNull)
+     * @deprecated
+     */
+    public ${glBehaviorWritableInterfaceName} getWBhv(Class bhvType);
+
+    /**
+     * Get bhv-writable by entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Bhv-writable. (NotNull)
+     * @deprecated
+     */
+    public ${glBehaviorWritableInterfaceName} getWBhv(${glEntityInterfaceName} entity);
+
+    /**
+     * Get bhv-writable by table multi-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Bhv-writable. (NotNull)
+     * @deprecated
+     */
+    public ${glBehaviorWritableInterfaceName} getWBhv(String tableMultiName);
+#end
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoWritable.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoWritable.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/DaoWritable.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,67 @@
+package ${glPackageBaseCommon};
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+
+/**
+ * The interface of dao-writable.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glDaoWritableInterfaceName} extends ${glDaoReadableInterfaceName} {
+
+    /**
+     * Insert one entity that the type is entity-interface.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Inserted count.
+     */
+    public int create(${glEntityInterfaceName} entity);
+
+    /**
+     * Update one entity that the type is entity-interface.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Updated count.
+     */
+    public int modify(${glEntityInterfaceName} entity);
+
+    /**
+     * Update one entity that the type is entity-interface. (modified only)
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Updated count.
+     */
+    public int modifyModifiedOnly(${glEntityInterfaceName} entity);
+
+    /**
+     * Delete one entity that the type is entity-interface.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Deleted count.
+     */
+    public int remove(${glEntityInterfaceName} entity);
+
+    /**
+     * Insert several entities that the type is entity-interface.
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Inserted count.
+     */
+    public int createList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    /**
+     * Update several entities that the type is entity-interface.
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Updated count.
+     */
+    public int modifyList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    /**
+     * Delete several entities that the type is entity-interface.
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Deleted count.
+     */
+    public int removeList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/Entity.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/Entity.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/Entity.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,224 @@
+package ${glPackageBaseCommon};
+
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+import ${glPackageBaseCommonHelper}.${glMapListStringName};
+import ${glPackageBaseCommonHelper}.${glMapListStringImplName};
+
+/**
+ * The interface of entity.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glEntityInterfaceName} {
+
+    // ===================================================================================
+    //                                                                          Definition
+    //                                                                          ==========
+    /** Map-string map-mark. */
+    public static final String MAP_STRING_MAP_MARK = "map:";
+
+    /** Map-string list-mark. */
+    public static final String MAP_STRING_LIST_MARK = "list:";
+
+    /** Map-string start-brace. */
+    public static final String MAP_STRING_START_BRACE = "${database.extractAcceptStartBrace}";
+
+    /** Map-string end-brace. */
+    public static final String MAP_STRING_END_BRACE = "${database.extractAcceptEndBrace}";
+
+    /** Map-string delimiter. */
+    public static final String MAP_STRING_DELIMITER = "${database.extractAcceptDelimiter}";
+
+    /** Map-string equal. */
+    public static final String MAP_STRING_EQUAL = "${database.extractAcceptEqual}";
+
+    // ===================================================================================
+    //                                                                              DBMeta
+    //                                                                              ======
+    /**
+     * Get dbmeta.
+     * 
+     * @return DBMeta. (NotNull)
+     */
+    public ${glDBMetaInterfaceName} getDBMeta();
+
+    // ===================================================================================
+    //                                                                          Table Name
+    //                                                                          ==========
+    /**
+     * Get table db-name.
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName();
+
+    /**
+     * Get table cap-prop-name.
+     * 
+     * @return Table cap-prop-name. (NotNull)
+     */
+    public String getTableCapPropName();
+
+    /**
+     * Get table uncap-prop-name.
+     * 
+     * @return Table uncap-prop-name. (NotNull)
+     */
+    public String getTableUncapPropName();
+
+    // ===================================================================================
+    //                                                                              Accept
+    //                                                                              ======
+    /**
+     * Accept primary-key map.
+     * 
+     * @param primaryKeyMap Primary-key map. (NotNull and NotEmpty)
+     * @deprecated Please use ${glDBMetaInterfaceName}#acceptPrimaryKeyMap(entity, primaryKeyMap);
+     */
+    public void acceptPrimaryKeyMap(java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap);
+
+    /**
+     * Accept primary-key map-string.
+     * 
+     * @param primaryKeyMapString Primary-key map-string. (NotNull)
+     * @deprecated Please use ${glDBMetaInterfaceName}#acceptPrimaryKeyMapString(entity, primaryKeyMap);
+     */
+    public void acceptPrimaryKeyMapString(String primaryKeyMapString);
+
+    /**
+     * Accept column-value map.
+     * 
+     * @param columnValueMap Column-value map. (NotNull and NotEmpty)
+     * @deprecated Please use ${glDBMetaInterfaceName}#acceptColumnValueMap(entity, columnValueMap);
+     */
+    public void acceptColumnValueMap(java.util.Map${database.filterGenericsString('String, ? extends Object')} columnValueMap);
+
+    /**
+     * Accept column-value map-string.
+     * 
+     * @param columnValueMapString Column-value map-string. (NotNull)
+     * @deprecated Please use ${glDBMetaInterfaceName}#acceptColumnValueMapString(entity, columnValueMapString);
+     */
+    public void acceptColumnValueMapString(String columnValueMapString);
+
+    // ===================================================================================
+    //                                                                             Extract
+    //                                                                             =======
+    /**
+     * Extract primary-key map-string. Delimiter is at-mark and semicolon.
+     * <p>
+     * <pre>
+     * ex) Uses that this method have.
+     *   final String primaryKeyMapString = entity.extractPrimaryKeyMapString();
+     *   final LdBook entity = dao.selectEntity(new LdBookCB().acceptPrimaryKeyMapString(primaryKeyMapString));
+     *   ... // as primary key for condition.
+     * </pre>
+     * 
+     * @return Primary-key map-string. (NotNull)
+     * @deprecated Please use ${glDBMetaInterfaceName}#extractPrimaryKeyMapString(entity);
+     */
+    public String extractPrimaryKeyMapString();
+
+    /**
+     * Extract primary-key map-string.
+     * 
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Primary-key map-string. (NotNull)
+     * @deprecated Please use ${glDBMetaInterfaceName}#extractPrimaryKeyMapString(entity, startBrace, endBrace, delimiter, equal);
+     */
+    public String extractPrimaryKeyMapString(String startBrace, String endBrace, String delimiter, String equal);
+
+    /**
+     * Extract column-value map-string. Delimiter is at-mark and semicolon.
+     * 
+     * @return Column-value map-string. (NotNull)
+     * @deprecated Please use ${glDBMetaInterfaceName}#extractColumnValueMapString(entity);
+     */
+    public String extractColumnValueMapString();
+
+    /**
+     * Extract column-value map-string.
+     * 
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     * @deprecated Please use ${glDBMetaInterfaceName}#extractColumnValueMapString(entity, startBrace, endBrace, delimiter, equal);
+     */
+    public String extractColumnValueMapString(String startBrace, String endBrace, String delimiter, String equal);
+
+    // ===================================================================================
+    //                                                                       Determination
+    //                                                                       =============
+    /**
+     * Has primary-key value?
+     * 
+     * @return Determination.
+     */
+    public boolean hasPrimaryKeyValue();
+
+    // ===================================================================================
+    //                                                                 Modified Properties
+    //                                                                 ===================
+    /**
+     * Get modified property names. (JavaBeansRule)
+     * 
+     * @return Modified property names. (NotNull)
+     */
+    public java.util.Set${database.filterGenericsString('String')} getModifiedPropertyNames();
+
+    /**
+     * Clear modified property names.
+     */
+    public void clearModifiedPropertyNames();
+
+    /**
+     * Entity modified properties.
+     */
+    public static class EntityModifiedProperties implements java.io.Serializable {
+
+        /** Serial version UID. (Default) */
+        private static final long serialVersionUID = 1L;
+
+        /** Set of properties. */
+        protected java.util.Set${database.filterGenericsString('String')} _propertiesSet = new java.util.LinkedHashSet${database.filterGenericsString('String')}();
+
+        /**
+         * Add property name. (JavaBeansRule)
+         * 
+         * @param propertyName Property name. (Nullable)
+         */
+        public void addPropertyName(String propertyName) {
+            _propertiesSet.add(propertyName);
+        }
+
+        /**
+         * Get the set of properties.
+         * 
+         * @return The set of properties. (NotNull)
+         */
+        public java.util.Set${database.filterGenericsString('String')} getPropertyNames() {
+            return _propertiesSet;
+        }
+
+        /**
+         * Clear the set of properties.
+         */
+        public void clear() {
+            _propertiesSet.clear();
+        }
+
+        /**
+         * Remove property name from the set. (JavaBeansRule)
+         * 
+         * @param propertyName Property name. (Nullable)
+         */
+        public void remove(String propertyName) {
+            _propertiesSet.remove(propertyName);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/EntityDefinedCommonColumn.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/EntityDefinedCommonColumn.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/EntityDefinedCommonColumn.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,78 @@
+package ${glPackageBaseCommon};
+
+/**
+ * The interface of entity defined common column.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glEntityDefinedCommonColumnInterfaceName} extends ${glEntityInterfaceName} {
+#foreach ($columnName in ${database.commonColumnNameList})
+  #set ($filteredColumnName = ${database.filterCommonColumn(${columnName})})
+  #set ($commonColumnMap = ${database.CommonColumnMap})
+  #set ($columnType = ${commonColumnMap.get(${columnName})})
+  #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+  #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+  #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+
+    /**
+     * Get the value of ${uncapitalisedJavaName}.
+     * 
+     * @return The value of ${uncapitalisedJavaName}.
+     */
+    public ${javaNative} get${javaName}();
+
+    /**
+     * Set the value of ${uncapitalisedJavaName}.
+     * 
+     * @param ${uncapitalisedJavaName} The value of ${uncapitalisedJavaName}.
+     */
+    public void set${javaName}(${javaNative} ${uncapitalisedJavaName});
+#if ($database.isGenerateDeprecated())
+
+    /**
+     * Has the setter of ${uncapitalisedJavaName} been invoked?
+     * 
+     * @return Determination.
+     * @deprecated This method is out of date because S2Dao supported modified-properties.
+     */
+    public boolean isSetterInvoked${javaName}();
+#end
+  #if (${database.isAllClassificationColumn($filteredColumnName)})
+    #set ($classificationName = $database.getAllClassificationName($filteredColumnName))
+    #set ($classificationList = $database.getClassificationMapList($classificationName))
+    #foreach ($classificationMap in $classificationList)
+
+    /**
+     * Classify the value of ${uncapitalisedJavaName} as ${classificationMap.get('name')}.
+     */
+    public void classify${javaName}${classificationMap.get('name')}();
+
+    /**
+     * Is the value of ${uncapitalisedJavaName} '${classificationMap.get('name')}'?
+     * The difference of capital letters and small letters is NOT distinguished.
+     * If the value is null, this method returns false!
+     * 
+     * @return Determanation.
+     */
+    public boolean is${javaName}${classificationMap.get('name')}();
+
+    /**
+     * Is the value of ${uncapitalisedJavaName} '${classificationMap.get('name')}'?
+     * The difference of capital letters and small letters is NOT distinguished.
+     * If the value is null, this method throws exception!
+     * 
+     * @return Determanation.
+     */
+    public boolean is${javaName}${classificationMap.get('name')}IfNullException();
+    #end
+  #end
+#end
+
+    /**
+     * Extract common-column-value map-string.
+     * 
+     * @return Common-column-value map-string. (NotNull)
+     * @deprecated Please use ${glDBMetaInterfaceName}#extractCommonColumnValueMapString(entity);
+     */
+    public String extractCommonColumnValueMapString();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/GenMetaData.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/GenMetaData.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/GenMetaData.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,410 @@
+package ${glPackageBaseCommon};
+
+#set ($myClassName = "${glGenMetaDataClassName}")
+
+/**
+ * The sigleton class that has generate-meta-data(GenMetaData).
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    /** Singleton instance. */
+    private static final ${myClassName} _instance = new ${myClassName}();
+
+    /**
+     * Constructor.
+     */
+    private ${myClassName}() {
+    }
+
+    /**
+     * Get instance.
+     *
+     * @return Singleton instance.
+     */
+    public static ${myClassName} getInstance() {
+        return _instance;
+    }
+
+    // =========================================================================================
+    //                                                                     Generated method name
+    //                                                                     =====================
+    /**
+     * Get the method name of 'getCountAll'.
+     *
+     * @return The method name of 'getCountAll'. (NotNull)
+     */
+    public String getMethodNameOfGetCountAll() {
+        return "getCountAll";
+    }
+
+    /**
+     * Get the method name of 'getListAll'.
+     *
+     * @return The method name of 'getListAll'. (NotNull)
+     */
+    public String getMethodNameOfGetListAll() {
+        return "getListAll";
+    }
+
+    /**
+     * Get the method name of 'getEntity'.
+     *
+     * @return The method name of 'getEntity'. (NotNull)
+     */
+    public String getMethodNameOfGetEntity() {
+        return "getEntity";
+    }
+
+    /**
+     * Get the method name of 'selectCountIgnoreFetchNarrowing'.
+     *
+     * @return The method name of 'selectCountIgnoreFetchNarrowing'. (NotNull)
+     */
+    public String getMethodNameOfSelectCountIgnoreFetchScope() {
+        return "selectCountIgnoreFetchScope";
+    }
+
+    /**
+     * Get the method name of 'selectEntity'.
+     *
+     * @return The method name of 'selectEntity'. (NotNull)
+     */
+    public String getMethodNameOfSelectEntity() {
+        return "selectEntity";
+    }
+
+    /**
+     * Get the method name of 'selectList'.
+     *
+     * @return The method name of 'selectList'. (NotNull)
+     */
+    public String getMethodNameOfSelectList() {
+        return "selectList";
+    }
+
+    // =========================================================================================
+    //                                             Only when having generated, the effective one
+    //                                             =============================================
+    // -------------------------------------------------------------------------------
+    //                                                                           Basic
+    //                                                                           -----
+    /**
+     * Get the property-value of targetLanguage.
+     *
+     * @return The property-value.
+     */
+    public String getTargetLanguage() {
+        return "${database.TargetLanguage}";
+    }
+
+    /**
+     * Get the property-value of templateFileExtension.
+     *
+     * @return The property-value.
+     */
+    public String getTemplateFileExtension() {
+        return "${database.TemplateFileExtension}";
+    }
+
+    /**
+     * Get the property-value of classFileExtension.
+     *
+     * @return The property-value.
+     */
+    public String getClassFileExtension() {
+        return "${database.ClassFileExtension}";
+    }
+
+    /**
+     * Get the property-value of templateFileEncoding.
+     *
+     * @return The property-value.
+     */
+    public String getTemplateEncoding() {
+        return "${database.TemplateFileEncoding}";
+    }
+
+    /**
+     * Get the property-value of classAuthor.
+     *
+     * @return The property-value.
+     */
+    public String getClassAuthor() {
+        return "${database.ClassAuthor}";
+    }
+
+    // -------------------------------------------------------------------------------
+    //                                                                       Available
+    //                                                                       ---------
+    /**
+     * Is java name of table same as db name? Answer is ${database.isJavaNameOfTableSameAsDbName()}!
+     *
+     * @return The property-value.
+     */
+    public boolean isJavaNameOfTableSameAsDbName() {
+        return ${database.isJavaNameOfTableSameAsDbName()};
+    }
+
+    /**
+     * Is java name of column same as db name? Answer is ${database.isJavaNameOfColumnSameAsDbName()}!
+     *
+     * @return The property-value.
+     */
+    public boolean isJavaNameOfColumnSameAsDbName() {
+        return ${database.isJavaNameOfColumnSameAsDbName()};
+    }
+
+    /**
+     * Is available behavior generation? Answer is ${database.isAvailableBehaviorGeneration()}!
+     *
+     * @return The property-value.
+     */
+    public boolean isAvailableBehaviorGeneration() {
+        return ${database.isAvailableBehaviorGeneration()};
+    }
+
+    /**
+     * Is available common-column-setup interceptor to behavior? Answer is ${database.isAvailableCommonColumnSetupInterceptorToBehavior()}!
+     *
+     * @return The property-value.
+     */
+    public boolean isAvailableCommonColumnSetupInterceptorToBehavior() {
+        return ${database.isAvailableCommonColumnSetupInterceptorToBehavior()};
+    }
+
+    /**
+     * Is available common-column-setup interceptor to dao? Answer is ${database.isAvailableCommonColumnSetupInterceptorToDao()}!
+     *
+     * @return The property-value.
+     */
+    public boolean isAvailableCommonColumnSetupInterceptorToDao() {
+        return ${database.isAvailableCommonColumnSetupInterceptorToDao()};
+    }
+
+    /**
+     * Is available generics? Answer is ${database.isAvailableGenerics()}!
+     *
+     * @return The property-value.
+     */
+    public boolean isAvailableGenerics() {
+        return ${database.isAvailableGenerics()};
+    }
+
+    // -------------------------------------------------------------------------------
+    //                                                                          Prefix
+    //                                                                          ------
+    /**
+     * Get the property-value of projectPrefix.
+     *
+     * @return The property-value.
+     */
+    public String getProjectPrefix() {
+        return "${database.ProjectPrefix}";
+    }
+
+    /**
+     * Get the property-value of basePrefix.
+     *
+     * @return The property-value.
+     */
+    public String getBasePrefix() {
+        return "${database.BasePrefix}";
+    }
+
+    // -------------------------------------------------------------------------------
+    //                                                                        DaoDicon
+    //                                                                        --------
+    /**
+     * Get the property-value of daoDiconNamespace.
+     *
+     * @return The property-value.
+     */
+    public String getDaoDiconNamespace() {
+        return "${database.DaoDiconNamespace}";
+    }
+
+    /**
+     * Get the property-value of daoDiconPackageName.
+     *
+     * @return The property-value.
+     */
+    public String getDaoDiconPackageName() {
+        return "${database.DaoDiconPackageName}";
+    }
+
+    /**
+     * Get the property-value of daoDiconFileName.
+     *
+     * @return The property-value.
+     */
+    public String getDaoDiconFileName() {
+        return "${database.DaoDiconFileName}";
+    }
+
+    /**
+     * Get the property-value of jdbcDiconResourceName.
+     *
+     * @return The property-value.
+     */
+    public String getJdbcDiconResourceName() {
+        return "${database.JdbcDiconResourceName}";
+    }
+
+    /**
+     * Get the property-value of requiredTxComponentName.
+     *
+     * @return The property-value.
+     */
+    public String getRequiredTxComponentName() {
+        return "${database.requiredTxComponentName}";
+    }
+
+    // -------------------------------------------------------------------------------
+    //                                                                         Package
+    //                                                                         -------
+    /**
+     * Get the property-value of baseCommonPackage.
+     *
+     * @return The property-value.
+     */
+    public String getBaseCommonPackage() {
+        return "${database.BaseCommonPackage}";
+    }
+
+    /**
+     * Get the property-value of baseBehaviorPackage.
+     *
+     * @return The property-value.
+     */
+    public String getBaseBehaviorPackage() {
+        return "${database.BaseBehaviorPackage}";
+    }
+
+    /**
+     * Get the property-value of baseDaoPackage.
+     *
+     * @return The property-value.
+     */
+    public String getBaseDaoPackage() {
+        return "${database.BaseDaoPackage}";
+    }
+
+    /**
+     * Get the property-value of baseEntityPackage.
+     *
+     * @return The property-value.
+     */
+    public String getBaseEntityPackage() {
+        return "${database.BaseEntityPackage}";
+    }
+
+    /**
+     * Get the property-value of conditionBeanPackage.
+     *
+     * @return The property-value.
+     */
+    public String getConditionBeanPackage() {
+        return "${database.ConditionBeanPackage}";
+    }
+
+    /**
+     * Get the property-value of extendedDaoPackage.
+     *
+     * @return The property-value.
+     */
+    public String getExtendedDaoPackage() {
+        return "${database.ExtendedDaoPackage}";
+    }
+
+    /**
+     * Get the property-value of extendedBehaviorPackage.
+     *
+     * @return The property-value.
+     */
+    public String getExtendedBehaviorPackage() {
+        return "${database.ExtendedBehaviorPackage}";
+    }
+
+    /**
+     * Get the property-value of extendedEntityPackage.
+     *
+     * @return The property-value.
+     */
+    public String getExtendedEntityPackage() {
+        return "${database.ExtendedEntityPackage}";
+    }
+
+    // -------------------------------------------------------------------------------
+    //                                                                 Optimistic Lock
+    //                                                                 ---------------
+    /**
+     * Get the property-value of updateDateFieldName.
+     *
+     * @return The property-value.
+     */
+    public String getUpdateDateFieldName() {
+        return "${database.UpdateDateFieldName}";
+    }
+
+    /**
+     * Get the property-value of versionNoFieldName.
+     *
+     * @return The property-value.
+     */
+    public String getVersionNoFieldName() {
+        return "${database.VersionNoFieldName}";
+    }
+
+    // -------------------------------------------------------------------------------
+    //                                                                    Select Param
+    //                                                                    ------------
+    /**
+     * Get the property-value of selectQueryTimeout.
+     *
+     * @return The property-value.
+     */
+    public int getSelectQueryTimeout() {
+        return ${database.SelectQueryTimeout};
+    }
+
+    // -------------------------------------------------------------------------------
+    //                                                                         Extract
+    //                                                                         -------
+    /**
+     * Get the value of 'extractAcceptStartBrace'.
+     *
+     * @return The property-value. (NotNull)
+     */
+    public String getExtractAcceptStartBrace() {
+        return "${database.extractAcceptStartBrace}";
+    }
+
+    /**
+     * Get the value of 'extractAcceptEndBrace'.
+     *
+     * @return The property-value. (NotNull)
+     */
+    public String getExtractAcceptEndBrace() {
+        return "${database.extractAcceptEndBrace}";
+    }
+
+    /**
+     * Get the value of 'extractAcceptDelimiter'.
+     *
+     * @return The property-value. (NotNull)
+     */
+    public String getExtractAcceptDelimiter() {
+        return "${database.extractAcceptDelimiter}";
+    }
+
+    /**
+     * Get the value of 'extractAcceptEqual'.
+     *
+     * @return The property-value. (NotNull)
+     */
+    public String getExtractAcceptEqual() {
+        return "${database.extractAcceptEqual}";
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/annotation/OutsideSql.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/annotation/OutsideSql.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/annotation/OutsideSql.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,13 @@
+package ${glPackageBaseCommonAnnotation};
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+ @ Inherited
+ @ Retention(RetentionPolicy.RUNTIME)
+ @ Target(ElementType.METHOD)
+public @interface ${glOutsideSqlAnnotation} {
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorReadable.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorReadable.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorReadable.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,521 @@
+#set ($myClassName = "${glBehaviorReadableAbstractName}")
+
+package ${glPackageBaseCommonBhv};
+
+import ${glPackageBaseCommon}.${glDaoSelectorInterfaceName};
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+#if ($database.isAvailableGenerics())
+import ${glPackageBaseCommonBhvSetup}.${glValueLabelSetupperName};
+import ${glPackageBaseCommonBhvSetup}.${glValueLabelBoxName};
+#end
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glListResultBeanName};
+import ${glPackageBaseCommonCBean}.${glPagingBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glPagingResultBeanName};
+
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileOutputOptionName};
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileOutputResultName};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingOptionName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingHeaderInfoName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingSimpleFacadeName};
+import ${glPackageBaseCommonHelperTokenFileImpl}.${glFileMakingSimpleFacadeImplName};
+
+/**
+ * The abstract class of behavior-readable.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class $myClassName implements ${glBehaviorReadableInterfaceName} {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    /** Dao-selector instance. */
+    protected ${glDaoSelectorInterfaceName} _daoSelector;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // ===================================================================================
+    //                                                                        Dao Accessor
+    //                                                                        ============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Dao-selector.
+     */
+    public ${glDaoSelectorInterfaceName} getDaoSelector() {
+        return _daoSelector;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param value Dao-selector.
+     */
+    public void setDaoSelector(${glDaoSelectorInterfaceName} value) {
+        _daoSelector = value;
+    }
+
+    // ===================================================================================
+    //                                                                     Delegate Method
+    //                                                                     ===============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return All count.
+     */
+    public int callGetCountAll() {
+        final java.lang.reflect.Method mtd = getMethod(getDaoReadable().getClass(), "getCountAll", new Class[]{});
+        final Object result = invoke(mtd, getDaoReadable(), new Object[]{});
+        return ((Integer)result).intValue();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return All list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${glEntityInterfaceName})} callGetListAll() {
+        final java.lang.reflect.Method mtd = getMethod(getDaoReadable().getClass(), "getListAll", new Class[]{});
+        final Object result = invoke(mtd, getDaoReadable(), new Object[]{});
+        return (java.util.List${database.filterGenericsString(${glEntityInterfaceName})})result;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+     * @return Read count. (NotNull)
+     */
+    public int callReadCount(${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        final Class[] types = new Class[]{cb.getClass()};
+        final java.lang.reflect.Method mtd = getMethod(getDaoReadable().getClass(), "selectCount", types);
+        final Object result = invoke(mtd, getDaoReadable(), new Object[]{cb});
+        return ((Integer)result).intValue();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+     * @return Read entity. If the select result is zero, it returns null. (Nullable)
+     */
+    public ${glEntityInterfaceName} callReadEntity(${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        final Class[] types = new Class[]{cb.getClass()};
+        final java.lang.reflect.Method mtd = getMethod(getDaoReadable().getClass(), "selectEntity", types);
+        final Object result = invoke(mtd, getDaoReadable(), new Object[]{cb});
+        return (${glEntityInterfaceName})result;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean that the type is condition-bean-interface. (NotNull)
+     * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${glEntityInterfaceName})} callReadList(${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        final Class[] types = new Class[]{cb.getClass()};
+        final java.lang.reflect.Method mtd = getMethod(getDaoReadable().getClass(), "selectList", types);
+        final Object result = invoke(mtd, getDaoReadable(), new Object[]{cb});
+        return (java.util.List${database.filterGenericsString(${glEntityInterfaceName})})result;
+    }
+
+    private java.lang.reflect.Method getMethod(Class clazz, String methodName, Class[] argTypes) {
+        try {
+            return clazz.getMethod(methodName, argTypes);
+        } catch (NoSuchMethodException ex) {
+            String msg = "class=" + clazz + " method=" + methodName + "-" + java.util.Arrays.asList(argTypes);
+            throw new RuntimeException(msg, ex);
+        }
+    }
+
+    private Object invoke(java.lang.reflect.Method method, Object target, Object[] args) {
+        try {
+            return method.invoke(target, args);
+        } catch (java.lang.reflect.InvocationTargetException ex) {
+            Throwable t = ex.getCause();
+            if (t instanceof RuntimeException) {
+                throw (RuntimeException) t;
+            }
+            if (t instanceof Error) {
+                throw (Error) t;
+            }
+            String msg = "target=" + target + " method=" + method + "-" + java.util.Arrays.asList(args);
+            throw new RuntimeException(msg, ex);
+        } catch (IllegalAccessException ex) {
+            String msg = "target=" + target + " method=" + method + "-" + java.util.Arrays.asList(args);
+            throw new RuntimeException(msg, ex);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                         Basic Get All
+    //                                                                         =============
+    /**
+     * Get count all.
+     * 
+     * @return Count all.
+     */
+    public int getCountAll() {
+        return callGetCountAll();
+    }
+
+    // =====================================================================================
+    //                                                                      Basic Read Count
+    //                                                                      ================
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean. This condition-bean should not be set up about fetch-scope. (NotNull)
+     * @return Read count. (NotNull)
+     */
+    public int readCount(${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        return callReadCount(cb);
+    }
+
+    // =====================================================================================
+    //                                                                     Basic Read Entity
+    //                                                                     =================
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Read entity. (Nullalble)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public ${glEntityInterfaceName} readEntity(${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        final java.util.List${database.filterGenericsString(${glEntityInterfaceName})} ls = readList(cb);
+        if (ls.isEmpty()) {
+            return null;
+        }
+        assertRecordHasBeenSelectedAsOne(ls, cb);
+        return (${glEntityInterfaceName})ls.get(0);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Read entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public ${glEntityInterfaceName} readEntityWithDeletedCheck(${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        final java.util.List${database.filterGenericsString(${glEntityInterfaceName})} ls = readList(cb);
+        assertRecordHasNotBeenDeleted(ls, cb);
+        assertRecordHasBeenSelectedAsOne(ls, cb);
+        return (${glEntityInterfaceName})ls.get(0);
+    }
+
+    // =====================================================================================
+    //                                                                       Basic Read List
+    //                                                                       ===============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean.
+     * @return List-result-bean. If the select result is zero, it returns empty list. (NotNull)
+     */
+    public ${glListResultBeanName}${database.filterGenericsString(${glEntityInterfaceName})} readList(${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        return new ResultBeanBuilder${database.filterGenericsString(${glEntityInterfaceName})}(this).buildListResultBean(cb, callReadList(cb));
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Read page. (NotNull)
+     */
+    public ${glPagingResultBeanName}${database.filterGenericsString(${glEntityInterfaceName})} readPage(final ${glConditionBeanInterfaceName} cb) {
+        assertConditionBeanNotNull(cb);
+        return readPage(cb, new SelectPageSimpleInvoker${database.filterGenericsString(${glEntityInterfaceName})}(this));
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @param invoker Select-page-invoker (NotNull)
+     * @return Read page. (NotNull)
+     */
+    public ${glPagingResultBeanName}${database.filterGenericsString(${glEntityInterfaceName})} readPage(final ${glConditionBeanInterfaceName} cb, SelectPageInvoker${database.filterGenericsString(${glEntityInterfaceName})} invoker) {
+        assertConditionBeanNotNull(cb);
+        final SelectPageCallback${database.filterGenericsString(${glEntityInterfaceName})} pageCallback = new SelectPageCallback${database.filterGenericsString(${glEntityInterfaceName})}() {
+            public ${glPagingBeanInterfaceName} getPagingBean() { return cb; }
+            public int selectCountIgnoreFetchScope() {
+                return readCount(cb);
+            }
+            public java.util.List${database.filterGenericsString(${glEntityInterfaceName})} selectListWithFetchScope() {
+                return readList(cb);
+            }
+        };
+        return invoker.invokeSelectPage(pageCallback);
+    }
+
+    /**
+     * Assert that record has not been deleted.
+     * 
+     * @param entity Selected entity.
+     * @param searchKey4log Search-key for Logging.
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    protected void assertRecordHasNotBeenDeleted(${glPackageBaseCommon}.${glEntityInterfaceName} entity, Object searchKey4log) {
+        if (entity == null) {
+            String msg = "The record has already been deleted by other thread: searchKey=" + searchKey4log;
+            throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(msg);
+        }
+    }
+
+    /**
+     * Assert that record has not been deleted.
+     * 
+     * @param ls Selected list.
+     * @param searchKey4log Search-key for Logging.
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    protected void assertRecordHasNotBeenDeleted(java.util.List ls, Object searchKey4log) {
+        if (ls == null || ls.isEmpty()) {
+            String msg = "The record has already been deleted by other thread: searchKey=" + searchKey4log;
+            throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(msg);
+        }
+    }
+
+    /**
+     * Assert that record has been selected as one.
+     * 
+     * @param ls Selected list.
+     * @param searchKey4log Search-key for Logging.
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    protected void assertRecordHasBeenSelectedAsOne(java.util.List ls, Object searchKey4log) {
+        if (ls == null || ls.isEmpty()) {
+            String msg = "The record has already been deleted by other thread: searchKey=" + searchKey4log;
+            throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(msg);
+        }
+        if (ls.size() != 1) {
+            String msg = "This selected contents should be only one: searchKey=" + searchKey4log;
+            msg = msg + " resultCount=" + ls.size();
+            throw new ${glPackageBaseCommonException}.${glRecordHasOverlappedException}(msg);
+        }
+    }
+
+    /**
+     * Assert that selected count has not exceeded max count.
+     * 
+     * @param selectedCount Selected count.
+     * @param maxCount Max count.
+     * @param clauseObject Clause object for exception message.
+     * @exception ${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}
+     */
+    protected void assertSelectedCountHasNotExceededMaxCount(int selectedCount, int maxCount, Object clauseObject) {
+        if (selectedCount > maxCount) {
+            String msg = "Selected count[" + selectedCount + "] has exceeded max count[" + maxCount + "]: clauseObject=" + clauseObject;
+            throw new ${glPackageBaseCommonException}.${glSelectedCountExceedMaxCountExceptionName}(msg, selectedCount, maxCount);
+        }
+    }
+
+#if ($database.isAvailableGenerics())
+    // ===================================================================================
+    //                                                                      Various Select
+    //                                                                      ==============
+    /**
+     * Select value-label list.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @param valueLabelSetupper Value-label-setupper. (NotNull)
+     * @return Value-label list. (NotNull)
+     */
+    protected <E> java.util.List<java.util.Map<String, Object>> createValueLabelList(${glListResultBeanName}<E> ls, ${glValueLabelSetupperName}<E> valueLabelSetupper) {
+        final java.util.List<java.util.Map<String, Object>> valueLabelList = new java.util.ArrayList<java.util.Map<String, Object>>();
+        final ${glValueLabelBoxName} box = new ${glValueLabelBoxName}();
+        for (E entity : ls) {
+            final java.util.Map<String, Object> valueLabel = new java.util.HashMap<String, Object>();
+            valueLabelSetupper.setup(box, entity);
+            valueLabel.put("value", box.getValue());
+            valueLabel.put("label", box.getLabel());
+            valueLabelList.add(valueLabel);
+        }
+        return valueLabelList;
+    }
+#end
+
+    // ===================================================================================
+    //                                                                          Token File
+    //                                                                          ==========
+    /**
+     * Output token-file from this table records.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @param filename Name of the file. (NotNull and NotEmpty)
+     * @param tokenFileOutputOption token-file-output-option. (NotNull and Required{delimiter and encoding})
+     * @return Token-file-output-result. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public ${glTokenFileOutputResultName} outputTokenFile(${glConditionBeanInterfaceName} cb, String filename, ${glTokenFileOutputOptionName} tokenFileOutputOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertConditionBeanNotNull(cb);
+        assertStringNotNullAndNotTrimmedEmpty("filename", filename);
+        assertObjectNotNull("tokenFileOutputOption", tokenFileOutputOption);
+
+        final java.util.List${database.filterGenericsString(${glEntityInterfaceName})} ls = readList(cb);
+        java.util.List${database.filterGenericsString('java.util.List<String>')} rowList = new java.util.ArrayList${database.filterGenericsString('java.util.List<String>')}();
+        for (java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+            final ${glEntityInterfaceName} entity = (${glEntityInterfaceName})ite.next();
+            final java.util.List${database.filterGenericsString('String')} valueList = getDBMeta().convertToColumnStringValueList(entity);
+            rowList.add(valueList);
+        }
+        final ${glFileMakingSimpleFacadeName} fileMakingSimpleFacade = new ${glFileMakingSimpleFacadeImplName}();
+        final ${glFileMakingOptionName} fileMakingOption = tokenFileOutputOption.getFileMakingOption();
+        final ${glFileMakingHeaderInfoName} fileMakingHeaderInfo = new ${glFileMakingHeaderInfoName}();
+        fileMakingHeaderInfo.setColumnNameList(getDBMeta().getColumnDbNameList());
+        fileMakingOption.setFileMakingHeaderInfo(fileMakingHeaderInfo);
+        fileMakingSimpleFacade.makeFromRowList(filename, rowList, fileMakingOption);
+        final ${glTokenFileOutputResultName} tokeFileOutputResult = new ${glTokenFileOutputResultName}();
+        tokeFileOutputResult.setSelectedList(ls);
+        return tokeFileOutputResult;
+    }
+
+    // ===================================================================================
+    //                                                                              Helper
+    //                                                                              ======
+    /**
+     * To lower case if the type is String.
+     * 
+     * @param obj Object. (Nullable)
+     * @return Lower object. (Nullable)
+     */
+    protected Object toLowerCaseIfString(Object obj) {
+        if (obj != null && obj instanceof String) {
+            return ((String)obj).toLowerCase();
+        }
+        return obj;
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the object is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertObjectNotNull(String variableName, Object value) {
+        if (variableName == null) {
+            String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "The value should not be null: variableName=" + variableName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert that the entity is not null.
+     * 
+     * @param entity Entity. (NotNull)
+     */
+    protected void assertEntityNotNull(${glEntityInterfaceName} entity) {
+        assertObjectNotNull("entity", entity);
+    }
+
+    /**
+     * Assert that the condition-bean is not null.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     */
+    protected void assertConditionBeanNotNull(${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName} cb) {
+        assertObjectNotNull("cb", cb);
+    }
+
+    /**
+     * Assert that the entity has primary-key value.
+     * 
+     * @param entity Entity. (NotNull)
+     */
+    protected void assertEntityNotNullAndHasPrimaryKeyValue(${glEntityInterfaceName} entity) {
+        assertEntityNotNull(entity);
+        if (!entity.hasPrimaryKeyValue()) {
+            String msg = "The entity must should primary-key: entity=" + entity;
+            throw new IllegalArgumentException(msg + entity);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the entity is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        assertObjectNotNull("variableName", variableName);
+        assertObjectNotNull(variableName, value);
+        if (value.trim().length() ==0) {
+            String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                      Assert List
+    //                                                      -----------
+    /**
+     * Assert that the list is empty.
+     * 
+     * @param ls List. (NotNull)
+     */
+    protected void assertListNotNullAndEmpty(java.util.List ls) {
+        assertObjectNotNull("ls", ls);
+        if (!ls.isEmpty()) {
+            String msg = "The list should be empty: ls=" + ls.toString();
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert that the list is not empty.
+     * 
+     * @param ls List. (NotNull)
+     */
+    protected void assertListNotNullAndNotEmpty(java.util.List ls) {
+        assertObjectNotNull("ls", ls);
+        if (ls.isEmpty()) {
+            String msg = "The list should not be empty: ls=" + ls.toString();
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert that the list having only one.
+     * 
+     * @param ls List. (NotNull)
+     */
+    protected void assertListNotNullAndHasOnlyOne(java.util.List ls) {
+        assertObjectNotNull("ls", ls);
+        if (ls.size() != 1) {
+            String msg = "The list should contain only one object: ls=" + ls.toString();
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorWritable.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorWritable.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/AbstractBehaviorWritable.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,601 @@
+#set ($myClassName = "${glBehaviorWritableAbstractName}")
+
+package ${glPackageBaseCommonBhv};
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonHelper}.${glMapStringBuilderName};
+import ${glPackageBaseCommonHelper}.${glMapStringBuilderImplName};
+
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileReflectionOptionName};
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileReflectionResultName};
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileReflectionFailureName};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingCallbackName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingRowResourceName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingHeaderInfoName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingOptionName};
+import ${glPackageBaseCommonHelperTokenFileImpl}.${glFileTokenImplName};
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The abstract class of behavior-writable.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${myClassName} extends ${glBehaviorReadableAbstractName} implements ${glBehaviorWritableInterfaceName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // =====================================================================================
+    //                                                                       Delegate Method
+    //                                                                       ===============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Inserted count.
+     */
+    public int callCreate(${glEntityInterfaceName} entity) {
+        assertEntityNotNull(entity);// If this table use identity, the entity does not have primary-key.
+        filterEntityOfInsert(entity);
+        assertEntityOfInsert(entity);
+        return getDaoWritable().create(entity);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * {modified only}
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Updated count.
+     */
+    public int callModify(${glEntityInterfaceName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        filterEntityOfUpdate(entity);
+        assertEntityOfUpdate(entity);
+        return getDaoWritable().modifyModifiedOnly(entity);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Deleted count.
+     */
+    public int callRemove(${glEntityInterfaceName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        filterEntityOfDelete(entity);
+        assertEntityOfDelete(entity);
+        return getDaoWritable().remove(entity);
+    }
+
+    /**
+     * Filter the entity of insert.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     */
+    protected void filterEntityOfInsert(${glEntityInterfaceName} entity) {
+    }
+
+    /**
+     * Assert the entity of insert.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     */
+    protected void assertEntityOfInsert(${glEntityInterfaceName} entity) {
+    }
+
+    /**
+     * Filter the entity of update.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     */
+    protected void filterEntityOfUpdate(${glEntityInterfaceName} entity) {
+    }
+
+    /**
+     * Assert the entity of update.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     */
+    protected void assertEntityOfUpdate(${glEntityInterfaceName} entity) {
+    }
+
+
+    /**
+     * Filter the entity of delete.
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     */
+    protected void filterEntityOfDelete(${glEntityInterfaceName} entity) {
+    }
+
+    /**
+     * Assert the entity of delete
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     */
+    protected void assertEntityOfDelete(${glEntityInterfaceName} entity) {
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Inserted count.
+     */
+    public int callCreateList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        for (final java.util.Iterator ite = entityList.iterator(); ite.hasNext(); ) {
+            final ${glEntityInterfaceName} entity = (${glEntityInterfaceName})ite.next();
+            filterEntityOfInsert(entity);
+            assertEntityOfInsert(entity);
+        }
+        return getDaoWritable().createList(entityList);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Updated count.
+     */
+    public int callModifyList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        for (final java.util.Iterator ite = entityList.iterator(); ite.hasNext(); ) {
+            final ${glEntityInterfaceName} entity = (${glEntityInterfaceName})ite.next();
+            filterEntityOfUpdate(entity);
+            assertEntityOfUpdate(entity);
+        }
+        return getDaoWritable().modifyList(entityList);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Deleted count.
+     */
+    public int callRemoveList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        for (final java.util.Iterator ite = entityList.iterator(); ite.hasNext(); ) {
+            final ${glEntityInterfaceName} entity = (${glEntityInterfaceName})ite.next();
+            filterEntityOfDelete(entity);
+            assertEntityOfDelete(entity);
+        }
+        return getDaoWritable().removeList(entityList);
+    }
+
+    // =====================================================================================
+    //                                                                   Basic Entity Update
+    //                                                                   ===================
+    /**
+     * Create.
+     * 
+     * @param entity Entity. (NotNull)
+     */
+    public void create(${glEntityInterfaceName} entity) {
+        doCreate(entity);
+    }
+
+    abstract protected void doCreate(${glEntityInterfaceName} entity);
+
+    /**
+     * Modify.
+     * 
+     * @param entity Entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public void modify(${glEntityInterfaceName} entity) {
+        doModify(entity);
+    }
+
+    abstract protected void doModify(${glEntityInterfaceName} entity);
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Entity having primary-key value. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    public void modifyAfterSelect(${glEntityInterfaceName} entity) {
+        doModifyAfterSelect(entity);
+    }
+
+    abstract protected void doModifyAfterSelect(${glEntityInterfaceName} entity);
+
+    /**
+     * Create or modify after select.
+     * {modify: modified only}
+     * 
+     * @param entity Entity. This must contain primary-key value at least(Except use identity). (NotNull)
+     */
+    public void createOrModifyAfterSelect(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        assertEntityNotNull(entity);
+        doCreateOrModifyAfterSelect(entity);
+    }
+
+    abstract protected void doCreateOrModifyAfterSelect(${glEntityInterfaceName} entity);
+#if ($database.isMakeBehaviorForUpdate())
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Entity having primary-key value. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @deprecated This method is deprecated.
+     */
+    public void modifyAfterSelectForUpdate(${glEntityInterfaceName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        doModifyAfterSelectForUpdate(entity);
+    }
+
+    abstract protected void doModifyAfterSelectForUpdate(${glEntityInterfaceName} entity);
+
+    /**
+     * Create or modify after select-for-update.
+     * {modify: modified only}
+     * 
+     * @param entity Entity. This must contain primary-key value at least(Except use identity). (NotNull)
+     * @deprecated This method is deprecated.
+     */
+    public void createOrModifyAfterSelectForUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        assertEntityNotNull(entity);
+        doCreateOrModifyAfterSelectForUpdate(entity);
+    }
+
+    abstract protected void doCreateOrModifyAfterSelectForUpdate(${glEntityInterfaceName} entity);
+#end
+
+    /**
+     * Merge entity.
+     * Copy the column data of sourceEntity that the setter has been invoked to destinationEntity.
+     * 
+     * @param sourceEntity Source entity. (NotNull)
+     * @param destinationEntity Destination entity. (NotNull)
+     */
+    abstract protected void mergeEntity(${glEntityInterfaceName} sourceEntity, ${glEntityInterfaceName} destinationEntity);
+
+    /**
+     * Remove.
+     * 
+     * @param entity Entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public void remove(${glPackageBaseCommon}.${glEntityInterfaceName} entity) {
+        assertEntityNotNull(entity);
+        callRemove(entity);
+    }
+
+    abstract protected void doRemove(${glEntityInterfaceName} entity);
+
+    /**
+     * Remove after select.
+     * 
+     * @param entity Entity. This must contain primary-key value at least. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    public void removeAfterSelect(${glEntityInterfaceName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        doRemoveAfterSelect(entity);
+    }
+
+    abstract protected void doRemoveAfterSelect(${glEntityInterfaceName} entity);
+
+    // =====================================================================================
+    //                                                                    Basic Batch Update
+    //                                                                    ==================
+    /**
+     * Create list.
+     * 
+     * @param entityList Entity-list. (NotNull and NotEmpty)
+     * @return Created count.
+     */
+    public int createList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        return callCreateList(entityList);
+    }
+
+    /**
+     * Modify list.
+     * 
+     * @param entityList Entity-list. (NotNull and NotEmpty)
+     * @return Modified count.
+     */
+    public int modifyList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        return callModifyList(entityList);
+    }
+
+    /**
+     * Remove list.
+     * 
+     * @param entityList Entity-list. (NotNull and NotEmpty)
+     * @return Removed count.
+     */
+    public int removeList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        return callRemoveList(entityList);
+    }
+
+    // =====================================================================================
+    //                                                                            Token File
+    //                                                                            ==========
+    /**
+     * Reflect(insert or update) token-file to this table.
+     * 
+     * @param filename Name of the file. (NotNull and NotEmpty)
+     * @param tokenFileReflectionOption token-file-reflection-option. (NotNull and Required{delimiter and encoding})
+     * @return Token-file-reflection-result. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public ${glTokenFileReflectionResultName} reflectTokenFile(String filename, ${glTokenFileReflectionOptionName} tokenFileReflectionOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertStringNotNullAndNotTrimmedEmpty("filename", filename);
+        assertFileTokenReflectionOption(tokenFileReflectionOption);
+
+        final ${glTokenFileReflectionResultName} result = buildTokenFileReflectionResult();
+        final ${glFileTokenizingCallbackName} fileTokenizingCallback = buildFileTokenReflectionFileTokenizingCallback(tokenFileReflectionOption, result);
+        final ${glFileTokenizingOptionName} fileTokenizingOption = buildFileTokenReflectionFileTokenizingOption(tokenFileReflectionOption);
+        final ${glFileTokenName} fileToken = new ${glFileTokenImplName}();
+        fileToken.tokenize(filename, fileTokenizingCallback, fileTokenizingOption);
+        return result;
+    }
+
+    /**
+     * Reflect(insert or update) token-file to this table.
+     * 
+     * @param inputStream Input stream. (NotNull and NotClosed)
+     * @param tokenFileReflectionOption token-file-reflection-option. (NotNull and Required{delimiter and encoding})
+     * @return Token-file-reflection-result. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public ${glTokenFileReflectionResultName} reflectTokenFile(java.io.InputStream inputStream, ${glTokenFileReflectionOptionName} tokenFileReflectionOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertObjectNotNull("inputStream", inputStream);
+        assertFileTokenReflectionOption(tokenFileReflectionOption);
+
+        final ${glTokenFileReflectionResultName} result = buildTokenFileReflectionResult();
+        final ${glFileTokenizingCallbackName} fileTokenizingCallback = buildFileTokenReflectionFileTokenizingCallback(tokenFileReflectionOption, result);
+        final ${glFileTokenizingOptionName} fileTokenizingOption = buildFileTokenReflectionFileTokenizingOption(tokenFileReflectionOption);
+        final ${glFileTokenName} fileToken = new ${glFileTokenImplName}();
+        fileToken.tokenize(inputStream, fileTokenizingCallback, fileTokenizingOption);
+        return result;
+    }
+
+    protected void assertFileTokenReflectionOption(${glTokenFileReflectionOptionName} tokenFileReflectionOption) {
+        assertObjectNotNull("tokenFileReflectionOption", tokenFileReflectionOption);
+
+        final String encoding = tokenFileReflectionOption.getEncoding();
+        final String delimiter = tokenFileReflectionOption.getDelimiter();
+        assertStringNotNullAndNotTrimmedEmpty("encoding", encoding);
+        assertObjectNotNull("delimiter", delimiter);
+    }
+
+    protected ${glTokenFileReflectionResultName} buildTokenFileReflectionResult() {
+        final ${glTokenFileReflectionResultName} result = new ${glTokenFileReflectionResultName}();
+        final java.util.List${database.filterGenericsString(${glTokenFileReflectionFailureName})} failureList = new java.util.ArrayList${database.filterGenericsString(${glTokenFileReflectionFailureName})}();
+        result.setFailureList(failureList);
+        return result;
+    }
+
+    protected ${glFileTokenizingCallbackName} buildFileTokenReflectionFileTokenizingCallback(${glTokenFileReflectionOptionName} tokenFileReflectionOption, final ${glTokenFileReflectionResultName} result) throws java.io.FileNotFoundException, java.io.IOException {
+        assertObjectNotNull("tokenFileReflectionOption", tokenFileReflectionOption);
+
+        final String encoding = tokenFileReflectionOption.getEncoding();
+        final String delimiter = tokenFileReflectionOption.getDelimiter();
+        final boolean interruptIfError = tokenFileReflectionOption.isInterruptIfError();
+        assertStringNotNullAndNotTrimmedEmpty("encoding", encoding);
+        assertObjectNotNull("delimiter", delimiter);
+        final java.util.List${database.filterGenericsString(${glTokenFileReflectionFailureName})} failureList = result.getFailureList();
+        assertObjectNotNull("failureList", failureList);
+
+        final ${glFileTokenizingCallbackName} fileTokenizingCallback = new ${glFileTokenizingCallbackName}() {
+            public void handleRowResource(${glFileTokenizingRowResourceName} fileTokenizingRowResource) {
+                final ${glFileTokenizingHeaderInfoName} fileTokenizingHeaderInfo = fileTokenizingRowResource.getFileTokenizingHeaderInfo();
+                final java.util.List${database.filterGenericsString('String')} columnNameList = fileTokenizingHeaderInfo.getColumnNameList();
+                final java.util.List${database.filterGenericsString('String')} valueList = fileTokenizingRowResource.getValueList();
+
+                // Set up columnNameList of result object.
+                if (result.getColumnNameList() == null) {
+                    result.setColumnNameList(columnNameList);
+                }
+
+                ${glEntityInterfaceName} entity = null;
+                try {
+                    // Create entity by the list of value composed of String.
+                    entity = createEntityByStringValueList(columnNameList, valueList);
+
+                    // Create or modify as non-strict.
+                    doCreateOrUpdateNonstrict(entity);
+
+                    // Increment successCount of result object.
+                    result.incrementSuccessCount();
+                } catch (RuntimeException e) {
+                    if (interruptIfError) {
+                        throw e;
+                    }
+                    final ${glTokenFileReflectionFailureName} failure = new ${glTokenFileReflectionFailureName}();
+                    failure.setColumnNameList(columnNameList);
+                    failure.setValueList(valueList);
+                    failure.setRowString(fileTokenizingRowResource.getRowString());
+                    failure.setRowNumber(fileTokenizingRowResource.getRowNumber());
+                    failure.setLineNumber(fileTokenizingRowResource.getLineNumber());
+                    if (entity != null) {
+                        failure.setEntity(entity);
+                    }
+                    failure.setException(e);
+                    failureList.add(failure);
+                }
+            }
+        };
+        return fileTokenizingCallback;
+    }
+
+    protected ${glEntityInterfaceName} createEntityByStringValueList(java.util.List${database.filterGenericsString('String')} columnNameList, java.util.List${database.filterGenericsString('String')} valueList) {
+        final ${glMapStringBuilderName} builder = new ${glMapStringBuilderImplName}();
+        builder.setMsMapMark(MAP_STRING_MAP_MARK);
+        builder.setMsStartBrace(MAP_STRING_START_BRACE);
+        builder.setMsEndBrace(MAP_STRING_END_BRACE);
+        builder.setMsDelimiter(MAP_STRING_DELIMITER);
+        builder.setMsEqual(MAP_STRING_EQUAL);
+        builder.setColumnNameList(columnNameList);
+        final String mapString = builder.buildFromList(valueList);
+
+        final ${glEntityInterfaceName} entity = getDBMeta().newEntity();
+        getDBMeta().acceptColumnValueMapString(entity, mapString);
+        return entity;
+    }
+
+    protected ${glFileTokenizingOptionName} buildFileTokenReflectionFileTokenizingOption(${glTokenFileReflectionOptionName} tokenFileReflectionOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertObjectNotNull("tokenFileReflectionOption", tokenFileReflectionOption);
+
+        final String encoding = tokenFileReflectionOption.getEncoding();
+        final String delimiter = tokenFileReflectionOption.getDelimiter();
+        assertStringNotNullAndNotTrimmedEmpty("encoding", encoding);
+        assertObjectNotNull("delimiter", delimiter);
+
+        final ${glFileTokenizingOptionName} fileTokenizingOption = new ${glFileTokenizingOptionName}();
+        fileTokenizingOption.setEncoding(encoding);
+        fileTokenizingOption.setDelimiter(delimiter);
+        if (tokenFileReflectionOption.isHandleEmptyAsNull()) {
+            fileTokenizingOption.handleEmptyAsNull();
+        }
+        return fileTokenizingOption;
+    }
+
+    abstract protected void doCreateOrUpdateNonstrict(${glEntityInterfaceName} entity);
+
+    /**
+     * Reflect(insert or update) from separated-file.
+     * 
+     * @param filename Name of the file. (NotNull and NotEmpty)
+     * @param encoding Encoding of the file. (NotNull and NotEmpty)
+     * @param delimiter Delimiter of the file. (NotNull and NotEmpty)
+     * @param batchCount Batch-count for transaction. If this value is 0, all records are done in one transaction.
+     * @param isErrorContinue If true, this method continue in spite of throwing the exception.   
+     * @return The list of OneEntityExceptionResult. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     * @deprecated Please use reflectTokenFile()
+     */
+    public java.util.List${database.filterGenericsString('OneEntityExceptionResult')} reflectFromSeparatedFile(
+            String filename, String encoding,
+            String delimiter, int batchCount, boolean isErrorContinue
+            ) throws java.io.FileNotFoundException, java.io.IOException {
+        assertStringNotNullAndNotTrimmedEmpty("filename", filename);
+        assertStringNotNullAndNotTrimmedEmpty("encoding", encoding);
+        assertObjectNotNull("delimiter", delimiter);
+        final java.util.List${database.filterGenericsString('OneEntityExceptionResult')} exceptionList = new java.util.ArrayList${database.filterGenericsString('OneEntityExceptionResult')}();
+
+        java.io.FileInputStream fis = null;
+        java.io.InputStreamReader ir = null;
+        java.io.BufferedReader br = null;
+        try {
+            fis = new java.io.FileInputStream(filename);
+            ir = new java.io.InputStreamReader(fis, encoding);
+            br = new java.io.BufferedReader(ir);
+
+            final ${glMapStringBuilderName} builder = new ${glMapStringBuilderImplName}();
+            builder.setMsMapMark(MAP_STRING_MAP_MARK);
+            builder.setMsStartBrace(MAP_STRING_START_BRACE);
+            builder.setMsEndBrace(MAP_STRING_END_BRACE);
+            builder.setMsDelimiter(MAP_STRING_DELIMITER);
+            builder.setMsEqual(MAP_STRING_EQUAL);
+            final java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList = new java.util.ArrayList${database.filterGenericsString(${glEntityInterfaceName})}();
+            int count = 0;
+            while (true) {
+                ++count;
+
+                final String lineString = br.readLine();
+                if (lineString == null) {
+                    if (entityList.size() > 0) {
+                        final java.util.List${database.filterGenericsString('OneEntityExceptionResult')} tmpList = reflectAfterSelectNewTx(entityList, isErrorContinue);
+                        exceptionList.addAll(tmpList);
+                        entityList.clear();
+                    }
+                    break;
+                }
+                if (count == 1) {
+                    builder.setColumnNames(lineString.split(delimiter));
+                    continue;
+                }
+
+                final String mapString = builder.buildByDelimiter(lineString, delimiter);
+                final ${glEntityInterfaceName} entity = getDBMeta().newEntity();
+                entity.acceptColumnValueMapString(mapString);
+                entityList.add(entity);
+
+                if (entityList.size() == batchCount) {
+                    final java.util.List${database.filterGenericsString('OneEntityExceptionResult')} tmpList = reflectAfterSelectNewTx(entityList, isErrorContinue);
+                    exceptionList.addAll(tmpList);
+                    entityList.clear();
+                }
+            }
+        } catch (java.io.FileNotFoundException e) {
+            throw e;
+        } catch (java.io.IOException e) {
+            throw e;
+        } finally {
+            try {
+                if (fis != null) {
+                    fis.close();
+                }
+                if (ir != null) {
+                    ir.close();
+                }
+                if (br != null) {
+                    br.close();
+                }
+            } catch (java.io.IOException ignored) {
+                _log.warn("File-close threw the exception: ", ignored);
+            }
+        }
+        return exceptionList;
+    }
+
+    /**
+     * Reflect(insert or update) from separated-file.
+     * 
+     * @param entityList The list of entity that is reflection target. (NotNull)
+     * @param isErrorContinue If true, this method continue in spite of throwing the exception.
+     * @return The list of InsertOrUpdateExceptionResult. (NotNull)
+     * @deprecated Please use reflectTokenFile()
+     */
+    public java.util.List${database.filterGenericsString('OneEntityExceptionResult')} reflectAfterSelectNewTx(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList,
+            boolean isErrorContinue) {
+        final java.util.List${database.filterGenericsString('OneEntityExceptionResult')} exceptionList = new java.util.ArrayList${database.filterGenericsString('OneEntityExceptionResult')}();
+        for (final java.util.Iterator ite = entityList.iterator(); ite.hasNext(); ) {
+            final ${glEntityInterfaceName} entity = (${glEntityInterfaceName})ite.next();
+            try {
+                createOrModifyAfterSelect(entity);
+            } catch (RuntimeException e) {
+                if (isErrorContinue) {
+                    final OneEntityExceptionResult result = new OneEntityExceptionResult();
+                    result.setPrimaryKeyMapString(entity.extractPrimaryKeyMapString());
+                    result.setEntity(entity);
+                    result.setException(e);
+                    exceptionList.add(result);
+                    continue;
+                }
+                throw e;
+            }
+        }
+        return exceptionList;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorReadable.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorReadable.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorReadable.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,374 @@
+package ${glPackageBaseCommonBhv};
+
+import ${glPackageBaseCommon}.${glDaoSelectorInterfaceName};
+import ${glPackageBaseCommon}.${glDaoReadableInterfaceName};
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glListResultBeanName};
+import ${glPackageBaseCommonCBean}.${glOrderByBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glPagingBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glPagingResultBeanName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileOutputOptionName};
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileOutputResultName};
+
+/**
+ * The interface of behavior-readable.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glBehaviorReadableInterfaceName} {
+
+    // =====================================================================================
+    //                                                                            Definition
+    //                                                                            ==========
+    /** Map-string map-mark. */
+    public static final String MAP_STRING_MAP_MARK = "map:";
+
+    /** Map-string list-mark. */
+    public static final String MAP_STRING_LIST_MARK = "list:";
+
+    /** Map-string start-brace. */
+    public static final String MAP_STRING_START_BRACE = "${database.extractAcceptStartBrace}";
+
+    /** Map-string end-brace. */
+    public static final String MAP_STRING_END_BRACE = "${database.extractAcceptEndBrace}";
+
+    /** Map-string delimiter. */
+    public static final String MAP_STRING_DELIMITER = "${database.extractAcceptDelimiter}";
+
+    /** Map-string equal. */
+    public static final String MAP_STRING_EQUAL = "${database.extractAcceptEqual}";
+
+    // =====================================================================================
+    //                                                                            Table name
+    //                                                                            ==========
+    /**
+     * Get table db-name.
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName();
+
+    // =====================================================================================
+    //                                                                                DBMeta
+    //                                                                                ======
+    /**
+     * Get dbmeta.
+     * 
+     * @return DBMeta. (NotNull)
+     */
+    public ${glDBMetaInterfaceName} getDBMeta();
+
+    // =====================================================================================
+    //                                                                          Dao Accessor
+    //                                                                          ============
+    /**
+     * Get dao-readable.
+     * 
+     * @return Dao-readable. (NotNull)
+     */
+    public ${glDaoReadableInterfaceName} getDaoReadable();
+
+    /**
+     * Get dao-selector.
+     * 
+     * @return Dao-selector.
+     */
+    public ${glDaoSelectorInterfaceName} getDaoSelector();
+
+    /**
+     * Set dao-selector.
+     * 
+     * @param value Dao-selector.
+     */
+    public void setDaoSelector(${glDaoSelectorInterfaceName} value);
+
+    // =====================================================================================
+    //                                                                          New Instance
+    //                                                                          ============
+    /**
+     * New entity.
+     * 
+     * @return Entity. (NotNull)
+     */
+    public ${glEntityInterfaceName} newEntity();
+
+    /**
+     * New condition-bean.
+     * 
+     * @return Condition-bean. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} newConditionBean();
+
+    // =====================================================================================
+    //                                                                       Delegate Method
+    //                                                                       ===============
+    /**
+     * Read count as all. (Delegate-Method)
+     * 
+     * @return All count. (NotNull)
+     */
+    public int callGetCountAll();
+
+    /**
+     * Read list as all. (Delegate-Method)
+     * 
+     * @return All list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${glEntityInterfaceName})} callGetListAll();
+
+    /**
+     * Read count by condition-bean. (Delegate-Method)
+     * If the condition-bean is invoked fetchFirst() and fetchScope() and fetchPage(), throw exception.
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     * @return Read count. (NotNull)
+     */
+    public int callReadCount(${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName});
+
+    /**
+     * Read entity by condition-bean. (Delegate-Method)
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     * @return Read entity. If the select result is zero, it returns null. (Nullable)
+     */
+    public ${glEntityInterfaceName} callReadEntity(${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName});
+
+    /**
+     * Read list by condition-bean. (Delegate-Method)
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     * @return Read list. If the select result is zero, it returns empty list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${glEntityInterfaceName})} callReadList(${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName});
+
+    // =====================================================================================
+    //                                                                         Basic Get All
+    //                                                                         =============
+    /**
+     * Get count all.
+     * 
+     * @return Count all.
+     */
+    public int getCountAll();
+
+    // =====================================================================================
+    //                                                                      Basic Read Count
+    //                                                                      ================
+    /**
+     * Read count by condition-bean.
+     * <pre>
+     * If the argument 'condition-bean' is effective about fetch-scope,
+     * this method invoke select count ignoring the fetch-scope.
+     * </pre>
+     * @param cb Condition-bean. This condition-bean should not be set up about fetch-scope. (NotNull)
+     * @return Read count. (NotNull)
+     */
+    public int readCount(${glConditionBeanInterfaceName} cb);
+
+    // =====================================================================================
+    //                                                                     Basic Read Entity
+    //                                                                     =================
+    /**
+     * Read entity by condition-bean.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Read entity. (Nullalble)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public ${glEntityInterfaceName} readEntity(${glConditionBeanInterfaceName} cb);
+
+    /**
+     * Read simple entity by condition-bean with deleted check.
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     * @return Read entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    public ${glEntityInterfaceName} readEntityWithDeletedCheck(${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName});
+
+    // =====================================================================================
+    //                                                                       Basic Read List
+    //                                                                       ===============
+    /**
+     * Read list as result-bean.
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     * @return List-result-bean. If the select result is zero, it returns empty list. (NotNull)
+     */
+    public ${glListResultBeanName}${database.filterGenericsString(${glEntityInterfaceName})} readList(${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName});
+
+    /**
+     * Read page as result-bean.
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     * @return Read page. (NotNull)
+     */
+    public ${glPagingResultBeanName}${database.filterGenericsString(${glEntityInterfaceName})} readPage(final ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName});
+
+    /**
+     * Read page as result-bean.
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     * @param invoker Select-page-invoker (NotNull)
+     * @return Read page. (NotNull)
+     */
+    public ${glPagingResultBeanName}${database.filterGenericsString(${glEntityInterfaceName})} readPage(final ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName}, SelectPageInvoker${database.filterGenericsString(${glEntityInterfaceName})} invoker);
+
+    // =====================================================================================
+    //                                                                            Token File
+    //                                                                            ==========
+    /**
+     * Output token-file from this table records.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @param filename Name of the file. (NotNull and NotEmpty)
+     * @param tokenFileOutputOption token-file-output-option. (NotNull and Required{delimiter and encoding})
+     * @return Token-file-output-result. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public ${glTokenFileOutputResultName} outputTokenFile(${glConditionBeanInterfaceName} cb, String filename, ${glTokenFileOutputOptionName} tokenFileOutputOption) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * The interface of select-page callback.
+     * 
+     * @param <T> The generic template for 'selectedList'.
+     */
+    public static interface SelectPageCallback${database.filterGenericsString('T')} {
+        public ${glPagingBeanInterfaceName} getPagingBean();
+        public int selectCountIgnoreFetchScope();
+        public java.util.List${database.filterGenericsString('T')} selectListWithFetchScope();
+    }
+
+    /**
+     * The object of result-bean builder.
+     * 
+     * @param <T> The generic template for 'resultBean'.
+     */
+    public static class ResultBeanBuilder${database.filterGenericsString('T')} {
+        protected ${glBehaviorReadableInterfaceName} _bhv;
+        public ResultBeanBuilder(${glBehaviorReadableInterfaceName} bhv) {
+            _bhv = bhv;
+        }
+        /**
+         * Build list-reuslt-bean.
+         * 
+         * @param ob Order-by-bean. (NotNull)
+         * @param selectedList Selected list. (NotNull)
+         * @return List-result-bean. (NotNull)
+         */
+        public ${glListResultBeanName}${database.filterGenericsString('T')} buildListResultBean(${glOrderByBeanInterfaceName} ob, java.util.List${database.filterGenericsString('T')} selectedList) {
+            ${glListResultBeanName}${database.filterGenericsString('T')} rb = new ${glListResultBeanName}${database.filterGenericsString('T')}();
+            rb.setTableDbName(_bhv.getTableDbName());
+            rb.setAllRecordCount(selectedList.size());
+            rb.setSelectedList(selectedList);
+            rb.setOrderByClause(ob.getSqlComponentOfOrderByClause());
+            return rb;
+        }
+        /**
+         * Build paging-reuslt-bean.
+         * 
+         * @param pb Paging-bean. (NotNull)
+         * @param allRecordCount All-record-count.
+         * @param selectedList Selected list. (NotNull)
+         * @return Paging-result-bean. (NotNull)
+         */
+        public ${glPagingResultBeanName}${database.filterGenericsString('T')} buildPagingResultBean(${glPagingBeanInterfaceName} pb, int allRecordCount, java.util.List${database.filterGenericsString('T')} selectedList) {
+            ${glPagingResultBeanName}${database.filterGenericsString('T')} rb = new ${glPagingResultBeanName}${database.filterGenericsString('T')}();
+            rb.setTableDbName(_bhv.getTableDbName());
+            rb.setAllRecordCount(allRecordCount);
+            rb.setSelectedList(selectedList);
+            rb.setPageSize(pb.getFetchSize());
+            rb.setCurrentPageNumber(pb.getFetchPageNumber());
+            rb.setOrderByClause(pb.getSqlComponentOfOrderByClause());
+            return rb;
+        }
+    }
+
+    public static interface SelectPageInvoker${database.filterGenericsString('T')} {
+        /**
+         * Invoke select-page by callback.
+         * 
+         * @param callback Callback. (NotNull)
+         * @return Paging-result-bean. (NotNull)
+         */
+        public ${glPagingResultBeanName}${database.filterGenericsString('T')} invokeSelectPage(SelectPageCallback${database.filterGenericsString('T')} callback);
+    }
+
+    /**
+     * The object of result-bean builder.
+     * 
+     * @param <T> The generic template for 'resultBean'.
+     */
+    public static class SelectPageSimpleInvoker${database.filterGenericsString('T')} implements SelectPageInvoker${database.filterGenericsString('T')} {
+        protected ${glBehaviorReadableInterfaceName} _bhv;
+        public SelectPageSimpleInvoker(${glBehaviorReadableInterfaceName} bhv) {
+            _bhv = bhv;
+        }
+
+        /**
+         * Invoke select-page by callback.
+         * 
+         * @param callback Callback. (NotNull)
+         * @return Paging-result-bean. (NotNull)
+         */
+        public ${glPagingResultBeanName}${database.filterGenericsString('T')} invokeSelectPage(SelectPageCallback${database.filterGenericsString('T')} callback) {
+            assertObjectNotNull("callback", callback);
+            assertObjectNotNull("callback.getPagingBean()", callback.getPagingBean());
+            if (!callback.getPagingBean().isFetchScopeEffective()) {
+                String msg = "The paging bean is not effective about fetch-scope!";
+                msg = msg + " When you select page, you should set up fetch-scope of paging bean(Should invoke fetchFirst() and fetchPage()!).";
+                msg = msg + " The paging bean is: " + callback.getPagingBean();
+                throw new IllegalStateException(msg);
+            }
+            final int allRecordCount = callback.selectCountIgnoreFetchScope();
+            final java.util.List${database.filterGenericsString('T')} selectedList = callback.selectListWithFetchScope();
+            final ${glPagingResultBeanName}${database.filterGenericsString('T')} rb = new ResultBeanBuilder${database.filterGenericsString('T')}(_bhv).buildPagingResultBean(callback.getPagingBean(), allRecordCount, selectedList);
+            if (isNecessaryToReadPageAgain(rb)) {
+                callback.getPagingBean().fetchPage(rb.getAllPageCount());
+                final int reAllRecordCount = callback.selectCountIgnoreFetchScope();
+                final java.util.List${database.filterGenericsString('T')} reSelectedList = callback.selectListWithFetchScope();
+                return new ResultBeanBuilder${database.filterGenericsString('T')}(_bhv).buildPagingResultBean(callback.getPagingBean(), reAllRecordCount, reSelectedList);
+            } else {
+                return rb;
+            }
+        }
+
+        /**
+         * Is it necessary to read page again?
+         * 
+         * @param rb Paging-result-bean. (NotNull)
+         * @return Determination.
+         */
+        protected boolean isNecessaryToReadPageAgain(${glPagingResultBeanName}${database.filterGenericsString('T')} rb) {
+            return rb.getAllRecordCount() > 0 && rb.getSelectedList().isEmpty();
+        }
+
+        /**
+         * Assert that the object is not null.
+         * 
+         * @param variableName Variable name. (NotNull)
+         * @param value Value. (NotNull)
+         * @exception IllegalArgumentException
+         */
+        protected void assertObjectNotNull(String variableName, Object value) {
+            if (variableName == null) {
+                String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+                throw new IllegalArgumentException(msg);
+            }
+            if (value == null) {
+                String msg = "The value should not be null: variableName=" + variableName;
+                throw new IllegalArgumentException(msg);
+            }
+        }
+    }
+
+    /**
+     * The marker interface of simple condition-bean setupper.
+     */
+    public static interface SimpleCBSetupper {
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorWritable.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorWritable.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/BehaviorWritable.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,227 @@
+package ${glPackageBaseCommonBhv};
+
+import ${glPackageBaseCommon}.${glDaoWritableInterfaceName};
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileReflectionOptionName};
+import ${glPackageBaseCommonBhvBatch}.${glTokenFileReflectionResultName};
+
+/**
+ * The interface of behavior-writable.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glBehaviorWritableInterfaceName} extends ${glBehaviorReadableInterfaceName} {
+
+    /**
+     * Get dao-writable.
+     * 
+     * @return Dao-writable. (NotNull)
+     */
+    public ${glDaoWritableInterfaceName} getDaoWritable();
+
+    /**
+     * Create entity. (Delegate-Method)
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Inserted count.
+     */
+    public int callCreate(${glEntityInterfaceName} entity);
+
+    /**
+     * Modify entity. (Delegate-Method)
+     * {modified only}
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Updated count.
+     */
+    public int callModify(${glEntityInterfaceName} entity);
+
+    /**
+     * Remove entity. (Delegate-Method)
+     * 
+     * @param entity Entity that the type is entity-interface. (NotNull)
+     * @return Deleted count.
+     */
+    public int callRemove(${glEntityInterfaceName} entity);
+
+    /**
+     * Create several entity-list. (Delegate-Method)
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Inserted count.
+     */
+    public int callCreateList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    /**
+     * Modify several entity-list. (Delegate-Method)
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Updated count.
+     */
+    public int callModifyList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    /**
+     * Remove several entity-list. (Delegate-Method)
+     * 
+     * @param entityList Entity-list that the type is entity-interface. (NotNull)
+     * @return Deleted count.
+     */
+    public int callRemoveList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    // =====================================================================================
+    //                                                                   Basic Entity Update
+    //                                                                   ===================
+    /**
+     * Create.
+     * 
+     * @param entity Entity. (NotNull)
+     */
+    public void create(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+    /**
+     * Modify.
+     * 
+     * @param entity Entity. (NotNull)
+     */
+    public void modify(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+    /**
+     * Modify after select.
+     * 
+     * @param entity Entity.
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    public void modifyAfterSelect(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+    /**
+     * Create or modify after select.
+     * 
+     * @param entity Entity. This must contain primary-key value at least(Except use identity). (NotNull)
+     */
+    public void createOrModifyAfterSelect(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+#if ($database.isMakeBehaviorForUpdate())
+
+    /**
+     * Modify after select-for-update.
+     * 
+     * @param entity Entity.
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @deprecated This method is deprecated.
+     */
+    public void modifyAfterSelectForUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+    /**
+     * Create or modify after select-for-update.
+     * 
+     * @param entity Entity. This must contain primary-key value at least(Except use identity). (NotNull)
+     * @deprecated This method is deprecated.
+     */
+    public void createOrModifyAfterSelectForUpdate(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+#end
+
+    /**
+     * Remove.
+     * 
+     * @param entity Entity. (NotNull)
+     */
+    public void remove(${glPackageBaseCommon}.${glEntityInterfaceName} entity);
+
+    // =====================================================================================
+    //                                                                    Basic Batch Update
+    //                                                                    ==================
+    /**
+     * Create list.
+     * 
+     * @param entityList Entity-list. (NotNull and NotEmpty)
+     * @return Created count.
+     */
+    public int createList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    /**
+     * Modify list.
+     * 
+     * @param entityList Entity-list. (NotNull and NotEmpty)
+     * @return Modified count.
+     */
+    public int modifyList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    /**
+     * Remove list.
+     * 
+     * @param entityList Entity-list. (NotNull and NotEmpty)
+     * @return Removed count.
+     */
+    public int removeList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} entityList);
+
+    // =====================================================================================
+    //                                                                            Token File
+    //                                                                            ==========
+    /**
+     * Reflect(insert or update) token-file to this table.
+     * 
+     * @param filename Name of the file. (NotNull and NotEmpty)
+     * @param tokenFileReflectionOption token-file-reflection-option. (NotNull and Required{delimiter and encoding})
+     * @return Token-file-reflection-result. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public ${glTokenFileReflectionResultName} reflectTokenFile(String filename, ${glTokenFileReflectionOptionName} tokenFileReflectionOption) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * Reflect(insert or update) token-file to this table.
+     * 
+     * @param inputStream Input stream. (NotNull and NotClosed)
+     * @param tokenFileReflectionOption token-file-reflection-option. (NotNull and Required{delimiter and encoding})
+     * @return Token-file-reflection-result. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public ${glTokenFileReflectionResultName} reflectTokenFile(java.io.InputStream inputStream, ${glTokenFileReflectionOptionName} tokenFileReflectionOption) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * Reflect(insert or update) from separated-file.
+     * 
+     * @param filename Name of the file. (NotNull and NotEmpty)
+     * @param encoding Encoding of the file. (NotNull and NotEmpty)
+     * @param delimiter Delimiter of the file. (NotNull and NotEmpty)
+     * @param batchCount Batch-count for transaction.
+     * @param isErrorContinue If true, this method continue in spite of throwing the exception.   
+     * @return The list of InsertOrUpdateExceptionResult. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     * @deprecated Please use reflectTokenFile()
+     */
+    public java.util.List${database.filterGenericsString('OneEntityExceptionResult')} reflectFromSeparatedFile(
+            String filename, String encoding,
+            String delimiter, int batchCount, boolean isErrorContinue
+            ) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * Exception result for one entity. 
+     * @deprecated Please use BatchTransactionFailureResult
+     */
+    public static class OneEntityExceptionResult {
+        protected String _primaryKeyMapString;
+        protected ${glEntityInterfaceName} _entity;
+        protected Exception _exception;
+        
+        public String getPrimaryKeyMapString() {
+            return _primaryKeyMapString;
+        }
+        public void setPrimaryKeyMapString(String value) {
+            _primaryKeyMapString = value;
+        }
+        public ${glEntityInterfaceName} getEntity() {
+            return _entity;
+        }
+        public void setEntity(${glEntityInterfaceName} value) {
+            _entity = value;
+        }
+        public Exception getException() {
+            return _exception;
+        }
+        public void setException(Exception value) {
+            _exception = value;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,87 @@
+package ${glPackageBaseCommonBhvBatch};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingOptionName};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glTokenFileOutputOptionName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected ${glFileMakingOptionName} _fileMakingOption = new ${glFileMakingOptionName}();
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+    public ${glTokenFileOutputOptionName} delimitateByComma() {
+        _fileMakingOption.delimitateByComma();
+        return this;
+    }
+
+    public ${glTokenFileOutputOptionName} delimitateByTab() {
+        _fileMakingOption.delimitateByTab();
+        return this;
+    }
+
+    public ${glTokenFileOutputOptionName} encodeAsUTF8() {
+        _fileMakingOption.encodeAsUTF8();
+        return this;
+    }
+
+    public ${glTokenFileOutputOptionName} encodeAsWindows31J() {
+        _fileMakingOption.encodeAsWindows31J();
+        return this;
+    }
+
+    public ${glTokenFileOutputOptionName} separateCrLf() {
+        _fileMakingOption.separateCrLf();
+        return this;
+    }
+
+    public ${glTokenFileOutputOptionName} separateLf() {
+        _fileMakingOption.separateLf();
+        return this;
+    }
+
+    public ${glTokenFileOutputOptionName} goodByeDoubleQuotation() {
+        _fileMakingOption.goodByeDoubleQuotation();
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public String getEncoding() {
+        return _fileMakingOption.getEncoding();
+    }
+
+    public void setEncoding(String encoding) {
+        _fileMakingOption.setDelimiter(encoding);
+    }
+
+    public String getDelimiter() {
+        return _fileMakingOption.getDelimiter();
+    }
+
+    public void setDelimiter(String delimiter) {
+        _fileMakingOption.setDelimiter(delimiter);
+    }
+
+    public String getLineSeparator() {
+        return _fileMakingOption.getLineSeparator();
+    }
+
+    public void setLineSeparator(String lineSeparator) {
+        _fileMakingOption.setLineSeparator(lineSeparator);
+    }
+
+    public boolean isGoodByeDoubleQuotation() {
+        return _fileMakingOption.isGoodByeDoubleQuotation();
+    }
+
+    public ${glFileMakingOptionName} getFileMakingOption() {
+        return _fileMakingOption;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputResult.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputResult.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileOutputResult.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,25 @@
+package ${glPackageBaseCommonBhvBatch};
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glTokenFileOutputResultName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected java.util.List${database.filterGenericsString(${glEntityInterfaceName})} _selectedList;
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public java.util.List${database.filterGenericsString(${glEntityInterfaceName})} getSelectedList() {
+        return _selectedList;
+    }
+
+    public void setSelectedList(java.util.List${database.filterGenericsString(${glEntityInterfaceName})} selectedList) {
+        _selectedList = selectedList;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionFailure.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionFailure.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionFailure.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,85 @@
+package ${glPackageBaseCommonBhvBatch};
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glTokenFileReflectionFailureName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected java.util.List${database.filterGenericsString('String')} _columnNameList;
+    protected java.util.List${database.filterGenericsString('String')} _valueList;
+
+    protected String rowString;
+
+    /** The row number. */
+    protected int _rowNumber;
+
+    /** The line number. */
+    protected int _lineNumber;
+
+    protected ${glEntityInterfaceName} _entity;
+    protected Exception _exception;
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public java.util.List${database.filterGenericsString('String')} getColumnNameList() {
+        return _columnNameList;
+    }
+
+    public void setColumnNameList(java.util.List${database.filterGenericsString('String')} columnNameList) {
+        this._columnNameList = columnNameList;
+    }
+
+    public java.util.List${database.filterGenericsString('String')} getValueList() {
+        return _valueList;
+    }
+
+    public void setValueList(java.util.List${database.filterGenericsString('String')} valueList) {
+        this._valueList = valueList;
+    }
+
+    public String getRowString() {
+        return rowString;
+    }
+
+    public void setRowString(String rowString) {
+        this.rowString = rowString;
+    }
+
+    public int getRowNumber() {
+        return _rowNumber;
+    }
+
+    public void setRowNumber(int rowNumber) {
+        _rowNumber = rowNumber;
+    }
+
+    public int getLineNumber() {
+        return _lineNumber;
+    }
+
+    public void setLineNumber(int lineNumber) {
+        _lineNumber = lineNumber;
+    }
+
+    public ${glEntityInterfaceName} getEntity() {
+        return _entity;
+    }
+
+    public void setEntity(${glEntityInterfaceName} value) {
+        _entity = value;
+    }
+
+    public Exception getException() {
+        return _exception;
+    }
+
+    public void setException(Exception value) {
+        _exception = value;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,76 @@
+package ${glPackageBaseCommonBhvBatch};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingOptionName};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glTokenFileReflectionOptionName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected boolean _interruptIfError;
+
+    protected ${glFileTokenizingOptionName} _fileTokenizingOption = new ${glFileTokenizingOptionName}();
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+    public ${glTokenFileReflectionOptionName} delimitateByComma() {
+        _fileTokenizingOption.delimitateByComma();
+        return this;
+    }
+
+    public ${glTokenFileReflectionOptionName} delimitateByTab() {
+        _fileTokenizingOption.delimitateByTab();
+        return this;
+    }
+
+    public ${glTokenFileReflectionOptionName} encodeAsUTF8() {
+        _fileTokenizingOption.encodeAsUTF8();
+        return this;
+    }
+
+    public ${glTokenFileReflectionOptionName} encodeAsWindows31J() {
+        _fileTokenizingOption.encodeAsWindows31J();
+        return this;
+    }
+
+    public ${glTokenFileReflectionOptionName} handleEmptyAsNull() {
+        _fileTokenizingOption.handleEmptyAsNull();
+        return this;
+    }
+
+    public ${glTokenFileReflectionOptionName} interruptIfError() {
+        _interruptIfError = true;
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public String getDelimiter() {
+        return _fileTokenizingOption.getDelimiter();
+    }
+
+    public void setDelimiter(String delimiter) {
+        _fileTokenizingOption.setDelimiter(delimiter);
+    }
+
+    public String getEncoding() {
+        return _fileTokenizingOption.getEncoding();
+    }
+
+    public void setEncoding(String encoding) {
+        _fileTokenizingOption.setDelimiter(encoding);
+    }
+
+    public boolean isHandleEmptyAsNull() {
+        return _fileTokenizingOption.isHandleEmptyAsNull();
+    }
+
+    public boolean isInterruptIfError() {
+        return _interruptIfError;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionResult.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionResult.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/batch/TokenFileReflectionResult.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,48 @@
+package ${glPackageBaseCommonBhvBatch};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glTokenFileReflectionResultName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected java.util.List${database.filterGenericsString('String')} _columnNameList;
+    protected int _successCount;
+    protected java.util.List${database.filterGenericsString(${glTokenFileReflectionFailureName})} _failureList;
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+    public void incrementSuccessCount() {
+        ++_successCount;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public java.util.List${database.filterGenericsString('String')} getColumnNameList() {
+        return _columnNameList;
+    }
+
+    public void setColumnNameList(java.util.List${database.filterGenericsString('String')} columnNameList) {
+        this._columnNameList = columnNameList;
+    }
+
+    public int getSuccessCount() {
+        return _successCount;
+    }
+
+    public void setSuccessCount(int successCount) {
+        _successCount = successCount;
+    }
+
+    public java.util.List${database.filterGenericsString(${glTokenFileReflectionFailureName})} getFailureList() {
+        return _failureList;
+    }
+
+    public void setFailureList(java.util.List${database.filterGenericsString(${glTokenFileReflectionFailureName})} failureList) {
+        this._failureList = failureList;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/load/LoadRefererOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/load/LoadRefererOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/load/LoadRefererOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,120 @@
+package ${glPackageBaseCommonBhvLoad};
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonBhvSetup}.${glConditionBeanSetupperName};
+import ${glPackageBaseCommonBhvSetup}.${glEntityListSetupperName};
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+
+/**
+ * The class of load referer option.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glLoadRefererOptionName}<REFERER_CONDITION_BEAN extends ${glConditionBeanInterfaceName}, REFERER_ENTITY extends ${glEntityInterfaceName}> {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    protected ${glConditionBeanSetupperName}<REFERER_CONDITION_BEAN> _conditionBeanSetupper;
+
+    protected ${glEntityListSetupperName}<REFERER_ENTITY> _entityListSetupper;
+
+    protected REFERER_CONDITION_BEAN _reffererConditionBean;
+
+    protected boolean _toLastKeyCondtion;
+
+    protected boolean _stopOrderByKey;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    public ${glLoadRefererOptionName}() {
+    }
+
+    public ${glLoadRefererOptionName}(${glConditionBeanSetupperName}<REFERER_CONDITION_BEAN> conditionBeanSetupper) {
+        this._conditionBeanSetupper = conditionBeanSetupper;
+    }
+
+    public ${glLoadRefererOptionName}(${glConditionBeanSetupperName}<REFERER_CONDITION_BEAN> conditionBeanSetupper, ${glEntityListSetupperName}<REFERER_ENTITY> entityListSetupper) {
+        this._conditionBeanSetupper = conditionBeanSetupper;
+        this._entityListSetupper = entityListSetupper;
+    }
+
+    // ===================================================================================
+    //                                                                         Easy-to-Use
+    //                                                                         ===========
+    /**
+     * Specify that the key condition is added as last condition. <br />
+     * This method is valid only after you use reffererConditionBean and add your original condition to it. <br />
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glLoadRefererOptionName}<REFERER_CONDITION_BEAN, REFERER_ENTITY> toLastKeyCondtion() {
+        _toLastKeyCondtion = true;
+        return this;
+    }
+
+    /**
+     * Specify that it stops adding order-by of the key. <br />
+     * This method is valid only after you use reffererConditionBean and add your original order-by to it. <br />
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glLoadRefererOptionName}<REFERER_CONDITION_BEAN, REFERER_ENTITY> stopOrderByKey() {
+        _stopOrderByKey = true;
+        return this;
+    }
+
+    public void delegateKeyConditionExchangingFirstWhereClauseForLastOne(REFERER_CONDITION_BEAN cb) {// Internal
+        if (!_toLastKeyCondtion) {
+            cb.getSqlClause().exchangeFirstWhereClauseForLastOne();
+        }
+    }
+
+    public void delegateConditionBeanSettingUp(REFERER_CONDITION_BEAN cb) {// Internal
+        if (_conditionBeanSetupper != null) {
+            _conditionBeanSetupper.setup(cb);
+        }
+    }
+
+    public void delegateEntitySettingUp(java.util.List<REFERER_ENTITY> entityList) {// Internal
+        if (_entityListSetupper != null) {
+            _entityListSetupper.setup(entityList);
+        }
+    }
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+    public ${glConditionBeanSetupperName}<REFERER_CONDITION_BEAN> getConditionBeanSetupper() {
+        return _conditionBeanSetupper;
+    }
+
+    public void setConditionBeanSetupper(${glConditionBeanSetupperName}<REFERER_CONDITION_BEAN> conditionBeanSetupper) {
+        this._conditionBeanSetupper = conditionBeanSetupper;
+    }
+
+    public ${glEntityListSetupperName}<REFERER_ENTITY> getEntityListSetupper() {
+        return _entityListSetupper;
+    }
+
+    public void setEntityListSetupper(${glEntityListSetupperName}<REFERER_ENTITY> entityListSetupper) {
+        this._entityListSetupper = entityListSetupper;
+    }
+
+    public REFERER_CONDITION_BEAN getReffererConditionBean() {
+        return _reffererConditionBean;
+    }
+
+    public void setReffererConditionBean(REFERER_CONDITION_BEAN reffererConditionBean) {
+        this._reffererConditionBean = reffererConditionBean;
+    }
+
+    public boolean isToLastKeyCondtion() {
+        return _toLastKeyCondtion;
+    }
+
+    public boolean isStopOrderByKey() {
+        return _stopOrderByKey;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ConditionBeanSetupper.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ConditionBeanSetupper.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ConditionBeanSetupper.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,18 @@
+package ${glPackageBaseCommonBhvSetup};
+
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+
+/**
+ * The interface of condition-bean setupper.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glConditionBeanSetupperName}<CONDITION_BEAN extends ${glConditionBeanInterfaceName}> {
+
+    /**
+     * Set up condition.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     */
+    public void setup(CONDITION_BEAN cb);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/EntityListSetupper.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/EntityListSetupper.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/EntityListSetupper.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,18 @@
+package ${glPackageBaseCommonBhvSetup};
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+
+/**
+ * The interface of entity list setupper.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glEntityListSetupperName}<ENTITY extends ${glEntityInterfaceName}> {
+
+    /**
+     * Set up entity list.
+     * 
+     * @param entityList Entity list. (NotNull)
+     */
+    public void setup(java.util.List<ENTITY> entityList);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelBox.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelBox.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelBox.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,26 @@
+package ${glPackageBaseCommonBhvSetup};
+
+/**
+ * The class of Value-Label Box.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glValueLabelBoxName} {
+
+    protected Object _value;
+
+    protected String _label;
+
+    public void setValueLabel(Object value, String label) {
+        this._value = value;
+        this._label = label;
+    }
+
+    public Object getValue() {
+        return _value;
+    }
+
+    public String getLabel() {
+        return _label;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelSetupper.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelSetupper.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/bhv/setup/ValueLabelSetupper.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,17 @@
+package ${glPackageBaseCommonBhvSetup};
+
+/**
+ * The interface of Value-Label Setupper.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glValueLabelSetupperName}<T> {
+
+    /**
+     * Set up value-label.
+     * 
+     * @param box Value-label box. (NotNull)
+     * @param entity Entity. (NotNull)
+     */
+    public void setup(${glValueLabelBoxName} box, T entity);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,549 @@
+package ${glPackageBaseCommonCBean};
+
+#set ($myClassName = "${glConditionBeanAbstractName}")
+
+import ${glPackageBaseCommonCBean}.${glConditionBeanContextName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInstanceHandlerName};
+import ${glPackageBaseCommonHelper}.${glMapListStringName};
+import ${glPackageBaseCommonHelper}.${glMapListStringImplName};
+import ${glPackageBaseCommonSqlClause}.${glOrderByClauseName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+
+/**
+ * The condition-bean as abstract.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class $myClassName implements ${glConditionBeanInterfaceName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** SQL clause instance. */
+    protected final ${glSqlClauseName} _sqlClause;
+    {
+        _sqlClause = ${glConditionBeanContextName}.createSqlClause(this);
+    }
+
+    // =====================================================================================
+    //                                                                            Sql-Clause
+    //                                                                            ==========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql clause. (NotNull)
+     */
+    public ${glSqlClauseName} getSqlClause() {
+        return _sqlClause;
+    }
+
+    // =====================================================================================
+    //                                                                       Condition-Query
+    //                                                                       ===============
+    /**
+     * Get condition query as interface.
+     * 
+     * @return Instance of query as interface. (NotNull)
+     */
+    abstract public ${glConditionQueryInterfaceName} getConditionQueryAsInterface();
+
+    // =====================================================================================
+    //                                                                    Accept Primary-Key
+    //                                                                    ==================
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param primaryKeyMapString Primary-key map. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMapString(String primaryKeyMapString) {
+        if (primaryKeyMapString == null) {
+            String msg = "The argument[primaryKeyMapString] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        final String prefix = MAP_STRING_MAP_MARK + MAP_STRING_START_BRACE;
+        final String suffix = MAP_STRING_END_BRACE;
+        if (!primaryKeyMapString.trim().startsWith(prefix)) {
+            primaryKeyMapString = prefix + primaryKeyMapString;
+        }
+        if (!primaryKeyMapString.trim().endsWith(suffix)) {
+            primaryKeyMapString = primaryKeyMapString + suffix;
+        }
+        ${glMapListStringName} mapListString = new ${glMapListStringImplName}();
+        mapListString.setMapMark(MAP_STRING_MAP_MARK);
+        mapListString.setListMark(MAP_STRING_LIST_MARK);
+        mapListString.setDelimiter(MAP_STRING_DELIMITER);
+        mapListString.setStartBrace(MAP_STRING_START_BRACE);
+        mapListString.setEndBrace(MAP_STRING_END_BRACE);
+        mapListString.setEqual(MAP_STRING_EQUAL);
+        acceptPrimaryKeyMap(mapListString.generateMap(primaryKeyMapString));
+    }
+
+    protected void checkTypeString(Object value, String propertyName, String typeName) {
+        if (value == null) {
+            throw new IllegalArgumentException("The value should not be null: " + propertyName);
+        }
+        if (!(value instanceof String)) {
+            String msg = "The value of " + propertyName + " should be " + typeName + " or String: ";
+            msg = msg + "valueType=" + value.getClass() + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    protected long parseDateString(Object value, String propertyName, String typeName) {
+        checkTypeString(value, propertyName, typeName);
+        try {
+            return getDateFormat().parse((String)value).getTime();
+        } catch (java.text.ParseException e) {
+            String msg = "The value of " + propertyName + " should be " + typeName + ". but: " + value;
+            throw new RuntimeException(msg + " threw the exception: value=[" + value + "]", e);
+        } catch (RuntimeException e) {
+            String msg = "The value of " + propertyName + " should be " + typeName + ". but: " + value;
+            throw new RuntimeException(msg + " threw the exception: value=[" + value + "]", e);
+        }
+    }
+
+    protected java.text.DateFormat getDateFormat() {
+        return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+    }
+
+    // =====================================================================================
+    //                                                                       Fetch-Narrowing
+    //                                                                       ===============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch start index.
+     */
+    public int getFetchNarrowingSkipStartIndex() {
+        return getSqlClause().getFetchNarrowingSkipStartIndex();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch size.
+     */
+    public int getFetchNarrowingLoopCount() {
+        return getSqlClause().getFetchNarrowingLoopCount();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchNarrowingSkipStartIndexEffective() {
+        return !getSqlClause().isFetchStartIndexSupported();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchNarrowingLoopCountEffective() {
+        return !getSqlClause().isFetchSizeSupported();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchNarrowingEffective() {
+        return getSqlClause().isFetchNarrowingEffective();
+    }
+
+    // =====================================================================================
+    //                                                                                Paging
+    //                                                                                ======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param fetchSize Fetch-size. (NotMinus & NotZero)
+     * @return this. (NotNUll)
+     */
+    public ${glPagingBeanInterfaceName} fetchFirst(int fetchSize) {
+        getSqlClause().fetchFirst(fetchSize);
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+     * @param fetchSize Fetch-size. (NotMinus & NotZero)
+     * @return this. (NotNUll)
+     */
+    public ${glPagingBeanInterfaceName} fetchScope(int fetchStartIndex, int fetchSize) {
+        getSqlClause().fetchScope(fetchStartIndex, fetchSize);
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param fetchPageNumber Fetch-page-number. 1 origin. (NotMinus & NotZero)
+     * @return this. (NotNull)
+     */
+    public ${glPagingBeanInterfaceName} fetchPage(int fetchPageNumber) {
+        getSqlClause().fetchPage(fetchPageNumber);
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-start-index.
+     */
+    public int getFetchStartIndex() {
+        return getSqlClause().getFetchStartIndex();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-size.
+     */
+    public int getFetchSize() {
+        return getSqlClause().getFetchSize();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-page-number.
+     */
+    public int getFetchPageNumber() {
+        return getSqlClause().getFetchPageNumber();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Page start index. 0 origin. (NotMinus)
+     */
+    public int getPageStartIndex() {
+        return getSqlClause().getPageStartIndex();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Page end index. 0 origin. (NotMinus)
+     */
+    public int getPageEndIndex() {
+        return getSqlClause().getPageEndIndex();
+    }
+
+    /**
+     * Is fetch scope effective?
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchScopeEffective() {
+        return getSqlClause().isFetchScopeEffective();
+    }
+
+    // =====================================================================================
+    //                                                                              Order-By
+    //                                                                              ========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql component of order-by clause. (NotNull)
+     */
+    public ${glOrderByClauseName} getSqlComponentOfOrderByClause() {
+        return getSqlClause().getSqlComponentOfOrderByClause();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Order-by clause. (NotNull)
+     */
+    public String getOrderByClause() {
+        return _sqlClause.getOrderByClause();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} clearOrderBy() {
+        getSqlClause().clearOrderBy();
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} ignoreOrderBy() {
+        getSqlClause().ignoreOrderBy();
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} makeOrderByEffective() {
+        getSqlClause().makeOrderByEffective();
+        return this;
+    }
+
+    /**
+     * Register order-by-asc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} registerOrderByAsc(String orderByProperty) {
+        getSqlClause().registerOrderBy(filterOrderByProperty(orderByProperty), orderByProperty, true);
+        return this;
+    }
+
+    /**
+     * Register order-by-desc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} registerOrderByDesc(String orderByProperty) {
+        getSqlClause().registerOrderBy(filterOrderByProperty(orderByProperty), orderByProperty, false);
+        return this;
+    }
+
+    /**
+     * Reverse order-by or Override order-by asc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} reverseOrderBy_Or_OverrideOrderByAsc(String orderByProperty) {
+        getSqlClause().reverseOrderBy_Or_OverrideOrderBy(filterOrderByProperty(orderByProperty), orderByProperty, true);
+        return this;
+    }
+
+    /**
+     * Reverse order-by or Override order-by desc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} reverseOrderBy_Or_OverrideOrderByDesc(String orderByProperty) {
+        getSqlClause().reverseOrderBy_Or_OverrideOrderBy(filterOrderByProperty(orderByProperty), orderByProperty, false);
+        return this;
+    }
+
+    protected String filterOrderByProperty(String orderByProperty) {
+        final java.util.List${database.filterGenericsString('String')} orderBySlashList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        {
+            final java.util.StringTokenizer st = new java.util.StringTokenizer(orderByProperty, "/");
+            while (st.hasMoreElements()) {
+                orderBySlashList.add(st.nextToken());
+            }
+        }
+
+        final StringBuffer sb = new StringBuffer();
+        ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableDbName(getTableDbName());
+        ${glConditionQueryInterfaceName} query = this.getConditionQueryAsInterface();
+        for (final java.util.Iterator ite = orderBySlashList.iterator(); ite.hasNext(); ) {
+            final String orderBySlashElement = (String)ite.next();
+	        final java.util.List${database.filterGenericsString('String')} orderByDotList = new java.util.ArrayList${database.filterGenericsString('String')}();
+	        {
+	            final java.util.StringTokenizer st = new java.util.StringTokenizer(orderBySlashElement, "/");
+	            while (st.hasMoreElements()) {
+	                orderByDotList.add(st.nextToken());
+	            }
+	        }
+
+            if (orderByDotList.size() == 1) {
+                if (dbmeta.isExistMultiName(orderBySlashElement)) {
+                    sb.append("/").append(query.getRealColumnName(dbmeta.getDbNameByMultiName(orderBySlashElement)));
+                } else {
+                    sb.append("/").append(orderBySlashElement);
+                }
+            } else {
+                ${glDBMetaInterfaceName} foreignDBMeta = dbmeta;
+                ${glConditionQueryInterfaceName} foreignQuery = query;
+                int count = 0;
+                for (final java.util.Iterator ite2 = orderByDotList.iterator(); ite2.hasNext(); ) {
+                    String orderByDotElement = (String)ite2.next();
+                    count++;
+
+                    if (orderByDotList.size() == count) {// Last Loop!
+                        if (!foreignDBMeta.isExistMultiName(orderByDotElement)) {
+                            String msg = "The name for order-by is not existing: name=" + orderByDotElement;
+                            msg = msg + " orderBySlashElement=" + orderBySlashElement + " orderByProperty=" + orderByProperty;
+                            throw new IllegalStateException(msg);
+                        }
+                        sb.append("/").append(foreignQuery.getRealColumnName(foreignDBMeta.getDbNameByMultiName(orderByDotElement)));
+                        break;
+                    }
+
+                    foreignDBMeta = foreignDBMeta.getForeignDBMeta(orderByDotElement);
+                    foreignQuery = foreignQuery.getForeignConditionQuery(orderByDotElement);
+                }
+            }
+        }
+        sb.delete(0, "/".length());
+        return sb.toString();
+    }
+
+    // =====================================================================================
+    //                                                                          Limit-Select
+    //                                                                          ============
+    /** Is limit-select PK only? */
+    protected boolean _isLimitSelectPKOnly;
+
+    /**
+     * Is limit-select PK only?
+     * 
+     * @return Determination.
+     */
+    public boolean isLimitSelect_PKOnly() {
+        return _isLimitSelectPKOnly;
+    }
+
+    /**
+     * Limit select PK only.
+     *
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} limitSelect_PKOnly() {
+        _isLimitSelectPKOnly = true;
+        return this;
+    }
+
+    /**
+     * Limit select off.
+     *
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} limitSelect_Off() {
+        _isLimitSelectPKOnly = false;
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                               Advance
+    //                                                                               =======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} lockForUpdate() {
+        getSqlClause().lockForUpdate();
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                        For SqlComment
+    //                                                                        ==============
+    /**
+     * Get select-hint. {select [select-hint] * from table...}
+     * 
+     * @return select-hint. (NotNull)
+     */
+    public String getSelectHint() {
+        return getSqlClause().getSelectHint();
+    }
+
+    /**
+     * Get from-base-table-hint. {select * from table [from-base-table-hint] where ...}
+     * 
+     * @return from-base-table-hint. (NotNull)
+     */
+    public String getFromBaseTableHint() {
+        return getSqlClause().getFromBaseTableHint();
+    }
+
+    /**
+     * Get from-hint. {select * from table left outer join ... on ... [from-hint] where ...}
+     * 
+     * @return from-hint. (NotNull)
+     */
+    public String getFromHint() {
+        return getSqlClause().getFromHint();
+    }
+
+    /**
+     * Get where clause.
+     * 
+     * @return Where clause. (NotNull)
+     */
+    public String getWhereClause() {
+        return getSqlClause().getWhereClause();
+    }
+
+    /**
+     * Get sql-suffix. {select * from table where ... order by ... [sql-suffix]}
+     * 
+     * @return Sql-suffix.  (NotNull)
+     */
+    public String getSqlSuffix() {
+        return getSqlClause().getSqlSuffix();
+    }
+
+    // ------------------------------
+    //                   for Internal
+    //                   ------------
+    /**
+     * Set up various things for select-count-ignore-fetch-scope. {Internal}
+     * This method is for INTERNAL. Don't invoke this!
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} xsetupSelectCountIgnoreFetchScope() {
+        _isSelectCountIgnoreFetchScope = true;
+
+        // If the query uses union query, it needs included-select-column.
+        if (!hasUnionQueryOrUnionAllQuery()) {
+            getSqlClause().ignoreIncludedSelectColumn();
+        }
+
+        getSqlClause().ignoreOrderBy();
+        getSqlClause().ignoreFetchScope();
+        return this;
+    }
+
+    /**
+     * Do after-care for select-count-ignore-fetch-scope. {Internal}
+     * This method is for INTERNAL. Don't invoke this!
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} xafterCareSelectCountIgnoreFetchScope() {
+        _isSelectCountIgnoreFetchScope = false;
+
+        // If the query uses union query, it needs included-select-column.
+        if (!hasUnionQueryOrUnionAllQuery()) {
+            getSqlClause().makeIncludedSelectColumnEffective();
+        }
+
+        getSqlClause().makeOrderByEffective();
+        getSqlClause().makeFetchScopeEffective();
+        return this;
+    }
+
+    /** Is set up various things for select-count-ignore-fetch-scope? */
+    protected boolean _isSelectCountIgnoreFetchScope;
+
+    /**
+     * Is set up various things for select-count-ignore-fetch-scope?
+     * This method is for INTERNAL. Don't invoke this!
+     * 
+     * @return Determination.
+     */
+    public boolean isSelectCountIgnoreFetchScope() {
+        return _isSelectCountIgnoreFetchScope;
+    }
+
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionQuery.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionQuery.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/AbstractConditionQuery.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,788 @@
+package ${glPackageBaseCommonCBean};
+
+#set ($myClassName = "${glConditionQueryAbstractName}")
+
+import ${glPackageBaseCommonCKey}.${glConditionKeyName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionFromToName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionLikeSearchName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionInScopeName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInstanceHandlerName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+
+/**
+ * The abstract class of condition-query.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${myClassName} implements ${glConditionQueryInterfaceName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** Condition value for DUMMY. */
+    protected static final ${glConditionValueName} DUMMY_CONDITION_VALUE = new ${glConditionValueName}();
+
+    /** Object for DUMMY. */
+    protected static final Object DUMMY_OBJECT = new Object();
+
+    /** SQL clause. */
+    protected final ${glSqlClauseName} _sqlClause;
+
+    /** My alias name. */
+    protected final String _aliasName;
+
+    /** Nest level. */
+    protected final int _nestLevel;
+
+    /** Child query. */
+    protected final ${glConditionQueryInterfaceName} _childQuery;
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     * 
+     * @param childQuery Child query. (Nullable: If null, this is base instance.)
+     * @param sqlClause SQL clause instance. (NotNull)
+     * @param aliasName My alias name. (NotNull)
+     * @param nestLevel Nest level.
+     */
+    public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel) {
+        _childQuery = childQuery;
+        _sqlClause = sqlClause;
+        _aliasName = aliasName;
+        _nestLevel = nestLevel;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    /**
+     * Get child query.
+     * 
+     * @return Child query. (Nullable)
+     */
+    public ${glConditionQueryInterfaceName} getChildQuery() {
+        return _childQuery;
+    }
+
+    /**
+     * Get sql clause.
+     * 
+     * @return Sql clause. (NotNull)
+     */
+    public ${glSqlClauseName} getSqlClause() {
+        return _sqlClause;
+    }
+
+    /**
+     * Get alias name.
+     * 
+     * @return Alias name. (NotNull)
+     */
+    public String getAliasName() {
+        return _aliasName;
+    }
+
+    /**
+     * Get nest level.
+     * 
+     * @return Nest level.
+     */
+    public int getNestLevel() {
+        return _nestLevel;
+    }
+
+    /**
+     * Get next nest level.
+     * 
+     * @return Next nest level.
+     */
+    public int getNextNestLevel() {
+        return _nestLevel+1;
+    }
+
+    /**
+     * Is base query?
+     * 
+     * @param query Condition query. (NotNull)
+     * @return Determination.
+     */
+    public boolean isBaseQuery(${glConditionQueryInterfaceName} query) {
+        return (query.getChildQuery() == null);
+    }
+
+    // =====================================================================================
+    //                                                                             Real Name
+    //                                                                             =========
+    /**
+     * Get real alias name(that has nest level mark).
+     * 
+     * @return Real alias name.
+     */
+    public String getRealAliasName() {
+        if (getNestLevel() > 1) {
+            return getAliasName() + "_n" + getNestLevel();
+        } else {
+            return getAliasName();
+        }
+    }
+
+    /**
+     * Get real column name(with real alias name).
+     * 
+     * @param columnName Column name without alias name. This should not contain comma. (NotNull)
+     * @return Real column name.
+     */
+    public String getRealColumnName(String columnName) {
+        assertColumnName(columnName);
+        return getRealAliasName() + "." + columnName;
+    }
+
+    // =====================================================================================
+    //                                                                              Location
+    //                                                                              ========
+    /**
+     * Get location.
+     * 
+     * @param columnPropertyName Column property name.
+     * @param key Condition key.
+     * @return Next nest level.
+     */
+    protected String getLocation(String columnPropertyName, ${glConditionKeyName} key) {
+        return getLocationBase(columnPropertyName) + "." + key.getConditionKey();
+    }
+
+    protected String getLocationBase() {
+        final StringBuffer sb = new StringBuffer();
+        ${glConditionQueryInterfaceName} query = this;
+        while (true) {
+            if (query.isBaseQuery(query)) {
+                sb.insert(0, "conditionQuery.");
+                break;
+            } else {
+                sb.insert(0, "conditionQuery" + query.getAliasName() + ".");
+            }
+            query = query.getChildQuery();
+        }
+        return sb.toString();
+    }
+
+    protected String getLocationBase(String columnPropertyName) {
+        return getLocationBase() + columnPropertyName;
+    }
+#set ($unionQueryGenericsString = "String, ${glConditionQueryInterfaceName}")
+
+    // =====================================================================================
+    //                                                                           Union-Query
+    //                                                                           ===========
+    protected java.util.Map${database.filterGenericsString(${unionQueryGenericsString})} _unionQueryMap = new java.util.LinkedHashMap${database.filterGenericsString(${unionQueryGenericsString})}();
+
+    public java.util.Map${database.filterGenericsString(${unionQueryGenericsString})} getUnionQueryMap() {// for Internal
+        return _unionQueryMap;
+    }
+
+    /**
+     * Set union query. {Internal}
+     * <pre>
+     * Add union query to condition bean.
+     * </pre>
+     * @param unionQuery Union query. (NotNull)
+     */
+    public void xsetUnionQuery(${glConditionQueryInterfaceName} unionQuery) {
+        xsetupUnion(unionQuery, false, _unionQueryMap);
+    }
+
+    protected java.util.Map${database.filterGenericsString(${unionQueryGenericsString})} _unionAllQueryMap = new java.util.LinkedHashMap${database.filterGenericsString(${unionQueryGenericsString})}();
+
+    public java.util.Map${database.filterGenericsString(${unionQueryGenericsString})} getUnionAllQueryMap() {// for Internal
+        return _unionAllQueryMap;
+    }
+
+    /**
+     * Set union all query. {Internal}
+     * <pre>
+     * Add union all query to condition bean.
+     * </pre>
+     * @param unionAllQuery Union all query. (NotNull)
+     */
+    public void xsetUnionAllQuery(${glConditionQueryInterfaceName} unionAllQuery) {
+        xsetupUnion(unionAllQuery, true, _unionAllQueryMap);
+    }
+
+    protected void xsetupUnion(${glConditionQueryInterfaceName} unionQuery, boolean unionAll, java.util.Map${database.filterGenericsString(${unionQueryGenericsString})} unionQueryMap) {
+        if (unionQuery == null) {
+            String msg = "The argument[unionQuery] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        reflectRelationOnUnionQuery(this, unionQuery);// Reflect Relation!
+        getSqlClause().copyIncludedSelectColumn(unionQuery.getSqlClause());// Reflect IncludedSelectColumn!
+        final String key = (unionAll ? "unionAllQuery" : "unionQuery") + unionQueryMap.size();
+        unionQueryMap.put(key, unionQuery);
+        registerUnionQuery(unionQuery, unionAll, (unionAll ? "unionAllQueryMap" : "unionQueryMap") + "." + key);
+    }
+
+    abstract protected void reflectRelationOnUnionQuery(${glConditionQueryInterfaceName} baseQueryAsSuper, ${glConditionQueryInterfaceName} unionQueryAsSuper);
+
+    public boolean hasUnionQueryOrUnionAllQuery() {
+        return !_unionQueryMap.isEmpty() || !_unionAllQueryMap.isEmpty();
+    }
+
+    public java.util.List${database.filterGenericsString(${glConditionQueryInterfaceName})} getUnionQueryList() {
+        return new java.util.ArrayList${database.filterGenericsString(${glConditionQueryInterfaceName})}(_unionQueryMap.values());
+    }
+
+    public java.util.List${database.filterGenericsString(${glConditionQueryInterfaceName})} getUnionAllQueryList() {
+        return new java.util.ArrayList${database.filterGenericsString(${glConditionQueryInterfaceName})}(_unionAllQueryMap.values());
+    }
+
+    // =====================================================================================
+    //                                                                       Include-As-Mine
+    //                                                                       ===============
+    /**
+     * Register included-select-column.
+     * 
+     * @param aliasName Alias name. This should not contain comma. (NotNull)
+     * @param realColumnName Real column name. This should not contain comma. (NotNull)
+     */
+    protected void registerIncludedSelectColumn(String aliasName, String realColumnName) {
+        assertAliasName(aliasName);
+        assertColumnName(realColumnName);
+        getSqlClause().registerIncludedSelectColumn(aliasName, realColumnName);
+    }
+
+    // =====================================================================================
+    //                                                                              Register
+    //                                                                              ========
+    // ----------------------------------------
+    //                                   Normal
+    //                                   ------
+    protected void registerQuery(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                 , String colName, String capPropName, String uncapPropName) {
+        if (key.isValidRegistration(cvalue, value, key.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+            setupConditionValueAndRegisterWhereClause(key, value, cvalue, colName, capPropName, uncapPropName);
+        }
+    }
+
+    protected void registerQuery(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                 , String colName, String capPropName, String uncapPropName, ${glConditionOptionInterfaceName} option) {
+        if (key.isValidRegistration(cvalue, value, key.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+            setupConditionValueAndRegisterWhereClause(key, value, cvalue, colName, capPropName, uncapPropName, option);
+        }
+    }
+
+    // ----------------------------------------
+    //                                   FromTo
+    //                                   ------
+    protected void registerFromToQuery(java.util.Date fromDate, java.util.Date toDate, ${glConditionValueName} cvalue
+                                 , String colName, String capPropName, String uncapPropName, ${glConditionOptionFromToName} option) {
+        {
+            final java.util.Date filteredFromDate = option.filterFromDate(fromDate);
+            final ${glConditionKeyName} fromKey = option.getFromDateConditionKey();
+            if (fromKey.isValidRegistration(cvalue, filteredFromDate, fromKey.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+                setupConditionValueAndRegisterWhereClause(fromKey, filteredFromDate, cvalue, colName, capPropName, uncapPropName);
+            }
+        }
+        {
+            final java.util.Date filteredToDate = option.filterToDate(toDate);
+            final ${glConditionKeyName} toKey = option.getToDateConditionKey();
+            if (toKey.isValidRegistration(cvalue, filteredToDate, toKey.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+                setupConditionValueAndRegisterWhereClause(toKey, filteredToDate, cvalue, colName, capPropName, uncapPropName);
+            }
+        }
+    }
+#set ($likeAsOrCallbackFullClassName = "${glConditionOptionLikeSearchName}.LikeAsOrCallback")
+
+    // ----------------------------------------
+    //                               LikeSearch
+    //                               ----------
+    protected void registerLikeSearchQuery(${glConditionKeyName} key, String value, ${glConditionValueName} cvalue
+                                     , String colName, String capPropName, String uncapPropName, ${glConditionOptionLikeSearchName} option) {
+        if (key.isValidRegistration(cvalue, value, key.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+            if (value != null && option.isSplit()) {
+                final String[] strArray = option.generateSplitValueArray(value);
+                for (int i=0; i < strArray.length; i++) {
+                    final String currentValue = strArray[i];
+                    setupConditionValueAndRegisterWhereClause(key, currentValue, cvalue, colName, capPropName, uncapPropName, option);
+
+                    // Callback for LikeAsOr!
+                    final java.util.List${database.filterGenericsString(${likeAsOrCallbackFullClassName})} callbackList = option.getLikeAsOrCallbackList();
+                    if (!callbackList.isEmpty()) {
+                        getSqlClause().makeAdditionalConditionAsOrEffective();
+                        for (java.util.Iterator ite = callbackList.iterator(); ite.hasNext(); ) {
+                            final ${likeAsOrCallbackFullClassName} likeAsOrCallback = (${likeAsOrCallbackFullClassName})ite.next();
+                            final String additionalTargetPropertyName = likeAsOrCallback.getAdditionalTargetPropertyName();
+                            final String filteredValue = likeAsOrCallback.filterValue(currentValue);
+                            final ${glConditionOptionLikeSearchName} optionDeepCopy = (${glConditionOptionLikeSearchName})option.createDeepCopy();
+                            optionDeepCopy.clearLikeAsOrCallback();
+                            final ${glConditionOptionLikeSearchName} filteredOption = likeAsOrCallback.filterOption(optionDeepCopy);
+                            invokeSetterLikeSearch(additionalTargetPropertyName, filteredValue, filteredOption);
+                        }
+                        getSqlClause().ignoreAdditionalConditionAsOr();
+                    }
+                }
+            } else {
+                setupConditionValueAndRegisterWhereClause(key, value, cvalue, colName, capPropName, uncapPropName, option);
+            }
+        }
+    }
+
+    // ----------------------------------------
+    //                                  InScope
+    //                                  -------
+    protected void registerInScopeQuery(${glConditionKeyName} key, String value, ${glConditionValueName} cvalue
+                                     , String colName, String capPropName, String uncapPropName, ${glConditionOptionInScopeName} option) {
+        if (key.isValidRegistration(cvalue, value, key.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+            if (value != null && option.isSplit()) {
+                final String[] strArray = option.generateSplitValueArray(value);
+                final java.util.List${database.filterGenericsString('String')} realValueList = new java.util.ArrayList${database.filterGenericsString('String')}();
+                for (int i=0; i < strArray.length; i++) {
+                    final String currentValue = strArray[i];
+                    realValueList.add(currentValue);
+                }
+                setupConditionValueAndRegisterWhereClause(key, realValueList, cvalue, colName, capPropName, uncapPropName, option);
+            } else {
+                setupConditionValueAndRegisterWhereClause(key, value, cvalue, colName, capPropName, uncapPropName, option);
+            }
+        }
+    }
+
+    protected void setupConditionValueAndRegisterWhereClause(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                                             , String colName, String capPropName, String uncapPropName) {
+        key.setupConditionValue(cvalue, value, getLocation(uncapPropName, key));// If Java, UncapProp!
+        getSqlClause().registerWhereClause(getRealColumnName(colName), key, cvalue);
+    }
+
+    protected void setupConditionValueAndRegisterWhereClause(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                                             , String colName, String capPropName, String uncapPropName, ${glConditionOptionInterfaceName} option) {
+        key.setupConditionValue(cvalue, value, getLocation(uncapPropName, key), option);// If Java, UncapProp!
+        getSqlClause().registerWhereClause(getRealColumnName(colName), key, cvalue, option);
+    }
+
+    // ----------------------------------------
+    //                                   Inline
+    //                                   ------
+    protected void registerInlineQuery(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                       , String colName, String capPropName, String uncapPropName) {
+        if (key.isValidRegistration(cvalue, value, key.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+            key.setupConditionValue(cvalue, value, getLocation(uncapPropName, key));// If Java, UncapProp!
+            if (isBaseQuery(this)) {
+                getSqlClause().registerBaseTableInlineWhereClause(colName, key, cvalue);
+            } else {
+                getSqlClause().registerOuterJoinInlineWhereClause(getRealAliasName(), colName, key, cvalue);
+            }
+        }
+    }
+
+    protected void registerInlineQuery(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                       , String colName, String capPropName, String uncapPropName, ${glConditionOptionInterfaceName} option) {
+        if (key.isValidRegistration(cvalue, value, key.getConditionKey() + " of " + getRealAliasName() + "." + uncapPropName)) {
+            key.setupConditionValue(cvalue, value, getLocation(uncapPropName, key), option);// If Java, UncapProp!
+            if (isBaseQuery(this)) {
+                getSqlClause().registerBaseTableInlineWhereClause(colName, key, cvalue, option);
+            } else {
+                getSqlClause().registerOuterJoinInlineWhereClause(getRealAliasName(), colName, key, cvalue, option);
+            }
+        }
+    }
+
+    // ----------------------------------------
+    //                          InScopeSubQuery
+    //                          ---------------
+    protected void registerInScopeSubQuery(${glConditionQueryInterfaceName} subQuery
+                                 , String columnName, String relatedColumnName, String propertyName) {
+        final String realColumnName = getRealColumnName(columnName);
+        final String subQueryClause = getInScopeSubQuerySql(subQuery, relatedColumnName, propertyName);
+        registerWhereClause(realColumnName + " in (" + subQueryClause + ")");
+    }
+
+    protected String getInScopeSubQuerySql(${glConditionQueryInterfaceName} subQuery
+                                 , String relatedColumnName, String propertyName) {
+        final String selectClause = "select " + subQuery.getAliasName() + "." + relatedColumnName;
+        String clause = subQuery.getSqlClause().getClauseWithoutIncludedOrderBySqlSuffix();
+        clause = replaceString(clause, ".conditionQuery.", "." + getLocationBase(propertyName) + ".");// Very Important!
+        return replaceString(clause, ${glSqlClauseInterfaceName}.INCLUDE_SELECT_CLAUSE_MARK, selectClause);
+    }
+
+    // ----------------------------------------
+    //                           ExistsSubQuery
+    //                           --------------
+    protected void registerExistsSubQuery(${glConditionQueryInterfaceName} subQuery
+                                 , String columnName, String relatedColumnName, String propertyName) {
+        final String realColumnName = getRealColumnName(columnName);
+        final String subQueryClause = getExistsSubQuerySql(subQuery, realColumnName, relatedColumnName, propertyName);
+        registerWhereClause("exists (" + subQueryClause + ")");
+    }
+
+    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+    // *Unsupport ExistsSubQuery as inline because it's so dangerous.
+    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+
+    protected String getExistsSubQuerySql(${glConditionQueryInterfaceName} subQuery
+                                 , String realColumnName, String relatedColumnName, String propertyName) {
+        final String selectClause = "select " + subQuery.getAliasName() + "." + relatedColumnName;
+        String clause = subQuery.getSqlClause().getClauseWithoutIncludedOrderBySqlSuffix();
+        clause = replaceString(clause, ".conditionQuery.", "." + getLocationBase(propertyName) + ".");// Very Important!
+        final String parentCondition;
+        if (clause.contains("where")) {
+            parentCondition = " and " + relatedColumnName + " = " + realColumnName;
+        } else {
+            parentCondition = " where " + relatedColumnName + " = " + realColumnName;
+        }
+        return replaceString(clause + parentCondition, ${glSqlClauseInterfaceName}.INCLUDE_SELECT_CLAUSE_MARK, selectClause);
+    }
+
+    protected void registerWhereClause(String whereClause) {
+        getSqlClause().registerWhereClause(whereClause);
+    }
+
+    protected void registerInlineWhereClause(String whereClause) {
+        if (isBaseQuery(this)) {
+            getSqlClause().registerBaseTableInlineWhereClause(whereClause);
+        } else {
+            getSqlClause().registerOuterJoinInlineWhereClause(getRealAliasName(), whereClause);
+        }
+    }
+#if ($database.isMakeDeprecated())
+
+    /**
+     * @param subQuery Sub query. (NotNull)
+     * @param columName Column name. (NotNull)
+     * @param relatedColumnName Related column name. (NotNull)
+     * @param propertyName Property name. (NotNull)
+     * @deprecated This method is deprecated.
+     */
+    protected void registerInlineInScopeSubQuery(${glConditionQueryInterfaceName} subQuery
+                                 , String columnName, String relatedColumnName, String propertyName) {
+        final String subQueryClause = getInScopeSubQuerySql(subQuery, relatedColumnName, propertyName);
+        final String finalClause = columnName + " in (" + subQueryClause + ")";
+        if (isBaseQuery(this)) {
+            getSqlClause().registerBaseTableInlineWhereClause(finalClause);
+        } else {
+            getSqlClause().registerOuterJoinInlineWhereClause(getRealAliasName(), finalClause);
+        }
+    }
+#end
+
+    // ----------------------------------------
+    //                               UnionQuery
+    //                               ----------
+    public void registerUnionQuery(${glConditionQueryInterfaceName} unionQuery, boolean unionAll, String unionQueryPropertyName) {
+        final String unionQueryClause = getUnionQuerySql(unionQuery, unionQueryPropertyName);
+        getSqlClause().registerUnionQuery(unionQueryClause, unionAll);
+    }
+
+    protected String getUnionQuerySql(${glConditionQueryInterfaceName} unionQuery, String unionQueryPropertyName) {
+        final String selectClause = unionQuery.getSqlClause().getIncludedSelectColumnClause();
+        final String queryClause = unionQuery.getSqlClause().getFromClause() + " " + unionQuery.getSqlClause().getWhereClause();
+        final String oldStr = ".conditionQuery.";
+        final String newStr = ".conditionQuery." + unionQueryPropertyName + ".";
+        final String replacedClause = replaceString(queryClause, oldStr, newStr);// Very Important!
+        return selectClause + " " + replacedClause;
+    }
+
+    // =====================================================================================
+    //                                                                                Invoke
+    //                                                                                ======
+    public ${glConditionValueName} invokeGetter(String columnMultiName) {
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableDbName(getTableDbName());
+        final String columnCapPropName = dbmeta.getCapPropNameByMultiName(columnMultiName);
+        String methodName = "get" + columnCapPropName;
+        java.lang.reflect.Method method = null;
+        try {
+            method = this.getClass().getMethod(methodName, new Class[]{});
+        } catch (NoSuchMethodException e) {
+            String msg = "The columnMultiName is not existing in this table: columnMultiName=" + columnMultiName;
+            msg = msg + " tableName=" + getTableDbName() + " methodName=" + methodName;
+            throw new RuntimeException(msg, e);
+        }
+        try {
+            final Object result = method.invoke(this, new Object[]{});
+            return (${glConditionValueName})result;
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        } catch (java.lang.reflect.InvocationTargetException e) {
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    public void invokeSetterEqual(String columnMultiName, Object value) {
+        invokeSetter(columnMultiName, value, "equal");
+    }
+
+    public void invokeSetterNotEqual(String columnMultiName, Object value) {
+        invokeSetter(columnMultiName, value, "notEqual");
+    }
+
+    public void invokeSetterGreaterThan(String columnMultiName, Object value) {
+        invokeSetter(columnMultiName, value, "greaterThan");
+    }
+
+    public void invokeSetterLessThan(String columnMultiName, Object value) {
+        invokeSetter(columnMultiName, value, "lessThan");
+    }
+
+    public void invokeSetterGreaterEqual(String columnMultiName, Object value) {
+        invokeSetter(columnMultiName, value, "greaterEqual");
+    }
+
+    public void invokeSetterLessEqual(String columnMultiName, Object value) {
+        invokeSetter(columnMultiName, value, "lessEqual");
+    }
+
+    protected void invokeSetter(String columnMultiName, Object value, String conditionKeyName) {
+        if (value == null) {
+            return;
+        }
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableDbName(getTableDbName());
+        final String columnCapPropName = dbmeta.getCapPropNameByMultiName(columnMultiName);
+        String methodName = "set" + columnCapPropName + "_" + conditionKeyName.substring(0, 1).toUpperCase() + conditionKeyName.substring(1);
+        java.lang.reflect.Method method = null;
+        try {
+            method = this.getClass().getMethod(methodName, new Class[]{value.getClass()});
+        } catch (NoSuchMethodException e) {
+            String msg = "The columnMultiName is not existing in this table: columnMultiName=" + columnMultiName;
+            msg = msg + " tableName=" + getTableDbName() + " methodName=" + methodName;
+            throw new RuntimeException(msg, e);
+        }
+        try {
+            method.invoke(this, new Object[]{value});
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        } catch (java.lang.reflect.InvocationTargetException e) {
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    protected void invokeSetterLikeSearch(String columnMultiName, Object value, ${glConditionOptionLikeSearchName} option) {
+        if (value == null) {
+            return;
+        }
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableDbName(getTableDbName());
+        final String columnCapPropName = dbmeta.getCapPropNameByMultiName(columnMultiName);
+        String methodName = "set" + columnCapPropName + "_" + "likeSearch".substring(0, 1).toUpperCase() + "likeSearch".substring(1);
+        java.lang.reflect.Method method = null;
+        try {
+            method = this.getClass().getMethod(methodName, new Class[]{value.getClass(), ${glConditionOptionLikeSearchName}.class});
+        } catch (NoSuchMethodException e) {
+            String msg = "The columnMultiName is not existing in this table: columnMultiName=" + columnMultiName;
+            msg = msg + " tableName=" + getTableDbName() + " methodName=" + methodName;
+            throw new RuntimeException(msg, e);
+        }
+        try {
+            method.invoke(this, new Object[]{value, option});
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        } catch (java.lang.reflect.InvocationTargetException e) {
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    public void invokeAddOrderByAsc(String columnMultiName) {
+        invokeOrderBy(columnMultiName, true);
+    }
+
+    public void invokeAddOrderByDesc(String columnMultiName) {
+        invokeOrderBy(columnMultiName, false);
+    }
+
+    protected void invokeOrderBy(String columnMultiName, boolean isAsc) {
+        String ascDesc = null;
+        if (isAsc) {
+            ascDesc = "Asc";
+        } else {
+            ascDesc = "Desc";
+        }
+        final ${glDBMetaInterfaceName} dbmeta = ${glDBMetaInstanceHandlerName}.getInstanceByTableDbName(getTableDbName());
+        final String methodName = "addOrderBy_" + dbmeta.getCapPropNameByMultiName(columnMultiName) + "_" + ascDesc;
+
+        java.lang.reflect.Method method = null;
+        try {
+            method = this.getClass().getMethod(methodName, new Class[]{});
+        } catch (NoSuchMethodException e) {
+            String msg = "The columnMultiName is not existing in this table: columnMultiName=" + columnMultiName;
+            msg = msg + " tableName=" + getTableDbName() + " methodName=" + methodName;
+            throw new RuntimeException(msg, e);
+        }
+        try {
+            method.invoke(this, new Object[]{});
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        } catch (java.lang.reflect.InvocationTargetException e) {
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    // =====================================================================================
+    //                                                                         Foreign Query
+    //                                                                         =============
+    /// <summary>
+    /// ${database.ImplementComment}
+    /// </summary>
+    /// <param name="foreignPropertyName">Foreign-property-name(Both OK - InitCap or not). (NotNull)</param>
+    /// <returns>Foreign condition-query as interface.</returns>
+    public ${glConditionQueryInterfaceName} getForeignConditionQuery(String foreignPropertyName) {
+        final String methodName = "query" + foreignPropertyName.substring(0, 1) + foreignPropertyName.substring(1);
+        java.lang.reflect.Method method = null;
+        try {
+            method = this.getClass().getMethod(methodName, new Class[]{});
+        } catch (NoSuchMethodException e) {
+            String msg = "The foreignPropertyName is not existing in this table: foreignPropertyName=" + foreignPropertyName;
+            msg = msg + " tableName=" + getTableDbName() + " methodName=" + methodName;
+            throw new RuntimeException(msg, e);
+        }
+        try {
+            return (${glConditionQueryInterfaceName})method.invoke(this, new Object[]{});
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        } catch (java.lang.reflect.InvocationTargetException e) {
+            throw new RuntimeException(e.getCause());
+        }
+    }
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+
+    protected final String replaceString(String text, String fromText, String toText) {
+        if(text == null || fromText == null || toText == null)
+            return null;
+        StringBuffer buf = new StringBuffer(100);
+        int pos = 0;
+        int pos2 = 0;
+        do {
+            pos = text.indexOf(fromText, pos2);
+            if(pos == 0) {
+                buf.append(toText);
+                pos2 = fromText.length();
+            } else
+            if(pos > 0) {
+                buf.append(text.substring(pos2, pos));
+                buf.append(toText);
+                pos2 = pos + fromText.length();
+            } else {
+                buf.append(text.substring(pos2));
+                return buf.toString();
+            }
+        } while(true);
+    }
+
+    /**
+     * Filter removing empty-string.
+     * If the value is null or empty-string, returns null.
+     * 
+     * @param value Query-value-string. (Nullable)
+     * @return Filtered value. (Nullable)
+     */
+    protected String filterRemoveEmptyString(String value) {
+        return ((value != null && !"".equals(value)) ? value : null);
+    }
+
+    /**
+     * Filter removing empty-string from the list.
+     * If the list is null or empty-string, returns null.
+     * 
+     * @param ls List. (Nullable)
+     * @return Filtered list. (Nullable)
+     */
+    protected java.util.List${database.filterGenericsString('String')} filterRemoveEmptyStringFromList(java.util.List${database.filterGenericsString('String')} ls) {
+        if (ls == null) {
+            return null;
+        }
+        java.util.List${database.filterGenericsString('String')} newList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        for (final java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+            final String str = (String)ite.next();
+            if ("".equals(str)) {
+                continue;
+            }
+            newList.add(str);
+        }
+        return newList;
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the object is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertObjectNotNull(String variableName, Object value) {
+        if (variableName == null) {
+            String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "The value should not be null: variableName=" + variableName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert that the column-name is not null and is not emtpy and does not contain comma.
+     * 
+     * @param columnName Column-name. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertColumnName(String columnName) {
+        if (columnName == null) {
+            String msg = "The columnName should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (columnName.trim().length() == 0) {
+            String msg = "The columnName should not be empty-string.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (columnName.indexOf(",") >= 0) {
+            String msg = "The columnName should not contain comma ',': " + columnName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert that the alias-name is not null and is not emtpy and does not contain comma.
+     * 
+     * @param aliasName Alias-name. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertAliasName(String aliasName) {
+        if (aliasName == null) {
+            String msg = "The aliasName should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (aliasName.trim().length() == 0) {
+            String msg = "The aliasName should not be empty-string.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (aliasName.indexOf(",") >= 0) {
+            String msg = "The aliasName should not contain comma ',': " + aliasName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the entity is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        assertObjectNotNull("variableName", variableName);
+        assertObjectNotNull("value", value);
+        if (value.trim().length() ==0) {
+            String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,165 @@
+package ${glPackageBaseCommonCBean};
+
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+
+/**
+ * The interface of condition-bean.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glConditionBeanInterfaceName} extends ${glPagingBeanInterfaceName} {
+
+    // =====================================================================================
+    //                                                                            Definition
+    //                                                                            ==========
+    /** Map-string map-mark. */
+    public static final String MAP_STRING_MAP_MARK = "map:";
+
+    /** Map-string list-mark. */
+    public static final String MAP_STRING_LIST_MARK = "list:";
+
+    /** Map-string start-brace. */
+    public static final String MAP_STRING_START_BRACE = "${database.extractAcceptStartBrace}";
+
+    /** Map-string end-brace. */
+    public static final String MAP_STRING_END_BRACE = "${database.extractAcceptEndBrace}";
+
+    /** Map-string delimiter. */
+    public static final String MAP_STRING_DELIMITER = "${database.extractAcceptDelimiter}";
+
+    /** Map-string equal. */
+    public static final String MAP_STRING_EQUAL = "${database.extractAcceptEqual}";
+
+    // =====================================================================================
+    //                                                                            Table Name
+    //                                                                            ==========
+    /**
+     * Get table db-name.
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName();
+
+    // =====================================================================================
+    //                                                                            Sql-Clause
+    //                                                                            ==========
+    /**
+     * Get sql-clause instance.
+     * 
+     * @return Sql-clause. (NotNull)
+     */
+    public ${glSqlClauseName} getSqlClause();
+
+    // =====================================================================================
+    //                                                                           Primary-Key
+    //                                                                           ===========
+    /**
+     * Accept primary-key map-string.
+     * 
+     * @param primaryKeyMap Primary-key map. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMap(java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap);
+
+    /**
+     * Accept primary-key map-string. Delimiter is at-mark and semicolon.
+     * 
+     * @param primaryKeyMapString Primary-key map. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMapString(String primaryKeyMapString);
+
+    // =====================================================================================
+    //                                                                              Order-By
+    //                                                                              ========
+    /**
+     * Add order-by PrimaryKey asc. {order by primaryKey1 asc, primaryKey2 asc...}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} addOrderBy_PK_Asc();
+
+    /**
+     * Add order-by PrimaryKey desc. {order by primaryKey1 desc, primaryKey2 desc...}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} addOrderBy_PK_Desc();
+
+    // =====================================================================================
+    //                                                                                 Query
+    //                                                                                 =====
+    /**
+     * Get condition-query as interface.
+     * 
+     * @return Instance of query as interface. (NotNull)
+     */
+    public ${glConditionQueryInterfaceName} getConditionQueryAsInterface();
+
+    // =====================================================================================
+    //                                                                           Union-Query
+    //                                                                           ===========
+    public boolean hasUnionQueryOrUnionAllQuery();
+
+    // =====================================================================================
+    //                                                                          Limit-Select
+    //                                                                          ============
+    /**
+     * Limit select PK only.
+     *
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} limitSelect_PKOnly();
+
+    /**
+     * Limit select off.
+     *
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} limitSelect_Off();
+
+    /**
+     * Is limit-select PK only?
+     * 
+     * @return Determination.
+     */
+    public boolean isLimitSelect_PKOnly();
+
+    // =====================================================================================
+    //                                                                               Advance
+    //                                                                               =======
+    /**
+     * Lock for update.
+     * 
+     * If you invoke this, your SQL lock target records for update.
+     * It depends whether this method supports this on the database type.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} lockForUpdate();
+
+    // ------------------------------
+    //                   for Internal
+    //                   ------------
+    /**
+     * Set up various things for select-count-ignore-fetch-scope. {Internal}
+     * This method is for INTERNAL. Don't invoke this!
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} xsetupSelectCountIgnoreFetchScope();
+
+    /**
+     * Do after-care for select-count-ignore-fetch-scope. {Internal}
+     * This method is for INTERNAL. Don't invoke this!
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} xafterCareSelectCountIgnoreFetchScope();
+
+    /**
+     * Is set up various things for select-count-ignore-fetch-scope? {Internal}
+     * This method is for INTERNAL. Don't invoke this!
+     * 
+     * @return Determination.
+     */
+    public boolean isSelectCountIgnoreFetchScope();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBeanContext.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBeanContext.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionBeanContext.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,196 @@
+package ${glPackageBaseCommonCBean};
+
+import ${glPackageBaseCommonSqlClause}.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Condition-Bean context. (referring to s2pager)
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glConditionBeanContextName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glConditionBeanContextName}.class);
+
+    // =====================================================================================
+    //                                                                          Thread Local
+    //                                                                          ============
+    /** The thread-local for this. */
+    private static final ThreadLocal${database.filterGenericsString(${glConditionBeanInterfaceName})} _threadLocal = new ThreadLocal${database.filterGenericsString(${glConditionBeanInterfaceName})}();
+
+    /**
+     * Get condition-bean on thread.
+     * 
+     * @return Condition-bean context. (Nullable)
+     */
+    public static ${glConditionBeanInterfaceName} getConditionBeanOnThread() {
+        return (${glConditionBeanInterfaceName})_threadLocal.get();
+    }
+
+    /**
+     * Set condition-bean on thread.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     */
+    public static void setConditionBeanOnThread(${glConditionBeanInterfaceName} cb) {
+        if (cb == null) {
+            String msg = "The argument[cb] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        _threadLocal.set(cb);
+    }
+
+    /**
+     * Is existing condition-bean on thread?
+     * 
+     * @return Determination.
+     */
+    public static boolean isExistConditionBeanOnThread() {
+        return (_threadLocal.get() != null);
+    }
+
+    /**
+     * Clear condition-bean on thread.
+     */
+    public static void clearConditionBeanOnThread() {
+        _threadLocal.set(null);
+    }
+
+    // =====================================================================================
+    //                                                       Initialize against LinkageError
+    //                                                       ===============================
+    public static void initialize() {
+        // Stop the LinkageError!
+        {
+            final Class clazz = ${glPackageBaseCommonCBean}.${glSimplePagingBeanName}.class;
+            _log.debug("Loading class of " + clazz.getName() + ": " + clazz.getClassLoader());
+        }
+        {
+            final Class clazz = ${glPackageBaseCommonCOption}.${glConditionOptionFromToName}.class;
+            _log.debug("Loading class of " + clazz.getName() + ": " + clazz.getClassLoader());
+        }
+        {
+            final Class clazz = ${glPackageBaseCommonCOption}.${glConditionOptionLikeSearchName}.class;
+            _log.debug("Loading class of " + clazz.getName() + ": " + clazz.getClassLoader());
+        }
+        {
+            final Class clazz = ${glPackageBaseCommonCOption}.${glConditionOptionInScopeName}.class;
+            _log.debug("Loading class of " + clazz.getName() + ": " + clazz.getClassLoader());
+        }
+    }
+
+    // =====================================================================================
+    //                                                                        Type Judgement
+    //                                                                        ==============
+    /**
+     * Is the argument condition-bean?
+     * 
+     * @param dtoInstance Dto instance.
+     * @return Determination.
+     */
+    public static boolean isTheArgumentConditionBean(final Object dtoInstance) {
+        if (dtoInstance instanceof ${glConditionBeanInterfaceName}) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Is the type condition-bean?
+     * 
+     * @param dtoClass DtoClass.
+     * @return Determination.
+     */
+    public static boolean isTheTypeConditionBean(final Class dtoClass) {
+        if (${glConditionBeanInterfaceName}.class.isAssignableFrom(dtoClass)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    // =====================================================================================
+    //                                                                          Product Name
+    //                                                                          ============
+    /** The database product name. */
+    private static String _databaseProductName;
+
+    /**
+     * Get database product name.
+     * 
+     * @return Database product name.
+     */
+    public static String getDatabaseProductName() {
+        return _databaseProductName;
+    }
+
+    /**
+     * Set database product name.
+     * 
+     * @param name Database product name. (NotNull)
+     */
+    public static void setDatabaseProductName(String name) {
+        if (_databaseProductName != null) {
+            String msg = "Already set up: current=" + _databaseProductName + " your=" + name;
+            throw new IllegalStateException(msg);
+        }
+        _databaseProductName = name;
+    }
+#set ($columnAliasGeneric = "Class, java.util.Map<String, String>")
+
+    // =====================================================================================
+    //                                                                          Column Alias
+    //                                                                          ============
+    public static final java.util.Map${database.filterGenericsString('Class, java.util.Map<String, String>')} _selectClauseColumnAliasContainerMap = new java.util.HashMap${database.filterGenericsString('Class, java.util.Map<String, String>')}();
+
+    public static void addColumnAliasInfo(Class conditionBeanClass, String columnFullName, String columnAliasName) {
+        if (_selectClauseColumnAliasContainerMap.containsKey(conditionBeanClass)) {
+            final java.util.Map${database.filterGenericsString('String, String')} selectClauseColumnAliasMap = (java.util.Map${database.filterGenericsString('String, String')})_selectClauseColumnAliasContainerMap.get(conditionBeanClass);
+            selectClauseColumnAliasMap.put(columnFullName, columnAliasName);
+        } else {
+            final java.util.Map${database.filterGenericsString('String, String')} selectClauseColumnAliasMap = new java.util.HashMap${database.filterGenericsString('String, String')}();
+            _selectClauseColumnAliasContainerMap.put(conditionBeanClass, selectClauseColumnAliasMap);
+            selectClauseColumnAliasMap.put(columnFullName, columnAliasName);
+        }
+    }
+
+    public static java.util.Map${database.filterGenericsString('String, String')} getSelectClauseColumnAliasMap(Class conditionBeanClass) {
+        return (java.util.Map${database.filterGenericsString('String, String')})_selectClauseColumnAliasContainerMap.get(conditionBeanClass);
+    }
+
+    // =====================================================================================
+    //                                                                               Creator
+    //                                                                               =======
+    public static ${glSqlClauseName} createSqlClause(${glConditionBeanInterfaceName} cb) {
+        final String tableDbName = cb.getTableDbName();
+        return createSqlClause(tableDbName);
+    }
+
+    public static ${glSqlClauseName} createSqlClause(String tableDbName) {
+        final String databaseProductName = getDatabaseProductName();
+        if (databaseProductName == null) {
+            return new ${glSqlClauseName}${database.DaoGenDbName}(tableDbName);
+        }
+        final String name = databaseProductName.toLowerCase();
+        if (name.startsWith("derby")) {
+            return new ${glSqlClauseName}Derby(tableDbName);
+        } else if (name.startsWith("oracle")) {
+            return new ${glSqlClauseName}Oracle(tableDbName);
+        } else if (name.startsWith("firebird")) {
+            return new ${glSqlClauseName}Firebird(tableDbName);
+        } else if (name.startsWith("mysql")) {
+            return new ${glSqlClauseName}MySql(tableDbName);
+        } else if (name.startsWith("postgre")) {
+            return new ${glSqlClauseName}PostgreSql(tableDbName);
+        } else if (name.startsWith("mssql")) {
+            return new ${glSqlClauseName}SqlServer(tableDbName);
+        } else if (name.startsWith("db2")) {
+            return new ${glSqlClauseName}Db2(tableDbName);
+        } else {
+            return new ${glSqlClauseName}${database.DaoGenDbName}(tableDbName);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionQuery.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionQuery.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ConditionQuery.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,105 @@
+package ${glPackageBaseCommonCBean};
+
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+
+/**
+ * The condition-query as interface.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glConditionQueryInterfaceName} {
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    /**
+     * Get table db-name.
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName();
+
+    /**
+     * Get real alias name(that has nest level mark).
+     * 
+     * @return Real alias name.
+     */
+    public String getRealAliasName();
+
+    /**
+     * Get real column name(with real alias name).
+     * 
+     * @param columnName Column name without alias name.
+     * @return Real column name.
+     */
+    public String getRealColumnName(String columnName);
+
+    /**
+     * Get child query.
+     * 
+     * @return Child query. (Nullable)
+     */
+    public ${glConditionQueryInterfaceName} getChildQuery();
+
+    /**
+     * Get sql clause.
+     * 
+     * @return Sql clause. (NotNull)
+     */
+    public ${glSqlClauseName} getSqlClause();
+
+    /**
+     * Get alias name.
+     * 
+     * @return Alias name. (NotNull)
+     */
+    public String getAliasName();
+
+    /**
+     * Get nest level.
+     * 
+     * @return Nest level.
+     */
+    public int getNestLevel();
+
+    /**
+     * Get next nest level.
+     * 
+     * @return Next nest level.
+     */
+    public int getNextNestLevel();
+
+    /**
+     * Is base query?
+     * 
+     * @param query Condition query. (NotNull)
+     * @return Determination.
+     */
+    public boolean isBaseQuery(${glConditionQueryInterfaceName} query);
+
+    // =====================================================================================
+    //                                                                                Invoke
+    //                                                                                ======
+    public ${glConditionValueName} invokeGetter(String columnMultiName);
+
+    public void invokeSetterEqual(String columnMultiName, Object value);
+    public void invokeSetterNotEqual(String columnMultiName, Object value);
+    public void invokeSetterGreaterThan(String columnMultiName, Object value);
+    public void invokeSetterLessThan(String columnMultiName, Object value);
+    public void invokeSetterGreaterEqual(String columnMultiName, Object value);
+    public void invokeSetterLessEqual(String columnMultiName, Object value);
+
+    public void invokeAddOrderByAsc(String columnMultiName);
+    public void invokeAddOrderByDesc(String columnMultiName);
+
+    // =====================================================================================
+    //                                                                         Foregin-Query
+    //                                                                         =============
+    /// <summary>
+    /// Get foreign condition-query.
+    /// </summary>
+    /// <param name="foreignPropertyName">Foreign-property-name(Both OK - InitCap or not). (NotNull)</param>
+    /// <returns>Foreign condition-query as interface.</returns>
+    public ${glConditionQueryInterfaceName} getForeignConditionQuery(String foreignPropertyName);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,44 @@
+package ${glPackageBaseCommonCBean};
+
+/**
+ * The condition-bean as interface.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glFetchNarrowingBeanInterfaceName} {
+
+    /**
+     * Get fetch start index.
+     * 
+     * @return Fetch start index.
+     */
+    public int getFetchNarrowingSkipStartIndex();
+
+    /**
+     * Get fetch size.
+     * 
+     * @return Fetch size.
+     */
+    public int getFetchNarrowingLoopCount();
+
+    /**
+     * Is fetch start index supported?
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchNarrowingSkipStartIndexEffective();
+
+    /**
+     * Is fetch size supported?
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchNarrowingLoopCountEffective();
+
+    /**
+     * Is fetch-narrowing effective?
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchNarrowingEffective();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBeanContext.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBeanContext.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/FetchNarrowingBeanContext.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,78 @@
+package ${glPackageBaseCommonCBean};
+
+/**
+ * Fetch-Narrowing-Bean context. (referring to s2pager)
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFetchNarrowingBeanContextName} {
+
+    /** The thread-local for this. */
+    private static ThreadLocal${database.filterGenericsString(${glFetchNarrowingBeanInterfaceName})} _threadLocal = new ThreadLocal${database.filterGenericsString(${glFetchNarrowingBeanInterfaceName})}();
+
+    /**
+     * Get fetch-narrowing-bean on thread.
+     * 
+     * @return Condition-bean context. (Nullable)
+     */
+    public static ${glFetchNarrowingBeanInterfaceName} getFetchNarrowingBeanOnThread() {
+        return (${glFetchNarrowingBeanInterfaceName})_threadLocal.get();
+    }
+
+    /**
+     * Set fetch-narrowing-bean on thread.
+     * 
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (NotNull)
+     */
+    public static void setFetchNarrowingBeanOnThread(${glFetchNarrowingBeanInterfaceName} ${glAttachedCBArgsVariableName}) {
+        if (${glAttachedCBArgsVariableName} == null) {
+            String msg = "The argument[${glAttachedCBArgsVariableName}] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        _threadLocal.set(${glAttachedCBArgsVariableName});
+    }
+
+    /**
+     * Is existing fetch-narrowing-bean on thread?
+     * 
+     * @return Determination.
+     */
+    public static boolean isExistFetchNarrowingBeanOnThread() {
+        return (_threadLocal.get() != null);
+    }
+
+    /**
+     * Clear fetch-narrowing-bean on thread.
+     */
+    public static void clearFetchNarrowingBeanOnThread() {
+        _threadLocal.set(null);
+    }
+
+    /**
+     * Is the argument fetch-narrowing-bean?
+     * 
+     * @param dtoInstance Dto instance.
+     * @return Determination.
+     */
+    public static boolean isTheArgumentFetchNarrowingBean(final Object dtoInstance) {
+        if (dtoInstance instanceof ${glFetchNarrowingBeanInterfaceName}) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Is the type fetch-narrowing-bean?
+     * 
+     * @param dtoClass DtoClass.
+     * @return Determination.
+     */
+    public static boolean isTheTypeFetchNarrowingBean(final Class dtoClass) {
+        if (${glFetchNarrowingBeanInterfaceName}.class.isAssignableFrom(dtoClass)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ListResultBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ListResultBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ListResultBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,422 @@
+package ${glPackageBaseCommonCBean};
+
+#set ($myClassName = "${glListResultBeanName}")
+#set ($selectedListArgumentGenericDefinition = "${glEntityInterfaceName}")
+#if ($database.isAvailableGenerics())
+import ${glPackageBaseCommonCBeanMapping}.${glEntityDtoMapperName};
+import ${glPackageBaseCommonCBeanGrouping}.${glGroupingOptionName};
+import ${glPackageBaseCommonCBeanGrouping}.${glGroupingRowEndDeterminerName};
+import ${glPackageBaseCommonCBeanGrouping}.${glGroupingRowResourceName};
+import ${glPackageBaseCommonCBeanGrouping}.${glGroupingRowSetupperName};
+#end
+import ${glPackageBaseCommonSqlClause}.${glOrderByClauseName};
+
+/**
+ * The list-result-bean for ${myClassName}.
+ * 
+ * @param ${database.filterGenericsString('ENTITY')} The generic template for 'selectedList'.
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName}${database.filterGenericsString('ENTITY')} implements java.util.List${database.filterGenericsString('ENTITY')}, java.io.Serializable {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** The value of table db-name. */
+    protected String _tableDbName;
+
+    /** The value of all record count. */
+    protected int _allRecordCount;
+
+    /** Selected list. */
+    protected java.util.List${database.filterGenericsString('ENTITY')} _selectedList = new java.util.ArrayList${database.filterGenericsString('ENTITY')}();
+
+    /** Order-by clause. */
+    protected ${glOrderByClauseName} _orderByClause = new ${glOrderByClauseName}();
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // =====================================================================================
+    //                                                                         Getter Setter
+    //                                                                         =============
+    /**
+     * Get the value of tableDbName.
+     * 
+     * @return The value of tableDbName.
+     */
+    public String getTableDbName() {
+        return _tableDbName;
+    }
+
+    /**
+     * Set the value of tableDbName.
+     * 
+     * @param tableDbName The value of tableDbName.
+     */
+    public void setTableDbName(String tableDbName) {
+        _tableDbName = tableDbName;
+    }
+
+    /**
+     * Get the value of allRecordCount.
+     * 
+     * @return The value of allRecordCount.
+     */
+    public int getAllRecordCount() {
+        return _allRecordCount;
+    }
+
+    /**
+     * Set the value of allRecordCount.
+     * 
+     * @param allRecordCount The value of allRecordCount.
+     */
+    public void setAllRecordCount(int allRecordCount) {
+        _allRecordCount = allRecordCount;
+    }
+
+    /**
+     * Get the value of selectedList.
+     * 
+     * @return Selected list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString('ENTITY')} getSelectedList() {
+        return _selectedList;
+    }
+
+    /**
+     * Set the value of selectedList.
+     * 
+     * @param selectedList Selected list. (NotNull)
+     */
+    public void setSelectedList(java.util.List${database.filterGenericsString('ENTITY')} selectedList) {
+        _selectedList = selectedList;
+    }
+
+    /**
+     * Get the value of orderByClause.
+     * 
+     * @return The value of orderByClause. (NotNull)
+     */
+    public ${glOrderByClauseName} getOrderByClause() {
+        return _orderByClause;
+    }
+
+    /**
+     * Set the value of orderByClause.
+     * 
+     * @param orderByClause The value of orderByClause. (NotNull)
+     */
+    public void setOrderByClause(${glOrderByClauseName} orderByClause) {
+        _orderByClause = orderByClause;
+    }
+
+#if ($database.isAvailableGenerics())
+    // =====================================================================================
+    //                                                                              Grouping
+    //                                                                              ========
+    public <ROW> java.util.List<ROW> groupingList(${glGroupingRowSetupperName}<ROW, ENTITY> groupingRowSetupper, ${glGroupingOptionName}<ENTITY> groupingOption) {
+        final java.util.List<ROW> groupingList = new java.util.ArrayList<ROW>();
+        ${glGroupingRowEndDeterminerName}<ENTITY> rowEndDeterminer = groupingOption.getGroupingRowEndDeterminer();
+        if (rowEndDeterminer == null) {
+            rowEndDeterminer = new ${glGroupingRowEndDeterminerName}<ENTITY>() {
+                public boolean determine(int columnIndex, int columnCount, ${glGroupingRowResourceName}<ENTITY> rowResource, ENTITY nextEntity) {
+                    return columnIndex == (columnCount-1);
+                }
+            };// as Default
+        }
+        ${glGroupingRowResourceName}<ENTITY> rowResource = new ${glGroupingRowResourceName}<ENTITY>();
+        int columnCount = groupingOption.getColumnCount();
+        int columnIndex = 0;
+        int rowIndex = 0;
+        for (ENTITY entity : _selectedList) {
+            // Set up row resource.
+            rowResource.addGroupingRowList(entity);
+
+            if (_selectedList.size() == (rowIndex + 1)) {// Last Loop!
+                // Callback!
+                final ROW groupingRowObject = groupingRowSetupper.setup(rowResource);
+
+                // Register!
+                groupingList.add(groupingRowObject);
+                break;
+            }
+
+            ENTITY nextElement = null;
+            if (_selectedList.size() > (rowIndex + 1)) {;
+                nextElement = _selectedList.get(rowIndex);
+            }
+
+            // Do at row end.
+            if (rowEndDeterminer.determine(columnIndex, columnCount, rowResource, nextElement)) {
+                // Callback!
+                final ROW groupingRowObject = groupingRowSetupper.setup(rowResource);
+
+                // Register!
+                groupingList.add(groupingRowObject);
+
+                // Initialize!
+                rowResource = new ${glGroupingRowResourceName}<ENTITY>();
+                columnIndex = 0;
+                ++rowIndex;
+                continue;
+            }
+            ++columnIndex;
+            ++rowIndex;
+        }
+        return groupingList;
+    }
+
+    // =====================================================================================
+    //                                                                               Mapping
+    //                                                                               =======
+    public <DTO> ${myClassName}<DTO> mappingList(${glEntityDtoMapperName}<ENTITY, DTO> entityDtoMapper) {
+        final ${myClassName}<DTO> mappingList = new ${myClassName}<DTO>();
+        for (ENTITY entity : _selectedList) {
+            mappingList.add(entityDtoMapper.map(entity));
+        }
+        mappingList.setTableDbName(getTableDbName());
+        mappingList.setAllRecordCount(getAllRecordCount());
+        mappingList.setOrderByClause(getOrderByClause());
+        return mappingList;
+    }
+#end
+
+    // =====================================================================================
+    //                                                                         Determination
+    //                                                                         =============
+    /**
+     * Has this result selected?
+     * <pre>
+     * If isSetterInvokedSelectedList is true, returns true.
+     * </pre>
+     * 
+     * @return Determination.
+     */
+    public boolean isSelectedResult() {
+        return _tableDbName != null;
+    }
+
+    // =====================================================================================
+    //                                                                        Basic Override
+    //                                                                        ==============
+    /**
+     * This method overrides the method that is declared at super.
+     * 
+     * @return View-string of all-columns value.
+     */
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+
+        sb.append(" tableDbName=").append(_tableDbName);
+        sb.append(" allRecordCount=").append(_tableDbName);
+        sb.append(" selectedList.size()=").append(_selectedList.size());
+        sb.append(" orderByClause=").append(_orderByClause);
+
+        return sb.toString();
+    }
+#if ($database.isAvailableGenerics())
+
+    // =====================================================================================
+    //                                                                         List Elements
+    //                                                                         =============
+    public boolean add(ENTITY o) {
+        return _selectedList.add(o);
+    }
+
+    public boolean addAll(java.util.Collection${database.filterGenericsString('? extends ENTITY')} c) {
+        return _selectedList.addAll(c);
+    }
+
+    public void clear() {
+        _selectedList.clear();
+    }
+
+    public boolean contains(Object o) {
+        return _selectedList.contains(o);
+    }
+
+    public boolean containsAll(java.util.Collection<?> c) {
+        return _selectedList.containsAll(c);
+    }
+
+    public boolean isEmpty() {
+        return _selectedList.isEmpty();
+    }
+
+    public java.util.Iterator${database.filterGenericsString('ENTITY')} iterator() {
+        return _selectedList.iterator();
+    }
+
+    public boolean remove(Object o) {
+        return _selectedList.remove(o);
+    }
+
+    public boolean removeAll(java.util.Collection${database.filterGenericsString('?')} c) {
+        return _selectedList.removeAll(c);
+    }
+
+    public boolean retainAll(java.util.Collection${database.filterGenericsString('?')} c) {
+        return _selectedList.retainAll(c);
+    }
+
+    public int size() {
+        return _selectedList.size();
+    }
+
+    public Object[] toArray() {
+        return _selectedList.toArray();
+    }
+
+    public ${database.filterGenericsString('TYPE')} TYPE[] toArray(TYPE[] a) {
+        return _selectedList.toArray(a);
+    }
+
+    public void add(int index, ENTITY element) {
+        _selectedList.add(index, element);
+    }
+
+    public boolean addAll(int index, java.util.Collection${database.filterGenericsString('? extends ENTITY')} c) {
+        return _selectedList.addAll(index, c);
+    }
+
+    public ENTITY get(int index) {
+        return _selectedList.get(index);
+    }
+
+    public int indexOf(Object o) {
+        return _selectedList.indexOf(o);
+    }
+
+    public int lastIndexOf(Object o) {
+        return _selectedList.lastIndexOf(o);
+    }
+
+    public java.util.ListIterator${database.filterGenericsString('ENTITY')} listIterator() {
+        return _selectedList.listIterator();
+    }
+
+    public java.util.ListIterator${database.filterGenericsString('ENTITY')} listIterator(int index) {
+        return _selectedList.listIterator(index);
+    }
+
+    public ENTITY remove(int index) {
+        return _selectedList.remove(index);
+    }
+
+    public ENTITY set(int index, ENTITY element) {
+        return _selectedList.set(index, element);
+    }
+
+    public java.util.List${database.filterGenericsString('ENTITY')} subList(int fromIndex, int toIndex) {
+        return _selectedList.subList(fromIndex, toIndex);
+    }
+#else
+
+    // =====================================================================================
+    //                                                                         List Elements
+    //                                                                         =============
+    public boolean add(Object arg0) {
+        return _selectedList.add(arg0);
+    }
+
+    public void add(int arg0, Object arg1) {
+        _selectedList.add(arg0, arg1);
+    }
+
+    public boolean addAll(java.util.Collection arg0) {
+        return _selectedList.addAll(arg0);
+    }
+
+    public boolean addAll(int arg0, java.util.Collection arg1) {
+        return _selectedList.addAll(arg0, arg1);
+    }
+
+    public void clear() {
+        _selectedList.clear();
+    }
+
+    public boolean contains(Object o) {
+        return _selectedList.contains(o);
+    }
+
+    public boolean containsAll(java.util.Collection arg0) {
+        return _selectedList.containsAll(arg0);
+    }
+
+    public Object get(int index) {
+        return _selectedList.get(index);
+    }
+
+    public int indexOf(Object o) {
+        return _selectedList.indexOf(o);
+    }
+
+    public boolean isEmpty() {
+        return _selectedList.isEmpty();
+    }
+
+    public java.util.Iterator iterator() {
+        return _selectedList.iterator();
+    }
+
+    public int lastIndexOf(Object o) {
+        return _selectedList.lastIndexOf(o);
+    }
+
+    public java.util.ListIterator listIterator() {
+        return _selectedList.listIterator();
+    }
+
+    public java.util.ListIterator listIterator(int index) {
+        return _selectedList.listIterator();
+    }
+
+    public boolean remove(Object o) {
+        return _selectedList.remove(o);
+    }
+
+    public Object remove(int index) {
+        return _selectedList.remove(index);
+    }
+
+    public boolean removeAll(java.util.Collection arg0) {
+        return _selectedList.removeAll(arg0);
+    }
+
+    public boolean retainAll(java.util.Collection arg0) {
+        return _selectedList.retainAll(arg0);
+    }
+
+    public Object set(int arg0, Object arg1) {
+        return _selectedList.set(arg0, arg1);
+    }
+
+    public int size() {
+        return _selectedList.size();
+    }
+
+    public java.util.List subList(int fromIndex, int toIndex) {
+        return _selectedList.subList(fromIndex, toIndex);
+    }
+
+    public Object[] toArray() {
+        return _selectedList.toArray();
+    }
+
+    public Object[] toArray(Object[] arg0) {
+        return _selectedList.toArray(arg0);
+    }
+#end
+
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/OrderByBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/OrderByBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/OrderByBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,78 @@
+package ${glPackageBaseCommonCBean};
+
+import ${glPackageBaseCommonSqlClause}.${glOrderByClauseName};
+
+/**
+ * The order-by-bean as interface.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glOrderByBeanInterfaceName} extends ${glSelectResourceInterfaceName} {
+
+    /**
+     * Get sql component of order-by clause.
+     * 
+     * @return Sql component of order-by clause. (NotNull)
+     */
+    public ${glOrderByClauseName} getSqlComponentOfOrderByClause();
+
+    /**
+     * Get order-by clause.
+     * 
+     * @return Order-by clause. (NotNull)
+     */
+    public String getOrderByClause();
+
+    /**
+     * Clear order-by.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} clearOrderBy();
+
+    /**
+     * Ignore order-by.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} ignoreOrderBy();
+
+    /**
+     * Make order-by effective.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} makeOrderByEffective();
+
+    /**
+     * Register order-by-asc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} registerOrderByAsc(String orderByProperty);
+
+    /**
+     * Register order-by-desc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} registerOrderByDesc(String orderByProperty);
+
+    /**
+     * Reverse order-by or Override order-by asc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} reverseOrderBy_Or_OverrideOrderByAsc(String orderByProperty);
+
+    /**
+     * Reverse order-by or Override order-by desc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} reverseOrderBy_Or_OverrideOrderByDesc(String orderByProperty);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,108 @@
+package ${glPackageBaseCommonCBean};
+
+/**
+ * The interface of paging-bean.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glPagingBeanInterfaceName} extends ${glFetchNarrowingBeanInterfaceName}, ${glOrderByBeanInterfaceName} {
+
+    /**
+     * Fetch first.
+     * 
+     * If you invoke this, your SQL returns [fetch-size] records from first.
+     * 
+     * @param fetchSize Fetch-size. (NotMinus & NotZero)
+     * @return this. (NotNUll)
+     */
+    public ${glPagingBeanInterfaceName} fetchFirst(int fetchSize);
+
+    /**
+     * Fetch scope.
+     * 
+     * If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index].
+     * 
+     * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+     * @param fetchSize Fetch-size. (NotMinus & NotZero)
+     * @return this. (NotNUll)
+     */
+    public ${glPagingBeanInterfaceName} fetchScope(int fetchStartIndex, int fetchSize);
+
+    /**
+     * Fetch page.
+     * 
+     * When you invoke this, it is normally necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that.
+     * But you also can use default-fetch-size without invoking 'fetchFirst()' or 'fetchScope()'.
+     * If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index] calculated by [fetch-page-number].
+     * 
+     * @param fetchPageNumber Fetch-page-number. 1 origin. (NotMinus & NotZero)
+     * @return this. (NotNull)
+     */
+    public ${glPagingBeanInterfaceName} fetchPage(int fetchPageNumber);
+
+    /**
+     * Get fetch-start-index.
+     * 
+     * @return Fetch-start-index.
+     */
+    public int getFetchStartIndex();
+
+    /**
+     * Get fetch-size.
+     * 
+     * @return Fetch-size.
+     */
+    public int getFetchSize();
+
+    /**
+     * Get fetch-page-number.
+     * 
+     * @return Fetch-page-number.
+     */
+    public int getFetchPageNumber();
+
+    /**
+     * Get page start index.
+     * 
+     * @return Page start index. 0 origin. (NotMinus)
+     */
+    public int getPageStartIndex();
+
+    /**
+     * Get page end index.
+     * 
+     * @return Page end index. 0 origin. (NotMinus)
+     */
+    public int getPageEndIndex();
+
+    /**
+     * Is fetch scope effective?
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchScopeEffective();
+
+    // =====================================================================================
+    //                                                                        For SqlComment
+    //                                                                        ==============
+    /**
+     * Get select-hint. {select [select-hint] * from table...}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    public String getSelectHint();
+
+    /**
+     * Get from-hint. {select * from table [from-hint] where ...}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    public String getFromHint();
+
+    /**
+     * Get sql-suffix. {select * from table where ... order by ... [sql-suffix]}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    public String getSqlSuffix();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingResultBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingResultBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/PagingResultBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,526 @@
+package ${glPackageBaseCommonCBean};
+
+#set ($myClassName = "${glPagingResultBeanName}")
+#if ($database.isAvailableGenerics())
+import ${glPackageBaseCommonCBeanMapping}.${glEntityDtoMapperName};
+#end
+/**
+ * The paging-result-bean for ${myClassName}.
+ * 
+ * @param ${database.filterGenericsString('ENTITY')} The generic template for 'selectedList'.
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName}${database.filterGenericsString('ENTITY')} extends ${glListResultBeanName}${database.filterGenericsString('ENTITY')} {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** The value of current page number. */
+    protected int _pageSize;
+
+    /** The value of current page number. */
+    protected int _currentPageNumber;
+
+    // -----------------------------------------
+    //                                Page Range
+    //                                ----------
+    /** The value of page-range option. */
+    protected PageRangeOption _pageRangeOption;
+
+    // -----------------------------------------
+    //                                Page Group
+    //                                ----------
+    /** The value of page-group option. */
+    protected PageGroupOption _pageGroupOption;
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    /**
+     * Get the value of pageSize.
+     * 
+     * @return The value of pageSize.
+     */
+    public int getPageSize() {
+        return _pageSize;
+    }
+
+    /**
+     * Set the value of pageSize.
+     * 
+     * @param pageSize The value of pageSize.
+     */
+    public void setPageSize(int pageSize) {
+        _pageSize = pageSize;
+    }
+
+    /**
+     * Get the value of currentPageNumber.
+     * 
+     * @return The value of currentPageNumber.
+     */
+    public int getCurrentPageNumber() {
+        return _currentPageNumber;
+    }
+
+    /**
+     * Set the value of currentPageNumber.
+     * 
+     * @param currentPageNumber The value of currentPageNumber.
+     */
+    public void setCurrentPageNumber(int currentPageNumber) {
+        _currentPageNumber = currentPageNumber;
+    }
+
+    /**
+     * Get the value of allPageCount.
+     * 
+     * @return The value of allPageCount.
+     */
+    public int getAllPageCount() {
+        return calculateAllPageCount(_allRecordCount, _pageSize);
+    }
+
+    /**
+     * Get the value of currentStartRecordNumber.
+     * 
+     * @return The value of currentStartRecordNumber.
+     */
+    public int getCurrentStartRecordNumber() {
+        return calculateCurrentStartRecordNumber(_currentPageNumber, _pageSize);
+    }
+
+    /**
+     * Get the value of currentEndRecordNumber.
+     * 
+     * @return The value of currentEndRecordNumber.
+     */
+    public int getCurrentEndRecordNumber() {
+        return calculateCurrentEndRecordNumber(_currentPageNumber, _pageSize);
+    }
+
+    // -----------------------------------------
+    //                                Page Range
+    //                                ----------
+    /**
+     * Get the value of pageRangeSize.
+     * 
+     * @return The value of pageRangeSize.
+     */
+    public int getPageRangeSize() {
+        return _pageRangeOption != null ? _pageRangeOption.getPageRangeSize() : 0;
+    }
+
+    /**
+     * Set the value of pageRangeSize.
+     * 
+     * @param pageRangeSize The value of pageRangeSize.
+     */
+    public void setPageRangeSize(int pageRangeSize) {
+        final PageRangeOption option = new PageRangeOption();
+        option.setPageRangeSize(pageRangeSize);
+        setPageRangeOption(option);
+    }
+
+    /**
+     * Set the value of pageRangeOption.
+     * 
+     * @param pageRangeOption The value of pageRangeOption.
+     */
+    public void setPageRangeOption(PageRangeOption pageRangeOption) {
+        _pageRangeOption = pageRangeOption;
+    }
+
+    public static class PageRangeOption {
+        protected int _pageRangeSize;
+
+        protected boolean _fillLimit;
+        
+        public int getPageRangeSize() {
+            return _pageRangeSize;
+        }
+
+        public void setPageRangeSize(int pageRangeSize) {
+            _pageRangeSize = pageRangeSize;
+        }
+
+        public boolean isFillLimit() {
+            return _fillLimit;
+        }
+
+        public void setFillLimit(boolean fillLimit) {
+            _fillLimit = fillLimit;
+        }
+    }
+
+    // -----------------------------------------
+    //                                Page Group
+    //                                ----------
+    /**
+     * Get the value of pageGroupSize.
+     * 
+     * @return The value of pageGroupSize.
+     */
+    public int getPageGroupSize() {
+        return _pageGroupOption != null ? _pageGroupOption.getPageGroupSize() : 0;
+    }
+
+    /**
+     * Set the value of pageGroupSize.
+     * 
+     * @param value The value of pageGroupSize.
+     */
+    public void setPageGroupSize(int pageGroupSize) {
+        final PageGroupOption option = new PageGroupOption();
+        option.setPageGroupSize(pageGroupSize);
+        setPageGroupOption(option);
+    }
+
+    /**
+     * Set the value of pageGroupOption.
+     * 
+     * @param pageGroupOption The value of pageGroupOption.
+     */
+    public void setPageGroupOption(PageGroupOption pageGroupOption) {
+        _pageGroupOption = pageGroupOption;
+    }
+
+    public static class PageGroupOption {
+        protected int _pageGroupSize;
+
+        public int getPageGroupSize() {
+            return _pageGroupSize;
+        }
+
+        public void setPageGroupSize(int pageGroupSize) {
+            _pageGroupSize = pageGroupSize;
+        }
+    }
+
+#if ($database.isAvailableGenerics())
+    // =====================================================================================
+    //                                                                               Mapping
+    //                                                                               =======
+    public <DTO> ${myClassName}<DTO> mappingList(${glEntityDtoMapperName}<ENTITY, DTO> entityDtoMapper) {
+        final ${glListResultBeanName}<DTO> ls = super.mappingList(entityDtoMapper);
+        final ${myClassName}<DTO> mappingList = new ${myClassName}<DTO>();
+        mappingList.setSelectedList(ls.getSelectedList());
+        mappingList.setTableDbName(getTableDbName());
+        mappingList.setAllRecordCount(getAllRecordCount());
+        mappingList.setOrderByClause(getOrderByClause());
+        mappingList.setPageSize(getPageSize());
+        mappingList.setCurrentPageNumber(getCurrentPageNumber());
+        mappingList.setPageRangeOption(_pageRangeOption);
+        mappingList.setPageGroupOption(_pageGroupOption);
+        return mappingList;
+    }
+#end
+
+    // =====================================================================================
+    //                                                                             Calculate
+    //                                                                             =========
+    // -------------------------------------------
+    //                                        Page
+    //                                        ----
+    /**
+     * Calculate all page count.
+     * 
+     * @param allRecordCount All record count.
+     * @param pageSize Fetch-size.
+     * @return All page count.
+     */
+    protected int calculateAllPageCount(int allRecordCount, int pageSize) {
+        if (allRecordCount == 0) {
+            return 1;
+        }
+        int pageCountBase = (allRecordCount / pageSize);
+        if (allRecordCount % pageSize > 0) {
+            pageCountBase++;
+        }
+        return pageCountBase;
+    }
+
+    protected int calculateCurrentStartRecordNumber(int currentPageNumber, int pageSize) {
+        return ((currentPageNumber - 1) * pageSize) + 1;
+    }
+
+    protected int calculateCurrentEndRecordNumber(int currentPageNumber, int pageSize) {
+        return calculateCurrentStartRecordNumber(currentPageNumber, pageSize) + _selectedList.size() - 1;
+    }
+
+    /**
+     * Is existing previous page?
+     * Using values are currentPageNumber.
+     * 
+     * @return Determination.
+     */
+    public boolean isExistPrePage() {
+        return (_allRecordCount > 0 && _currentPageNumber > 1);
+    }
+
+    /**
+     * Is existing next page?
+     * Using values are currentPageNumber and allPageCount.
+     * 
+     * @return Determination.
+     */
+    public boolean isExistNextPage() {
+        return (_allRecordCount > 0 && _currentPageNumber < getAllPageCount());
+    }
+
+    // -------------------------------------------
+    //                                  Page Range
+    //                                  ----------
+    /**
+     * Get current page-range page-number-list.
+     * Using values are pageRangeOption and currentPageNumber and allPageCount.
+     * 
+     * @return Current page-range page-number-list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString('Integer')} getCurrentPageRangePageNumberList() {
+        assertPageRangeValid();
+        final int pageRangeSize = _pageRangeOption.getPageRangeSize();
+        final int allPageCount = this.getAllPageCount();
+        final int currentPageNumber = _currentPageNumber;
+
+        final java.util.List${database.filterGenericsString('Integer')} resultList = new java.util.ArrayList${database.filterGenericsString('Integer')}();
+        for (int i = currentPageNumber - pageRangeSize; i < currentPageNumber; i++) {
+            if (i < 1) {
+                continue;
+            }
+            resultList.add(new Integer(i));
+        }
+
+        resultList.add(new Integer(currentPageNumber));
+
+        final int endPageNumber = (currentPageNumber + pageRangeSize);
+        for (int i = currentPageNumber + 1 ; i <= endPageNumber && i <= allPageCount; i++) {
+            resultList.add(new Integer(i));
+        }
+
+        final boolean fillLimit = _pageRangeOption.isFillLimit();
+        final int limitSize = (pageRangeSize * 2) + 1;
+        if (fillLimit && !resultList.isEmpty() && resultList.size() < limitSize) {
+            final Integer firstElements = (Integer)resultList.get(0);
+            final Integer lastElements = (Integer)resultList.get(resultList.size() - 1);
+            if (firstElements.intValue() > 1) {
+                for (int i = firstElements.intValue() - 1 ; resultList.size() < limitSize && i > 0; i--) {
+                    resultList.add(0, new Integer(i));
+                }
+            }
+            for (int i = lastElements.intValue() + 1 ; resultList.size() < limitSize && i <= allPageCount; i++) {
+                resultList.add(new Integer(i));
+            }
+        }
+        return resultList;
+    }
+
+    /**
+     * Get current page-range page-number-array.
+     * Using values are pageRangeOption and currentPageNumber and allPageCount.
+     * 
+     * @return Current page-range page-number-array.
+     */
+    public int[] getCurrentPageRangePageNumberArray() {
+        assertPageRangeValid();
+        return convertListToIntArray(getCurrentPageRangePageNumberList());
+    }
+
+    protected int[] convertListToIntArray(java.util.List${database.filterGenericsString('Integer')} ls) {
+        final int[] resultArray = new int[ls.size()];
+        int arrayIndex = 0;
+        for (final java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+            final Integer tmpPageNumber = (Integer)ite.next();
+            resultArray[arrayIndex] = tmpPageNumber.intValue();
+            arrayIndex++;
+        }
+        return resultArray;
+    }
+
+    /**
+     * Is existing previous page-range?
+     * Using values are pageRangeOption and currentPageNumber and allPageCount.
+     * 
+     * @return Determination.
+     */
+    public boolean isExistPrePageRange() {
+        assertPageRangeValid();
+        final int[] array = getCurrentPageRangePageNumberArray();
+        if (array.length == 0) {
+            return false;
+        }
+        return array[0] > 1;
+    }
+
+    /**
+     * Is existing next page-range?
+     * Using values are pageRangeOption and currentPageNumber and allPageCount.
+     * 
+     * @return Determination.
+     */
+    public boolean isExistNextPageRange() {
+        assertPageRangeValid();
+        final int[] array = getCurrentPageRangePageNumberArray();
+        if (array.length == 0) {
+            return false;
+        }
+        return array[array.length-1] < getAllPageCount();
+    }
+
+    protected void assertPageRangeValid() {
+        if (_pageRangeOption == null) {
+            String msg = "The pageRangeOption should not be null. Please invoke setPageRangeOption().";
+            throw new IllegalStateException(msg);
+        }
+        final int pageRangeSize = _pageRangeOption.getPageRangeSize();
+        if (pageRangeSize == 0) {
+            String msg = "The pageRangeSize should be greater than 1. But the value is zero.";
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    // -------------------------------------------
+    //                                  Page Group
+    //                                  ----------
+    /**
+     * Calculate current page-group start-page-number.
+     * Using values are currentPageNumber and pageGroupSize.
+     * 
+     * @return Current page-group start-page-number.
+     */
+    public int calculateCurrentPageGroupStartPageNumber() {
+        assertPageGroupValid();
+        final int pageGroupSize = _pageGroupOption.getPageGroupSize();
+        final int currentPageNumber = _currentPageNumber;
+
+        int currentPageGroupNumber = (currentPageNumber / pageGroupSize);
+        if ((currentPageNumber % pageGroupSize) == 0)
+        {
+            currentPageGroupNumber--;
+        }
+        final int currentPageGroupStartPageNumber = (pageGroupSize * currentPageGroupNumber) + 1;
+        if (!(currentPageNumber >= currentPageGroupStartPageNumber)) {
+            String msg = "currentPageNumber should be greater equal currentPageGroupStartPageNumber. But:";
+            msg = msg + " currentPageNumber=" + currentPageNumber;
+            msg = msg + " currentPageGroupStartPageNumber=" + currentPageGroupStartPageNumber;
+            throw new IllegalStateException(msg);
+        }
+        return currentPageGroupStartPageNumber;
+    }
+
+    /**
+     * Get current page-group page-number-list.
+     * Using values are currentPageNumber and pageGroupSize and allPageCount.
+     * 
+     * @return Current page-group page-number-list.
+     */
+    public java.util.List${database.filterGenericsString('Integer')} getCurrentPageGroupPageNumberList() {
+        assertPageGroupValid();
+        final int pageGroupSize = _pageGroupOption.getPageGroupSize();
+        final int allPageCount = getAllPageCount();
+        final int currentPageGroupStartPageNumber = calculateCurrentPageGroupStartPageNumber();
+        if (!(currentPageGroupStartPageNumber > 0)) {
+            String msg = "currentPageGroupStartPageNumber should be greater than 0. {> 0} But:";
+            msg = msg + " currentPageGroupStartPageNumber=" + currentPageGroupStartPageNumber;
+            throw new IllegalStateException(msg);
+        }
+        final int nextPageGroupStartPageNumber = currentPageGroupStartPageNumber + pageGroupSize;
+
+        final java.util.List${database.filterGenericsString('Integer')} resultList = new java.util.ArrayList${database.filterGenericsString('Integer')}();
+        for (int i=currentPageGroupStartPageNumber; i < nextPageGroupStartPageNumber && i <= allPageCount; i++) {
+            resultList.add(new Integer(i));
+        }
+        return resultList;
+    }
+
+    /**
+     * Get current page-group page-number-array.
+     * Using values are currentPageNumber and pageGroupSize and allPageCount.
+     * 
+     * @return Current page-group page-number-array.
+     */
+    public int[] getCurrentPageGroupPageNumberArray() {
+        assertPageGroupValid();
+        return convertListToIntArray(getCurrentPageGroupPageNumberList());
+    }
+
+    /**
+     * Is existing previous page-group?
+     * Using values are currentPageNumber and pageGroupSize.
+     * 
+     * @return Determination.
+     */
+    public boolean isExistPrePageGroup() {
+        assertPageGroupValid();
+        return (_currentPageNumber > _pageGroupOption.getPageGroupSize());
+    }
+
+    /**
+     * Is existing next page-group?
+     * Using values are currentPageNumber and pageGroupSize and allPageCount.
+     * 
+     * @return Determination.
+     */
+    public boolean isExistNextPageGroup() {
+        assertPageGroupValid();
+        int currentPageGroupStartPageNumber = calculateCurrentPageGroupStartPageNumber();
+        if (!(currentPageGroupStartPageNumber > 0)) {
+            String msg = "currentPageGroupStartPageNumber should be greater than 0. {> 0} But:";
+            msg = msg + " currentPageGroupStartPageNumber=" + currentPageGroupStartPageNumber;
+            throw new IllegalStateException(msg);
+        }
+        int nextPageGroupStartPageNumber = currentPageGroupStartPageNumber + _pageGroupOption.getPageGroupSize();
+        return (nextPageGroupStartPageNumber <= getAllPageCount());
+    }
+
+    protected void assertPageGroupValid() {
+        if (_pageGroupOption == null) {
+            String msg = "The pageGroupOption should not be null. Please invoke setPageGroupOption().";
+            throw new IllegalStateException(msg);
+        }
+        if (_pageGroupOption.getPageGroupSize() == 0) {
+            String msg = "The pageGroupSize should be greater than 1. But the value is zero.";
+            msg = msg + " pageGroupSize=" + _pageGroupOption.getPageGroupSize();
+            throw new IllegalStateException(msg);
+        }
+        if (_pageGroupOption.getPageGroupSize() == 1) {
+            String msg = "The pageGroupSize should be greater than 1. But the value is one.";
+            msg = msg + " pageGroupSize=" + _pageGroupOption.getPageGroupSize();
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                 Basic-Override Method
+    //                                                                 =====================
+    /**
+     * This method overrides the method that is declared at super.
+     * 
+     * @return View-string of all-columns value.
+     */
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+
+        sb.append(getCurrentPageNumber()).append("/").append(getAllPageCount());
+        sb.append(" of ").append(getAllRecordCount());
+        sb.append(" listSize=").append(getSelectedList() != null ? new Integer(getSelectedList().size()) : null);
+        sb.append(" pageSize=").append(getPageSize());
+        sb.append(" page:{").append(isExistPrePage()).append("/").append(isExistNextPage()).append("}");
+        sb.append(" groupSize=").append(getPageGroupSize());
+        sb.append(" rangeSize=").append(getPageRangeSize());
+
+        return sb.toString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SelectResource.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SelectResource.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SelectResource.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,9 @@
+package ${glPackageBaseCommonCBean};
+
+/**
+ * The select-resource as marker-interface.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glSelectResourceInterfaceName} {
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimpleOrderByBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimpleOrderByBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimpleOrderByBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,136 @@
+package ${glPackageBaseCommonCBean};
+
+import ${glPackageBaseCommonSqlClause}.${glOrderByClauseName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+
+/// <summary>
+/// The order-by-bean as simple implemetation.
+/// Author: ${database.ClassAuthor}
+/// </summary>
+public class ${glSimpleOrderByBeanName} implements ${glOrderByBeanInterfaceName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** SQL clause instance. */
+    protected final ${glSqlClauseName} _sqlClause;
+    {
+        _sqlClause = ${glConditionBeanContextName}.createSqlClause("Dummy");
+    }
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     */
+    public ${glSimpleOrderByBeanName}() {
+    }
+
+    // =====================================================================================
+    //                                                                             SqlClause
+    //                                                                             =========
+    /**
+     * Get sql-clause.
+     * 
+     * @return Sql clause. (NotNull)
+     */
+    protected ${glSqlClauseName} getSqlClause() {
+        return _sqlClause;
+    }
+
+    // =====================================================================================
+    //                                                                               OrderBy
+    //                                                                               =======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql component of order-by clause. (NotNull)
+     */
+    public ${glOrderByClauseName} getSqlComponentOfOrderByClause() {
+        return getSqlClause().getSqlComponentOfOrderByClause();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Order-by clause. (NotNull)
+     */
+    public String getOrderByClause() {
+        return getSqlClause().getOrderByClause();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} clearOrderBy() {
+        getSqlClause().clearOrderBy();
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} ignoreOrderBy() {
+        getSqlClause().ignoreOrderBy();
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} makeOrderByEffective() {
+        getSqlClause().makeOrderByEffective();
+        return this;
+    }
+
+    /**
+     * Register order-by-asc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} registerOrderByAsc(String orderByProperty) {
+        getSqlClause().registerOrderBy(orderByProperty, orderByProperty, true);
+        return this;
+    }
+
+    /**
+     * Register order-by-desc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} registerOrderByDesc(String orderByProperty) {
+        getSqlClause().registerOrderBy(orderByProperty, orderByProperty, false);
+        return this;
+    }
+
+    /**
+     * Reverse order-by or Override order-by asc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} reverseOrderBy_Or_OverrideOrderByAsc(String orderByProperty) {
+        getSqlClause().reverseOrderBy_Or_OverrideOrderBy(orderByProperty, orderByProperty, true);
+        return this;
+    }
+
+    /**
+     * Reverse order-by or Override order-by desc.
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @return this. (NotNull)
+     */
+    public ${glOrderByBeanInterfaceName} reverseOrderBy_Or_OverrideOrderByDesc(String orderByProperty) {
+        getSqlClause().reverseOrderBy_Or_OverrideOrderBy(orderByProperty, orderByProperty, false);
+        return this;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimplePagingBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimplePagingBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/SimplePagingBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,209 @@
+package ${glPackageBaseCommonCBean};
+
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+
+/**
+ * The simple paging-bean.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glSimplePagingBeanName} extends ${glSimpleOrderByBeanName} implements ${glPagingBeanInterfaceName} {
+
+    // =====================================================================================
+    //                                                                             SqlClause
+    //                                                                             =========
+    /**
+     * Get sql-clause.
+     * 
+     * @return Sql clause. (NotNull)
+     */
+    protected ${glSqlClauseName} getSqlClause() {
+        return _sqlClause;
+    }
+
+    // =====================================================================================
+    //                                                                        FetchNarrowing
+    //                                                                        ==============
+    /**
+     * Get fetch-narrowing start-index.
+     * 
+     * @return Fetch-narrowing start-index.
+     */
+    public int getFetchNarrowingSkipStartIndex() {
+        return getSqlClause().getFetchNarrowingSkipStartIndex();
+    }
+
+    /**
+     * Get fetch-narrowing size.
+     * 
+     * @return Fetch-narrowing size.
+     */
+    public int getFetchNarrowingLoopCount() {
+        return getSqlClause().getFetchNarrowingLoopCount();
+    }
+
+    /**
+     * Is fetch start index supported?
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchNarrowingSkipStartIndexEffective() {
+        return !getSqlClause().isFetchStartIndexSupported();
+    }
+
+    /**
+     * Is fetch size supported?
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchNarrowingLoopCountEffective() {
+        return !getSqlClause().isFetchSizeSupported();
+    }
+
+    /**
+     * Is fetch-narrowing effective?
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchNarrowingEffective() {
+        return getSqlClause().isFetchNarrowingEffective();
+    }
+
+    // =====================================================================================
+    //                                                                                Paging
+    //                                                                                ======
+    /**
+     * Fetch first.
+     * <pre>
+     * If you invoke this, your SQL returns [fetch-size] records from first.
+     * </pre>
+     * @param fetchSize Fetch-size. (NotMinus & NotZero)
+     * @return this. (NotNull)
+     */
+    public ${glPagingBeanInterfaceName} fetchFirst(int fetchSize) {
+        getSqlClause().fetchFirst(fetchSize);
+        return this;
+    }
+
+    /**
+     * Fetch scope.
+     * <pre>
+     * If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index].
+     * </pre>
+     * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+     * @param fetchSize Fetch-size. (NotMinus & NotZero)</param>
+     * @return this. (NotNull)
+     */
+    public ${glPagingBeanInterfaceName} fetchScope(int fetchStartIndex, int fetchSize) {
+        getSqlClause().fetchScope(fetchStartIndex, fetchSize);
+        return this;
+    }
+
+    /**
+     * Fetch page.
+     * <pre>
+     * When you invoke this, it is normally necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that.
+     *  But you also can use default-fetch-size without invoking 'fetchFirst()' or 'fetchScope()'.
+     *  If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index] calculated by [fetch-page-number].
+     * </pre>
+     * @param fetchPageNumber Fetch-page-number. 1 origin. (NotMinus & NotZero)
+     * @return this. (NotNull)
+     */
+    public ${glPagingBeanInterfaceName} fetchPage(int fetchPageNumber) {
+        getSqlClause().fetchPage(fetchPageNumber);
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-start-index.
+     */
+    public int getFetchStartIndex() {
+        return getSqlClause().getFetchStartIndex();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-size.
+     */
+    public int getFetchSize() {
+        return getSqlClause().getFetchSize();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-page-number.
+     */
+    public int getFetchPageNumber() {
+        return getSqlClause().getFetchPageNumber();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Page start index. 0 origin. (NotMinus)
+     */
+    public int getPageStartIndex() {
+        return getSqlClause().getPageStartIndex();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Page end index. 0 origin. (NotMinus)
+     */
+    public int getPageEndIndex() {
+        return getSqlClause().getPageEndIndex();
+    }
+
+    /**
+     * Is fetch scope effective?
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchScopeEffective() {
+        return getSqlClause().isFetchScopeEffective();
+    }
+
+    // =====================================================================================
+    //                                                                        For SqlComment
+    //                                                                        ==============
+    /**
+     * Get select-hint. {select [select-hint] * from table...}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    public String getSelectHint() {
+        return getSqlClause().getSelectHint();
+    }
+
+    /**
+     * Get from-base-table-hint. {select * from table [from-base-table-hint] where ...}
+     * 
+     * @return from-base-table-hint. (NotNull)
+     */
+    public String getFromBaseTableHint() {
+        return getSqlClause().getFromBaseTableHint();
+    }
+
+    /**
+     * Get from-hint. {select * from table [from-hint] where ...}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    public String getFromHint() {
+        return getSqlClause().getFromHint();
+    }
+
+    /**
+     * Get sql-suffix. {select * from table where ... order by ... [sql-suffix]}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    public String getSqlSuffix() {
+        return getSqlClause().getSqlSuffix();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,287 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}")
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The abstract class of condition-key.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${myClassName} {
+
+    /** Mark of replaced value. */
+    public static final String MARK_OF_REPLACED_VALUE = "ReplacedValue";
+
+    /** The condition key of equal. */
+    public static final ${myClassName} CK_EQUAL = new ${myClassName}Equal();
+
+    /** The condition key of notEqual. */
+    public static final ${myClassName} CK_NOT_EQUAL = new ${myClassName}NotEqual();
+
+    /** The condition key of greaterThan. */
+    public static final ${myClassName} CK_GREATER_THAN = new ${myClassName}GreaterThan();
+
+    /** The condition key of lessrThan. */
+    public static final ${myClassName} CK_LESS_THAN = new ${myClassName}LessThan();
+
+    /** The condition key of greaterEqual. */
+    public static final ${myClassName} CK_GREATER_EQUAL = new ${myClassName}GreaterEqual();
+
+    /** The condition key of lessEqual. */
+    public static final ${myClassName} CK_LESS_EQUAL = new ${myClassName}LessEqual();
+
+    /** The condition key of prefixSearch. */
+    public static final ${myClassName} CK_PREFIX_SEARCH = new ${myClassName}PrefixSearch();
+
+    /** The condition key of likeSearch. */
+    public static final ${myClassName} CK_LIKE_SEARCH = new ${myClassName}LikeSearch();
+
+    /** The condition key of inScope. */
+    public static final ${myClassName} CK_IN_SCOPE = new ${myClassName}InScope();
+
+    /** The condition key of notInScope. */
+    public static final ${myClassName} CK_NOT_IN_SCOPE = new ${myClassName}NotInScope();
+
+    /** The condition key of isNull. */
+    public static final ${myClassName} CK_IS_NULL = new ${myClassName}IsNull();
+
+    /** The condition key of isNotNull. */
+    public static final ${myClassName} CK_IS_NOT_NULL = new ${myClassName}IsNotNull();
+
+    /** Dummy-object for IsNull and IsNotNull and so on... */
+    protected static final Object DUMMY_OBJECT = new Object();
+
+    /** Condition-key. */
+    protected String _conditionKey;
+
+    /** Operand. */
+    protected String _operand;
+
+    /**
+     * Get condition-key.
+     * 
+     * @return Condition-key.
+     */
+    public String getConditionKey() {
+        return _conditionKey;
+    }
+
+    /**
+     * Get operand.
+     * 
+     * @return Operand.
+     */
+    public String getOperand() {
+        return _operand;
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    abstract public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName);
+
+    /**
+     * Add where clause.
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @return this.
+     */
+    public ${myClassName} addWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value == null) {
+            String msg = "Argument[value] must not be null:";
+            throw new IllegalArgumentException(msg + " value=" + value + " this.toString()=" + toString());
+        }
+        doAddWhereClause(conditionList, columnName, value);
+        return this;
+    }
+
+    /**
+     * Add where clause.
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     * @return this.
+     */
+    public ${myClassName} addWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        if (value == null) {
+            String msg = "Argument[value] must not be null:";
+            throw new IllegalArgumentException(msg + " value=" + value + " this.toString()=" + toString());
+        }
+        doAddWhereClause(conditionList, columnName, value, option);
+        return this;
+    }
+
+    /**
+     * Do add where clause.
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    abstract protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value);
+
+    /**
+     * Do add where clause.
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    abstract protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option);
+
+    /**
+     * Setup condition value.
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (Nullable)
+     * @param location Location. (Nullable)
+     * @return Condition value. (The same as argument[conditionValue]) (NotNull)
+     */
+    public ${glConditionValueName} setupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        if (conditionValue == null) {
+            String msg = "Argument[conditionValue] must not be null:";
+            throw new IllegalArgumentException(msg + " value=" + value + " this.toString()=" + toString());
+        }
+        doSetupConditionValue(conditionValue, value, location);
+        return conditionValue;
+    }
+
+    /**
+     * Setup condition value.
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (Nullable)
+     * @param location Location. (Nullable)
+     * @param option Condition option. (NotNull)
+     * @return Condition value. (The same as argument[conditionValue]) (NotNull)
+     */
+    public ${glConditionValueName} setupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        if (conditionValue == null) {
+            String msg = "Argument[conditionValue] must not be null:";
+            throw new IllegalArgumentException(msg + " value=" + value + " this.toString()=" + toString());
+        }
+        doSetupConditionValue(conditionValue, value, location, option);
+        return conditionValue;
+    }
+
+    /**
+     * Do setup condition value.
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    abstract protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location);
+
+    /**
+     * Do setup condition value.
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    abstract protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option);
+
+    /**
+     * Build bind clause. (for s2dao)
+     * 
+     * @param columnName Column name. (NotNull)
+     * @param location Location. (NotNull)
+     * @return Bind clause. (NotNull)
+     */
+    protected String buildBindClause(String columnName, String location) {
+        return columnName + " " + getOperand() + " " + "/*dto." + location + "*/null";
+    }
+
+    /**
+     * Build bind clause. (for s2dao)
+     * 
+     * @param columnName Column name. (NotNull)
+     * @param location Location. (NotNull)
+     * @param additionalOption Additional option. (NotNull)
+     * @return Bind clause. (NotNull)
+     */
+    protected String buildBindClauseWithRearOption(String columnName, String location, String rearOption) {
+        return columnName + " " + getOperand() + " " + "/*dto." + location + "*/null" + rearOption;
+    }
+
+    /**
+     * Build bind clause. (for s2dao)
+     * 
+     * @param columnName Column name. (NotNull)
+     * @param location Location. (NotNull)
+     * @param dummyValue Dummy value. (NotNull)
+     * @return Bind clause. (NotNull)
+     */
+    protected String buildBindClause(String columnName, String location, String dummyValue) {
+        return columnName + " " + getOperand() + " " + "/*dto." + location + "*/" + dummyValue;
+    }
+
+    /**
+     * Build clause without value.
+     * 
+     * @param columnName Column name. (NotNull)
+     * @return Clause without value. (NotNull)
+     */
+    protected String buildClauseWithoutValue(String columnName) {
+        return columnName + " " + getOperand();
+    }
+
+    /**
+     * Get wild-card.
+     * 
+     * @return Wild-card.
+     */
+    protected String getWildCard() {
+        return "${database.wildCard}";
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * Returns hash-code of this condition-key string.
+     * 
+     * @return HashCode.
+     */
+    public int hashCode() {
+        return getConditionKey().hashCode();
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * If the condition-key of the other is same as this one, returns true.
+     * 
+     * @param other Other entity. (Nullable)
+     * @return Comparing result. If other is null, returns false.
+     */
+    public boolean equals(Object other) {
+        if (other instanceof ${myClassName}) {
+            if (this.getConditionKey().equals(((${myClassName})other).getConditionKey())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return View-string of condition key information.
+     */
+    public String toString() {
+        return "${myClassName}: " + getConditionKey() + " " + getOperand() + " wild-card=[" + getWildCard() + "]";
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_equal.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_equal.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_equal.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,101 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}Equal")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of equal.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "equal";
+        _operand = "=";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (conditionValue.hasEqual()) {
+            if (conditionValue.equalEqual(value)) {
+                _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                return false;
+            } else {
+                conditionValue.overrideEqual(value);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getEqual() == null) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getEqualLocation()));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause with condition-option is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setEqual(value).setEqualLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterEqual.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterEqual.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterEqual.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,101 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}GreaterEqual")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of greaterEqual.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "greaterEqual";
+        _operand = ">=";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (conditionValue.hasGreaterEqual()) {
+            if (conditionValue.equalGreaterEqual(value)) {
+                _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                return false;
+            } else {
+                conditionValue.overrideGreaterEqual(value);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getGreaterEqual() == null) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getGreaterEqualLocation()));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setGreaterEqual(value).setGreaterEqualLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterThan.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterThan.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_greaterThan.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,101 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}GreaterThan")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of greaterThan.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "greaterThan";
+        _operand = ">";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (conditionValue.hasGreaterThan()) {
+            if (conditionValue.equalGreaterThan(value)) {
+                _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                return false;
+            } else {
+                conditionValue.overrideGreaterThan(value);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getGreaterThan() == null) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getGreaterThanLocation()));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setGreaterThan(value).setGreaterThanLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_inScope.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_inScope.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_inScope.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,126 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}InScope")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionInScopeName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of inScope.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "inScope";
+        _operand = "in";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (value instanceof java.util.List && ((java.util.List)value).isEmpty()) {
+            return false;
+        }
+        if (value instanceof java.util.List) {
+            if (conditionValue.hasInScope()) {
+                if (conditionValue.equalInScope(((java.util.List)value))) {
+                    _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                    return false;
+                } else {
+                    conditionValue.overrideInScope(((java.util.List)value));
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getInScope() == null) {
+            return;
+        }
+        final java.util.List valueList = value.getInScope();
+        final java.util.List${database.filterGenericsString('Object')} checkedValueList = new java.util.ArrayList${database.filterGenericsString('Object')}();
+        for (final java.util.Iterator ite = valueList.iterator(); ite.hasNext(); ) {
+            final Object checkTargetValue = ite.next();
+            if (checkTargetValue != null) {;
+                checkedValueList.add(checkTargetValue);
+            }
+        }
+        if (checkedValueList.isEmpty()) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getInScopeLocation(), "('a1', 'a2')"));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        if (option == null) {
+            String msg = "The argument[option] should not be null: columnName=" + columnName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (!(option instanceof ${glConditionOptionInScopeName})) {
+            String msg = "The argument[option] should be ${glConditionOptionInScopeName}: columnName=" + columnName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        conditionList.add(buildBindClause(columnName, value.getInScopeLocation(), "('a1', 'a2')"));
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setInScope((java.util.List)value).setInScopeLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        conditionValue.setInScope((java.util.List)value, (${glConditionOptionInScopeName})option).setInScopeLocation(location);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNotNull.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNotNull.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNotNull.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,93 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}IsNotNull")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of isNotNull.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "isNotNull";
+        _operand = "is not null";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (conditionValue.hasIsNotNull()) {
+            _log.warn("The value has already registered at " + callerName);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getIsNotNull() == null) {
+            return;
+        }
+        conditionList.add(buildClauseWithoutValue(columnName));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setIsNotNull(DUMMY_OBJECT).setIsNotNullLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNull.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNull.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_isNull.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,93 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}IsNull")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of isNull.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "isNull";
+        _operand = "is null";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (conditionValue.hasIsNull()) {
+            _log.warn("The value has already registered at " + callerName);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getIsNull() == null) {
+            return;
+        }
+        conditionList.add(buildClauseWithoutValue(columnName));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setIsNull(DUMMY_OBJECT).setIsNullLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessEqual.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessEqual.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessEqual.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,101 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}LessEqual")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of lessEqual.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "lessEqual";
+        _operand = "<=";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (conditionValue.hasLessEqual()) {
+            if (conditionValue.equalLessEqual(value)) {
+                _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                return false;
+            } else {
+                conditionValue.overrideLessEqual(value);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getLessEqual() == null) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getLessEqualLocation()));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setLessEqual(value).setLessEqualLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessThan.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessThan.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_lessThan.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,101 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}LessThan")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of lessThan.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "lessThan";
+        _operand = "<";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (conditionValue.hasLessThan()) {
+            if (conditionValue.equalLessThan(value)) {
+                _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                return false;
+            } else {
+                conditionValue.overrideLessThan(value);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getLessThan() == null) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getLessThanLocation()));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setLessThan(value).setLessThanLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_likeSearch.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_likeSearch.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_likeSearch.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,93 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}LikeSearch")
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionLikeSearchName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of likeSearch.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "likeSearch";
+        _operand = "like";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        throw new UnsupportedOperationException("doAddWhereClause without condition-option is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        if (option == null) {
+            String msg = "The argument[option] should not be null: columnName=" + columnName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (!(option instanceof ${glConditionOptionLikeSearchName})) {
+            String msg = "The argument[option] should be ${glConditionOptionLikeSearchName}: columnName=" + columnName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        final ${glConditionOptionLikeSearchName} myOption = (${glConditionOptionLikeSearchName})option;
+        conditionList.add(buildBindClauseWithRearOption(columnName, value.getLikeSearchLocation(), myOption.getRearOption()));
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        throw new UnsupportedOperationException("doSetupConditionValue without condition-option is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        conditionValue.setLikeSearch((String)value, (${glConditionOptionLikeSearchName})option).setLikeSearchLocation(location);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notEqual.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notEqual.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notEqual.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,101 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}NotEqual")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of notEqual.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "notEqual";
+        _operand = "!=";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (conditionValue.hasNotEqual()) {
+            if (conditionValue.equalNotEqual(value)) {
+                _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                return false;
+            } else {
+                conditionValue.overrideNotEqual(value);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getNotEqual() == null) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getNotEqualLocation()));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause with condition-option is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setNotEqual(value).setNotEqualLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notInScope.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notInScope.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_notInScope.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,117 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}NotInScope")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of notInScope.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "notInScope";
+        _operand = "not in";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (value instanceof java.util.List && ((java.util.List)value).isEmpty()) {
+            return false;
+        }
+        if (value instanceof java.util.List) {
+            if (conditionValue.hasNotInScope()) {
+                if (conditionValue.equalNotInScope(((java.util.List)value))) {
+                    _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                    return false;
+                } else {
+                    conditionValue.overrideNotInScope(((java.util.List)value));
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getNotInScope() == null) {
+            return;
+        }
+        final java.util.List valueList = value.getNotInScope();
+        final java.util.List${database.filterGenericsString('Object')} checkedValueList = new java.util.ArrayList${database.filterGenericsString('Object')}();
+        for (final java.util.Iterator ite = valueList.iterator(); ite.hasNext(); ) {
+            final Object checkTargetValue = ite.next();
+            if (checkTargetValue != null) {;
+                checkedValueList.add(checkTargetValue);
+            }
+        }
+        if (checkedValueList.isEmpty()) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getNotInScopeLocation(), "('a1', 'a2')"));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setNotInScope((java.util.List)value).setNotInScopeLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_prefixSearch.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_prefixSearch.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/ckey/ConditionKey_prefixSearch.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,101 @@
+package ${glPackageBaseCommonCKey};
+
+#set ($myClassName = "${glConditionKeyName}PrefixSearch")
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The condition-key of prefixSearch.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionKeyName} {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${myClassName}.class);
+
+    /**
+     * Constructor.
+     */
+    protected ${myClassName}() {
+        _conditionKey = "prefixSearch";
+        _operand = "like";
+    }
+
+    /**
+     * Is valid registration?
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param callerName Caller name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName) {
+        if (value == null) {
+            return false;
+        }
+        if (conditionValue.hasPrefixSearch()) {
+            if (conditionValue.equalPrefixSearch(value + getWildCard())) {
+                _log.warn("The value has already registered at " + callerName + ": value=" + value);
+                return false;
+            } else {
+                conditionValue.overridePrefixSearch(value);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value) {
+        if (value.getPrefixSearch() == null) {
+            return;
+        }
+        conditionList.add(buildBindClause(columnName, value.getPrefixSearchLocation()));
+    }
+
+    /**
+     * This method implements super#doAddWhereClause().
+     * 
+     * @param conditionList Condition list. (NotNull)
+     * @param columnName Column name. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doAddWhereClause(java.util.List${database.filterGenericsString('String')} conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doAddWhereClause that has ConditionOption is unsupported!!!");
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
+        conditionValue.setPrefixSearch((value != null ? value + getWildCard() : null)).setPrefixSearchLocation(location);
+    }
+
+    /**
+     * This method implements super#doSetupConditionValue().
+     * 
+     * @param conditionValue Condition value. (NotNull)
+     * @param value Value. (NotNull)
+     * @param location Location. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
+        throw new UnsupportedOperationException("doSetupConditionValue with condition-option is unsupported!!!");
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/ConditionOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/ConditionOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/ConditionOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,12 @@
+package ${glPackageBaseCommonCOption};
+
+#set ($myClassName = "${glConditionOptionInterfaceName}")
+
+/**
+ * The interface of condition-option.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${myClassName} {
+    public String getRearOption();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/FromToOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/FromToOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/FromToOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,145 @@
+package ${glPackageBaseCommonCOption};
+
+#set ($myClassName = "${glConditionOptionFromToName}")
+
+/**
+ * The class of from-to-option.
+ * <pre>
+ * ex) fromDate:{2007/04/10 08:24:53} toDate:{2007/04/16 14:36:29}
+ *
+ *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+ *   new ${myClassName}().compareAsDate(); 
+ *     --&gt; column &gt;= '2007/04/10 00:00:00' and column &lt; '2007/04/17 00:00:00'
+ *   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+ *
+ *   new ${myClassName}(); 
+ *     --&gt; column &gt;= '2007/04/10 08:24:53' and column &lt;= '2007/04/16 14:36:29'
+ *
+ *   new ${myClassName}().greaterThan(); 
+ *     --&gt; column &gt; '2007/04/10 08:24:53' and column &lt;= '2007/04/16 14:36:29'
+ *
+ *   new ${myClassName}().lessThan(); 
+ *     --&gt; column &gt;= '2007/04/10 08:24:53' and column &lt; '2007/04/16 14:36:29'
+ *
+ *   new ${myClassName}().greaterThan().lessThan(); 
+ *     --&gt; column &gt; '2007/04/10 08:24:53' and column &lt; '2007/04/16 14:36:29'
+ * 
+ * </pre>
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} implements ${glConditionOptionInterfaceName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected boolean _fromDateGreaterThan;
+
+    protected boolean _toDateLessThan;
+
+    protected boolean _compareAsDate;
+
+    // =====================================================================================
+    //                                                              Interface Implementation
+    //                                                              ========================
+    public String getRearOption() {
+        String msg = "Thie option does not use getRearOption()!";
+        throw new UnsupportedOperationException(msg);
+    }
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    public ${myClassName} greaterThan() {
+        _fromDateGreaterThan = true; return this;
+    }
+
+    public ${myClassName} lessThan() {
+        _toDateLessThan = true; return this;
+    }
+
+    /**
+     * Compare as date.
+     * <pre>
+     * ex) fromDate:{2007/04/10 08:24:53} toDate:{2007/04/16 14:36:29}
+     *
+     *   new ${myClassName}().compareAsDate();
+     *     --&gt; column &gt;= '2007/04/10 00:00:00' and column &lt; '2007/04/17 00:00:00'
+     * 
+     * This method ignore greaterThan() and lessThan().
+     * </pre>
+     * @return this. (NotNull)
+     */
+    public ${myClassName} compareAsDate() {
+        _compareAsDate = true; return this;
+    }
+
+    // =====================================================================================
+    //                                                                         Internal Main
+    //                                                                         =============
+    public java.util.Date filterFromDate(java.util.Date fromDate) {
+        if (fromDate == null) {
+            return null;
+        }
+        if (_compareAsDate) {
+            final java.util.Calendar cal = java.util.Calendar.getInstance();
+            cal.setTimeInMillis(fromDate.getTime());
+            clearCalendarHourMinuteSecondMilli(cal);
+            final java.util.Date cloneDate = (java.util.Date) fromDate.clone();
+            cloneDate.setTime(cal.getTimeInMillis());
+            return cloneDate;
+        }
+        return fromDate;
+    }
+
+    public java.util.Date filterToDate(java.util.Date toDate) {
+        if (toDate == null) {
+            return null;
+        }
+        if (_compareAsDate) {
+            final java.util.Calendar cal = java.util.Calendar.getInstance();
+            cal.setTimeInMillis(toDate.getTime());
+            clearCalendarHourMinuteSecondMilli(cal);
+            addCalendarNextDay(cal);// Key Point!
+            final java.util.Date cloneDate = (java.util.Date) toDate.clone();
+            cloneDate.setTime(cal.getTimeInMillis());
+            return cloneDate;
+        }
+        return toDate;
+    }
+
+    public ${glPackageBaseCommonCKey}.${glConditionKeyName} getFromDateConditionKey() {
+        if (_compareAsDate) {
+            return ${glPackageBaseCommonCKey}.${glConditionKeyName}.CK_GREATER_EQUAL;
+        }
+        if (_fromDateGreaterThan) {
+            return ${glPackageBaseCommonCKey}.${glConditionKeyName}.CK_GREATER_THAN;// Default!
+        } else {
+            return ${glPackageBaseCommonCKey}.${glConditionKeyName}.CK_GREATER_EQUAL;// Default!
+        }
+    }
+
+    public ${glPackageBaseCommonCKey}.${glConditionKeyName} getToDateConditionKey() {
+        if (_compareAsDate) {
+            return ${glPackageBaseCommonCKey}.${glConditionKeyName}.CK_LESS_THAN;
+        }
+        if (_toDateLessThan) {
+            return ${glPackageBaseCommonCKey}.${glConditionKeyName}.CK_LESS_THAN;// Default!
+        } else {
+            return ${glPackageBaseCommonCKey}.${glConditionKeyName}.CK_LESS_EQUAL;// Default!
+        }
+    }
+
+    // =====================================================================================
+    //                                                                       Calendar Helper
+    //                                                                       ===============
+    protected void addCalendarNextDay(java.util.Calendar cal) {
+        cal.add(java.util.Calendar.DAY_OF_MONTH, 1);
+    }
+
+    protected void clearCalendarHourMinuteSecondMilli(java.util.Calendar cal) {
+        cal.clear(java.util.Calendar.MILLISECOND);
+        cal.clear(java.util.Calendar.SECOND);
+        cal.clear(java.util.Calendar.MINUTE);
+        cal.set(java.util.Calendar.HOUR_OF_DAY, cal.getActualMinimum(java.util.Calendar.HOUR_OF_DAY));
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/InScopeOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/InScopeOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/InScopeOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,89 @@
+package ${glPackageBaseCommonCOption};
+
+#set ($myClassName = "${glConditionOptionInScopeName}")
+
+import ${glPackageBaseCommonCOptionPartsLocal}.${glConditionOptionPartsAgentJapaneseName};
+
+/**
+ * The class of in-scope-option.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionOptionSimpleStringName} {
+
+    // =====================================================================================
+    //                                                                                 Split
+    //                                                                                 =====
+    public ${myClassName} splitBySpace() {
+        return (${myClassName})doSplitBySpace();
+    }
+
+    public ${myClassName} splitBySpace(int splitLimitCount) {
+        return (${myClassName})doSplitBySpace(splitLimitCount);
+    }
+
+    public ${myClassName} splitBySpaceContainsDoubleByte() {
+        return (${myClassName})doSplitBySpaceContainsDoubleByte();
+    }
+
+    public ${myClassName} splitBySpaceContainsDoubleByte(int splitLimitCount) {
+        return (${myClassName})doSplitBySpaceContainsDoubleByte(splitLimitCount);
+    }
+
+    public ${myClassName} splitByPipeLine() {
+        return (${myClassName})doSplitByPipeLine();
+    }
+
+    public ${myClassName} splitByPipeLine(int splitLimitCount) {
+        return (${myClassName})doSplitByPipeLine(splitLimitCount);
+    }
+
+    // =====================================================================================
+    //                                                                   To Upper/Lower Case
+    //                                                                   ===================
+    public ${myClassName} toUpperCase() {
+        return (${myClassName})doToUpperCase();
+    }
+
+    public ${myClassName} toLowerCase() {
+        return (${myClassName})doToLowerCase();
+    }
+
+    // =====================================================================================
+    //                                                                        To Single Byte
+    //                                                                        ==============
+    public ${myClassName} toSingleByteSpace() {
+        return (${myClassName})doToSingleByteSpace();
+    }
+
+    public ${myClassName} toSingleByteAlphabetNumber() {
+        return (${myClassName})doToSingleByteAlphabetNumber();
+    }
+
+    public ${myClassName} toSingleByteAlphabetNumberMark() {
+        return (${myClassName})doToSingleByteAlphabetNumberMark();
+    }
+
+    // =====================================================================================
+    //                                                                        To Double Byte
+    //                                                                        ==============
+
+    // =====================================================================================
+    //                                                                              Japanese
+    //                                                                              ========
+    public ${glConditionOptionPartsAgentJapaneseName} localJapanese() {
+        return doLocalJapanese();
+    }
+
+    // =====================================================================================
+    //                                                                            Real Value
+    //                                                                            ==========
+    public java.util.List generateRealValueList(java.util.List valueList) {
+        final java.util.List${database.filterGenericsString('String')} resultList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        for (final java.util.Iterator ite = valueList.iterator(); ite.hasNext(); ) {
+            final String value = (String)ite.next();
+            resultList.add(generateRealValue(value));
+        }
+        return resultList;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/LikeSearchOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/LikeSearchOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/LikeSearchOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,210 @@
+package ${glPackageBaseCommonCOption};
+
+#set ($myClassName = "${glConditionOptionLikeSearchName}")
+
+import ${glPackageBaseCommonCOptionPartsLocal}.${glConditionOptionPartsAgentJapaneseName};
+
+/**
+ * The class of like-search-option.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionOptionSimpleStringName} {
+
+    protected static final String LIKE_PREFIX = "prefix";
+    protected static final String LIKE_SUFFIX = "suffix";
+    protected static final String LIKE_CONTAIN = "contain";
+
+    protected String _like;
+    protected String _escape;
+
+    protected java.util.List${database.filterGenericsString('LikeAsOrCallback')} _likeAsOrCallbackList = new java.util.ArrayList${database.filterGenericsString('LikeAsOrCallback')}();
+
+    // =====================================================================================
+    //                                                                           Rear Option
+    //                                                                           ===========
+    public String getRearOption() {
+        if (_escape == null || _escape.trim().length() == 0) {
+            return "";
+        }
+        return " escape '" + _escape + "'";
+    }
+
+    // =====================================================================================
+    //                                                                                  AsOr
+    //                                                                                  ====
+    public static interface LikeAsOrCallback {
+        public String getAdditionalTargetPropertyName();
+        public String filterValue(String currentValue);
+        public ${myClassName} filterOption(${myClassName} optionDeepCopyWithoutCallback);
+    }
+
+    public static abstract class DefaultLikeAsOrCallback implements LikeAsOrCallback {
+        public String filterValue(String currentValue) {
+            return currentValue;
+        }
+        public ${myClassName} filterOption(${myClassName} optionDeepCopyWithoutCallback) {
+            return optionDeepCopyWithoutCallback;
+        }
+    }
+
+    public java.util.List${database.filterGenericsString('LikeAsOrCallback')} getLikeAsOrCallbackList() {
+        return _likeAsOrCallbackList;
+    }
+
+    public void addLikeAsOrCallback(LikeAsOrCallback likeAsOrCallback) {
+        _likeAsOrCallbackList.add(likeAsOrCallback);
+    }
+
+    public void clearLikeAsOrCallback() {
+        _likeAsOrCallbackList.clear();
+    }
+
+    // =====================================================================================
+    //                                                                                  Like
+    //                                                                                  ====
+    public ${myClassName} likePrefix() {
+        _like = LIKE_PREFIX;
+        return this;
+    }
+    public ${myClassName} likeSuffix() {
+        _like = LIKE_SUFFIX;
+        return this;
+    }
+    public ${myClassName} likeContain() {
+        _like = LIKE_CONTAIN;
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                                Escape
+    //                                                                                ======
+    public ${myClassName} escapeByPipeLine() {
+        _escape = "|";
+        return this;
+    }
+
+    public ${myClassName} escapeByAtMark() {
+        _escape = "@";
+        return this;
+    }
+
+    public ${myClassName} escapeBySlash() {
+        _escape = "/";
+        return this;
+    }
+
+    public ${myClassName} escapeByBackSlash() {
+        _escape = "\\";
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                                 Split
+    //                                                                                 =====
+    public ${myClassName} splitBySpace() {
+        return (${myClassName})doSplitBySpace();
+    }
+
+    public ${myClassName} splitBySpace(int splitLimitCount) {
+        return (${myClassName})doSplitBySpace(splitLimitCount);
+    }
+
+    public ${myClassName} splitBySpaceContainsDoubleByte() {
+        return (${myClassName})doSplitBySpaceContainsDoubleByte();
+    }
+
+    public ${myClassName} splitBySpaceContainsDoubleByte(int splitLimitCount) {
+        return (${myClassName})doSplitBySpaceContainsDoubleByte(splitLimitCount);
+    }
+
+    public ${myClassName} splitByPipeLine() {
+        return (${myClassName})doSplitByPipeLine();
+    }
+
+    public ${myClassName} splitByPipeLine(int splitLimitCount) {
+        return (${myClassName})doSplitByPipeLine(splitLimitCount);
+    }
+
+    // =====================================================================================
+    //                                                                   To Upper/Lower Case
+    //                                                                   ===================
+    public ${myClassName} toUpperCase() {
+        return (${myClassName})doToUpperCase();
+    }
+
+    public ${myClassName} toLowerCase() {
+        return (${myClassName})doToLowerCase();
+    }
+
+    // =====================================================================================
+    //                                                                        To Single Byte
+    //                                                                        ==============
+    public ${myClassName} toSingleByteSpace() {
+        return (${myClassName})doToSingleByteSpace();
+    }
+
+    public ${myClassName} toSingleByteAlphabetNumber() {
+        return (${myClassName})doToSingleByteAlphabetNumber();
+    }
+
+    public ${myClassName} toSingleByteAlphabetNumberMark() {
+        return (${myClassName})doToSingleByteAlphabetNumberMark();
+    }
+
+    // =====================================================================================
+    //                                                                        To Double Byte
+    //                                                                        ==============
+
+    // =====================================================================================
+    //                                                                              Japanese
+    //                                                                              ========
+    public ${glConditionOptionPartsAgentJapaneseName} localJapanese() {
+        return doLocalJapanese();
+    }
+
+    // =====================================================================================
+    //                                                                            Real Value
+    //                                                                            ==========
+    public String generateRealValue(String value) {
+        value = super.generateRealValue(value);
+
+        // Escape
+        if (_escape != null && _escape.trim().length() != 0) {
+            String tmp = replace(value, _escape, _escape + _escape);
+            tmp = replace(tmp, "%", _escape + "%");
+            tmp = replace(tmp, "_", _escape + "_");
+            value = tmp;
+        }
+        final String wildCard = "${database.wildCard}";
+        if (_like == null || _like.trim().length() == 0) {
+            return value;
+        } else if (_like.equals(LIKE_PREFIX)) {
+            return value + wildCard;
+        } else if (_like.equals(LIKE_SUFFIX)) {
+            return wildCard + value;
+        } else if (_like.equals(LIKE_CONTAIN)) {
+            return wildCard + value + wildCard;
+        } else {
+            String msg = "The like was wrong string: " + _like;
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                              DeepCopy
+    //                                                                              ========
+    public Object createDeepCopy() {
+        final ${myClassName} deepCopy = (${myClassName})super.createDeepCopy();
+        deepCopy._like = _like;
+        deepCopy._escape = _escape;
+        for (java.util.Iterator ite = _likeAsOrCallbackList.iterator(); ite.hasNext(); ) {
+            deepCopy.addLikeAsOrCallback((LikeAsOrCallback)ite.next());
+        }
+        return deepCopy;
+    }
+
+    protected ${glConditionOptionSimpleStringName} newDeepCopyInstance() {
+        return new ${myClassName}();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/SimpleStringOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/SimpleStringOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/SimpleStringOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,193 @@
+package ${glPackageBaseCommonCOption};
+
+#set ($myClassName = "${glConditionOptionSimpleStringName}")
+
+import ${glPackageBaseCommonCOptionParts}.${glConditionOptionPartsSplitName};
+import ${glPackageBaseCommonCOptionParts}.${glConditionOptionPartsToUpperLowerCaseName};
+import ${glPackageBaseCommonCOptionParts}.${glConditionOptionPartsToSingleByteName};
+import ${glPackageBaseCommonCOptionPartsLocal}.${glConditionOptionPartsAgentJapaneseName};
+
+/**
+ * The class of simple-string-option.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} implements ${glConditionOptionInterfaceName} {
+
+    protected ${glConditionOptionPartsSplitName} _splitOptionParts;
+    protected ${glConditionOptionPartsToUpperLowerCaseName} _toUpperLowerCaseOptionParts;
+    protected ${glConditionOptionPartsToSingleByteName} _toSingleByteCaseOptionParts;
+    protected ${glConditionOptionPartsAgentJapaneseName} _japaneseOptionPartsAgent;
+
+    // =====================================================================================
+    //                                                                           Rear Option
+    //                                                                           ===========
+    public String getRearOption() {
+        return "";
+    }
+
+    // =====================================================================================
+    //                                                                                 Split
+    //                                                                                 =====
+    protected ${myClassName} doSplitBySpace() {
+        getSplitOptionParts().splitBySpace();
+        return this;
+    }
+
+    protected ${myClassName} doSplitBySpace(int splitLimitCount) {
+        getSplitOptionParts().splitBySpace(splitLimitCount);
+        return this;
+    }
+
+    protected ${myClassName} doSplitBySpaceContainsDoubleByte() {
+        getSplitOptionParts().splitBySpaceContainsDoubleByte();
+        return this;
+    }
+
+    protected ${myClassName} doSplitBySpaceContainsDoubleByte(int splitLimitCount) {
+        getSplitOptionParts().splitBySpaceContainsDoubleByte(splitLimitCount);
+        return this;
+    }
+
+    protected ${myClassName} doSplitByPipeLine() {
+        getSplitOptionParts().splitByPipeLine();
+        return this;
+    }
+
+    protected ${myClassName} doSplitByPipeLine(int splitLimitCount) {
+        getSplitOptionParts().splitByPipeLine(splitLimitCount);
+        return this;
+    }
+
+    protected ${glConditionOptionPartsSplitName} getSplitOptionParts() {
+        if (_splitOptionParts == null) {
+            _splitOptionParts = new ${glConditionOptionPartsSplitName}();
+        }
+        return _splitOptionParts;
+    }
+
+    public boolean isSplit() {
+        return getSplitOptionParts().isSplit();
+    }
+
+    public String[] generateSplitValueArray(String value) {
+        return getSplitOptionParts().generateSplitValueArray(value);
+    }
+
+    // =====================================================================================
+    //                                                                   To Upper/Lower Case
+    //                                                                   ===================
+    protected ${myClassName} doToUpperCase() {
+        getToUpperLowerCaseOptionParts().toUpperCase();
+        return this;
+    }
+
+    protected ${myClassName} doToLowerCase() {
+        getToUpperLowerCaseOptionParts().toLowerCase();
+        return this;
+    }
+
+    protected ${glConditionOptionPartsToUpperLowerCaseName} getToUpperLowerCaseOptionParts() {
+        if (_toUpperLowerCaseOptionParts == null) {
+            _toUpperLowerCaseOptionParts = new ${glConditionOptionPartsToUpperLowerCaseName}();
+        }
+        return _toUpperLowerCaseOptionParts;
+    }
+
+    // =====================================================================================
+    //                                                                        To Single Byte
+    //                                                                        ==============
+    protected ${myClassName} doToSingleByteSpace() {
+        getToSingleByteOptionParts().toSingleByteSpace();
+        return this;
+    }
+
+    protected ${myClassName} doToSingleByteAlphabetNumber() {
+        getToSingleByteOptionParts().toSingleByteAlphabetNumber();
+        return this;
+    }
+
+    protected ${myClassName} doToSingleByteAlphabetNumberMark() {
+        getToSingleByteOptionParts().toSingleByteAlphabetNumberMark();
+        return this;
+    }
+
+    protected ${glConditionOptionPartsToSingleByteName} getToSingleByteOptionParts() {
+        if (_toSingleByteCaseOptionParts == null) {
+            _toSingleByteCaseOptionParts = new ${glConditionOptionPartsToSingleByteName}();
+        }
+        return _toSingleByteCaseOptionParts;
+    }
+
+    // =====================================================================================
+    //                                                                        To Double Byte
+    //                                                                        ==============
+
+    // =====================================================================================
+    //                                                                              Japanese
+    //                                                                              ========
+    protected ${glConditionOptionPartsAgentJapaneseName} doLocalJapanese() {
+        return getJapaneseOptionPartsAgent();
+    }
+
+    protected ${glConditionOptionPartsAgentJapaneseName} getJapaneseOptionPartsAgent() {
+        if (_japaneseOptionPartsAgent == null) {
+            _japaneseOptionPartsAgent = new ${glConditionOptionPartsAgentJapaneseName}();
+        }
+        return _japaneseOptionPartsAgent;
+    }
+
+    // =====================================================================================
+    //                                                                            Real Value
+    //                                                                            ==========
+    public String generateRealValue(String value) {
+        value = getToUpperLowerCaseOptionParts().generateRealValue(value);
+        value = getToSingleByteOptionParts().generateRealValue(value);
+        value = getJapaneseOptionPartsAgent().generateRealValue(value);
+        return value;
+    }
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+    protected final String replace(String text, String fromText,
+            String toText) {
+
+        if (text == null || fromText == null || toText == null) {
+            return null;
+        }
+        StringBuffer buf = new StringBuffer(100);
+        int pos = 0;
+        int pos2 = 0;
+        while (true) {
+            pos = text.indexOf(fromText, pos2);
+            if (pos == 0) {
+                buf.append(toText);
+                pos2 = fromText.length();
+            } else if (pos > 0) {
+                buf.append(text.substring(pos2, pos));
+                buf.append(toText);
+                pos2 = pos + fromText.length();
+            } else {
+                buf.append(text.substring(pos2));
+                break;
+            }
+        }
+        return buf.toString();
+    }
+
+    // =====================================================================================
+    //                                                                              DeepCopy
+    //                                                                              ========
+    public Object createDeepCopy() {
+        final ${myClassName} deepCopy = newDeepCopyInstance();
+        deepCopy._splitOptionParts = _splitOptionParts != null ? (${glConditionOptionPartsSplitName})_splitOptionParts.createDeepCopy() : null;
+        deepCopy._toUpperLowerCaseOptionParts = _toUpperLowerCaseOptionParts != null ? (${glConditionOptionPartsToUpperLowerCaseName})_toUpperLowerCaseOptionParts.createDeepCopy() : null;
+        deepCopy._toSingleByteCaseOptionParts = _toSingleByteCaseOptionParts != null ? (${glConditionOptionPartsToSingleByteName})_toSingleByteCaseOptionParts.createDeepCopy() : null;
+        deepCopy._japaneseOptionPartsAgent = _japaneseOptionPartsAgent != null ? (${glConditionOptionPartsAgentJapaneseName})_japaneseOptionPartsAgent.createDeepCopy() : null;
+        return deepCopy;
+    }
+    protected ${myClassName} newDeepCopyInstance() {
+        return new ${myClassName}();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/SplitOptionParts.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/SplitOptionParts.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/SplitOptionParts.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,155 @@
+package ${glPackageBaseCommonCOptionParts};
+
+#set ($myClassName = "${glConditionOptionPartsSplitName}")
+
+/**
+ * The interface of condition-option.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+	protected String _split;
+	protected String _splitContainedDelimiter;
+    protected int _splitLimitCount;
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    public boolean isSplit() {
+        return _split != null;
+    }
+
+    public void splitBySpace() {
+        _split = " ";
+    }
+
+    public void splitBySpace(int splitLimitCount) {
+        _split = " ";
+        _splitLimitCount = splitLimitCount;
+    }
+
+    public void splitBySpaceContainsDoubleByte() {
+        _split = " ";
+        _splitContainedDelimiter = "\u3000";
+    }
+
+    public void splitBySpaceContainsDoubleByte(int splitLimitCount) {
+        _split = " ";
+        _splitContainedDelimiter = "\u3000";
+        _splitLimitCount = splitLimitCount;
+    }
+
+    public void splitByPipeLine() {
+        _split = "|";
+    }
+
+    public void splitByPipeLine(int splitLimitCount) {
+        _split = "|";
+        _splitLimitCount = splitLimitCount;
+    }
+
+    // =====================================================================================
+    //                                                                            Real Value
+    //                                                                            ==========
+    public String[] generateSplitValueArray(String value) {
+        if (value == null || value.trim().length() == 0) {
+            String msg = "The argument[value] should not be null of empty: " + value;
+            throw new IllegalArgumentException(msg);
+        }
+        value = repalceContainedDelimiterToRealDelimiter(value);
+        final java.util.StringTokenizer st = new java.util.StringTokenizer(value, _split);
+        final String[] tokenizedValues = new String[st.countTokens()];
+        int count = 0;
+        while (st.hasMoreTokens()) {
+            tokenizedValues[count] = st.nextToken();
+            count++;
+        }
+        final String[] values = removeInvalidValue(tokenizedValues);
+        if (_splitLimitCount > 0 && values.length > _splitLimitCount) {
+            final String[] realValues = new String[_splitLimitCount];
+            for (int i=0; i < values.length; i++) {
+                if (i == _splitLimitCount) {
+                    break;
+                }
+                realValues[i] = values[i];
+            }
+            return realValues;
+        } else {
+            return values;
+        }
+        
+    }
+
+    protected String repalceContainedDelimiterToRealDelimiter(String value) {
+        if (value == null || value.trim().length() == 0) {
+            return value;
+        }
+        if (_splitContainedDelimiter == null) {
+            return value;
+        }
+        if (_split == null) {
+            return value;
+        }
+        return replace(value, _splitContainedDelimiter, _split);
+    }
+
+    protected String[] removeInvalidValue(String[] values) {
+        final java.util.List${database.filterGenericsString('String')} ls = new java.util.ArrayList${database.filterGenericsString('String')}();
+        for (int i = 0; i < values.length; i++) {
+            final String value = values[i];
+            if (value == null || value.equals("")) {// Don't trim!!!
+                continue;
+            }
+            ls.add(value);
+        }
+        final String[] resultArray = new String[ls.size()];
+        for (int i = 0; i < ls.size(); i++) {
+            resultArray[i] = (String) ls.get(i);
+        }
+        return resultArray;
+    }
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+    protected final String replace(String text, String fromText,
+            String toText) {
+
+        if (text == null || fromText == null || toText == null) {
+            return null;
+        }
+        StringBuffer buf = new StringBuffer(100);
+        int pos = 0;
+        int pos2 = 0;
+        while (true) {
+            pos = text.indexOf(fromText, pos2);
+            if (pos == 0) {
+                buf.append(toText);
+                pos2 = fromText.length();
+            } else if (pos > 0) {
+                buf.append(text.substring(pos2, pos));
+                buf.append(toText);
+                pos2 = pos + fromText.length();
+            } else {
+                buf.append(text.substring(pos2));
+                break;
+            }
+        }
+        return buf.toString();
+    }
+
+    // =====================================================================================
+    //                                                                              DeepCopy
+    //                                                                              ========
+    public Object createDeepCopy() {
+        final ${myClassName} deepCopy = new ${myClassName}();
+        deepCopy._split = _split;
+        deepCopy._splitContainedDelimiter = _splitContainedDelimiter;
+        deepCopy._splitLimitCount = _splitLimitCount;
+        return deepCopy;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToSingleByteOptionParts.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToSingleByteOptionParts.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToSingleByteOptionParts.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,83 @@
+package ${glPackageBaseCommonCOptionParts};
+
+#set ($myClassName = "${glConditionOptionPartsToSingleByteName}")
+
+import ${glPackageBaseCommonHelperCharacter}.${glGeneralCharacterName};
+import ${glPackageBaseCommonHelperCharacterImpl}.${glGeneralCharacterImplName};
+
+/**
+ * The interface of condition-option.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected boolean _toSingleByteSpace;
+    protected boolean _toSingleByteAlphabetNumber;
+    protected boolean _toSingleByteAlphabetNumberMark;
+
+    private ${glGeneralCharacterName} _generalCharacter;
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    public boolean isToSingleByteSpace() {
+        return _toSingleByteSpace;
+    }
+    public void toSingleByteSpace() {
+        _toSingleByteSpace = true;
+    }
+
+    public void toSingleByteAlphabetNumber() {
+        _toSingleByteAlphabetNumber = true;
+    }
+
+    public void toSingleByteAlphabetNumberMark() {
+        _toSingleByteAlphabetNumberMark = true;
+    }
+
+    // =====================================================================================
+    //                                                                            Real Value
+    //                                                                            ==========
+    public String generateRealValue(String value) {
+        if (value == null || value.trim().length() == 0) {
+            String msg = "The argument[value] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+
+        // To Single Byte
+        if (_toSingleByteSpace) {
+            value = (value != null ? value.replaceAll("\u3000", " ") : value);
+        }
+        if (_toSingleByteAlphabetNumberMark) {
+            value = getGeneralCharacter().toSingleByteAlphabetNumberMark(value);
+        } else if (_toSingleByteAlphabetNumber) {
+            value = getGeneralCharacter().toSingleByteAlphabetNumber(value);
+        }
+        return value;
+    }
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+    protected ${glGeneralCharacterName} getGeneralCharacter() {
+        if (_generalCharacter == null) {
+            _generalCharacter = new ${glGeneralCharacterImplName}();
+        }
+        return _generalCharacter;
+    }
+
+    // =====================================================================================
+    //                                                                              DeepCopy
+    //                                                                              ========
+    public Object createDeepCopy() {
+        final ${myClassName} deepCopy = new ${myClassName}();
+        deepCopy._toSingleByteSpace = _toSingleByteSpace;
+        deepCopy._toSingleByteAlphabetNumber = _toSingleByteAlphabetNumber;
+        deepCopy._toSingleByteAlphabetNumberMark = _toSingleByteAlphabetNumberMark;
+        return deepCopy;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToUpperLowerCaseOptionParts.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToUpperLowerCaseOptionParts.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/ToUpperLowerCaseOptionParts.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,59 @@
+package ${glPackageBaseCommonCOptionParts};
+
+#set ($myClassName = "${glConditionOptionPartsToUpperLowerCaseName}")
+
+/**
+ * The class of condition-option-parts about toUpperCase/toLowerCase.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected boolean _toUpperCase;
+    protected boolean _toLowerCase;
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    public void toUpperCase() {
+        _toUpperCase = true;
+        _toLowerCase = false;
+    }
+
+    public void toLowerCase() {
+        _toUpperCase = false;
+        _toLowerCase = true;
+    }
+
+    // =====================================================================================
+    //                                                                            Real Value
+    //                                                                            ==========
+    public String generateRealValue(String value) {
+        if (value == null || value.trim().length() == 0) {
+            String msg = "The argument[value] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+
+        // To Upper/Lower Case
+        if (_toUpperCase) {
+            value = (value != null ? value.toUpperCase() : value);
+        }
+        if (_toLowerCase) {
+            value = (value != null ? value.toLowerCase() : value);
+        }
+        return value;
+    }
+
+    // =====================================================================================
+    //                                                                              DeepCopy
+    //                                                                              ========
+    public Object createDeepCopy() {
+        final ${myClassName} deepCopy = new ${myClassName}();
+        deepCopy._toUpperCase = _toUpperCase;
+        deepCopy._toLowerCase = _toLowerCase;
+        return deepCopy;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/local/JapaneseOptionPartsAgent.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/local/JapaneseOptionPartsAgent.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/coption/parts/local/JapaneseOptionPartsAgent.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,82 @@
+package ${glPackageBaseCommonCOptionPartsLocal};
+
+#set ($myClassName = "${glConditionOptionPartsAgentJapaneseName}")
+
+import ${glPackageBaseCommonHelperCharacter}.${glJapaneseCharacterName};
+import ${glPackageBaseCommonHelperCharacterImpl}.${glJapaneseCharacterImplName};
+
+/**
+ * The class of condition-option-parts-agent.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected boolean _toDoubleByteKatakana;
+    protected boolean _removeLastLongVowel;
+    private ${glJapaneseCharacterName} _japaneseCharacter;
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    public boolean isToDoubleByteKatakana() {
+        return _toDoubleByteKatakana;
+    }
+
+    public void toDoubleByteKatakana() {
+        _toDoubleByteKatakana = true;
+    }
+
+    public boolean isRemoveLastLongVowel() {
+        return _removeLastLongVowel;
+    }
+    public void removeLastLongVowel() {
+        _removeLastLongVowel = true;
+    }
+
+    // =====================================================================================
+    //                                                                            Real Value
+    //                                                                            ==========
+    public String generateRealValue(String value) {
+        if (value == null || value.trim().length() == 0) {
+            String msg = "The argument[value] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+
+        // To Double Byte
+        if (_toDoubleByteKatakana) {
+            value = getJapaneseCharacter().toDoubleByteKatakana(value);
+        }
+
+        // Remove
+        if (_removeLastLongVowel) {
+            if (value != null && value.endsWith("\u30fc")) {
+                value = value.substring(0, value.length() - "\u30fc".length());
+            }
+        }
+        return value;
+    }
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+    protected ${glJapaneseCharacterName} getJapaneseCharacter() {
+        if (_japaneseCharacter == null) {
+            _japaneseCharacter = new ${glJapaneseCharacterImplName}();
+        }
+        return _japaneseCharacter;
+    }
+
+    // =====================================================================================
+    //                                                                              DeepCopy
+    //                                                                              ========
+    public Object createDeepCopy() {
+        final ${myClassName} deepCopy = new ${myClassName}();
+        deepCopy._toDoubleByteKatakana = _toDoubleByteKatakana;
+        deepCopy._removeLastLongVowel = _removeLastLongVowel;
+        return deepCopy;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/cvalue/ConditionValue.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/cvalue/ConditionValue.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/cvalue/ConditionValue.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,1186 @@
+package ${glPackageBaseCommonCValue};
+
+#set ($myClassName = "${glConditionValueName}")
+
+import java.util.List;
+
+import ${glPackageBaseCommonCOption}.${glConditionOptionLikeSearchName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionInScopeName};
+
+/**
+ * Condition value.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // ===================================================================================
+    //                                                                               Equal
+    //                                                                               =====
+    /** Value of equal. */
+    protected Object _equalValue;
+
+    /**
+     * Get the value of equal.
+     * 
+     * @return The value of equal. (Nullable)
+     */
+    public Object getEqual() {
+        return filterValue(_equalValue);
+    }
+
+    /**
+     * Set the value of equal.
+     * 
+     * @param value The value of equal. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setEqual(Object value) {
+        _equalValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of equal?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasEqual() {
+        return _equalValue != null;
+    }
+
+    /**
+     * Does the value equal the value of equal?
+     * 
+     * @param value The value of equal. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalEqual(Object value) {
+        return hasEqual() ? _equalValue.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of equal.
+     * 
+     * @param value The value of equal. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideEqual(Object value) {
+        _equalValue = value;
+        return this;
+    }
+
+    /** Location of equal. */
+    protected String _equalLocation;
+
+    /**
+     * Get the location of equal.
+     * 
+     * @return The location of equal. (Nullable)
+     */
+    public String getEqualLocation() {
+        return _equalLocation;
+    }
+
+    /**
+     * Set the location of equal.
+     * 
+     * @param location The location of equal. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setEqualLocation(String location) {
+        _equalLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                           Not Equal
+    //                                                                           =========
+    /** Value of notEqual. */
+    protected Object _notEqualValue;
+
+    /**
+     * Get the value of notEqual.
+     * 
+     * @return The value of notEqual. (Nullable)
+     */
+    public Object getNotEqual() {
+        return filterValue(_notEqualValue);
+    }
+
+    /**
+     * Set the value of notEqual.
+     * 
+     * @param value The value of notEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setNotEqual(Object value) {
+        _notEqualValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of notEqual?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasNotEqual() {
+        return _notEqualValue != null;
+    }
+
+    /**
+     * Does the value equal the value of notEqual?
+     * 
+     * @param value The value of notEqual. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalNotEqual(Object value) {
+        return hasNotEqual() ? _notEqualValue.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of notEqual.
+     * 
+     * @param value The value of notEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideNotEqual(Object value) {
+        _notEqualValue = value;
+        return this;
+    }
+
+    /** Location of notEqual. */
+    protected String _notEqualLocation;
+
+    /**
+     * Get the location of notEqual.
+     * 
+     * @return The location of notEqual. (Nullable)
+     */
+    public String getNotEqualLocation() {
+        return _notEqualLocation;
+    }
+
+    /**
+     * Set the location of notEqual.
+     * 
+     * @param location The location of notEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setNotEqualLocation(String location) {
+        _notEqualLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                        Greater Than
+    //                                                                        ============
+    /** Value of greaterThan. */
+    protected Object _greaterThanValue;
+
+    /**
+     * Get the value of greaterThan.
+     * 
+     * @return The value of greaterThan. (Nullable)
+     */
+    public Object getGreaterThan() {
+        return filterValue(_greaterThanValue);
+    }
+
+    /**
+     * Set the value of greaterThan.
+     * 
+     * @param value The value of greaterThan. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setGreaterThan(Object value) {
+        _greaterThanValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of greaterThan?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasGreaterThan() {
+        return _greaterThanValue != null;
+    }
+
+    /**
+     * Does the value equal the value of greaterThan?
+     * 
+     * @param value The value of greaterThan. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalGreaterThan(Object value) {
+        return hasGreaterThan() ? _greaterThanValue.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of greaterThan.
+     * 
+     * @param value The value of greaterThan. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideGreaterThan(Object value) {
+        _greaterThanValue = value;
+        return this;
+    }
+
+    /** Location of GreaterThan. */
+    protected String _greaterThanLocation;
+
+    /**
+     * Get the location of greaterThan.
+     * 
+     * @return The location of greaterThan. (Nullable)
+     */
+    public String getGreaterThanLocation() {
+        return _greaterThanLocation;
+    }
+
+    /**
+     * Set the location of greaterThan.
+     * 
+     * @param location The location of greaterThan. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setGreaterThanLocation(String location) {
+        _greaterThanLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                           Less Than
+    //                                                                           =========
+    /** Value of lessThan. */
+    protected Object _lessThanValue;
+
+    /**
+     * Get the value of lessThan.
+     * 
+     * @return The value of lessThan. (Nullable)
+     */
+    public Object getLessThan() {
+        return filterValue(_lessThanValue);
+    }
+
+    /**
+     * Set the value of lessThan.
+     * 
+     * @param value The value of lessThan. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setLessThan(Object value) {
+        _lessThanValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of lessThan?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasLessThan() {
+        return _lessThanValue != null;
+    }
+
+    /**
+     * Does the value equal the value of lessThan?
+     * 
+     * @param value The value of lessThan. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalLessThan(Object value) {
+        return hasLessThan() ? _lessThanValue.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of lessThan.
+     * 
+     * @param value The value of lessThan. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideLessThan(Object value) {
+        _lessThanValue = value;
+        return this;
+    }
+
+    /** Location of lessThan. */
+    protected String _lessThanLocation;
+
+    /**
+     * Get the location of lessThan.
+     * 
+     * @return The location of lessThan. (Nullable)
+     */
+    public String getLessThanLocation() {
+        return _lessThanLocation;
+    }
+
+    /**
+     * Set the location of lessThan.
+     * 
+     * @param location The location of lessThan. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setLessThanLocation(String location) {
+        _lessThanLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                       Greater Equal
+    //                                                                       =============
+    /** Value of greaterEqual. */
+    protected Object _greaterEqualValue;
+
+    /**
+     * Get the value of greaterEqual.
+     * 
+     * @return The value of greaterEqual. (Nullable)
+     */
+    public Object getGreaterEqual() {
+        return filterValue(_greaterEqualValue);
+    }
+
+    /**
+     * Set the value of greaterEqual.
+     * 
+     * @param value The value of greaterEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setGreaterEqual(Object value) {
+        _greaterEqualValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of greaterEqual?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasGreaterEqual() {
+        return _greaterEqualValue != null;
+    }
+
+    /**
+     * Does the value equal the value of greaterEqual?
+     * 
+     * @param value The value of greaterEqual. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalGreaterEqual(Object value) {
+        return hasGreaterEqual() ? _greaterEqualValue.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of greaterEqual.
+     * 
+     * @param value The value of greaterEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideGreaterEqual(Object value) {
+        _greaterEqualValue = value;
+        return this;
+    }
+
+    /** Location of greaterEqual. */
+    protected String _greaterEqualLocation;
+
+    /**
+     * Get the location of greaterEqual.
+     * 
+     * @return The location of greaterEqual. (Nullable)
+     */
+    public String getGreaterEqualLocation() {
+        return _greaterEqualLocation;
+    }
+
+    /**
+     * Set the location of greaterEqual.
+     * 
+     * @param location The location of greaterEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setGreaterEqualLocation(String location) {
+        _greaterEqualLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                          Less Equal
+    //                                                                          ==========
+    /** Value of lessEqual. */
+    protected Object _lessEqualValue;
+
+    /**
+     * Get the value of lessEqual.
+     * 
+     * @return The value of lessEqual. (Nullable)
+     */
+    public Object getLessEqual() {
+        return filterValue(_lessEqualValue);
+    }
+
+    /**
+     * Set the value of lessEqual.
+     * 
+     * @param value The value of lessEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setLessEqual(Object value) {
+        _lessEqualValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of lessEqual?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasLessEqual() {
+        return _lessEqualValue != null;
+    }
+
+    /**
+     * Does the value equal the value of lessEqual?
+     * 
+     * @param value The value of lessEqual. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalLessEqual(Object value) {
+        return hasLessEqual() ? _lessEqualValue.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of lessEqual.
+     * 
+     * @param value The value of lessEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideLessEqual(Object value) {
+        _lessEqualValue = value;
+        return this;
+    }
+
+    /** Location of lessEqual. */
+    protected String _lessEqualLocation;
+
+    /**
+     * Get the location of lessEqual.
+     * 
+     * @return The location of lessEqual. (Nullable)
+     */
+    public String getLessEqualLocation() {
+        return _lessEqualLocation;
+    }
+
+    /**
+     * Set the location of lessEqual.
+     * 
+     * @param location The location of lessEqual. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setLessEqualLocation(String location) {
+        _lessEqualLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                       Prefix Search
+    //                                                                       =============
+    /** Value of prefixSearch. */
+    protected Object _prefixSearch;
+
+    /**
+     * Get the value of prefixSearch.
+     * 
+     * @return The value of prefixSearch. (Nullable)
+     */
+    public Object getPrefixSearch() {
+        return filterValue(_prefixSearch);
+    }
+
+    /**
+     * Set the value of prefixSearch.
+     * 
+     * @param value The value of prefixSearch. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setPrefixSearch(Object value) {
+        _prefixSearch = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of prefixSearch?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasPrefixSearch() {
+        return _prefixSearch != null;
+    }
+
+    /**
+     * Does the value equal the value of prefixSearch?
+     * 
+     * @param value The value of prefixSearch. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalPrefixSearch(Object value) {
+        return hasPrefixSearch() ? _prefixSearch.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of prefixSearch.
+     * 
+     * @param value The value of prefixSearch. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overridePrefixSearch(Object value) {
+        _prefixSearch = value;
+        return this;
+    }
+
+    /** Location of prefixSearch. */
+    protected String _prefixSearchLocation;
+
+    /**
+     * Get the location of prefixSearch.
+     * 
+     * @return The location of prefixSearch. (Nullable)
+     */
+    public String getPrefixSearchLocation() {
+        return _prefixSearchLocation;
+    }
+
+    /**
+     * Set the location of prefixSearch.
+     * 
+     * @param location The location of prefixSearch. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setPrefixSearchLocation(String location) {
+        _prefixSearchLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                         Like Search
+    //                                                                         ===========
+    /** Value of likeSearch. */
+    protected java.util.List${database.filterGenericsString('LikeSearchValue')} _likeSearch;
+
+    /** Value of likeSearch for spare. */
+    protected java.util.List${database.filterGenericsString('LikeSearchValue')} _likeSearch4Spare;
+
+    /**
+     * Get the value of likeSearch.
+     * 
+     * @return The value of likeSearch. (Nullable)
+     */
+    public String getLikeSearch() {
+        if (_likeSearch == null) {
+            return null;
+        }
+        if (_likeSearch.isEmpty() && !_likeSearch4Spare.isEmpty()) {
+            for (int index=0; index < _likeSearch4Spare.size(); index++) {
+                _likeSearch.add(_likeSearch4Spare.get(index));
+            }
+        }
+        final LikeSearchValue likeSearchValue = (LikeSearchValue)_likeSearch.remove(0);
+        return (String)filterValue(likeSearchValue.generateRealValue());
+    }
+
+    /**
+     * Set the value of likeSearch.
+     * 
+     * @param value The value of likeSearch. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setLikeSearch(String value, ${glConditionOptionLikeSearchName} option) {
+        if (_likeSearch == null) {
+            _likeSearch = new java.util.ArrayList${database.filterGenericsString('LikeSearchValue')}();
+            _likeSearch4Spare= new java.util.ArrayList${database.filterGenericsString('LikeSearchValue')}();
+        }
+        if (_likeSearch.isEmpty() && !_likeSearch4Spare.isEmpty()) {
+            for (int index=0; index < _likeSearch4Spare.size(); index++) {
+                _likeSearch.add(_likeSearch4Spare.get(index));
+            }
+        }
+        final LikeSearchValue likeSearchValue = new LikeSearchValue(value, option);
+        _likeSearch.add(likeSearchValue);
+        _likeSearch4Spare.add(likeSearchValue);
+        return this;
+    }
+
+    /** Location of likeSearch. */
+    protected String _likeSearchLocation;
+
+    /**
+     * Get the location of likeSearch.
+     * 
+     * @return The location of likeSearch. (Nullable)
+     */
+    public String getLikeSearchLocation() {
+        return _likeSearchLocation;
+    }
+
+    /**
+     * Set the location of likeSearch.
+     * 
+     * @param location The location of likeSearch. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setLikeSearchLocation(String location) {
+        _likeSearchLocation = location;
+        return this;
+    }
+
+    protected static class LikeSearchValue {
+        protected String _value;
+        protected ${glConditionOptionLikeSearchName} _option;
+        public LikeSearchValue(String value, ${glConditionOptionLikeSearchName} option) {
+            _value = value;
+            _option = option;
+        }
+        public String getValue() {
+            return _value;
+        }
+        public ${glConditionOptionLikeSearchName} getOption() {
+            return _option;
+        }
+        public String generateRealValue() {
+            if (_option == null) {
+                return _value;
+            }
+            return _option.generateRealValue(_value);
+        }
+    }
+
+    // ===================================================================================
+    //                                                                            In Scope
+    //                                                                            ========
+    /** Value of inScope. */
+    protected List _inScope;
+
+    protected ${glConditionOptionInScopeName} _inScopeOption;
+
+    /**
+     * Get the value of inScope.
+     * 
+     * @return The value of inScope. (Nullable)
+     */
+    public List getInScope() {
+        if (_inScopeOption != null) {
+            return filterValue(_inScopeOption.generateRealValueList(_inScope));
+        }
+        return filterValue(_inScope);
+    }
+
+    /**
+     * Set the value of inScope.
+     * 
+     * @param value The value of inScope. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setInScope(List value) {
+        _inScope = value;
+        return this;
+    }
+
+    public ${myClassName} setInScope(List value, ${glConditionOptionInScopeName} option) {
+        _inScope = value;
+        _inScopeOption = option;
+        return this;
+    }
+
+    /**
+     * Does it has the value of inScope?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasInScope() {
+        return _inScope != null;
+    }
+
+    /**
+     * Does the value equal the value of inScope?
+     * 
+     * @param value The value of inScope. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalInScope(List value) {
+        return hasInScope() ? _inScope.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of inScope.
+     * 
+     * @param value The value of inScope. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideInScope(List value) {
+        _inScope = value;
+        return this;
+    }
+
+    /** Location of InScope. */
+    protected String _inScopeLocation;
+
+    /**
+     * Get the location of inScope.
+     * 
+     * @return The location of inScope. (Nullable)
+     */
+    public String getInScopeLocation() {
+        return _inScopeLocation;
+    }
+
+    /**
+     * Set the location of inScope.
+     * 
+     * @param location The location of inScope. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setInScopeLocation(String location) {
+        _inScopeLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                        Not In Scope
+    //                                                                        ============
+    /** Value of notInScope. */
+    protected List _notInScope;
+
+    /**
+     * Get the value of notInScope.
+     * 
+     * @return The value of notInScope. (Nullable)
+     */
+    public List getNotInScope() {
+        return filterValue(_notInScope);
+    }
+
+    /**
+     * Set the value of notInScope.
+     * 
+     * @param value The value of notInScope. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setNotInScope(List value) {
+        _notInScope = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of inNotScope?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasNotInScope() {
+        return _notInScope != null;
+    }
+
+    /**
+     * Does the value equal the value of inNotScope?
+     * 
+     * @param value The value of inNotScope. (Nullable)
+     * @return Determination. (NotNull)
+     */
+    public boolean equalNotInScope(List value) {
+        return hasNotInScope() ? _notInScope.equals(value) : value == null;
+    }
+
+    /**
+     * Override the value of inNotScope.
+     * 
+     * @param value The value of inNotScope. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} overrideNotInScope(List value) {
+        _notInScope = value;
+        return this;
+    }
+
+    /** Location of notInScope. */
+    protected String _notInScopeLocation;
+
+    /**
+     * Get the location of notInScope.
+     * 
+     * @return The location of notInScope. (Nullable)
+     */
+    public String getNotInScopeLocation() {
+        return _notInScopeLocation;
+    }
+
+    /**
+     * Set the location of notInScope.
+     * 
+     * @param location The location of notInScope. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setNotInScopeLocation(String location) {
+        _notInScopeLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                             Is Null
+    //                                                                             =======
+    /** Value of isNull. */
+    protected Object _isNullValue;
+
+    /**
+     * Get the value of isNull.
+     * 
+     * @return The value of isNull. (Nullable)
+     */
+    public Object getIsNull() {
+        return _isNullValue;
+    }
+
+    /**
+     * Set the value of isNull.
+     * 
+     * @param value The value of isNull. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setIsNull(Object value) {
+        _isNullValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of isNull?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasIsNull() {
+        return _isNullValue != null;
+    }
+
+    /** Location of isNull. */
+    protected String _isNullLocation;
+
+    /**
+     * Get the location of isNull.
+     * 
+     * @return The location of isNull. (Nullable)
+     */
+    public String getIsNullLocation() {
+        return _isNullLocation;
+    }
+
+    /**
+     * Set the location of isNull.
+     * 
+     * @param location The location of isNull. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setIsNullLocation(String location) {
+        _isNullLocation = location;
+        return this;
+    }
+
+    // ===================================================================================
+    //                                                                         Is Not Null
+    //                                                                         ===========
+    /** Value of isNotNull. */
+    protected Object _isNotNullValue;
+
+    /**
+     * Get the value of isNotNull.
+     * 
+     * @return The value of isNotNull. (Nullable)
+     */
+    public Object getIsNotNull() {
+        return _isNotNullValue;
+    }
+
+    /**
+     * Set the value of isNotNull.
+     * 
+     * @param value The value of isNotNull. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setIsNotNull(Object value) {
+        _isNotNullValue = value;
+        return this;
+    }
+
+    /**
+     * Does it has the value of isNotNull?
+     * 
+     * @return Determination. (NotNull)
+     */
+    public boolean hasIsNotNull() {
+        return _isNotNullValue != null;
+    }
+
+    /** Location of isNotNull. */
+    protected String _isNotNullLocation;
+
+    /**
+     * Get the location of isNotNull.
+     * 
+     * @return The location of isNotNull. (Nullable)
+     */
+    public String getIsNotNullLocation() {
+        return _isNotNullLocation;
+    }
+
+    /**
+     * Set the location of isNotNull.
+     * 
+     * @param location The location of isNotNull. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} setIsNotNullLocation(String location) {
+        _isNotNullLocation = location;
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                                Filter
+    //                                                                                ======
+    /**
+     * Filter value.
+     * If the value is instance of java.util.Date or java.util.Calendar, returns value as java.sql.Date.
+     * 
+     * @param value Value. (Nullable)
+     * @return Filtered value. (Nullable)
+     */
+    protected Object filterValue(Object value) {
+        if (value == null) {
+            return value;
+        }
+        if (value instanceof java.sql.Timestamp) {
+            return value;
+        }
+        if (value instanceof java.util.Date || value instanceof java.util.Calendar) {
+            return SqlDateConversionUtil.toDate(value);
+        } else {
+            return value;
+        }
+    }
+
+    /**
+     * Filter value.
+     * If the value is instance of java.util.Date or java.util.Calendar, returns value as java.sql.Date.
+     * 
+     * @param valueList Value-list. (Nullable)
+     * @return Filtered value-list. (Nullable)
+     */
+    protected java.util.List filterValue(java.util.List valueList) {
+        if (valueList == null || valueList.isEmpty()) {
+            return valueList;
+        }
+        final List${database.filterGenericsString("Object")} resultList = new java.util.ArrayList${database.filterGenericsString("Object")}();
+        for (final java.util.Iterator ite = valueList.iterator(); ite.hasNext(); ) {
+            Object value = ite.next();
+            resultList.add(filterValue(value));
+        }
+        return resultList;
+    }
+
+    protected static class SqlDateConversionUtil {
+
+        private SqlDateConversionUtil() {
+        }
+
+        public static java.sql.Date toDate(Object o) {
+            return toDate(o, null);
+        }
+
+        public static java.sql.Date toDate(Object o, String pattern) {
+            if (o instanceof java.sql.Date) {
+                return (java.sql.Date) o;
+            }
+            java.util.Date date = DateConversionUtil.toDate(o, pattern);
+            if (date != null) {
+                return new java.sql.Date(date.getTime());
+            }
+            return null;
+        }
+    }
+
+    protected static class DateConversionUtil {
+
+        private DateConversionUtil() {
+        }
+
+        public static java.util.Date toDate(Object o) {
+            return toDate(o, null);
+        }
+
+        public static java.util.Date toDate(Object o, String pattern) {
+            if (o == null) {
+                return null;
+            } else if (o instanceof String) {
+                return toDate((String) o, pattern);
+            } else if (o instanceof java.util.Date) {
+                return (java.util.Date) o;
+            } else if (o instanceof java.util.Calendar) {
+                return ((java.util.Calendar) o).getTime();
+            } else {
+                return toDate(o.toString(), pattern);
+            }
+        }
+
+        public static java.util.Date toDate(String s, String pattern) {
+            return toDate(s, pattern, java.util.Locale.getDefault());
+        }
+
+        public static java.util.Date toDate(String s, String pattern, java.util.Locale locale) {
+            java.text.SimpleDateFormat sdf = getDateFormat(s, pattern, locale);
+            try {
+                return sdf.parse(s);
+            } catch (java.text.ParseException ex) {
+                throw new RuntimeException(ex);
+            }
+        }
+
+        public static java.text.SimpleDateFormat getDateFormat(String s, String pattern,
+                java.util.Locale locale) {
+            if (pattern != null) {
+                return new java.text.SimpleDateFormat(pattern);
+            }
+            return getDateFormat(s, locale);
+        }
+
+        public static java.text.SimpleDateFormat getDateFormat(String s, java.util.Locale locale) {
+            String pattern = getPattern(locale);
+            String shortPattern = removeDelimiter(pattern);
+            String delimitor = findDelimiter(s);
+            if (delimitor == null) {
+                if (s.length() == shortPattern.length()) {
+                    return new java.text.SimpleDateFormat(shortPattern);
+                }
+                if (s.length() == shortPattern.length() + 2) {
+                    return new java.text.SimpleDateFormat(InternalStringUtil.replace(shortPattern,
+                            "yy", "yyyy"));
+                }
+            } else {
+                String[] array = InternalStringUtil.split(s, delimitor);
+                for (int i = 0; i < array.length; ++i) {
+                    if (array[i].length() == 4) {
+                        pattern = InternalStringUtil.replace(pattern, "yy", "yyyy");
+                        break;
+                    }
+                }
+                return new java.text.SimpleDateFormat(pattern);
+            }
+            return new java.text.SimpleDateFormat();
+        }
+
+        public static java.text.SimpleDateFormat getDateFormat(java.util.Locale locale) {
+            return new java.text.SimpleDateFormat(getPattern(locale));
+        }
+
+        public static java.text.SimpleDateFormat getY4DateFormat(java.util.Locale locale) {
+            return new java.text.SimpleDateFormat(getY4Pattern(locale));
+        }
+
+        public static String getY4Pattern(java.util.Locale locale) {
+            String pattern = getPattern(locale);
+            if (pattern.indexOf("yyyy") < 0) {
+                pattern = InternalStringUtil.replace(pattern, "yy", "yyyy");
+            }
+            return pattern;
+        }
+
+        public static String getPattern(java.util.Locale locale) {
+            java.text.SimpleDateFormat df = (java.text.SimpleDateFormat) java.text.DateFormat.getDateInstance(
+                    java.text.DateFormat.SHORT, locale);
+            String pattern = df.toPattern();
+            int index = pattern.indexOf(' ');
+            if (index > 0) {
+                pattern = pattern.substring(0, index);
+            }
+            if (pattern.indexOf("MM") < 0) {
+                pattern = InternalStringUtil.replace(pattern, "M", "MM");
+            }
+            if (pattern.indexOf("dd") < 0) {
+                pattern = InternalStringUtil.replace(pattern, "d", "dd");
+            }
+            return pattern;
+        }
+
+        public static String findDelimiter(String value) {
+            for (int i = 0; i < value.length(); ++i) {
+                char c = value.charAt(i);
+                if (Character.isDigit(c)) {
+                    continue;
+                }
+                return Character.toString(c);
+            }
+            return null;
+        }
+
+        public static String removeDelimiter(String pattern) {
+            StringBuffer buf = new StringBuffer();
+            for (int i = 0; i < pattern.length(); ++i) {
+                char c = pattern.charAt(i);
+                if (c == 'y' || c == 'M' || c == 'd') {
+                    buf.append(c);
+                }
+            }
+            return buf.toString();
+        }
+    }
+
+    protected static class InternalStringUtil {
+
+        public static final String[] EMPTY_STRINGS = new String[0];
+
+        private InternalStringUtil() {
+        }
+
+        public static final boolean isEmpty(String text) {
+            return text == null || text.length() == 0;
+        }
+
+        public static final String replace(String text, String fromText,
+                String toText) {
+
+            if (text == null || fromText == null || toText == null) {
+                return null;
+            }
+            StringBuffer buf = new StringBuffer(100);
+            int pos = 0;
+            int pos2 = 0;
+            while (true) {
+                pos = text.indexOf(fromText, pos2);
+                if (pos == 0) {
+                    buf.append(toText);
+                    pos2 = fromText.length();
+                } else if (pos > 0) {
+                    buf.append(text.substring(pos2, pos));
+                    buf.append(toText);
+                    pos2 = pos + fromText.length();
+                } else {
+                    buf.append(text.substring(pos2));
+                    break;
+                }
+            }
+            return buf.toString();
+        }
+
+        public static String[] split(String str, String delim) {
+            if (str == null) {
+                return EMPTY_STRINGS;
+            }
+            java.util.List${database.filterGenericsString('String')} list = new java.util.ArrayList${database.filterGenericsString('String')}();
+            java.util.StringTokenizer st = new java.util.StringTokenizer(str, delim);
+            while (st.hasMoreElements()) {
+                list.add(st.nextToken());
+            }
+            return (String[]) list.toArray(new String[list.size()]);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,42 @@
+package ${glPackageBaseCommonCBeanGrouping};
+
+/**
+ * The class of option for grouping making.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glGroupingOptionName}<ENTITY> {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected int _columnCount;
+
+    protected ${glGroupingRowEndDeterminerName}<ENTITY> _groupingRowEndDeterminer;
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    public ${glGroupingOptionName}(int columnCount) {
+        _columnCount = columnCount;
+    }
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public int getColumnCount() {
+        return this._columnCount;
+    }
+
+    public ${glGroupingRowEndDeterminerName}<ENTITY> getGroupingRowEndDeterminer() {
+        return this._groupingRowEndDeterminer;
+    }
+
+    public void setGroupingRowEndDeterminer(${glGroupingRowEndDeterminerName}<ENTITY> groupingRowEndDeterminer) {
+        this._groupingRowEndDeterminer = groupingRowEndDeterminer;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowEndDeterminer.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowEndDeterminer.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowEndDeterminer.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${glPackageBaseCommonCBeanGrouping};
+
+/**
+ * The interface of grouping switch point determiner.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glGroupingRowEndDeterminerName}<ENTITY> {
+
+    public boolean determine(int columnIndex, int columnCount, ${glGroupingRowResourceName}<ENTITY> rowResource, ENTITY nextEntity);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowResource.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowResource.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowResource.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,29 @@
+package ${glPackageBaseCommonCBeanGrouping};
+
+/**
+ * The class of row resource for grouping making.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glGroupingRowResourceName}<ENTITY> {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected java.util.List<ENTITY> _groupingRowList = new java.util.ArrayList<ENTITY>();
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public java.util.List<ENTITY> getGroupingRowList() {
+        return this._groupingRowList;
+    }
+
+    public void addGroupingRowList(ENTITY groupingRow) {
+        this._groupingRowList.add(groupingRow);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowSetupper.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowSetupper.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/grouping/GroupingRowSetupper.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,17 @@
+package ${glPackageBaseCommonCBeanGrouping};
+
+/**
+ * The interface of grouping row setupper.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glGroupingRowSetupperName}<ROW, ENTITY> {
+
+    /**
+     * Set up grouping row object.
+     * 
+     * @param groupingRowResource Grouping row resource. (NotNull)
+     * @return Grouping row object. (NotNull)
+     */
+    public ROW setup(${glGroupingRowResourceName}<ENTITY> groupingRowResource);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/mapping/EntityDtoMapper.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/mapping/EntityDtoMapper.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/mapping/EntityDtoMapper.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,17 @@
+package ${glPackageBaseCommonCBeanMapping};
+
+/**
+ * The interface of entity converter.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glEntityDtoMapperName}<ENTITY, DTO> {
+
+    /**
+     * Map entity to data transfer object.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Data transfer object. (NotNull)
+     */
+    public DTO map(ENTITY entity);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/AbstractSqlClause.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/AbstractSqlClause.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/AbstractSqlClause.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,1009 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseAbstractName}")
+
+import ${glPackageBaseCommonCKey}.*;
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The abstract class of SqlClause.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${myClassName} implements ${glSqlClauseInterfaceName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** Target table name. */
+    protected final String _tableName;
+
+    /** Included select column map. */
+    protected java.util.Map${database.filterGenericsString('String, String')} _includedSelectColumnMap = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+
+    /** Outer join map. */
+    protected java.util.Map${database.filterGenericsString('String, LeftOuterJoinInfo')} _outerJoinMap = new java.util.LinkedHashMap${database.filterGenericsString('String, LeftOuterJoinInfo')}();
+
+    /** Where list. */
+    protected java.util.List${database.filterGenericsString('String')} _whereList = new java.util.ArrayList${database.filterGenericsString('String')}();
+
+    /** Inline where list for BaseTable. */
+    protected java.util.List${database.filterGenericsString('String')} _baseTableInlineWhereList = new java.util.ArrayList${database.filterGenericsString('String')}();
+
+    /** Order-by clause. */
+    protected final ${glOrderByClauseName} _orderByClause = new ${glOrderByClauseName}();
+
+    /** Order-by clause. */
+    protected java.util.Map${database.filterGenericsString('String, String')} _selectClauseColumnAliasMap;
+
+    /** Union clause list. */
+    protected java.util.List${database.filterGenericsString('UnionQueryInfo')} _unionQueryInfoList = new java.util.ArrayList${database.filterGenericsString('UnionQueryInfo')}();
+
+    /** Is incoluded-select-column effective? Default value is false. */
+    protected boolean _isIncludedSelectColumnEffective = false;
+
+    /** Is order-by effective? Default value is false. */
+    protected boolean _isOrderByEffective = false;
+
+    /** Fetch start index. (for fetchXxx()) */
+    protected int _fetchStartIndex = 0;
+
+    /** Fetch size. (for fetchXxx()) */
+    protected int _fetchSize = 0;
+
+    /** Fetch page number. (for fetchXxx()) This value should be plus. */
+    protected int _fetchPageNumber = 1;
+
+    /** Is fetch-narrowing effective? Default value is false. */
+    protected boolean _isFetchScopeEffective = false;
+
+    /** Is additional condition as or effective?*/
+    protected boolean _isAdditionalConditionAsOrEffective = false;
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     * 
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        if (tableName == null) {
+            String msg = "Argument[tableName] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        _tableName = tableName;
+    }
+
+    // =====================================================================================
+    //                                                                         Select-Clause
+    //                                                                         =============
+    public void setSelectClauseColumnAliasMap(java.util.Map${database.filterGenericsString('String, String')} selectClauseColumnAliasMap) {
+        _selectClauseColumnAliasMap = selectClauseColumnAliasMap;
+    }
+
+    // =====================================================================================
+    //                                                                                Clause
+    //                                                                                ======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Clause string. (NotNull)
+     */
+    public String getClause() {
+        final StringBuffer sb = new StringBuffer(128);
+        sb.append(INCLUDE_SELECT_CLAUSE_MARK);
+        sb.append(" ");
+        if (_isIncludedSelectColumnEffective && !_includedSelectColumnMap.isEmpty()) {
+            sb.append(" ").append(getIncludedSelectColumnClause());
+        }
+        sb.append(" ");
+        sb.append(getFromClause());
+        sb.append(" ");
+        sb.append(getFromHint());
+        sb.append(" ");
+        sb.append(getWhereClause());
+        sb.append(getUnionClause());
+        if (_isOrderByEffective && !_orderByClause.isEmpty()) {
+            sb.append(" ");
+            sb.append(getOrderByClause());
+        }
+        sb.append(" ");
+        sb.append(getSqlSuffix());
+        return sb.toString();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Clause string. (NotNull)
+     */
+    public String getClauseWithoutIncludedOrderBySqlSuffix() {
+        final StringBuffer sb = new StringBuffer(128);
+        sb.append(INCLUDE_SELECT_CLAUSE_MARK);
+        sb.append(" ");
+        sb.append(getFromClause());
+        sb.append(" ");
+        sb.append(getFromHint());
+        sb.append(" ");
+        sb.append(getWhereClause());
+        sb.append(getUnionClause());
+        return sb.toString();
+    }
+
+    protected String getUnionClause() {
+        final StringBuffer sb = new StringBuffer();
+        for (final java.util.Iterator ite = _unionQueryInfoList.iterator(); ite.hasNext(); ) {
+            final UnionQueryInfo unionQueryInfo = (UnionQueryInfo)ite.next();
+            final String unionQueryClause = unionQueryInfo.getUnionQueryClause();
+            final boolean unionAll = unionQueryInfo.isUnionAll();
+            sb.append(unionAll ? " union all " : " union ").append(INCLUDE_SELECT_CLAUSE_MARK).append(unionQueryClause);
+        }
+        return sb.toString();
+    }
+
+    // =====================================================================================
+    //                                                                          Clause Parts
+    //                                                                          ============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return select-hint. {select [select-hint] * from table...} (NotNull)
+     */
+    public String getSelectHint() {
+        return createSelectHint();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Included-select-column clause. {select ... , [included-select-column clause] from table...} (NotNull)
+     */
+    public String getIncludedSelectColumnClause() {
+        final StringBuffer sb = new StringBuffer();
+        int count = 0;
+        for (final java.util.Iterator ite = _includedSelectColumnMap.keySet().iterator(); ite.hasNext(); count++) {
+            final String aliasName = (String)ite.next();
+            final String realColumnName = (String)_includedSelectColumnMap.get(aliasName);
+            sb.append(", ").append(realColumnName).append(" as ").append(aliasName);
+        }
+        return sb.toString();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From clause. (NotNull)
+     */
+    public String getFromClause() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("from ");
+        if (_baseTableInlineWhereList.isEmpty()) {
+            sb.append(_tableName);
+        } else {
+            sb.append(getInlineViewClause(_tableName, _baseTableInlineWhereList)).append(" ").append(_tableName);
+        }
+        sb.append(getFromBaseTableHint());
+        sb.append(getLeftOuterJoinClause());
+        return sb.toString();
+    }
+
+    protected String getLeftOuterJoinClause() {
+        final StringBuffer sb = new StringBuffer();
+        for (final java.util.Iterator ite = _outerJoinMap.keySet().iterator(); ite.hasNext(); ) {
+            final String aliasName = (String)ite.next();
+            final LeftOuterJoinInfo joinInfo = (LeftOuterJoinInfo)_outerJoinMap.get(aliasName);
+            final String joinTableName = joinInfo.getJoinTableName();
+            final java.util.List${database.filterGenericsString('String')} inlineWhereClauseList = joinInfo.getInlineWhereClauseList();
+            final java.util.Map${database.filterGenericsString('String, String')} joinOnMap = joinInfo.getJoinOnMap();
+            assertJoinOnMapNotEmpty(joinOnMap, aliasName);
+
+            sb.append(" left outer join ");
+            if (inlineWhereClauseList.isEmpty()) {
+                sb.append(joinTableName);
+            } else {
+                sb.append(getInlineViewClause(joinTableName, inlineWhereClauseList));
+            }
+            sb.append(" ").append(aliasName).append(" on ");
+            int count = 0;
+            for (final java.util.Iterator joinOnMapIte = joinOnMap.keySet().iterator(); joinOnMapIte.hasNext(); count++) {
+                final String localColumnName = (String)joinOnMapIte.next();
+                final String foreignColumnName = (String)joinOnMap.get(localColumnName);
+                if (count != 0) {
+                    sb.append(" and ");
+                }
+                sb.append(localColumnName).append(" = ").append(foreignColumnName);
+            }
+        }
+        return sb.toString();
+    }
+
+    protected String getInlineViewClause(String joinTableName, java.util.List${database.filterGenericsString('String')} inlineWhereClauseList) {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("(select * from ").append(joinTableName).append(" where ");
+        int count = 0;
+        for (final java.util.Iterator ite = inlineWhereClauseList.iterator(); ite.hasNext(); ) {
+            final String whereClause = (String)ite.next();
+            if (count > 0) {
+                sb.append(" and ");
+            }
+            sb.append(whereClause);
+            ++count;
+        }
+        sb.append(")");
+        return sb.toString();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return from-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    public String getFromBaseTableHint() {
+        return createFromBaseTableHint();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return from-hint. {select * from table left outer join ... on ... [from-hint] where ...} (NotNull)
+     */
+    public String getFromHint() {
+        return createFromHint();
+    }
+
+    public String getWhereClause() {
+        final StringBuffer sb = new StringBuffer();
+        int count = 0;
+        for (final java.util.Iterator ite = _whereList.iterator(); ite.hasNext(); count++) {
+            if (count == 0) {
+                sb.append("where ").append((String)ite.next());
+            } else {
+                sb.append(" and ").append((String)ite.next());
+            }
+        }
+        return sb.toString();
+    }
+
+    public String getOrderByClause() {
+        if (!_unionQueryInfoList.isEmpty()) {
+            if (_selectClauseColumnAliasMap == null || _selectClauseColumnAliasMap.isEmpty()) {
+                String msg = "The selectClauseColumnAliasMap should not be null or empty when union query exists: " + toString();
+                throw new IllegalStateException(msg);
+            }
+            return _orderByClause.getOrderByClause(_selectClauseColumnAliasMap);
+        } else {
+            return _orderByClause.getOrderByClause();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return sql-suffix. {select * from table where ... order by ... [sql-suffix]} (NotNull)
+     */
+    public String getSqlSuffix() {
+        return createSqlSuffix();
+    }
+
+    // =====================================================================================
+    //                                                                            Copy Parts
+    //                                                                            ==========
+    /**
+     * Copy included-select-column.
+     */
+    public void copyIncludedSelectColumn(${glSqlClauseInterfaceName} sqlClause) {
+        final java.util.Set keySet = _includedSelectColumnMap.keySet();
+        for (final java.util.Iterator ite = keySet.iterator(); ite.hasNext(); ) {
+            final String aliasName = (String)ite.next();
+            final String realColumnName = (String)_includedSelectColumnMap.get(aliasName);
+            sqlClause.registerIncludedSelectColumn(aliasName, realColumnName);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                  IncludedSelectColumn
+    //                                                                  ====================
+    /**
+     * Ignore included-select-column.
+     */
+    public void ignoreIncludedSelectColumn() {
+        _isIncludedSelectColumnEffective = false;
+    }
+
+    /**
+     * Make included-select-column effective.
+     */
+    public void makeIncludedSelectColumnEffective() {
+        if (!_includedSelectColumnMap.isEmpty()) {
+            _isIncludedSelectColumnEffective = true;
+        }
+    }
+
+    /**
+     * Register included-select-column.
+     * 
+     * @param aliasName Alias name. (NotNull)
+     * @param realColumnName Real column name. (NotNull)
+     */
+    public void registerIncludedSelectColumn(String aliasName, String realColumnName) {
+        _isIncludedSelectColumnEffective = true;
+        _includedSelectColumnMap.put(aliasName, realColumnName);
+    }
+
+    // =====================================================================================
+    //                                                                             OuterJoin
+    //                                                                             =========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param joinTableName Join table name(outer join [joinTableName]). (NotNull)
+     * @param aliasName Alias name of join table. (NotNull and Unique per invoking method.)
+     * @param joinOnMap Map that has conditions of 'on' clause. (NotNull)
+     */
+    public void registerOuterJoin(String joinTableName, String aliasName, java.util.Map${database.filterGenericsString('String, String')} joinOnMap) {
+        assertAlreadyOuterJoin(aliasName);
+        assertJoinOnMapNotEmpty(joinOnMap, aliasName);
+        final LeftOuterJoinInfo joinInfo = new LeftOuterJoinInfo();
+        joinInfo.setAliasName(aliasName);
+        joinInfo.setJoinTableName(joinTableName);
+        joinInfo.setJoinOnMap(joinOnMap);
+        _outerJoinMap.put(aliasName, joinInfo);
+    }
+
+    protected static class LeftOuterJoinInfo {
+        protected String _aliasName;
+        protected String _joinTableName;
+        protected java.util.List${database.filterGenericsString('String')} _inlineWhereClauseList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        protected java.util.Map${database.filterGenericsString('String, String')} _joinOnMap;
+        public String getAliasName() {
+            return _aliasName;
+        }
+        public void setAliasName(String value) {
+            _aliasName = value;
+        }
+        public String getJoinTableName() {
+            return _joinTableName;
+        }
+        public void setJoinTableName(String value) {
+            _joinTableName = value;
+        }
+        public java.util.List${database.filterGenericsString('String')} getInlineWhereClauseList() {
+            return _inlineWhereClauseList;
+        }
+        public void addInlineWhereClause(String value) {
+            _inlineWhereClauseList.add(value);
+        }
+        public java.util.Map${database.filterGenericsString('String, String')} getJoinOnMap() {
+            return _joinOnMap;
+        }
+        public void setJoinOnMap(java.util.Map${database.filterGenericsString('String, String')} value) {
+            _joinOnMap = value;
+        }
+    }
+
+    /**
+     * Assert whether the alias name have already registered in outer join.
+     * 
+     * @param aliasName Alias name.
+     */
+    protected void assertAlreadyOuterJoin(String aliasName) {
+        if (_outerJoinMap.containsKey(aliasName)) {
+            String msg = "The alias name have already registered in outer join: " + aliasName;
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    /**
+     * Assert whether the joinOnMap should not be empty.
+     * 
+     * @param joinOnMap Map that has conditions of 'on' clause. (NotNull)
+     * @param aliasName Alias name.
+     */
+    protected void assertJoinOnMapNotEmpty(java.util.Map${database.filterGenericsString('String, String')} joinOnMap, String aliasName) {
+        if (joinOnMap.isEmpty()) {
+            String msg = "The joinOnMap should not be empty: aliasName=" + aliasName;
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                                 Where
+    //                                                                                 =====
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param columnFullName Column-full-name([table-name].[column-name]). (NotNull)
+     * @param key Condition key. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    public void registerWhereClause(String columnFullName, ${glConditionKeyName} key, ${glConditionValueName} value) {
+        assertStringNotNullAndNotTrimmedEmpty("columnFullName", columnFullName);
+        key.addWhereClause(_whereList, columnFullName, value);
+        arrangeWhereListAdditionalConditionAsOr(_whereList);
+    }
+
+    /**
+     * Register where clause.
+     * 
+     * @param columnFullName Column-full-name([table-name].[column-name]). (NotNull)
+     * @param key Condition key. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Operand option. (NotNull)
+     */
+    public void registerWhereClause(String columnFullName, ${glConditionKeyName} key, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        assertStringNotNullAndNotTrimmedEmpty("columnFullName", columnFullName);
+        assertObjectNotNull("option of " + columnFullName, option);
+        key.addWhereClause(_whereList, columnFullName, value, option);
+        arrangeWhereListAdditionalConditionAsOr(_whereList);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param clause Where-clause. (NotNull)
+     */
+    public void registerWhereClause(String clause) {
+        assertStringNotNullAndNotTrimmedEmpty("clause", clause);
+        _whereList.add(clause);
+        arrangeWhereListAdditionalConditionAsOr(_whereList);
+    }
+
+    /**
+     * Exchange first where clause for last one.
+     */
+    public void exchangeFirstWhereClauseForLastOne() {
+        if (_whereList.size() > 1) {
+            final String first = (String)_whereList.get(0);
+            final String last = (String)_whereList.get(_whereList.size() - 1);
+            _whereList.set(0, last);
+            _whereList.set(_whereList.size() - 1, first);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                           InlineWhere
+    //                                                                           ===========
+    public void registerBaseTableInlineWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value) {
+        assertStringNotNullAndNotTrimmedEmpty("columnName", columnName);
+        key.addWhereClause(_baseTableInlineWhereList, columnName, value);
+        arrangeWhereListAdditionalConditionAsOr(_baseTableInlineWhereList);
+    }
+
+    public void registerBaseTableInlineWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        assertStringNotNullAndNotTrimmedEmpty("columnName", columnName);
+        assertObjectNotNull("option of " + columnName, option);
+        key.addWhereClause(_baseTableInlineWhereList, columnName, value, option);
+        arrangeWhereListAdditionalConditionAsOr(_baseTableInlineWhereList);
+    }
+
+    public void registerBaseTableInlineWhereClause(String value) {
+        _baseTableInlineWhereList.add(value);
+    }
+
+    public void registerOuterJoinInlineWhereClause(String aliasName, String columnName, ${glConditionKeyName} key, ${glConditionValueName} value) {
+        assertNotYetOuterJoin(aliasName);
+        assertStringNotNullAndNotTrimmedEmpty("columnName", columnName);
+        final LeftOuterJoinInfo joinInfo = (LeftOuterJoinInfo)_outerJoinMap.get(aliasName);
+        key.addWhereClause(joinInfo.getInlineWhereClauseList(), columnName, value);
+        arrangeWhereListAdditionalConditionAsOr(joinInfo.getInlineWhereClauseList());
+    }
+
+    public void registerOuterJoinInlineWhereClause(String aliasName, String columnName, ${glConditionKeyName} key, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
+        assertNotYetOuterJoin(aliasName);
+        assertStringNotNullAndNotTrimmedEmpty("columnName", columnName);
+        final LeftOuterJoinInfo joinInfo = (LeftOuterJoinInfo)_outerJoinMap.get(aliasName);
+        key.addWhereClause(joinInfo.getInlineWhereClauseList(), columnName, value, option);
+        arrangeWhereListAdditionalConditionAsOr(joinInfo.getInlineWhereClauseList());
+    }
+
+    public void registerOuterJoinInlineWhereClause(String aliasName, String value) {
+        assertNotYetOuterJoin(aliasName);
+        final LeftOuterJoinInfo joinInfo = (LeftOuterJoinInfo)_outerJoinMap.get(aliasName);
+        joinInfo.addInlineWhereClause(value);
+        arrangeWhereListAdditionalConditionAsOr(joinInfo.getInlineWhereClauseList());
+    }
+
+    /**
+     * Assert whether the alias name have already registered in outer join.
+     * 
+     * @param aliasName Alias name.
+     */
+    protected void assertNotYetOuterJoin(String aliasName) {
+        if (!_outerJoinMap.containsKey(aliasName)) {
+            String msg = "The alias name have not registered in outer join yet: " + aliasName;
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    // =====================================================================================
+    //                                                               AdditionalConditionAsOr
+    //                                                               =======================
+    public void makeAdditionalConditionAsOrEffective() {
+        _isAdditionalConditionAsOrEffective = true;
+    }
+
+    public void ignoreAdditionalConditionAsOr() {
+        _isAdditionalConditionAsOrEffective = false;
+    }
+
+    protected void arrangeWhereListAdditionalConditionAsOr(java.util.List${database.filterGenericsString('String')} whereList) {
+        if (_isAdditionalConditionAsOrEffective) {
+            if (whereList.size() < 2) {
+                String msg = "The whereList should have two more elements when the isAdditionalConditionAsOrEffective is true: " + toString();
+                throw new IllegalStateException(msg);
+            }
+            final String lastWhereClause = (String)whereList.remove(whereList.size() - 1);
+            final String preWhereClause = (String)whereList.remove(whereList.size() - 1);
+            if (preWhereClause.startsWith("(") && preWhereClause.endsWith(")")) {
+                final String plainClause = preWhereClause.substring("(".length(), preWhereClause.length() - ")".length());
+                whereList.add("(" + plainClause + " or " + lastWhereClause + ")");
+            } else {
+                whereList.add("(" + preWhereClause + " or " + lastWhereClause + ")");
+            }
+        }
+    }
+
+    // =====================================================================================
+    //                                                                               OrderBy
+    //                                                                               =======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glOrderByClauseName} getSqlComponentOfOrderByClause() {
+        return _orderByClause;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} clearOrderBy() {
+        _isOrderByEffective = false;
+        _orderByClause.clear();
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} ignoreOrderBy() {
+        _isOrderByEffective = false;
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} makeOrderByEffective() {
+        if (!_orderByClause.isEmpty()) {
+            _isOrderByEffective = true;
+        }
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @param registeredOrderByProperty Registered-order-by-property. ([table-name].[column-name]) (Nullable)
+     * @param isAsc Is asc?
+     */
+    public void reverseOrderBy_Or_OverrideOrderBy(String orderByProperty, String registeredOrderByProperty, boolean isAsc) {
+        _isOrderByEffective = true;
+        if (!_orderByClause.isSameOrderByColumn(orderByProperty)) {
+            clearOrderBy();
+            registerOrderBy(orderByProperty, registeredOrderByProperty, isAsc);
+        } else {
+            _orderByClause.reverseAll();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param orderByProperty Order-by-property. 'aliasName.columnName/aliasName.columnName/...' (NotNull)
+     * @param registeredOrderByProperty Registered-order-by-property. ([table-name].[column-name]) (Nullable)
+     * @param isAsc Is asc?
+     */
+    public void registerOrderBy(String orderByProperty, String registeredOrderByProperty, boolean isAsc) {
+        try {
+            _isOrderByEffective = true;
+            final java.util.List${database.filterGenericsString('String')} orderByList = new java.util.ArrayList${database.filterGenericsString('String')}();
+            {
+                final  java.util.StringTokenizer st = new java.util.StringTokenizer(orderByProperty, "/");
+                while (st.hasMoreElements()) {
+                    orderByList.add(st.nextToken());
+                }
+            }
+
+            if (registeredOrderByProperty == null || registeredOrderByProperty.trim().length() ==0) {
+                registeredOrderByProperty = orderByProperty;
+            }
+
+            final java.util.List${database.filterGenericsString('String')} registeredOrderByList = new java.util.ArrayList${database.filterGenericsString('String')}();
+            {
+                final java.util.StringTokenizer st = new java.util.StringTokenizer(registeredOrderByProperty, "/");
+                while (st.hasMoreElements()) {
+                    registeredOrderByList.add(st.nextToken());
+                }
+            }
+
+            int count = 0;
+            for (final java.util.Iterator ite = orderByList.iterator(); ite.hasNext(); ) {
+                String orderBy = (String)ite.next();
+                String registeredOrderBy = (String)registeredOrderByList.get(count);
+
+                _isOrderByEffective = true;
+                String aliasName = null;
+                String columnName = null;
+                String registeredAliasName = null;
+                String registeredColumnName = null;
+
+                if (orderBy.indexOf(".") < 0) {
+                    columnName = orderBy;
+                } else {
+                    aliasName = orderBy.substring(0, orderBy.lastIndexOf("."));
+                    columnName = orderBy.substring(orderBy.lastIndexOf(".") + 1);
+                }
+
+                if (registeredOrderBy.indexOf(".") < 0) {
+                    registeredColumnName = registeredOrderBy;
+                } else {
+                    registeredAliasName = registeredOrderBy.substring(0, registeredOrderBy.lastIndexOf("."));
+                    registeredColumnName = registeredOrderBy.substring(registeredOrderBy.lastIndexOf(".") + 1);
+                }
+
+                ${glOrderByElementName} element = new ${glOrderByElementName}();
+                element.setAliasName(aliasName);
+                element.setColumnName(columnName);
+                element.setRegisteredAliasName(registeredAliasName);
+                element.setRegisteredColumnName(registeredColumnName);
+                if (isAsc) {
+                    element.setupAsc();
+                } else {
+                    element.setupDesc();
+                }
+                _orderByClause.addOrderByElement(element);
+
+                count++;
+            }
+        } catch (RuntimeException e) {
+            String msg = "registerOrderBy() threw the exception: orderByProperty=" + orderByProperty;
+            msg = msg + " registeredColumnFullName=" + registeredOrderByProperty;
+            msg = msg + " isAsc=" + isAsc;
+            msg = msg + " sqlClause=" + this.toString();
+            throw new RuntimeException(msg, e);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                                Clause
+    //                                                                                ======
+    public void registerUnionQuery(String unionQueryClause, boolean unionAll) {
+        assertStringNotNullAndNotTrimmedEmpty("unionQueryClause", unionQueryClause);
+        final UnionQueryInfo unionQueryInfo = new UnionQueryInfo();
+        unionQueryInfo.setUnionQueryClause(unionQueryClause);
+        unionQueryInfo.setUnionAll(unionAll);
+        _unionQueryInfoList.add(unionQueryInfo);
+    }
+
+    protected static class UnionQueryInfo {
+        protected String _unionQueryClause;
+        protected boolean _unionAll;
+        public String getUnionQueryClause() {
+            return _unionQueryClause;
+        }
+        public void setUnionQueryClause(String unionQueryClause) {
+            _unionQueryClause = unionQueryClause;
+        }
+        public boolean isUnionAll() {
+            return _unionAll;
+        }
+        public void setUnionAll(boolean unionAll) {
+            _unionAll = unionAll;
+        }
+    }
+
+    // =====================================================================================
+    //                                                                               Advance
+    //                                                                               =======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param fetchSize Fetch-size. (NotMinus & NotZero)
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} fetchFirst(int fetchSize) {
+        _isFetchScopeEffective = true;
+        if (fetchSize <= 0) {
+            String msg = "Argument[fetchSize] must be plus: " + fetchSize;
+            throw new IllegalArgumentException(msg);
+        }
+        _fetchStartIndex = 0;
+        _fetchSize = fetchSize;
+        _fetchPageNumber = 1;
+        doClearFetchPageClause();
+        doFetchFirst();
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+     * @param fetchSize Fetch size. (NotMinus)
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} fetchScope(int fetchStartIndex, int fetchSize) {
+        _isFetchScopeEffective = true;
+        if (fetchStartIndex < 0) {
+            String msg = "Argument[fetchStartIndex] must be plus or zero: " + fetchStartIndex;
+            throw new IllegalArgumentException(msg);
+        }
+        if (fetchSize <= 0) {
+            String msg = "Argument[fetchSize] must be plus: " + fetchSize;
+            throw new IllegalArgumentException(msg);
+        }
+        _fetchStartIndex = fetchStartIndex;
+        _fetchSize = fetchSize;
+        return fetchPage(1);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param fetchPageNumber Page-number. 1 origin. (NotMinus & NotZero: If minus or zero, set one.)
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} fetchPage(int fetchPageNumber) {
+        _isFetchScopeEffective = true;
+        if (fetchPageNumber <= 0) {
+            fetchPageNumber = 1;
+        }
+        if (_fetchSize <= 0) {
+            String msg = "Fetch size should not be minus or zero when you invoke this method. ";
+            msg = msg + "When you invoke this method, it is necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that. ";
+            msg = msg + ": fetchPageNumber=" + fetchPageNumber + " _fetchSize=" + _fetchSize;
+            throw new IllegalStateException(msg);
+        }
+        _fetchPageNumber = fetchPageNumber;
+        if (_fetchPageNumber == 1 && _fetchStartIndex == 0) {
+            return fetchFirst(_fetchSize);
+        }
+        doClearFetchPageClause();
+        doFetchPage();
+        return this;
+    }
+
+    /**
+     * Do fetch first.
+     */
+    abstract protected void doFetchFirst();
+
+    /**
+     * Do fetch page.
+     */
+    abstract protected void doFetchPage();
+
+    /**
+     * Do clear fetch-page clause.
+     */
+    abstract protected void doClearFetchPageClause();
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch start index.
+     */
+    public int getFetchStartIndex() {
+        return _fetchStartIndex;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch size.
+     */
+    public int getFetchSize() {
+        return _fetchSize;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch page number.
+     */
+    public int getFetchPageNumber() {
+        return _fetchPageNumber;
+    }
+
+    /**
+     * Get page start index.
+     * 
+     * @return Page start index. 0 origin. (NotMinus)
+     */
+    public int getPageStartIndex() {
+        if (_fetchPageNumber <= 0) {
+            String msg = "_fetchPageNumber must be plus: " + _fetchPageNumber;
+            throw new IllegalStateException(msg);
+        }
+        return _fetchStartIndex + (_fetchSize * (_fetchPageNumber - 1));
+    }
+
+    /**
+     * Get page end index.
+     * 
+     * @return Page end index. 0 origin. (NotMinus)
+     */
+    public int getPageEndIndex() {
+        if (_fetchPageNumber <= 0) {
+            String msg = "_fetchPageNumber must be plus: " + _fetchPageNumber;
+            throw new IllegalStateException(msg);
+        }
+        return _fetchStartIndex + (_fetchSize * _fetchPageNumber);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchScopeEffective() {
+        return _isFetchScopeEffective;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} ignoreFetchScope() {
+        _isFetchScopeEffective = false;
+        doClearFetchPageClause();
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} makeFetchScopeEffective() {
+        if (getFetchSize() > 0 && getFetchPageNumber() > 0) {
+            fetchPage(getFetchPageNumber());
+        }
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchStartIndexSupported() {
+        return true; // Default
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchSizeSupported() {
+        return true; // Default
+    }
+
+    /**
+     * Create select-hint.
+     * 
+     * @return Select-hint. {select [select-hint] * from table...} (NotNull)
+     */
+    abstract protected String createSelectHint();
+
+    /**
+     * Create from-base-table-hint.
+     * 
+     * @return From-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    abstract protected String createFromBaseTableHint();
+
+    /**
+     * Create from-hint.
+     * 
+     * @return From-hint. {select * from table left outer join ... on ... [from-hint] where ...} (NotNull)
+     */
+    abstract protected String createFromHint();
+
+    /**
+     * Create sql-suffix.
+     * 
+     * @return Sql-suffix. {select * from table where ... order by ... [sql-suffix]} (NotNull)
+     */
+    abstract protected String createSqlSuffix();
+
+    // =====================================================================================
+    //                                                                        FetchNarrowing
+    //                                                                        ==============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-narrowing start-index.
+     */
+    public int getFetchNarrowingSkipStartIndex() {
+        if (isFetchStartIndexSupported()) {
+            return 0;
+        } else {
+            return getPageStartIndex();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Fetch-narrowing size.
+     */
+    public int getFetchNarrowingLoopCount() {
+        return getFetchSize();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchNarrowingEffective() {
+        return _isFetchScopeEffective;
+    }
+
+    // =====================================================================================
+    //                                                                         Helper Method
+    //                                                                         =============
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the object is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertObjectNotNull(String variableName, Object value) {
+        if (variableName == null) {
+            String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "The value should not be null: variableName=" + variableName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the entity is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        assertObjectNotNull("variableName", variableName);
+        assertObjectNotNull("value", value);
+        if (value.trim().length() ==0) {
+            String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByClause.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByClause.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByClause.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,277 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glOrderByClauseName}")
+
+/**
+ * The paging-result-bean of ${myClassName}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} implements java.io.Serializable {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected java.util.List${database.filterGenericsString(${glOrderByElementName})} _orderByList = new java.util.ArrayList${database.filterGenericsString(${glOrderByElementName})}();
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // =====================================================================================
+    //                                                                              Behavior
+    //                                                                              ========
+    /**
+     * Add order-by element.
+     * 
+     * @param orderByElement Order-by element. (NotNull)
+     */
+    public void addOrderByElement(${glOrderByElementName} orderByElement) {
+        _orderByList.add(orderByElement);
+    }
+
+    /**
+     * Insert first order-by element .
+     * 
+     * @param orderByElement Order-by element. (NotNull)
+     */
+    public void insertFirstOrderByElement(${glOrderByElementName} orderByElement) {
+        _orderByList.add(0, orderByElement);
+    }
+
+    public void reverseAll() {
+        for (final java.util.Iterator ite = _orderByList.iterator(); ite.hasNext(); ) {
+            final ${glOrderByElementName} element = (${glOrderByElementName})ite.next();
+            element.reverse();
+        }
+    }
+
+    public void exchangeFirstOrderByElementForLastOne() {
+        if (_orderByList.size() > 1) {
+            final ${glOrderByElementName} first = (${glOrderByElementName})_orderByList.get(0);
+            final ${glOrderByElementName} last = (${glOrderByElementName})_orderByList.get(_orderByList.size() - 1);
+            _orderByList.set(0, last);
+            _orderByList.set(_orderByList.size() - 1, first);
+        }
+    }
+
+    /**
+     * Get the value of allRecordCount.
+     * 
+     * @return The value of allRecordCount.
+     */
+    public java.util.List${database.filterGenericsString(${glOrderByElementName})} getOrderByList() {
+        return _orderByList;
+    }
+
+    public String getOrderByClause() {
+        if (_orderByList.isEmpty()) {
+            return "";
+        }
+        final StringBuffer sb = new StringBuffer();
+        final String delimiter = ", ";
+        for (final java.util.Iterator ite = _orderByList.iterator(); ite.hasNext(); ) {
+            final ${glOrderByElementName} element = (${glOrderByElementName})ite.next();
+            sb.append(delimiter).append(element.getElementClause());
+        }
+        sb.delete(0, delimiter.length()).insert(0, "order by ");
+        return sb.toString();
+    }
+
+    public String getOrderByClause(java.util.Map${database.filterGenericsString('String, String')} selectClauseColumnAliasMap) {
+        if (_orderByList.isEmpty()) {
+            return "";
+        }
+        final StringBuffer sb = new StringBuffer();
+        final String delimiter = ", ";
+        for (final java.util.Iterator ite = _orderByList.iterator(); ite.hasNext(); ) {
+            final ${glOrderByElementName} element = (${glOrderByElementName})ite.next();
+            sb.append(delimiter).append(element.getElementClause(selectClauseColumnAliasMap));
+        }
+        sb.delete(0, delimiter.length()).insert(0, "order by ");
+        return sb.toString();
+    }
+
+    public boolean isSameOrderByColumn(String orderByProperty) {
+        final java.util.List${database.filterGenericsString('String')} orderByList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        {
+            final java.util.StringTokenizer st = new java.util.StringTokenizer(orderByProperty, "/");
+            while (st.hasMoreElements()) {
+                orderByList.add(st.nextToken());
+            }
+        }
+        if (_orderByList.size() != orderByList.size()) {
+            return false;
+        }
+        int count = 0;
+        for (final java.util.Iterator ite = orderByList.iterator(); ite.hasNext(); ) {
+            final String columnFullName = (String)ite.next();
+            final ${glOrderByElementName} element = (${glOrderByElementName})_orderByList.get(count);
+            if (!element.getColumnFullName().equals(columnFullName)) {
+                return false;
+            }
+            count++;
+        }
+        return true;
+    }
+
+    // =====================================================================================
+    //                                                                         First Element
+    //                                                                         =============
+    /**
+     * Is first element asc?
+     * If order-by list is empty, throws exception.
+     * 
+     * @return Determination.
+     */
+    public boolean isFirstElementAsc() {
+        if (isEmpty()) {
+            String msg = "This order-by clause is empty: " + toString();
+            throw new IllegalStateException(msg);
+        }
+        final ${glOrderByElementName} element = (${glOrderByElementName})_orderByList.get(0);
+        return element.isAsc();
+    }
+
+    /**
+     * Is first element desc?
+     * If order-by list is empty, throws exception.
+     * 
+     * @return Determination.
+     */
+    public boolean isFirstElementDesc() {
+        return !isFirstElementAsc();
+    }
+
+    /**
+     * Is same as first element alias-name?
+     * If order-by list is empty, throws exception.
+     * 
+     * @param expectedAliasName Expected alias-name. (Nullable)
+     * @return Determination.
+     */
+    public boolean isSameAsFirstElementAliasName(String expectedAliasName) {
+        if (isEmpty()) {
+            String msg = "This order-by clause is empty: " + toString();
+            throw new RuntimeException(msg);
+        }
+        ${glOrderByElementName} element = (${glOrderByElementName})_orderByList.get(0);
+        String actualAliasName = element.getAliasName();
+        if (actualAliasName != null && expectedAliasName != null) {
+            return actualAliasName.equalsIgnoreCase(expectedAliasName);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Is same as first element column-name?
+     * If order-by list is empty, throws exception.
+     * 
+     * @param expectedColumnName Expected column-name. (Nullable)
+     * @return Determination.
+     */
+    public boolean isSameAsFirstElementColumnName(String expectedColumnName) {
+        if (isEmpty()) {
+            String msg = "This order-by clause is empty: " + toString();
+            throw new RuntimeException(msg);
+        }
+        ${glOrderByElementName} element = (${glOrderByElementName})_orderByList.get(0);
+        String actualColumnName = element.getColumnName();
+        if (actualColumnName != null && expectedColumnName != null) {
+            return actualColumnName.equalsIgnoreCase(expectedColumnName);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Is same as first element registered-alias-name?
+     * If order-by list is empty, throws exception.
+     * 
+     * @param expectedAliasName Expected alias-name. (Nullable)
+     * @return Determination.
+     */
+    public boolean isSameAsFirstElementRegisteredAliasName(String expectedAliasName) {
+        if (isEmpty()) {
+            String msg = "This order-by clause is empty: " + toString();
+            throw new RuntimeException(msg);
+        }
+        ${glOrderByElementName} element = (${glOrderByElementName})_orderByList.get(0);
+        String actualAliasName = element.getRegisteredAliasName();
+        if (actualAliasName != null && expectedAliasName != null) {
+            return actualAliasName.equalsIgnoreCase(expectedAliasName);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Is same as first element registered-column-name?
+     * If order-by list is empty, throws exception.
+     * 
+     * @param expectedColumnName Expected column-name. (Nullable)
+     * @return Determination.
+     */
+    public boolean isSameAsFirstElementRegisteredColumnName(String expectedColumnName) {
+        if (isEmpty()) {
+            String msg = "This order-by clause is empty: " + toString();
+            throw new RuntimeException(msg);
+        }
+        ${glOrderByElementName} element = (${glOrderByElementName})_orderByList.get(0);
+        String actualColumnName = element.getRegisteredColumnName();
+        if (actualColumnName != null && expectedColumnName != null) {
+            return actualColumnName.equalsIgnoreCase(expectedColumnName);
+        } else {
+            return false;
+        }
+    }
+
+    // =====================================================================================
+    //                                                                      Delegate of List
+    //                                                                      ================
+    /**
+     * Is empty?
+     * 
+     * @return Determination.
+     */
+    public boolean isEmpty() {
+        return _orderByList.isEmpty();
+    }
+
+    /**
+     * Get iterator of order-by list.
+     * 
+     * @return Determination.
+     */
+    public java.util.Iterator iterator() {
+        return _orderByList.iterator();
+    }
+
+    /**
+     * Clear order-by list.
+     */
+    public void clear() {
+        _orderByList.clear();
+    }
+
+    // =====================================================================================
+    //                                                                 Basic-Override Method
+    //                                                                 =====================
+    /**
+     * This method overrides the method that is declared at super.
+     * 
+     * @return View-string of all-columns value.
+     */
+    public String toString() {
+        return _orderByList.toString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByElement.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByElement.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/OrderByElement.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,173 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glOrderByElementName}")
+
+/**
+ * The paging-result-bean of ${myClassName}.
+ * 
+ * <pre>
+ *   For example, if you make order-by 'order BOOK.BOOK_ID asc', the way is as follows:
+ *       /-----------------------------------------------------
+ *       ${myClassName} orderByElement = new ${myClassName}();
+ *       orderByElement.AliasName = "BOOK";
+ *       orderByElement.ColumnName = "BOOK_ID";
+ *       orderByElement.SetupAsc();
+ *       -------------/
+ * </pre>
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} implements java.io.Serializable {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** The value of alias name. */
+    protected String _aliasName;
+
+    /** The value of column name. */
+    protected String _columnName;
+
+    /** The value of registered alias name. */
+    protected String _registeredAliasName;
+
+    /** The value of registered column name. */
+    protected String _registeredColumnName;
+
+    /** The value of ascDesc. */
+    protected String _ascDesc = "asc";
+
+    // =====================================================================================
+    //                                                                          GetterSetter
+    //                                                                          ============
+    public String getAliasName() {
+        return _aliasName;
+    }
+    public String getColumnName() {
+        return _columnName;
+    }
+    public String getRegisteredAliasName() {
+        return _registeredAliasName;
+    }
+    public String getRegisteredColumnName() {
+        return _registeredColumnName;
+    }
+    public String getAscDesc() {
+        return _ascDesc;
+    }
+    public void setAliasName(String value) {
+        _aliasName = value;
+    }
+    public void setColumnName(String value) {
+        _columnName = value;
+    }
+    public void setRegisteredAliasName(String value) {
+        _registeredAliasName = value;
+    }
+    public void setRegisteredColumnName(String value) {
+        _registeredColumnName = value;
+    }
+    public void setAscDesc(String value) {
+        _ascDesc = value;
+    }
+
+    // =====================================================================================
+    //                                                                              Behavior
+    //                                                                              ========
+    public void setupAsc() {
+        _ascDesc = "asc";
+    }
+
+    public void setupDesc() {
+        _ascDesc = "desc";
+    }
+
+    public void reverse() {
+        if (_ascDesc == null) {
+            String msg = "The attribute[ascDesc] should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        if (_ascDesc.equals("asc")) {
+            _ascDesc = "desc";
+        } else if (_ascDesc.equals("desc")) {
+            _ascDesc = "asc";
+        } else {
+            String msg = "The attribute[ascDesc] should be asc or desc: but ascDesc=" + _ascDesc;
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    public boolean isAsc() {
+        if (_ascDesc == null) {
+            String msg = "The attribute[ascDesc] should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        if (_ascDesc.equals("asc")) {
+            return true;
+        } else if (_ascDesc.equals("desc")) {
+            return false;
+        } else {
+            String msg = "The attribute[ascDesc] should be asc or desc: but ascDesc=" + _ascDesc;
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    public String getColumnFullName() {
+        final StringBuffer sb = new StringBuffer();
+        if (_aliasName != null) {
+            sb.append(_aliasName).append(".");
+        }
+        if (_columnName == null) {
+            String msg = "The attribute[columnName] should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        sb.append(_columnName);
+        return sb.toString();
+    }
+
+    public String getElementClause() {
+        if (_ascDesc == null) {
+            String msg = "The attribute[ascDesc] should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        final StringBuffer sb = new StringBuffer();
+        sb.append(getColumnFullName()).append(" ").append(_ascDesc);
+        return sb.toString();
+    }
+
+    public String getElementClause(java.util.Map${database.filterGenericsString('String, String')} selectClauseColumnAliasMap) {
+        if (_ascDesc == null) {
+            String msg = "The attribute[ascDesc] should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        final StringBuffer sb = new StringBuffer();
+        final String columnAlias = (String)selectClauseColumnAliasMap.get(getColumnFullName());
+        if (columnAlias == null || columnAlias.trim().length() == 0) {
+            String msg = "The selectClauseColumnAliasMap should have the value of the key: " + getColumnFullName();
+            throw new IllegalStateException(msg + " But the map is " + selectClauseColumnAliasMap);
+        }
+        sb.append(columnAlias).append(" ").append(_ascDesc);
+        return sb.toString();
+    }
+
+    // =====================================================================================
+    //                                                                        Basic Override
+    //                                                                        ==============
+    /**
+     * This method overrides the method that is declared at super.
+     * 
+     * @return View-string of all-columns value.
+     */
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+        sb.append("[OrderByElement] aliasName=").append(_aliasName);
+        sb.append(" columnName=").append(_columnName);
+        sb.append(" registeredAliasName=").append(_registeredAliasName);
+        sb.append(" registeredColumnName=").append(_registeredColumnName);
+        sb.append(" ascDesc=").append(_ascDesc);
+        return sb.toString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,373 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}")
+
+import java.util.Map;
+
+import ${glPackageBaseCommonCKey}.${glConditionKeyName};
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+
+/**
+ * The interface of SqlClause.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${myClassName} {
+
+    public static final String INCLUDE_SELECT_CLAUSE_MARK = "/* df:includeSelectClause */";
+
+    // =====================================================================================
+    //                                                                         Select Clause
+    //                                                                         =============
+    public void setSelectClauseColumnAliasMap(java.util.Map${database.filterGenericsString('String, String')} selectClauseColumnAliasMap);
+
+    // =====================================================================================
+    //                                                                                Clause
+    //                                                                                ======
+    /**
+     * Get clause string.
+     * <p>
+     * <pre>
+     * ex)
+     * # from [base-table] left outer join [fk-table] [fk-alias] on [join-condition]
+     * # where [base-table].[column] = [value] and [fk-alias].[column] is null
+     * # order by [base-table].[column] asc, [fk-alias].[column] desc
+     * # for update
+     * </pre>
+     *
+     * @return Clause string. (NotNull)
+     */
+    public String getClause();
+
+    /**
+     * Get clause string without included and orderby and sqlsuffix.
+     * 
+     * @return Clause string. (NotNull)
+     */
+    public String getClauseWithoutIncludedOrderBySqlSuffix();
+
+    // =====================================================================================
+    //                                                                          Clause Parts
+    //                                                                          ============
+    /**
+     * Get select-hint. This is an internal method.
+     * 
+     * @return select-hint. {select [select-hint] * from table...} (NotNull)
+     */
+    public String getSelectHint();
+
+    /**
+     * Get included-select-column clause. This is an internal method.
+     * 
+     * @return Included-select-column clause. {select ... , [included-select-column clause] from table...} (NotNull)
+     */
+    public String getIncludedSelectColumnClause();
+
+    /**
+     * Get from clause. {from table left outer join foreign-table on ...}
+     * 
+     * @return From clause. (NotNull)
+     */
+    public String getFromClause();
+
+    /**
+     * Get from-base-table-hint. This is an internal method.
+     * 
+     * @return from-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    public String getFromBaseTableHint();
+
+    /**
+     * Get from-hint. This is an internal method.
+     * 
+     * @return from-hint. {select * from table left outer join ... on ... [from-hint] where ...} (NotNull)
+     */
+    public String getFromHint();
+
+    /**
+     * Get where clause. {where [base-table].[column] = [value] and [fk-alias].[column] is null}
+     * 
+     * @return Where clause. (NotNull)
+     */
+    public String getWhereClause();
+
+    /**
+     * Get order-by clause. {order by [base-table].[column] asc, [fk-alias].[column] desc}
+     * 
+     * @return Order-by clause. (NotNull)
+     */
+    public String getOrderByClause();
+
+    /**
+     * Get sql-suffix. This is an internal method.
+     * 
+     * @return sql-suffix. {select * from table where ... order by ... [sql-suffix]} (NotNull)
+     */
+    public String getSqlSuffix();
+
+    // =====================================================================================
+    //                                                                            Copy Parts
+    //                                                                            ==========
+    /**
+     * Copy included-select-column.
+     */
+    public void copyIncludedSelectColumn(${glSqlClauseInterfaceName} sqlClause);
+
+    // =====================================================================================
+    //                                                                  IncludedSelectColumn
+    //                                                                  ====================
+    /**
+     * Ignore included-select-column.
+     */
+    public void ignoreIncludedSelectColumn();
+
+    /**
+     * Make included-select-column effective.
+     */
+    public void makeIncludedSelectColumnEffective();
+
+    /**
+     * Register included-select-column.
+     * 
+     * @param aliasName Alias name. (NotNull)
+     * @param realColumnName Real column name. (NotNull)
+     */
+    public void registerIncludedSelectColumn(String aliasName, String realColumnName);
+
+    // =====================================================================================
+    //                                                                             OuterJoin
+    //                                                                             =========
+    /**
+     * Register outer join.
+     * 
+     * @param joinTableName Join table name(outer join [joinTableName]). (NotNull)
+     * @param aliasName Alias name of join table. (NotNull and Unique per invoking method.)
+     * @param joinOnMap Map that has conditions of 'on' clause. (NotNull)
+     */
+    public void registerOuterJoin(String joinTableName, String aliasName, Map${database.filterGenericsString('String, String')} joinOnMap);
+
+    // =====================================================================================
+    //                                                                                 Where
+    //                                                                                 =====
+    /**
+     * Register where clause.
+     * 
+     * @param columnFullName Column-full-name([table-name].[column-name]). (NotNull)
+     * @param key Condition key. (NotNull)
+     * @param value Condition value. (NotNull)
+     */
+    public void registerWhereClause(String columnFullName, ${glConditionKeyName} key, ${glConditionValueName} value);
+
+    /**
+     * Register where clause.
+     * 
+     * @param columnFullName Column-full-name([table-name].[column-name]). (NotNull)
+     * @param key Condition key. (NotNull)
+     * @param value Condition value. (NotNull)
+     * @param option Condition option. (NotNull)
+     */
+    public void registerWhereClause(String columnFullName, ${glConditionKeyName} key, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option);
+
+    /**
+     * Register where clause.
+     * 
+     * @param clause Where-clause. (NotNull)
+     */
+    public void registerWhereClause(String clause);
+
+    /**
+     * Exchange first where clause for last one.
+     */
+    public void exchangeFirstWhereClauseForLastOne();
+
+    // =====================================================================================
+    //                                                                           InlineWhere
+    //                                                                           ===========
+    public void registerBaseTableInlineWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value);
+    public void registerBaseTableInlineWhereClause(String columnName, ${glConditionKeyName} key, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option);
+    public void registerBaseTableInlineWhereClause(String value);
+    public void registerOuterJoinInlineWhereClause(String aliasName, String columnName, ${glConditionKeyName} key, ${glConditionValueName} value);
+    public void registerOuterJoinInlineWhereClause(String aliasName, String columnName, ${glConditionKeyName} key, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option);
+    public void registerOuterJoinInlineWhereClause(String aliasName, String value);
+
+    // =====================================================================================
+    //                                                               AdditionalConditionAsOr
+    //                                                               =======================
+    public void makeAdditionalConditionAsOrEffective();
+    public void ignoreAdditionalConditionAsOr();
+
+    // =====================================================================================
+    //                                                                               OrderBy
+    //                                                                               =======
+    public ${glOrderByClauseName} getSqlComponentOfOrderByClause();
+
+    /**
+     * Clear order-by.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} clearOrderBy();
+
+    /**
+     * Ignore order-by.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} ignoreOrderBy();
+
+    /**
+     * Make order-by effective.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} makeOrderByEffective();
+
+    public void registerOrderBy(String orderByProperty, String registeredOrderByProperty, boolean isAsc);
+
+    public void reverseOrderBy_Or_OverrideOrderBy(String orderByProperty, String registeredOrderByProperty, boolean isAsc);
+
+    // =====================================================================================
+    //                                                                                Clause
+    //                                                                                ======
+    public void registerUnionQuery(String unionClause, boolean unionAll);
+
+    // =====================================================================================
+    //                                                                               Advance
+    //                                                                               =======
+    /**
+     * Fetch first.
+     * <p>
+     * If you invoke this, your SQL returns [fetch-size] records from first.
+     * If you invoke this, instance-variable[_fetchPageNumber] is initialized as one.
+     * 
+     * @param fetchSize Fetch-size. (NotMinus)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} fetchFirst(int fetchSize);
+
+    /**
+     * Fetch scope.
+     * <p>
+     * If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index].
+     * If you invoke this, instance-variable[_fetchPageNumber] is initialized as one.
+     * 
+     * @param fetchStartIndex Fetch-start-index. 0 origin. (NotMinus)
+     * @param fetchSize Fetch-size. (NotMinus)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} fetchScope(int fetchStartIndex, int fetchSize);
+
+    /**
+     * Fetch page.
+     * <p>
+     * When you invoke this, it is normally necessary to invoke 'fetchFirst()' or 'fetchScope()' ahead of that.
+     * But you also can use default-fetch-size without invoking 'fetchFirst()' or 'fetchScope()'.
+     * If you invoke this, your SQL returns [fetch-size] records from [fetch-start-index] calculated by [fetch-page-number].
+     * 
+     * @param fetchPageNumber Fetch-page-number. 1 origin. (NotMinus & NotZero)
+     * @return this. (NotNull)
+     */
+    public ${myClassName} fetchPage(int fetchPageNumber);
+
+    /**
+     * Get fetch start index.
+     * 
+     * @return Fetch start index.
+     */
+    public int getFetchStartIndex();
+
+    /**
+     * Get fetch size.
+     * 
+     * @return Fetch size.
+     */
+    public int getFetchSize();
+
+    /**
+     * Get fetch page number.
+     * 
+     * @return Fetch page number.
+     */
+    public int getFetchPageNumber();
+
+    /**
+     * Get page start index.
+     * 
+     * @return Page start index. 0 origin. (NotMinus)
+     */
+    public int getPageStartIndex();
+
+    /**
+     * Get page end index.
+     * 
+     * @return Page end index. 0 origin. (NotMinus)
+     */
+    public int getPageEndIndex();
+
+    /**
+     * Is fetch scope effective?
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchScopeEffective();
+
+    /**
+     * Ignore fetch-scope.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} ignoreFetchScope();
+
+    /**
+     * Make fetch-scope effective.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} makeFetchScopeEffective();
+
+    /**
+     * Is fetch start index supported?
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchStartIndexSupported();
+
+    /**
+     * Is fetch size supported?
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchSizeSupported();
+
+    /**
+     * Is fetch-narrowing effective?
+     * 
+     * @return Determiantion.
+     */
+    public boolean isFetchNarrowingEffective();
+
+    /**
+     * Get fetch-narrowing skip-start-index.
+     * 
+     * @return Skip-start-index.
+     */
+    public int getFetchNarrowingSkipStartIndex();
+
+    /**
+     * Get fetch-narrowing loop-count.
+     * 
+     * @return Loop-count.
+     */
+    public int getFetchNarrowingLoopCount();
+
+    /**
+     * Lock for update.
+     * <p>
+     * If you invoke this, your SQL lock target records for update.
+     * It depends whether this method supports this on the database type.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} lockForUpdate();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_db2.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_db2.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_db2.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,110 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}Db2")
+
+/**
+ * SqlClause for DB2.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of fetch-first as sql-suffix. */
+    protected String _fetchFirstSqlSuffix = "";
+
+    /** String of lock as from-hint. */
+    protected String _lockSqlSuffix = "";
+
+    /**
+     * Constructor.
+     * 
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+        if (isFetchSizeSupported()) {
+            _fetchFirstSqlSuffix = " fetch first " + getFetchSize() + " rows only";
+        }
+    }
+
+    /**
+     * ${database.ImplementComment} {Unsupported!}
+     */
+    protected void doFetchPage() {
+        if (isFetchSizeSupported()) {
+            if (isFetchStartIndexSupported()) {
+                _fetchFirstSqlSuffix = " fetch first " + getFetchSize() + " rows only";
+            } else {
+                _fetchFirstSqlSuffix = " fetch first " + getPageEndIndex() + " rows only";
+            }
+        }
+    }
+
+    /**
+     * ${database.ImplementComment} {Unsupported!}
+     */
+    protected void doClearFetchPageClause() {
+        _fetchFirstSqlSuffix = "";
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchStartIndexSupported() {
+        return false;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockSqlSuffix = " for update with RS";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return _fetchFirstSqlSuffix + _lockSqlSuffix;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_default.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_default.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_default.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,102 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}Default")
+
+/**
+ * SqlClause for Default.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /**
+     * Constructor.
+     * <p>
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchStartIndexSupported() {
+        return false; // Default
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchSizeSupported() {
+        return false; // Default
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        String msg = "LockForUpdate-SQL is unsupported in the database. Sorry...: " + toString();
+        throw new UnsupportedOperationException(msg);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return "";
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_derby.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_derby.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_derby.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,105 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}Derby")
+
+/**
+ * SqlClause for Default.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of lock as sql-suffix. */
+    protected String _lockSqlSuffix = "";
+
+    /**
+     * Constructor.
+     * <p>
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchStartIndexSupported() {
+        return false; // Default
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchSizeSupported() {
+        return false; // Default
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockSqlSuffix = " for update";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return _lockSqlSuffix;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_firebird.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_firebird.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_firebird.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,103 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}Firebird")
+
+/**
+ * SqlClause for Firebird.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of fetch-scope as select-hint. */
+    protected String _fetchScopeSelectHint = "";
+
+    /** String of lock as sql-suffix. */
+    protected String _lockSqlSuffix = "";
+
+    /**
+     * Constructor.
+     * 
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+        if (isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " first " + getFetchSize();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+        if (isFetchStartIndexSupported() && isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " first " + getFetchSize() + " skip " + getPageStartIndex();
+        }
+        if (isFetchStartIndexSupported() && !isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " skip " + getPageStartIndex();
+        }
+        if (!isFetchStartIndexSupported() && isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " first " + getPageEndIndex();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+        _fetchScopeSelectHint = "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockSqlSuffix = " for update with lock";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return _fetchScopeSelectHint;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return _lockSqlSuffix;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_interbase.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_interbase.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_interbase.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,103 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}Interbase")
+
+/**
+ * SqlClause for Interbase.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of fetch-scope as select-hint. */
+    protected String _fetchScopeSelectHint = "";
+
+    /** String of lock as sql-suffix. */
+    protected String _lockSqlSuffix = "";
+
+    /**
+     * Constructor.
+     * 
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+        if (isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " first " + getFetchSize();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+        if (isFetchStartIndexSupported() && isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " first " + getFetchSize() + " skip " + getPageStartIndex();
+        }
+        if (isFetchStartIndexSupported() && !isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " skip " + getPageStartIndex();
+        }
+        if (!isFetchStartIndexSupported() && isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " first " + getPageEndIndex();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+        _fetchScopeSelectHint = "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockSqlSuffix = " for update with lock";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return _fetchScopeSelectHint;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return _lockSqlSuffix;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mssql.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mssql.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mssql.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,110 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}SqlServer")
+
+/**
+ * SqlClause for MSSQL.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of fetch-first as select-hint. */
+    protected String _fetchFirstSelectHint = "";
+
+    /** String of lock as from-hint. */
+    protected String _lockFromHint = "";
+
+    /**
+     * Constructor.
+     * 
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+        if (isFetchSizeSupported()) {
+            _fetchFirstSelectHint = " top " + getFetchSize();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+        if (isFetchSizeSupported()) {
+            if (isFetchStartIndexSupported()) {
+                _fetchFirstSelectHint = " top " + getFetchSize();
+            } else {
+                _fetchFirstSelectHint = " top " + getPageEndIndex();
+            }
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+        _fetchFirstSelectHint = "";
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Determination.
+     */
+    public boolean isFetchStartIndexSupported() {
+        return false;
+    }
+
+    /**
+     * ${database.ImplementComment} {Implement}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockFromHint = " with (updlock)";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return _fetchFirstSelectHint;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return _lockFromHint;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return "";
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mysql.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mysql.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_mysql.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,93 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}MySql")
+
+/**
+ * SqlClause for MySQL.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of fetch-scope as sql-suffix. */
+    protected String _fetchScopeSqlSuffix = "";
+
+    /** String of lock as sql-suffix. */
+    protected String _lockSqlSuffix = "";
+
+    /**
+     * Constructor.
+     * <p>
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+        doFetchPage();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+        _fetchScopeSqlSuffix = " limit " + getPageStartIndex() + ", " + getFetchSize();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+        _fetchScopeSqlSuffix = "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockSqlSuffix = " for update";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return _fetchScopeSqlSuffix + _lockSqlSuffix;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_oracle.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_oracle.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_oracle.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,114 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}Oracle")
+
+/**
+ * SqlClause for Oracle.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of fetch-scope as select-hint. */
+    protected String _fetchScopeSelectHint = "";
+
+    /** String of fetch-scope as sql-suffix. */
+    protected String _fetchScopeSqlSuffix = "";
+
+    /** String of lock as sql-suffix. */
+    protected String _lockSqlSuffix = "";
+
+    /**
+     * Constructor.
+     * 
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+        if (isFetchSizeSupported()) {
+            _fetchScopeSelectHint = " * from (select";
+            _fetchScopeSqlSuffix = ") where rownum <= " + getFetchSize();
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+        if (!isFetchStartIndexSupported() && !isFetchSizeSupported()) {
+            return;
+        }
+        _fetchScopeSelectHint = " * from (select base.*, rownum as rn from (select";
+        _fetchScopeSqlSuffix = "";
+        if (isFetchStartIndexSupported()) {
+            _fetchScopeSqlSuffix = ") base ) where rn > " + getPageStartIndex();
+        }
+        if (isFetchSizeSupported()) {
+            if (isFetchStartIndexSupported()) {
+                _fetchScopeSqlSuffix = _fetchScopeSqlSuffix + " and rn <= " + getPageEndIndex();
+            } else {
+                _fetchScopeSqlSuffix = ") base ) where rn <= " + getPageEndIndex();
+            }
+        }
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+        _fetchScopeSelectHint = "";
+        _fetchScopeSqlSuffix = "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockSqlSuffix = " for update";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return _fetchScopeSelectHint;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return _fetchScopeSqlSuffix + _lockSqlSuffix;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_postgresql.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_postgresql.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/cbean/sqlclause/SqlClause_postgresql.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,93 @@
+package ${glPackageBaseCommonSqlClause};
+
+#set ($myClassName = "${glSqlClauseInterfaceName}PostgreSql")
+
+/**
+ * SqlClause for PostreSQL.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glSqlClauseAbstractName} {
+
+    /** String of fetch-scope as sql-suffix. */
+    protected String _fetchScopeSqlSuffix = "";
+
+    /** String of lock as sql-suffix. */
+    protected String _lockSqlSuffix = "";
+
+    /**
+     * Constructor.
+     * 
+     * @param tableName Table name. (NotNull)
+     **/
+    public ${myClassName}(String tableName) {
+        super(tableName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchFirst() {
+        doFetchPage();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doFetchPage() {
+        _fetchScopeSqlSuffix = " offset " + getPageStartIndex() + " limit " + getFetchSize();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     */
+    protected void doClearFetchPageClause() {
+        _fetchScopeSqlSuffix = "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glSqlClauseInterfaceName} lockForUpdate() {
+        _lockSqlSuffix = " for update";
+        return this;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Select-hint. (NotNull)
+     */
+    protected String createSelectHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-base-table-hint. {select * from table [from-base-table-hint] where ...} (NotNull)
+     */
+    protected String createFromBaseTableHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return From-hint. (NotNull)
+     */
+    protected String createFromHint() {
+        return "";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Sql-suffix. (NotNull)
+     */
+    protected String createSqlSuffix() {
+        return _fetchScopeSqlSuffix + _lockSqlSuffix;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/AbstractDBMeta.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/AbstractDBMeta.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/AbstractDBMeta.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,608 @@
+package ${glPackageBaseCommonDBMeta};
+
+#set ($myClassName = "${glDBMetaAbstractName}")
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonHelper}.${glMapListStringName};
+import ${glPackageBaseCommonHelper}.${glMapListStringImplName};
+import ${glPackageBaseCommonHelper}.${glMapStringBuilderName};
+import ${glPackageBaseCommonHelper}.${glMapStringBuilderImplName};
+
+/**
+ * The abstract class of dbmeta.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${myClassName} implements ${glDBMetaInterfaceName} {
+
+    // =====================================================================================
+    //                                                                         Name Handling
+    //                                                                         =============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param dbName Db-name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isExistDbName(String dbName) {
+        return getDbNameCapPropNameMap().containsKey(dbName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param capPropName Cap-prop-name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isExistCapPropName(String capPropName) {
+        return getCapPropNameDbNameMap().containsKey(capPropName);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param uncapPropName Uncap-prop-name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isExistUncapPropName(String uncapPropName) {
+        return getUncapPropNameDbNameMap().containsKey(uncapPropName);
+    }
+
+    /// <sumarry>
+    /// ${database.ImplementComment}
+    /// </sumarry>
+    /// <param name="multiName">Multi-name.</param>
+    /// <returns>Determination.</returns>
+    public boolean isExistMultiName(String multiName) {
+        if (isExistDbName(multiName)) {
+            return true;
+        }
+        if (isExistCapPropName(multiName)) {
+            return true;
+        }
+        if (isExistUncapPropName(multiName)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param capPropName Cap-prop-name. (NotNull)
+     * @return Db-name. (NotNull)
+     */
+    public String getDbNameByCapPropName(String capPropName) {
+        assertStringNotNullAndNotTrimmedEmpty("capPropName", capPropName);
+        final String dbName = (String)getCapPropNameDbNameMap().get(capPropName);
+        if (dbName == null) {
+            String msg = "The capPropNameDbNameMap didn't contain the key of '" + capPropName + "': ";
+            throw new IllegalStateException(msg + getCapPropNameDbNameMap());
+        }
+        return dbName;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param uncapPropName Uncap-prop-name. (NotNull)
+     * @return {db-name : java-name} map. (NotNull)
+     */
+    public String getDbNameByUncapPropName(String uncapPropName) {
+        assertStringNotNullAndNotTrimmedEmpty("uncapPropName", uncapPropName);
+        final String dbName = (String)getUncapPropNameDbNameMap().get(uncapPropName);
+        if (dbName == null) {
+            String msg = "The uncapPropNameDbNameMap didn't contain the key of '" + uncapPropName + "': ";
+            throw new IllegalStateException(msg + getUncapPropNameDbNameMap());
+        }
+        return dbName;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param dbName Db-name. (NotNull)
+     * @return Cap-prop-name. (NotNull)
+     */
+    public String getCapPropNameByDbName(String dbName) {
+        assertStringNotNullAndNotTrimmedEmpty("dbName", dbName);
+        final String capPropName = (String)getDbNameCapPropNameMap().get(dbName);
+        if (capPropName == null) {
+            String msg = "The dbNameCapPropNameMap didn't contain the key of '" + dbName + "': ";
+            throw new IllegalStateException(msg + getDbNameCapPropNameMap());
+        }
+        return capPropName;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param uncapPropName Uncap-prop-name. (NotNull)
+     * @return Cap-prop-name. (NotNull)
+     */
+    public String getCapPropNameByUncapPropName(String uncapPropName) {
+        assertStringNotNullAndNotTrimmedEmpty("uncapPropName", uncapPropName);
+        final String dbName = getDbNameByMultiName(uncapPropName);
+        final String capPropName = (String)getDbNameCapPropNameMap().get(dbName);
+        if (capPropName == null) {
+            String msg = "The dbNameCapPropNameMap didn't contain the key of '" + dbName + "': ";
+            throw new IllegalStateException(msg + getDbNameCapPropNameMap());
+        }
+        return capPropName;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param dbName Db-name. (NotNull)
+     * @return Uncap-prop-name. (NotNull)
+     */
+    public String getUncapPropNameByDbName(String dbName) {
+        assertStringNotNullAndNotTrimmedEmpty("dbName", dbName);
+        final String uncapPropName = (String)getDbNameUncapPropNameMap().get(dbName);
+        if (uncapPropName == null) {
+            String msg = "The dbNameUncapPropNameMap didn't contain the key of '" + dbName + "': ";
+            throw new IllegalStateException(msg + getDbNameUncapPropNameMap());
+        }
+        return uncapPropName;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param capPropName Cap-prop-name. (NotNull)
+     * @return Uncap-prop-name. (NotNull)
+     */
+    public String getUncapPropNameByCapPropName(String capPropName) {
+        assertStringNotNullAndNotTrimmedEmpty("capPropName", capPropName);
+        final String dbName = getDbNameByMultiName(capPropName);
+        final String uncapPropName = (String)getDbNameUncapPropNameMap().get(dbName);
+        if (uncapPropName == null) {
+            String msg = "The dbNameUncapPropNameMap didn't contain the key of '" + capPropName + "': ";
+            throw new IllegalStateException(msg + getDbNameUncapPropNameMap());
+        }
+        return uncapPropName;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param multiName Multi-name. (NotNull)
+     * @return Db-name. (NotNull)
+     */
+    public String getDbNameByMultiName(String multiName) {
+        assertStringNotNullAndNotTrimmedEmpty("multiName", multiName);
+        if (isExistDbName(multiName)) {
+            return multiName;
+        }
+        if (isExistCapPropName(multiName)) {
+            return getDbNameByCapPropName(multiName);
+        }
+        if (isExistUncapPropName(multiName)) {
+            return getDbNameByUncapPropName(multiName);
+        }
+        String msg = "The multi-name is invalid: multiName=" + multiName;
+        throw new IllegalStateException(msg);
+    }
+
+    /**
+     * Get java-name by multi-name.
+     * 
+     * @param multiName Multi-name.
+     * @return Cap-prop-name.
+     */
+    public String getCapPropNameByMultiName(String multiName) {
+        assertStringNotNullAndNotTrimmedEmpty("multiName", multiName);
+        if (isExistDbName(multiName)) {
+            return getCapPropNameByDbName(multiName);
+        }
+        if (isExistCapPropName(multiName)) {
+            return multiName;
+        }
+        if (isExistUncapPropName(multiName)) {
+            return getCapPropNameByUncapPropName(multiName);
+        }
+        String msg = "The multi-name is invalid: multiName=" + multiName;
+        throw new IllegalStateException(msg);
+    }
+
+    /**
+     * Get property-name by multi-name.
+     * 
+     * @param multiName Multi-name.
+     * @return Uncap-prop-name.
+     */
+    public String getUncapPropNameByMultiName(String multiName) {
+        assertStringNotNullAndNotTrimmedEmpty("multiName", multiName);
+        if (isExistDbName(multiName)) {
+            return getUncapPropNameByDbName(multiName);
+        }
+        if (isExistCapPropName(multiName)) {
+            return getUncapPropNameByCapPropName(multiName);
+        }
+        if (isExistUncapPropName(multiName)) {
+            return multiName;
+        }
+        String msg = "The multi-name is invalid: multiName=" + multiName;
+        throw new IllegalStateException(msg);
+    }
+
+    // ===================================================================================
+    //                                                                        JDBC Support
+    //                                                                        ============
+    public int insertEntity(java.sql.Connection conn, ${glEntityInterfaceName} entity) {
+        return insertEntity(conn, entity, "");
+    }
+
+    public int insertEntity(java.sql.Connection conn, ${glEntityInterfaceName} entity, String tablePrefix) {
+        checkDowncast(entity);
+        final String sql = getPreparedInsertClause(tablePrefix);
+        java.sql.PreparedStatement ps = null;
+        try {
+            ps = conn.prepareStatement(sql);
+            final java.util.List${database.filterGenericsString('Object')} valueList = convertToColumnValueList(entity);
+            int settingIndex = 1;
+            for (final java.util.Iterator ite = valueList.iterator(); ite.hasNext(); ) {
+                Object value = ite.next();
+                if (value == null) {
+                    ps.setNull(settingIndex, java.sql.Types.VARCHAR);
+                } else {
+                    ps.setObject(settingIndex, value);
+                }
+                ++settingIndex;
+            }
+            return ps.executeUpdate();
+        } catch (java.sql.SQLException e) {
+            String msg = "The sql threw the exception: sql=" + sql;
+            throw new IllegalStateException(msg, e);
+        } finally {
+            if (ps != null) {
+                try {
+                    ps.close();
+                } catch (java.sql.SQLException ignored) {
+                }
+            }
+        }
+    }
+
+    // ===================================================================================
+    //                                                                          Map String
+    //                                                                          ==========
+    public ${glMapListStringName} createMapListString() {
+        return MapStringUtil.createMapListString();
+    }
+
+    public ${glMapStringBuilderName} createMapStringBuilder() {
+        return MapStringUtil.createMapStringBuilder(getColumnDbNameList());
+    }
+
+    // ===================================================================================
+    //                                                                          Util Class
+    //                                                                          ==========
+    /**
+     * This class is for Internal. Don't use this!
+     */
+    protected static class MapStringUtil {
+        public static void acceptPrimaryKeyMapString(String primaryKeyMapString, ${glEntityInterfaceName} entity) {
+            if (primaryKeyMapString == null) {
+                String msg = "The argument[primaryKeyMapString] should not be null.";
+                throw new IllegalArgumentException(msg);
+            }
+            final String prefix = MAP_STRING_MAP_MARK + MAP_STRING_START_BRACE;
+            final String suffix = MAP_STRING_END_BRACE;
+            if (!primaryKeyMapString.trim().startsWith(prefix)) {
+                primaryKeyMapString = prefix + primaryKeyMapString;
+            }
+            if (!primaryKeyMapString.trim().endsWith(suffix)) {
+                primaryKeyMapString = primaryKeyMapString + suffix;
+            }
+            ${glMapListStringName} mapListString = createMapListString();
+            entity.getDBMeta().acceptPrimaryKeyMap(entity, mapListString.generateMap(primaryKeyMapString));
+        }
+
+        public static void acceptColumnValueMapString(String columnValueMapString, ${glEntityInterfaceName} entity) {
+            if (columnValueMapString == null) {
+                String msg = "The argument[columnValueMapString] should not be null.";
+                throw new IllegalArgumentException(msg);
+            }
+            final String prefix = MAP_STRING_MAP_MARK + MAP_STRING_START_BRACE;
+            final String suffix = MAP_STRING_END_BRACE;
+            if (!columnValueMapString.trim().startsWith(prefix)) {
+                columnValueMapString = prefix + columnValueMapString;
+            }
+            if (!columnValueMapString.trim().endsWith(suffix)) {
+                columnValueMapString = columnValueMapString + suffix;
+            }
+            ${glMapListStringName} mapListString = createMapListString();
+            entity.getDBMeta().acceptColumnValueMap(entity, mapListString.generateMap(columnValueMapString));
+        }
+
+        public static String extractPrimaryKeyMapString(${glEntityInterfaceName} entity) {
+            final String startBrace = MAP_STRING_START_BRACE;
+            final String endBrace = MAP_STRING_END_BRACE;
+            final String delimiter = MAP_STRING_DELIMITER;
+            final String equal = MAP_STRING_EQUAL;
+            return entity.getDBMeta().extractPrimaryKeyMapString(entity, startBrace, endBrace, delimiter, equal);
+        }
+
+        public static String extractColumnValueMapString(${glEntityInterfaceName} entity) {
+            final String startBrace = MAP_STRING_START_BRACE;
+            final String endBrace = MAP_STRING_END_BRACE;
+            final String delimiter = MAP_STRING_DELIMITER;
+            final String equal = MAP_STRING_EQUAL;
+            return entity.getDBMeta().extractColumnValueMapString(entity, startBrace, endBrace, delimiter, equal);
+        }
+
+        public static void checkTypeString(Object value, String propertyName, String typeName) {
+            if (value == null) {
+                throw new IllegalArgumentException("The value should not be null: " + propertyName);
+            }
+            if (!(value instanceof String)) {
+                String msg = "The value of " + propertyName + " should be " + typeName + " or String: ";
+                msg = msg + "valueType=" + value.getClass() + " value=" + value;
+                throw new IllegalArgumentException(msg);
+            }
+        }
+
+        public static long parseDateStringAsMillis(Object value, String propertyName, String typeName) {
+            checkTypeString(value, propertyName, typeName);
+            try {
+                final String valueString = (String)value;
+                if (valueString.indexOf("-") >= 0 && valueString.indexOf("-") != valueString.lastIndexOf("-")) {
+                    return java.sql.Timestamp.valueOf(valueString).getTime();
+                } else {
+                    return getParseDateFormat().parse((String)value).getTime();
+                }
+            } catch (java.text.ParseException e) {
+                String msg = "The value of " + propertyName + " should be " + typeName + ". but: " + value;
+                throw new RuntimeException(msg + " threw the exception: value=[" + value + "]", e);
+            } catch (RuntimeException e) {
+                String msg = "The value of " + propertyName + " should be " + typeName + ". but: " + value;
+                throw new RuntimeException(msg + " threw the exception: value=[" + value + "]", e);
+            }
+        }
+
+        public static String formatDate(java.util.Date value) {
+            return getFormatDateFormat().format(value);
+        }
+
+        public static String formatTimestamp(java.sql.Timestamp value) {
+            return getFormatDateFormat().format(value);
+        }
+
+        public static java.text.DateFormat getParseDateFormat() {
+            return java.text.DateFormat.getDateTimeInstance();
+        }
+
+        public static java.text.DateFormat getFormatDateFormat() {
+            return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+        }
+
+        public static ${glMapListStringName} createMapListString() {
+            final ${glMapListStringName} mapListString = new ${glMapListStringImplName}();
+            mapListString.setMapMark(MAP_STRING_MAP_MARK);
+            mapListString.setListMark(MAP_STRING_LIST_MARK);
+            mapListString.setStartBrace(MAP_STRING_START_BRACE);
+            mapListString.setEndBrace(MAP_STRING_END_BRACE);
+            mapListString.setEqual(MAP_STRING_EQUAL);
+            mapListString.setDelimiter(MAP_STRING_DELIMITER);
+            return mapListString;
+        }
+
+        public static ${glMapStringBuilderName} createMapStringBuilder(java.util.List${database.filterGenericsString('String')} columnNameList) {
+            ${glMapStringBuilderName} mapStringBuilder = new ${glMapStringBuilderImplName}();
+            mapStringBuilder.setMsMapMark(MAP_STRING_MAP_MARK);
+            mapStringBuilder.setMsStartBrace(MAP_STRING_START_BRACE);
+            mapStringBuilder.setMsEndBrace(MAP_STRING_END_BRACE);
+            mapStringBuilder.setMsEqual(MAP_STRING_EQUAL);
+            mapStringBuilder.setMsDelimiter(MAP_STRING_DELIMITER);
+            mapStringBuilder.setColumnNameList(columnNameList);
+            return mapStringBuilder;
+        }
+    }
+
+    /**
+     * This class is for Internal. Don't use this!
+     */
+    protected static class MapAssertUtil {
+        public static void assertPrimaryKeyMapNotNullAndNotEmpty(java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap) {
+            if (primaryKeyMap == null) {
+                String msg = "The argument[primaryKeyMap] should not be null.";
+                throw new IllegalArgumentException(msg);
+            }
+            if (primaryKeyMap.isEmpty()) {
+                String msg = "The argument[primaryKeyMap] should not be empty.";
+                throw new IllegalArgumentException(msg);
+            }
+        }
+        public static void assertColumnExistingInPrimaryKeyMap(java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap, String columnName) {
+            if (!primaryKeyMap.containsKey(columnName)) {
+                String msg = "The primaryKeyMap must have the value of " + columnName;
+                throw new IllegalStateException(msg + ": primaryKeyMap --> " + primaryKeyMap);
+            }
+        }
+        public static void assertColumnValueMapNotNullAndNotEmpty(java.util.Map${database.filterGenericsString('String, ? extends Object')} columnValueMap) {
+            if (columnValueMap == null) {
+                String msg = "The argument[columnValueMap] should not be null.";
+                throw new IllegalArgumentException(msg);
+            }
+            if (columnValueMap.isEmpty()) {
+                String msg = "The argument[columnValueMap] should not be empty.";
+                throw new IllegalArgumentException(msg);
+            }
+        }
+    }
+
+#if ($database.isAvailableGenerics())
+
+    /**
+     * This class is for Internal. Don't use this!
+     */
+    protected static class MapStringValueAnalyzer {
+        protected java.util.Map<String, ? extends Object> _valueMap;
+        protected java.util.Set<String> _modifiedPropertyNames;
+        protected String _columnName;
+        protected String _uncapPropName;
+        protected String _propertyName;
+
+        public MapStringValueAnalyzer(java.util.Map<String, ? extends Object> valueMap, java.util.Set<String> modifiedPropertyNames) {
+            this._valueMap = valueMap;
+            this._modifiedPropertyNames = modifiedPropertyNames;
+        }
+
+        public boolean init(String columnName, String uncapPropName, String propertyName) {
+            this._columnName = columnName;
+            this._uncapPropName = uncapPropName;
+            this._propertyName = propertyName;
+            return _valueMap.containsKey(_columnName);
+        }
+
+        public <COLUMN_TYPE> COLUMN_TYPE analyzeString(Class<COLUMN_TYPE> javaType) {
+            final Object obj = _valueMap.get(_columnName);
+            if (obj == null) {
+                _modifiedPropertyNames.remove(_propertyName);
+                return null;
+            }
+            helpCheckingTypeString(obj, _uncapPropName, javaType.getName());
+            return (COLUMN_TYPE)obj;
+        }
+
+        public <COLUMN_TYPE> COLUMN_TYPE analyzeNumber(Class<COLUMN_TYPE> javaType) {
+            final Object obj = _valueMap.get(_columnName);
+            if (obj == null) {
+                _modifiedPropertyNames.remove(_propertyName);
+                return null;
+            }
+            if (javaType.isAssignableFrom(obj.getClass())) {
+                return (COLUMN_TYPE)obj;
+            }
+            return (COLUMN_TYPE)newInstanceByConstructor(javaType, String.class, obj.toString());
+        }
+
+        public <COLUMN_TYPE> COLUMN_TYPE analyzeDate(Class<COLUMN_TYPE> javaType) {
+            final Object obj = _valueMap.get(_columnName);
+            if (obj == null) {
+                _modifiedPropertyNames.remove(_propertyName);
+                return null;
+            }
+            if (javaType.isAssignableFrom(obj.getClass())) {
+                return (COLUMN_TYPE)obj;
+            }
+            return (COLUMN_TYPE)newInstanceByConstructor(javaType, long.class, helpParsingDateString(obj, _uncapPropName, javaType.getName()));
+        }
+
+        public <COLUMN_TYPE> COLUMN_TYPE analyzeOther(Class<COLUMN_TYPE> javaType) {
+            final Object obj = _valueMap.get(_columnName);
+            if (obj == null) {
+                _modifiedPropertyNames.remove(_propertyName);
+                return null;
+            }
+            return (COLUMN_TYPE)obj;
+        }
+
+	    private void helpCheckingTypeString(Object value, String uncapPropName, String typeName) {
+	        MapStringUtil.checkTypeString(value, uncapPropName, typeName);
+	    }
+
+	    private long helpParsingDateString(Object value, String uncapPropName, String typeName) {
+	        return MapStringUtil.parseDateStringAsMillis(value, uncapPropName, typeName);
+	    }
+
+        protected Object newInstanceByConstructor(Class targetType, Class argType, Object arg) {
+            java.lang.reflect.Constructor constructor;
+            try {
+                constructor = targetType.getConstructor(new Class[]{argType});
+            } catch (SecurityException e) {
+                String msg = "targetType=" + targetType + " argType=" + argType + " arg=" + arg;
+                throw new RuntimeException(msg, e);
+            } catch (NoSuchMethodException e) {
+                String msg = "targetType=" + targetType + " argType=" + argType + " arg=" + arg;
+                throw new RuntimeException(msg, e);
+            }
+            try {
+                return constructor.newInstance(new Object[]{arg});
+            } catch (IllegalArgumentException e) {
+                String msg = "targetType=" + targetType + " argType=" + argType + " arg=" + arg;
+                throw new RuntimeException(msg, e);
+            } catch (InstantiationException e) {
+                String msg = "targetType=" + targetType + " argType=" + argType + " arg=" + arg;
+                throw new RuntimeException(msg, e);
+            } catch (IllegalAccessException e) {
+                String msg = "targetType=" + targetType + " argType=" + argType + " arg=" + arg;
+                throw new RuntimeException(msg, e);
+            } catch (java.lang.reflect.InvocationTargetException e) {
+                String msg = "targetType=" + targetType + " argType=" + argType + " arg=" + arg;
+                throw new RuntimeException(msg, e);
+            }
+        }
+    }
+
+#end
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+    abstract protected void checkDowncast(${glEntityInterfaceName} entity);
+
+    protected String helpGettingColumnStringValue(Object value) {
+        if (value instanceof java.sql.Timestamp) {
+            return (value != null ? helpFormatingTimestamp((java.sql.Timestamp)value) : "");
+        } else if (value instanceof java.util.Date) {
+            return (value != null ? helpFormatingDate((java.util.Date)value) : "");
+        } else {
+            return (value != null ? value.toString() : "");
+        }
+    }
+
+    protected String helpFormatingDate(java.util.Date date) {
+        return MapStringUtil.formatDate(date);
+    }
+
+    protected String helpFormatingTimestamp(java.sql.Timestamp timestamp) {
+        return MapStringUtil.formatTimestamp(timestamp);
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the argument is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param arg Argument. (NotNull)
+     */
+    protected void assertObjectNotNull(String variableName, Object arg) {
+        if (variableName == null) {
+            String msg = "Argument[variableName] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (arg == null) {
+            String msg = "Argument[" + variableName + "] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the string is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        if (variableName == null) {
+            String msg = "Variable[variableName] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "Variable[" + variableName + "] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (value.trim().length() == 0) {
+            String msg = "Variable[" + variableName + "] should not be empty: [" + value + "]";
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMeta.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMeta.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMeta.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,473 @@
+package ${glPackageBaseCommonDBMeta};
+
+#set ($myClassName = "${glDBMetaInterfaceName}")
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonHelper}.${glMapListStringName};
+import ${glPackageBaseCommonHelper}.${glMapStringBuilderName};
+
+/**
+ * The interface of dbmeta.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${myClassName} {
+
+    // ===================================================================================
+    //                                                                          Definition
+    //                                                                          ==========
+    /** Map-string map-mark. */
+    public static final String MAP_STRING_MAP_MARK = "map:";
+
+    /** Map-string list-mark. */
+    public static final String MAP_STRING_LIST_MARK = "list:";
+
+    /** Map-string start-brace. */
+    public static final String MAP_STRING_START_BRACE = "${database.extractAcceptStartBrace}";
+
+    /** Map-string end-brace. */
+    public static final String MAP_STRING_END_BRACE = "${database.extractAcceptEndBrace}";
+
+    /** Map-string delimiter. */
+    public static final String MAP_STRING_DELIMITER = "${database.extractAcceptDelimiter}";
+
+    /** Map-string equal. */
+    public static final String MAP_STRING_EQUAL = "${database.extractAcceptEqual}";
+
+    // ===================================================================================
+    //                                                                          Table Name
+    //                                                                          ==========
+    /**
+     * Get table db-name.
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName();
+
+    /**
+     * Get table cap-prop-name.
+     * 
+     * @return Table cap-prop-name. (NotNull)
+     */
+    public String getTableCapPropName();
+
+    /**
+     * Get table uncap-prop-name.
+     * 
+     * @return Table uncap-prop-name. (NotNull)
+     */
+    public String getTableUncapPropName();
+
+    // ===================================================================================
+    //                                                                         Column Name
+    //                                                                         ===========
+    public java.util.List${database.filterGenericsString('String')} getColumnDbNameList();
+
+    public java.util.List${database.filterGenericsString('String')} getColumnCapPropNameList();
+
+    public java.util.List${database.filterGenericsString('String')} getColumnUncapPropNameList();
+
+    /**
+     * Get column-db-name comma-string.
+     * 
+     * @return Column-db-name comma-string. (NotNull)
+     */
+    public String getColumnDbNameCommaString();
+
+    // ===================================================================================
+    //                                                                       Name Handling
+    //                                                                       =============
+    /**
+     * Is existing db-name?
+     * 
+     * @param dbName Db-name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isExistDbName(String dbName);
+
+    /**
+     * Is existing cap-prop-name?
+     * 
+     * @param capPropName Cap-prop-name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isExistCapPropName(String capPropName);
+
+    /**
+     * Is existing uncap-prop-name?
+     * 
+     * @param uncapPropName Uncap-prop-name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isExistUncapPropName(String uncapPropName);
+
+    /**
+     * Is existing multi-name?
+     * 
+     * @param multiName Multi-name. (NotNull)
+     * @return Determination.
+     */
+    public boolean isExistMultiName(String multiName);
+
+    /**
+     * Get db-name by property-name.
+     * 
+     * @param capPropName Cap-prop-name.
+     * @return Db-name.
+     */
+    public String getDbNameByCapPropName(String capPropName);
+
+    /**
+     * Get db-name by property-name.
+     * 
+     * @param propertyName Uncap-prop-name.
+     * @return {db-name : cap-prop-name} map.
+     */
+    public String getDbNameByUncapPropName(String propertyName);
+
+    /**
+     * Get cap-prop-name by db-name.
+     * 
+     * @param dbName Db-name.
+     * @return Cap-prop-name.
+     */
+    public String getCapPropNameByDbName(String dbName);
+
+    /**
+     * Get cap-prop-name by property-name.
+     * 
+     * @param propertyName Uncap-prop-name.
+     * @return Cap-prop-name.
+     */
+    public String getCapPropNameByUncapPropName(String propertyName);
+
+    /**
+     * Get property-name by db-name.
+     * 
+     * @param dbName Db-name.
+     * @return Uncap-prop-name.
+     */
+    public String getUncapPropNameByDbName(String dbName);
+
+    /**
+     * Get property-name by cap-prop-name.
+     * 
+     * @param capPropName Cap-prop-name.
+     * @return Uncap-prop-name.
+     */
+    public String getUncapPropNameByCapPropName(String capPropName);
+
+    /**
+     * Get db-name by multi-name.
+     * 
+     * @param multiName Multi-name.
+     * @return Db-name.
+     */
+    public String getDbNameByMultiName(String multiName);
+
+    /**
+     * Get cap-prop-name by multi-name.
+     * 
+     * @param multiName Multi-name.
+     * @return Cap-prop-name.
+     */
+    public String getCapPropNameByMultiName(String multiName);
+
+    /**
+     * Get property-name by multi-name.
+     * 
+     * @param multiName Multi-name.
+     * @return Uncap-prop-name.
+     */
+    public String getUncapPropNameByMultiName(String multiName);
+
+    // ===================================================================================
+    //                                                                            Name Map
+    //                                                                            ========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {db-name : cap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getDbNameCapPropNameMap();
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {db-name : uncap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getDbNameUncapPropNameMap();
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {cap-prop-name : db-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getCapPropNameDbNameMap();
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {cap-prop-name : uncap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getCapPropNameUncapPropNameMap();
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {uncap-prop-name : db-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getUncapPropNameDbNameMap();
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {uncap-prop-name : cap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getUncapPropNameCapPropNameMap();
+
+    // ===================================================================================
+    //                                                                           Type Name
+    //                                                                           =========
+    /**
+     * Get the type-name of entity.
+     * 
+     * @return The type-name of entity. (NotNull)
+     */ 
+    public String getEntityTypeName();
+
+    /**
+     * Get the type-name of condition-bean.
+     * 
+     * @return The type-name of condition-bean. (Nullable: If the condition-bean does not exist)
+     */ 
+    public String getConditionBeanTypeName();
+
+    /**
+     * Get the type-name of dao.
+     * 
+     * @return The type-name of dao. (Nullable: If the dao does not exist)
+     */ 
+    public String getDaoTypeName();
+
+    /**
+     * Get the type-name of behavior.
+     * 
+     * @return The type-name of behavior. (Nullable: If the behavior does not exist)
+     */ 
+    public String getBehaviorTypeName();
+
+    // ===================================================================================
+    //                                                                                Type
+    //                                                                                ====
+    /**
+     * Get the type of entity.
+     * 
+     * @return The type of entity. (NotNull)
+     */ 
+    public Class getEntityType();
+
+    // ===================================================================================
+    //                                                                            Instance
+    //                                                                            ========
+    /**
+     * New the instance of entity.
+     * 
+     * @return The instance of entity. (NotNull)
+     */ 
+    public ${glEntityInterfaceName} newEntity();
+
+    // ===================================================================================
+    //                                                                      Foreign DBMeta
+    //                                                                      ==============
+    /**
+     * Get foreign dbmeta.
+     * 
+     * @param foreignPropertyName Foreign-property-name(Both OK - InitCap or not). (NotNull)
+     * @return Foreign DBMeta. (NotNull)
+     */ 
+    public ${myClassName} getForeignDBMeta(String foreignPropertyName);
+
+    // ===================================================================================
+    //                                                                       Determination
+    //                                                                       =============
+    /**
+     * Has two or more primary-keys?
+     * 
+     * @return Determination.
+     */
+    public boolean hasTwoOrMorePrimaryKeys();
+
+    /**
+     * Has common column?
+     * 
+     * @return Determination.
+     */
+    public boolean hasCommonColumn();
+
+    // ===================================================================================
+    //                                                                     Entity Handling
+    //                                                                     ===============
+    // -----------------------------------------------------
+    //                                                Accept
+    //                                                ------
+    /**
+     * Accept primary-key map.
+     * 
+     * The column that column-value map-string doesn't have the value of is reflected as null.
+     * The column that column-value map-string doesn't have the key of is NOT updated nothing.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param primaryKeyMap Primary-key map. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMap(${glEntityInterfaceName} entity, java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap);
+
+    /**
+     * Accept primary-key map-string.
+     * 
+     * The column that column-value map-string doesn't have the value of is reflected as null.
+     * The column that column-value map-string doesn't have the key of is NOT updated nothing.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param primaryKeyMapString Primary-key map-string. (NotNull)
+     */
+    public void acceptPrimaryKeyMapString(${glEntityInterfaceName} entity, String primaryKeyMapString);
+
+    /**
+     * Accept column-value map.
+     * 
+     * The column that column-value map-string doesn't have the value of is reflected as null.
+     * The column that column-value map-string doesn't have the key of is NOT updated nothing.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param columnValueMap Column-value map. (NotNull and NotEmpty)
+     */
+    public void acceptColumnValueMap(${glEntityInterfaceName} entity, java.util.Map${database.filterGenericsString('String, ? extends Object')} columnValueMap);
+
+    /**
+     * Accept column-value map-string.
+     * 
+     * The column that column-value map-string doesn't have the value of is reflected as null.
+     * The column that column-value map-string doesn't have the key of is NOT updated nothing.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param columnValueMapString Column-value map-string. (NotNull)
+     */
+    public void acceptColumnValueMapString(${glEntityInterfaceName} entity, String columnValueMapString);
+
+    // -----------------------------------------------------
+    //                                               Extract
+    //                                               -------
+    /**
+     * Extract primary-key map-string. Delimiter is at-mark and semicolon.
+     * <p>
+     * <pre>
+     * ex) Uses that this method have.
+     *   final String primaryKeyMapString = LdBookDbm.extractPrimaryKeyMapString(entity);
+     *   final LdBook entity = dao.selectEntity(new LdBookCB().acceptPrimaryKeyMapString(primaryKeyMapString));
+     *   ... // as primary key for condition.
+     * </pre>
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Primary-key map-string. (NotNull)
+     */
+    public String extractPrimaryKeyMapString(${glEntityInterfaceName} entity);
+
+    /**
+     * Extract primary-key map-string.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Primary-key map-string. (NotNull)
+     */
+    public String extractPrimaryKeyMapString(${glEntityInterfaceName} entity, String startBrace, String endBrace, String delimiter, String equal);
+
+    /**
+     * Extract column-value map-string. Delimiter is at-mark and semicolon.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     */
+    public String extractColumnValueMapString(${glEntityInterfaceName} entity);
+
+    /**
+     * Extract column-value map-string.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     */
+    public String extractColumnValueMapString(${glEntityInterfaceName} entity, String startBrace, String endBrace, String delimiter, String equal);
+
+    /**
+     * Extract common-column-value map-string.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Common-column-value map-string. (NotNull)
+     */
+    public String extractCommonColumnValueMapString(${glEntityInterfaceName} entity);
+
+    /**
+     * Extract common-column-value map-string.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Common-column-value map-string. (NotNull)
+     */
+    public String extractCommonColumnValueMapString(${glEntityInterfaceName} entity, String startBrace, String endBrace, String delimiter, String equal);
+
+    // -----------------------------------------------------
+    //                                               Convert
+    //                                               -------
+    /**
+     * Convert entity to column value as list.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return The list of column value. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString('Object')} convertToColumnValueList(${glEntityInterfaceName} entity);
+
+    /**
+     * Convert entity to column value as map.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return The map of column value. (NotNull)
+     */
+    public java.util.Map${database.filterGenericsString('String, Object')} convertToColumnValueMap(${glEntityInterfaceName} entity);
+
+    /**
+     * Convert entity to column string-value as list.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return The list of column string-value. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString('String')} convertToColumnStringValueList(${glEntityInterfaceName} entity);
+
+    /**
+     * Convert entity to column string-value as map.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return The map of column string-value. (NotNull)
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} convertToColumnStringValueMap(${glEntityInterfaceName} entity);
+
+    // ===================================================================================
+    //                                                                        JDBC Support
+    //                                                                        ============
+    public int insertEntity(java.sql.Connection conn, ${glEntityInterfaceName} entity);
+    public int insertEntity(java.sql.Connection conn, ${glEntityInterfaceName} entity, String tablePrefix);
+    public String getPreparedInsertClause();
+    public String getPreparedInsertClause(String tablePrefix);
+
+    // ===================================================================================
+    //                                                                          Map String
+    //                                                                          ==========
+    public ${glMapListStringName} createMapListString();
+
+    public ${glMapStringBuilderName} createMapStringBuilder();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMetaInstanceHandler.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMetaInstanceHandler.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/dbmeta/DBMetaInstanceHandler.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,187 @@
+package ${glPackageBaseCommonDBMeta};
+
+#set ($myClassName = "${glDBMetaInstanceHandlerName}")
+#set ($instanceMapGenericDefinition = "String, ${glDBMetaInterfaceName}")
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+/**
+ * DBMeta instance handler.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    /** Table db-name instance map. */
+    protected static final Map${database.filterGenericsString(${instanceMapGenericDefinition})} _tableDbNameInstanceMap;
+    static {
+        Map${database.filterGenericsString(${instanceMapGenericDefinition})} tmpMap = new LinkedHashMap${database.filterGenericsString(${instanceMapGenericDefinition})}();
+
+#foreach ($table in $database.Tables)
+        tmpMap.put("${table.Name}", getDBMeta("${glPackageBaseDBMeta}.${glProjectPrefix}${table.JavaName}Dbm"));
+#end
+
+        _tableDbNameInstanceMap = java.util.Collections.unmodifiableMap(tmpMap);
+    }
+
+    /** Table cap-prop-name instance map. */
+    protected static final Map${database.filterGenericsString(${instanceMapGenericDefinition})} _tableCapPropNameInstanceMap;
+    static {
+        Map${database.filterGenericsString(${instanceMapGenericDefinition})} tmpMap = new LinkedHashMap${database.filterGenericsString(${instanceMapGenericDefinition})}();
+
+#foreach ($table in $database.Tables)
+        tmpMap.put("${table.JavaName}", getDBMeta("${glPackageBaseDBMeta}.${glProjectPrefix}${table.JavaName}Dbm"));
+#end
+
+        _tableCapPropNameInstanceMap = java.util.Collections.unmodifiableMap(tmpMap);
+    }
+
+    /** Table uncap-prop-name instance map. */
+    protected static final Map${database.filterGenericsString(${instanceMapGenericDefinition})} _tableUncapPropNameInstanceMap;
+    static {
+        Map${database.filterGenericsString(${instanceMapGenericDefinition})} tmpMap = new LinkedHashMap${database.filterGenericsString(${instanceMapGenericDefinition})}();
+
+#foreach ($table in $database.Tables)
+        tmpMap.put("${table.UncapitalisedJavaName}", getDBMeta("${glPackageBaseDBMeta}.${glProjectPrefix}${table.JavaName}Dbm"));
+#end
+
+        _tableUncapPropNameInstanceMap = java.util.Collections.unmodifiableMap(tmpMap);
+    }
+
+    protected static ${glDBMetaInterfaceName} getDBMeta(String className) {
+        try {
+            final Class clazz = Class.forName(className);
+            final java.lang.reflect.Method methoz = clazz.getMethod("getInstance", (Class[])null);
+            final Object result = methoz.invoke(null, (Object[])null);
+            return (${glDBMetaInterfaceName})result;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Get instance by table db-name.
+     * 
+     * @param tableDbName Table db-name. (NotNull)
+     * @return Instance. (NotNull)
+     */
+    public static ${glDBMetaInterfaceName} getInstanceByTableDbName(String tableDbName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableDbName", tableDbName);
+        final ${glDBMetaInterfaceName} instance = (${glDBMetaInterfaceName})_tableDbNameInstanceMap.get(tableDbName);
+        if (instance == null) {
+            String msg = "The instance map returned null by the key: key=" + tableDbName + " instanceMap=" + _tableDbNameInstanceMap;
+            throw new IllegalStateException(msg);
+        }
+        return instance;
+    }
+
+    /**
+     * Get instance by table cap-prop-name.
+     * 
+     * @param tableCapPropName Table cap-prop-name. (NotNull)
+     * @return Instance. (NotNull)
+     */
+    public static ${glDBMetaInterfaceName} getInstanceByTableCapPropName(String tableCapPropName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableCapPropName", tableCapPropName);
+        final ${glDBMetaInterfaceName} instance = (${glDBMetaInterfaceName})_tableCapPropNameInstanceMap.get(tableCapPropName);
+        if (instance == null) {
+            String msg = "The instance map returned null by the key: key=" + tableCapPropName + " instanceMap=" + _tableCapPropNameInstanceMap;
+            throw new IllegalStateException(msg);
+        }
+        return instance;
+    }
+
+    /**
+     * Get instance by table uncap-prop-name.
+     * 
+     * @param tableUncapPropName Table uncap-prop-name. (NotNull)
+     * @return Instance. (NotNull)
+     */
+    public static ${glDBMetaInterfaceName} getInstanceByTableUncapPropName(String tableUncapPropName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableUncapPropName", tableUncapPropName);
+        final ${glDBMetaInterfaceName} instance = (${glDBMetaInterfaceName})_tableUncapPropNameInstanceMap.get(tableUncapPropName);
+        if (instance == null) {
+            String msg = "The instance map returned null by the key: key=" + tableUncapPropName + " instanceMap=" + _tableUncapPropNameInstanceMap;
+            throw new IllegalStateException(msg);
+        }
+        return instance;
+    }
+
+    /**
+     * Get instance by table uncap-prop-name.
+     * 
+     * @param tableMultiName Table multi-name. (NotNull)
+     * @return Instance. (NotNull)
+     */
+    public static ${glDBMetaInterfaceName} getInstanceByTableMultiName(String tableMultiName) {
+        assertStringNotNullAndNotTrimmedEmpty("tableMultiName", tableMultiName);
+        {
+            final ${glDBMetaInterfaceName} instance = (${glDBMetaInterfaceName})_tableDbNameInstanceMap.get(tableMultiName);
+            if (instance != null) {
+                return instance;
+            }
+        }
+        {
+            final ${glDBMetaInterfaceName} instance = (${glDBMetaInterfaceName})_tableCapPropNameInstanceMap.get(tableMultiName);
+            if (instance != null) {
+                return instance;
+            }
+        }
+        {
+            final ${glDBMetaInterfaceName} instance = (${glDBMetaInterfaceName})_tableUncapPropNameInstanceMap.get(tableMultiName);
+            if (instance != null) {
+                return instance;
+            }
+        }
+        String msg = "The tableMultiName does not exist in all-instance-map: tableMultiName=" + tableMultiName;
+        msg = msg + " tableDbNameInstanceMap=" + _tableDbNameInstanceMap;
+        msg = msg + " tableCapPropNameInstanceMap=" + _tableCapPropNameInstanceMap;
+        msg = msg + " tableUncapPropNameInstanceMap=" + _tableUncapPropNameInstanceMap;
+        throw new IllegalStateException(msg);
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the argument is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param arg Argument. (NotNull)
+     */
+    protected static void assertObjectNotNull(String variableName, Object arg) {
+        if (variableName == null) {
+            String msg = "Argument[variableName] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (arg == null) {
+            String msg = "Argument[" + variableName + "] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the string is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected static void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        if (variableName == null) {
+            String msg = "Variable[variableName] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "Variable[" + variableName + "] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (value.trim().length() == 0) {
+            String msg = "Variable[" + variableName + "] should not be empty: [" + value + "]";
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/DaoExceptionContext.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/DaoExceptionContext.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/DaoExceptionContext.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,104 @@
+package ${glPackageBaseCommonException};
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+/**
+ * Dao-exception context.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glDaoExceptionContextName} {
+
+    /** The thread-local for this. */
+    private static ThreadLocal${database.filterGenericsString('Map<String, Object>')} _threadLocal = new ThreadLocal${database.filterGenericsString('Map<String, Object>')}();
+
+    /** Key of sql. */
+    public static final String KEY_SQL = "sql";
+
+    /** Key of exception. */
+    public static final String KEY_EXCEPTION = "exception";
+
+    /**
+     * Get condition-bean on thread.
+     * 
+     * @return Condition-bean context. (Nullable)
+     */
+    public static Map${database.filterGenericsString('String, Object')} getInformationMapOnThread() {
+        return (Map${database.filterGenericsString('String, Object')})_threadLocal.get();
+    }
+
+    /**
+     * Get sql on thread.
+     * 
+     * @return SQL. (NotNull)
+     */
+    public static String getSqlOnThread() {
+        if (getInformationMapOnThread() == null) {
+            return null;
+        }
+        return (String)getInformationMapOnThread().get(KEY_SQL);
+    }
+
+    /**
+     * Set sql on thread.
+     * 
+     * @param sql SQL. (NotNull)
+     */
+    public static void setSqlOnThread(String sql) {
+        if (sql == null) {
+            String msg = "The argument[sql] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (getInformationMapOnThread() == null) {
+            final Map${database.filterGenericsString('String, Object')} contextMap = new LinkedHashMap${database.filterGenericsString('String, Object')}();
+            _threadLocal.set(contextMap);
+        }
+        getInformationMapOnThread().put(KEY_SQL, sql);
+    }
+
+    /**
+     * Get exception on thread.
+     * 
+     * @return Exception. (NotNull)
+     */
+    public static Exception getExceptionOnThread() {
+        if (getInformationMapOnThread() == null) {
+            return null;
+        }
+        return (Exception)getInformationMapOnThread().get(KEY_EXCEPTION);
+    }
+
+    /**
+     * Set exception on thread.
+     * 
+     * @param exception Exception. (NotNull)
+     */
+    public static void setExceptionOnThread(Exception exception) {
+        if (exception == null) {
+            String msg = "The argument[e] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (getInformationMapOnThread() == null) {
+            final Map${database.filterGenericsString('String, Object')} contextMap = new LinkedHashMap${database.filterGenericsString('String, Object')}();
+            _threadLocal.set(contextMap);
+        }
+        getInformationMapOnThread().put(KEY_EXCEPTION, exception);
+    }
+
+    /**
+     * Is existing dao-exception on thread?
+     * 
+     * @return Determination.
+     */
+    public static boolean isExistDaoExceptionOnThread() {
+        return (_threadLocal.get() != null);
+    }
+
+    /**
+     * Clear dao-exception on thread.
+     */
+    public static void clearDaoExceptionOnThread() {
+        _threadLocal.set(null);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasAlreadyBeenDeletedException.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasAlreadyBeenDeletedException.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasAlreadyBeenDeletedException.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,21 @@
+package ${glPackageBaseCommonException};
+
+/**
+ * The exception when the record has already been deleted (by other thread).
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glRecordHasAlreadyBeenDeletedException} extends RuntimeException {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Constructor.
+     * 
+     * @param msg Exception message.
+     */
+    public ${glRecordHasAlreadyBeenDeletedException}(String msg) {
+        super(msg);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasOverlappedException.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasOverlappedException.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/RecordHasOverlappedException.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,21 @@
+package ${glPackageBaseCommonException};
+
+/**
+ * The exception when the record has overlapped.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glRecordHasOverlappedException} extends RuntimeException {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Constructor.
+     * 
+     * @param msg Exception message.
+     */
+    public ${glRecordHasOverlappedException}(String msg) {
+        super(msg);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/SelectedCountExceedMaxCountException.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/SelectedCountExceedMaxCountException.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/exception/SelectedCountExceedMaxCountException.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,49 @@
+package ${glPackageBaseCommonException};
+
+/**
+ * The exception when selected count exceeds max count.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glSelectedCountExceedMaxCountExceptionName} extends RuntimeException {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /** Selected count. */
+    protected int _selectedCount;
+
+    /** Max count. */
+    protected int _maxCount;
+
+    /**
+     * Constructor.
+     * 
+     * @param msg Exception message.
+     * @param maxCount Max count.
+     * @param selectedCount Selected count.
+     */
+    public ${glSelectedCountExceedMaxCountExceptionName}(String msg, int selectedCount, int maxCount) {
+        super(msg);
+        _selectedCount = selectedCount;
+        _maxCount = maxCount;
+    }
+
+    /**
+     * Get selected count.
+     * 
+     * @return Selected count.
+     */
+    public int getSelectedCount() {
+        return _selectedCount;
+    }
+
+    /**
+     * Get max count.
+     * 
+     * @return Max count.
+     */
+    public int getMaxCount() {
+        return _maxCount;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListString.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListString.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListString.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,102 @@
+package ${glPackageBaseCommonHelper};
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * MapList-String.
+ * <p>
+ * <pre>
+ * # Interface that offers generation of map and list from the following character strings (map list string). 
+ * # 
+ * #   ex) map:{key1=value1,key2=list:{value21,value22,value23},key3=map:{key31=value31}}
+ * #   ex) list:{key1=value1,key2=list:{value21,value22,value23},key3=map:{key31=value31}}
+ * # 
+ * </pre>
+ *
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glMapListStringName} {
+
+    /** Default of map-mark. */
+    public static final String DEFAULT_MAP_MARK = "map:";
+
+    /** Default of list-mark. */
+    public static final String DEFAULT_LIST_MARK = "list:";
+
+    /** Default of start-brace. */
+    public static final String DEFAULT_START_BRACE = "{";
+
+    /** Default of end-brace. */
+    public static final String DEFAULT_END_BRACE = "}";
+
+    /** Default of delimter. */
+    public static final String DEFAULT_DELIMITER = ";";
+
+    /** Default of equal. */
+    public static final String DEFAULT_EQUAL = "=";
+
+    // ==========================================================================================
+    //                                                                                     Setter
+    //                                                                                     ======
+    /**
+     * Set map-mark.
+     * 
+     * @param mapMark Map-mark. (NotNull)
+     */
+    public void setMapMark(String mapMark);
+
+    /**
+     * Set list-mark.
+     * 
+     * @param listMark List-mark. (NotNull)
+     */
+    public void setListMark(String listMark);
+
+    /**
+     * Set start brace.
+     * 
+     * @param startBrace Start brace. (NotNull)
+     */
+    public void setStartBrace(String startBrace);
+
+    /**
+     * Set end brace.
+     * 
+     * @param endBrace End brace. (NotNull)
+     */
+    public void setEndBrace(String endBrace);
+
+    /**
+     * Set delimiter.
+     * 
+     * @param delimiter Delimiter. (NotNull)
+     */
+    public void setDelimiter(String delimiter);
+
+    /**
+     * Set equal.
+     * 
+     * @param equal Equal. (NotNull)
+     */
+    public void setEqual(String equal);
+    
+    // ==========================================================================================
+    //                                                                                   Generate
+    //                                                                                   ========
+    /**
+     * Generate map from map-string.
+     * 
+     * @param mapString Map-string (NotNull)
+     * @return Generated map. (NotNull)
+     */
+    public Map${database.filterGenericsString('String, Object')} generateMap(String mapString);
+
+    /**
+     * Generate map from list-string. {Implement}
+     * 
+     * @param listString List-string (NotNull)
+     * @return Generated list. (NotNull)
+     */
+    public List${database.filterGenericsString('Object')} generateList(String listString);
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListStringImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListStringImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapListStringImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,938 @@
+package ${glPackageBaseCommonHelper};
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The implementation of MapList-String.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glMapListStringImplName} implements ${glMapListStringName} {
+
+    /** Line separator. */
+    public static final String NEW_LINE = System.getProperty("line.separator");
+
+    /** Map-mark. */
+    protected String _mapMark;
+
+    /** List-mark. */
+    protected String _listMark;
+
+    /** Start-brace. */
+    protected String _startBrace;
+
+    /** End-brace. */
+    protected String _endBrace;
+
+    /** Delimiter. */
+    protected String _delimiter;
+
+    /** Equal. */
+    protected String _equal;
+
+    /** Top string. */
+    protected String _topString;
+
+    /** Remainder string. */
+    protected String _remainderString;
+
+    /**
+     * Constructor.
+     */
+    public ${glMapListStringImplName}() {
+        _mapMark = DEFAULT_MAP_MARK;
+        _listMark = DEFAULT_LIST_MARK;
+        _startBrace = DEFAULT_START_BRACE;
+        _endBrace = DEFAULT_END_BRACE;
+        _delimiter = DEFAULT_DELIMITER;
+        _equal = DEFAULT_EQUAL;
+    }
+
+    // ==========================================================================================
+    //                                                                                     Setter
+    //                                                                                     ======
+    /**
+     * Set map-mark.
+     * 
+     * @param mapMark Map mark. (NotNull)
+     */
+    public void setMapMark(String mapMark) {
+        _mapMark = mapMark;
+    }
+
+    /**
+     * Set list-mark.
+     * 
+     * @param listMark List mark. (NotNull)
+     */
+    public void setListMark(String listMark) {
+        _listMark = listMark;
+    }
+
+    /**
+     * Set start-brace.
+     * 
+     * @param startBrace Start-brace. (NotNull)
+     */
+    public synchronized void setStartBrace(String startBrace) {
+        _startBrace = startBrace;
+    }
+
+    /**
+     * Set end-brace.
+     * 
+     * @param endBrace End-brace. (NotNull)
+     */
+    public synchronized void setEndBrace(String endBrace) {
+        _endBrace = endBrace;
+    }
+
+    /**
+     * Set delimiter.
+     * 
+     * @param delimiter Delimiter. (NotNull)
+     */
+    public synchronized void setDelimiter(String delimiter) {
+        _delimiter = delimiter;
+    }
+
+    /**
+     * Set equal.
+     * 
+     * @param equal Equal. (NotNull)
+     */
+    public void setEqual(String equal) {
+        _equal = equal;
+    }
+
+    // ****************************************************************************************************
+    //                                                                                          Main Method
+    //                                                                                          ***********
+
+    // ==========================================================================================
+    //                                                                                   Generate
+    //                                                                                   ========
+    /**
+     * Generate map from map-string. {Implement}
+     * 
+     * @param mapString Map-string (NotNull)
+     * @return Generated map. (NotNull)
+     */
+    public synchronized Map${database.filterGenericsString('String, Object')} generateMap(String mapString) {
+        assertMapString(mapString);
+
+        _topString = mapString;
+        _remainderString = mapString;
+
+        removeBothSideSpaceAndTabAndNewLine();
+        removePrefixMapMarkAndStartBrace();
+
+        final Map${database.filterGenericsString('String, Object')} generatedMap = newStringObjectMap();
+        parseRemainderMapString(generatedMap);
+        if (!"".equals(_remainderString)) {
+            String msg = "Final remainderString must be empty string:";
+            msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+            msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString;
+            msg = msg + getNewLineAndIndent() + " # generatedMap --> " + generatedMap;
+            throw new IllegalStateException(msg);
+        }
+        return generatedMap;
+    }
+
+    /**
+     * Generate map from list-string. {Implement}
+     * 
+     * @param listString List-string (NotNull)
+     * @return Generated list. (NotNull)
+     */
+    public synchronized List${database.filterGenericsString('Object')} generateList(String listString) {
+        assertListString(listString);
+
+        _topString = listString;
+        _remainderString = listString;
+
+        removeBothSideSpaceAndTabAndNewLine();
+        removePrefixListMarkAndStartBrace();
+
+        final List${database.filterGenericsString('Object')} generatedList = newObjectList();
+        parseRemainderListString(generatedList);
+        if (!"".equals(_remainderString)) {
+            String msg = "Final remainderString must be empty string:";
+            msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+            msg = msg + getNewLineAndIndent() + " # listString --> " + listString;
+            msg = msg + getNewLineAndIndent() + " # generatedList --> " + generatedList;
+            throw new IllegalStateException(msg);
+        }
+        return generatedList;
+    }
+
+    // ==========================================================================================
+    //                                                                                      Parse
+    //                                                                                      =====
+    /**
+     * Parse remainder map string.
+     * 
+     * @param currentMap current map.
+     */
+    protected void parseRemainderMapString(final Map${database.filterGenericsString('String, Object')} currentMap) {
+        while (true) {
+            if (initializeAtLoopBeginning()) {
+                return;
+            }
+
+            // *** Now, _remainderString should starts with the key of the map. ***
+
+            final int equalIndex = _remainderString.indexOf(_equal);
+            assertEqualIndex(_remainderString, equalIndex, _topString, currentMap);
+            final String mapKey = _remainderString.substring(0, equalIndex).trim();
+            removePrefixTargetIndexPlus(equalIndex, _equal.length());
+            removeBothSideSpaceAndTabAndNewLine();
+
+            // *** Now, _remainderString should starts with the value of the map. ***
+
+            if (isStartsWithMapPrefix(_remainderString)) {
+                removePrefixMapMarkAndStartBrace();
+                parseRemainderMapString(setupNestMap(currentMap, mapKey));
+                if (closingAfterParseNestMapList()) {
+                    return;
+                }
+                continue;
+            }
+
+            if (isStartsWithListPrefix(_remainderString)) {
+                removePrefixListMarkAndStartBrace();
+                parseRemainderListString(setupNestList(currentMap, mapKey));
+                if (closingAfterParseNestMapList()) {
+                    return;
+                }
+                continue;
+            }
+
+            final int delimiterIndex = _remainderString.indexOf(_delimiter);
+            final int endBraceIndex = _remainderString.indexOf(_endBrace);
+            assertEndBracekIndex(_remainderString, endBraceIndex, _topString, currentMap);
+
+            // If delimiter exists and delimiter is closer than end brace, 
+            // Everything from the head of the present remainder string to the delimiter becomes map value.
+            //   ex) value1,key2=value2}
+            if (delimiterIndex >= 0 && delimiterIndex < endBraceIndex) {
+                final String mapValue = _remainderString.substring(0, delimiterIndex);
+                currentMap.put(mapKey, filterMapListValue(mapValue));
+
+                // Because the map element continues since the delimiter, skip the delimiter and continue the loop.
+                removePrefixTargetIndexPlus(delimiterIndex, _delimiter.length());
+                continue;
+            }
+
+            // Everything from the head of the present remainder string to the delimiter becomes map value.
+            //   ex) value1}, key2=value2}
+            final String mapValue = _remainderString.substring(0, endBraceIndex);
+            currentMap.put(mapKey, filterMapListValue(mapValue));
+
+            // Analyzing map is over. So closing and return.
+            closingByEndBraceIndex(endBraceIndex);
+            return;
+        }
+    }
+
+    /**
+     * Parse remainder list string.
+     * 
+     * @param currentList current list.
+     */
+    protected void parseRemainderListString(final List${database.filterGenericsString('Object')} currentList) {
+        while (true) {
+            if (initializeAtLoopBeginning()) {
+                return;
+            }
+
+            // *** Now, _remainderString should starts with the value of the list. ***
+
+            if (isStartsWithMapPrefix(_remainderString)) {
+                removePrefixMapMarkAndStartBrace();
+                parseRemainderMapString(setupNestMap(currentList));
+                if (closingAfterParseNestMapList()) {
+                    return;
+                }
+                continue;
+            }
+
+            if (isStartsWithListPrefix(_remainderString)) {
+                removePrefixListMarkAndStartBrace();
+                parseRemainderListString(setupNestList(currentList));
+                if (closingAfterParseNestMapList()) {
+                    return;
+                }
+                continue;
+            }
+
+            final int delimiterIndex = _remainderString.indexOf(_delimiter);
+            final int endBraceIndex = _remainderString.indexOf(_endBrace);
+            assertEndBraceIndex(_remainderString, endBraceIndex, _topString, currentList);
+
+            // If delimiter exists and delimiter is closer than end brace, 
+            // Everything from the head of the present remainder string to the delimiter becomes list value.
+            //   ex) value1,value2,value3}
+            if (delimiterIndex >= 0 && delimiterIndex < endBraceIndex) {
+                final String listValue = _remainderString.substring(0, delimiterIndex);
+                currentList.add(filterMapListValue(listValue));
+
+                // Because the list element continues since the delimiter, skip the delimiter and continue the loop.
+                removePrefixTargetIndexPlus(delimiterIndex, _delimiter.length());
+                continue;
+            }
+
+            // Everything from the head of the present remainder string to the delimiter becomes list value.
+            //   ex) value1}, value2, }
+            final String listValue = _remainderString.substring(0, endBraceIndex);
+            currentList.add(filterMapListValue(listValue));
+
+            // Analyzing list is over. So closing and return.
+            closingByEndBraceIndex(endBraceIndex);
+            return;
+        }
+    }
+
+    /**
+     * Initialize at loop beginning.
+     * 
+     * @return Is return?
+     */
+    protected boolean initializeAtLoopBeginning() {
+        // Remove prefix delimiter. (Result string is always trimmed.)
+        removePrefixAllDelimiter();
+
+        // If the remainder string is empty-string, Analyzing is over!
+        if (_remainderString.equals("")) {
+            return true;
+        }
+
+        // If the remainder string starts with end-brace, Analyzing current map is over!
+        // And then remove the end-brace.
+        if (isStartsWithEndBrace(_remainderString)) {
+            removePrefixEndBrace();
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Close after parse nest map list.
+     * 
+     * @return Is return?
+     */
+    protected boolean closingAfterParseNestMapList() {
+        // If the remainder string starts with end-brace, remove it and return true.
+        if (isStartsWithEndBrace(_remainderString)) {
+            removePrefixEndBrace();
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Close by end-brace index.
+     * 
+     * @param endBraceIndex End-brace index.
+     */
+    protected void closingByEndBraceIndex(int endBraceIndex) {
+        // Remove the value that was finished analyzing and end-brace.
+        _remainderString = _remainderString.substring(endBraceIndex);
+        removePrefixEndBrace();
+    }
+
+    // ****************************************************************************************************
+    //                                                                                      StateFul Method
+    //                                                                                      ***************
+
+    // ==========================================================================================
+    //                                                                                     Remove
+    //                                                                                     ======
+    /**
+     * Remove prefix map-mark and start-brace.
+     */
+    protected void removePrefixMapMarkAndStartBrace() {
+        removePrefix(_mapMark + _startBrace);
+    }
+
+    /**
+     * Remove prefix list-mark and start-brace.
+     */
+    protected void removePrefixListMarkAndStartBrace() {
+        removePrefix(_listMark + _startBrace);
+    }
+
+    /**
+     * Remove prefix delimiter.
+     */
+    protected void removePrefixDelimiter() {
+        removePrefix(_delimiter);
+    }
+
+    /**
+     * Remove prefix end-brace.
+     */
+    protected void removePrefixEndBrace() {
+        removePrefix(_endBrace);
+    }
+
+    /**
+     * Remove prefix.
+     * 
+     * @param prefixString Prefix string. (NotNull)
+     */
+    protected void removePrefix(String prefixString) {
+        if (_remainderString == null) {
+            String msg = "Argument[remainderString] must not be null: " + _remainderString;
+            throw new IllegalArgumentException(msg);
+        }
+        if (prefixString == null) {
+            String msg = "Argument[prefixString] must not be null: " + prefixString;
+            throw new IllegalArgumentException(msg);
+        }
+
+        removeBothSideSpaceAndTabAndNewLine();
+
+        if (_remainderString.length() < prefixString.length()) {
+            String msg = "Argument[remainderString] length must be larger than Argument[prefixString] length:";
+            msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+            msg = msg + getNewLineAndIndent() + " # prefixString=" + prefixString;
+            throw new IllegalArgumentException(msg);
+        }
+        if (!_remainderString.startsWith(prefixString)) {
+            String msg = "Argument[remainderString] must start with Argument[prefixString:]";
+            msg = msg + getNewLineAndIndent() + " # remainderString --> " + _remainderString;
+            msg = msg + getNewLineAndIndent() + " # prefixString --> " + prefixString;
+            throw new IllegalArgumentException(msg);
+        }
+
+        _remainderString = _remainderString.substring(prefixString.length());
+        removeBothSideSpaceAndTabAndNewLine();
+    }
+
+    /**
+     * Remove prefix and delimiter.
+     */
+    protected void removePrefixAllDelimiter() {
+        removeBothSideSpaceAndTabAndNewLine();
+
+        while (true) {
+            if (!isStartsWithDelimiter(_remainderString)) {
+                break;
+            }
+
+            if (isStartsWithDelimiter(_remainderString)) {
+                removePrefixDelimiter();
+                removeBothSideSpaceAndTabAndNewLine();
+            }
+        }
+    }
+
+    /**
+     * Remove both side space and tab and new-line.
+     */
+    protected void removeBothSideSpaceAndTabAndNewLine() {
+        _remainderString = _remainderString.trim();
+    }
+
+    /**
+     * Remove prefix (target index plus one).
+     * 
+     * @param index Index.
+     * @param plusCount Plus count.
+     */
+    protected void removePrefixTargetIndexPlus(int index, int plusCount) {
+        _remainderString = _remainderString.substring(index + plusCount);
+    }
+
+    // ****************************************************************************************************
+    //                                                                                     StateLess Method
+    //                                                                                     ****************
+
+    // ==========================================================================================
+    //                                                                                     Assert
+    //                                                                                     ======
+    /**
+     * Assert map-string.
+     * 
+     * @param mapString Map-string. (NotNull)
+     */
+    protected void assertMapString(String mapString) {
+        if (mapString == null) {
+            String msg = "Argument[mapString] must not be null: ";
+            throw new IllegalArgumentException(msg + "mapString=" + mapString);
+        }
+        mapString = mapString.trim();
+        if (!isStartsWithMapPrefix(mapString)) {
+            String msg = "Argument[mapString] must start with '" + _mapMark + _startBrace + "': ";
+            throw new IllegalArgumentException(msg + "mapString=" + mapString);
+        }
+        if (!isEndsWithEndBrace(mapString)) {
+            String msg = "Argument[mapString] must end with '" + _endBrace + "': ";
+            throw new IllegalArgumentException(msg + "mapString=" + mapString);
+        }
+
+        final int startBraceCount = getDelimiterCount(mapString, _startBrace);
+        final int endBraceCount = getDelimiterCount(mapString, _endBrace);
+        if (startBraceCount != endBraceCount) {
+            String msg = "It is necessary to have braces of the same number on start and end:";
+            msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString;
+            msg = msg + getNewLineAndIndent() + " # startBraceCount --> " + startBraceCount;
+            msg = msg + getNewLineAndIndent() + " # endBraceCount --> " + endBraceCount;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert list-string.
+     * 
+     * @param listString List-string. (NotNull)
+     */
+    protected void assertListString(String listString) {
+        if (listString == null) {
+            String msg = "Argument[listString] must not be null: ";
+            throw new IllegalArgumentException(msg + "listString=" + listString);
+        }
+        listString = listString.trim();
+        if (!isStartsWithListPrefix(listString)) {
+            String msg = "Argument[listString] must start with '" + _mapMark + "': ";
+            throw new IllegalArgumentException(msg + "listString=" + listString);
+        }
+        if (!isEndsWithEndBrace(listString)) {
+            String msg = "Argument[listString] must end with '" + _endBrace + "': ";
+            throw new IllegalArgumentException(msg + "listString=" + listString);
+        }
+
+        final int startBraceCount = getDelimiterCount(listString, _startBrace);
+        final int endBraceCount = getDelimiterCount(listString, _endBrace);
+        if (startBraceCount != endBraceCount) {
+            String msg = "It is necessary to have braces of the same number on start and end:";
+            msg = msg + getNewLineAndIndent() + " # listString --> " + listString;
+            msg = msg + getNewLineAndIndent() + " # startBraceCount --> " + startBraceCount;
+            msg = msg + getNewLineAndIndent() + " # endBraceCount --> " + endBraceCount;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert equal-index.
+     * 
+     * @param remainderMapString Remainder map-string. (NotNull)
+     * @param equalIndex Equal-index.
+     * @param mapString4Log Map-string for log. (NotNull)
+     * @param currentMap4Log Current-map for log. (NotNull)
+     */
+    protected void assertEqualIndex(String remainderMapString, int equalIndex, String mapString4Log
+            , Map${database.filterGenericsString('String, Object')} currentMap4Log) {
+        if (remainderMapString == null) {
+            String msg = "Argument[remainderMapString] must not be null:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+            msg = msg + getNewLineAndIndent() + " # mapString4Log --> " + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap4Log --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        if (equalIndex < 0) {
+            String msg = "Argument[equalIndex] must be plus or zero:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+            msg = msg + getNewLineAndIndent() + " # mapString4Log --> " + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap4Log --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        if (remainderMapString.length() < equalIndex) {
+            String msg = "Argument[remainderMapString] length must be larger than equalIndex value:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+            msg = msg + getNewLineAndIndent() + " # mapString4Log --> " + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap4Log --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        final String expectedAsEndMark = remainderMapString.substring(equalIndex, equalIndex + _equal.length());
+        if (!expectedAsEndMark.equals(_equal)) {
+            String msg = "Argument[remainderMapString] must have '" + _equal + "' at Argument[equalIndex]:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # equalIndex --> " + equalIndex;
+            msg = msg + getNewLineAndIndent() + " # expectedAsEndMark --> " + expectedAsEndMark;
+            msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert end-brace-index.
+     * 
+     * @param remainderMapString Remainder map-string. (NotNull)
+     * @param endBraceIndex End-brace-index.
+     * @param mapString4Log Map-string for log. (NotNull)
+     * @param currentMap4Log Current-map for log. (NotNull)
+     */
+    protected void assertEndBracekIndex(String remainderMapString, int endBraceIndex, String mapString4Log
+            , Map${database.filterGenericsString('String, Object')} currentMap4Log) {
+        if (remainderMapString == null) {
+            String msg = "Argument[remainderMapString] must not be null:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        if (endBraceIndex < 0) {
+            String msg = "Argument[endMarkIndex] must be plus or zero:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # mapString --> =" + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        if (remainderMapString.length() < endBraceIndex) {
+            String msg = "Argument[remainderMapString] length must be larger than endMarkIndex value:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        final String expectedAsEndMark = remainderMapString.substring(endBraceIndex, endBraceIndex + _endBrace.length());
+        if (!expectedAsEndMark.equals(_endBrace)) {
+            String msg = "Argument[remainderMapString] must have '" + _endBrace + "' at Argument[endBraceIndex]:";
+            msg = msg + getNewLineAndIndent() + " # remainderMapString --> " + remainderMapString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # expectedAsEndMark --> " + expectedAsEndMark;
+            msg = msg + getNewLineAndIndent() + " # mapString --> " + mapString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentMap --> " + currentMap4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    /**
+     * Assert end-brace-index.
+     * 
+     * @param remainderListString Remainder list-string. (NotNull)
+     * @param endBraceIndex End-brace-index.
+     * @param listString4Log List-string for log. (NotNull)
+     * @param currentList4Log Current-list for log. (NotNull)
+     */
+    protected void assertEndBraceIndex(String remainderListString, int endBraceIndex, String listString4Log,
+            List currentList4Log) {
+        if (remainderListString == null) {
+            String msg = "Argument[remainderListString] must not be null:";
+            msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # listString --> " + listString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        if (endBraceIndex < 0) {
+            String msg = "Argument[endMarkIndex] must be plus or zero:";
+            msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # listString --> " + listString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        if (remainderListString.length() < endBraceIndex) {
+            String msg = "Argument[remainderListString] length must be larger than endMarkIndex value:";
+            msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # listString --> " + listString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+
+        final String expectedAsEndBrace = remainderListString.substring(endBraceIndex, endBraceIndex + _endBrace.length());
+        if (!expectedAsEndBrace.equals(_endBrace)) {
+            String msg = "Argument[remainderListString] must have '" + _endBrace + "' at Argument[endBraceIndex]:";
+            msg = msg + getNewLineAndIndent() + " # remainderListString --> " + remainderListString;
+            msg = msg + getNewLineAndIndent() + " # endBraceIndex --> " + endBraceIndex;
+            msg = msg + getNewLineAndIndent() + " # expectedAsEndBrace --> " + expectedAsEndBrace;
+            msg = msg + getNewLineAndIndent() + " # listString --> " + listString4Log;
+            msg = msg + getNewLineAndIndent() + " # currentList --> " + currentList4Log;
+            msg = msg + getNewLineAndIndent() + " # _startBrace --> " + _startBrace;
+            msg = msg + getNewLineAndIndent() + " # _endBrace --> " + _endBrace;
+            msg = msg + getNewLineAndIndent() + " # _delimiter --> " + _delimiter;
+            msg = msg + getNewLineAndIndent() + " # _equal --> " + _equal;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ==========================================================================================
+    //                                                                                     Filter
+    //                                                                                     ======
+    /**
+     * Filter map or list value.
+     * <p>
+     * <pre>
+     * # The value is trimmed.
+     * # If the value is null, this returns null.
+     * # If the value is 'null', this returns null.
+     * # If the trimmed value is empty string, this returns null.
+     * </pre>
+     * @param value value. (Nullable)
+     * @return Filtered value. (Nullable)
+     */
+    protected String filterMapListValue(String value) {
+        if (value == null) {
+            return null;
+        }
+        value = value.trim();
+        return (("".equals(value) || "null".equals(value)) ? null : value);
+    }
+
+    // ==========================================================================================
+    //                                                                                  Judgement
+    //                                                                                  =========
+    /**
+     * Does it start with map-prefix?
+     * 
+     * @param targetString Target-string. (NotNull)
+     * @return Determination.
+     */
+    protected boolean isStartsWithMapPrefix(String targetString) {
+        if (targetString == null) {
+            String msg = "Argument[targetString] must not be null: " + targetString;
+            throw new IllegalArgumentException(msg);
+        }
+        targetString = targetString.trim();
+        if (targetString.startsWith(_mapMark + _startBrace)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Does it start with list-prefix?
+     * 
+     * @param targetString Target-string. (NotNull)
+     * @return Determination.
+     */
+    protected boolean isStartsWithListPrefix(String targetString) {
+        if (targetString == null) {
+            String msg = "Argument[targetString] must not be null: " + targetString;
+            throw new IllegalArgumentException(msg);
+        }
+        targetString = targetString.trim();
+        if (targetString.startsWith(_listMark + _startBrace)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Does it start with delimiter?
+     * 
+     * @param targetString Target-string. (NotNull)
+     * @return Determination.
+     */
+    protected boolean isStartsWithDelimiter(String targetString) {
+        if (targetString == null) {
+            String msg = "Argument[targetString] must not be null: " + targetString;
+            throw new IllegalArgumentException(msg);
+        }
+        targetString = targetString.trim();
+        if (targetString.startsWith(_delimiter)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Does it start with end-brace?
+     * 
+     * @param targetString Target-string. (NotNull)
+     * @return Determination.
+     */
+    protected boolean isStartsWithEndBrace(String targetString) {
+        if (targetString == null) {
+            String msg = "Argument[targetString] must not be null: " + targetString;
+            throw new IllegalArgumentException(msg);
+        }
+        targetString = targetString.trim();
+        if (targetString.startsWith(_endBrace)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Does it end with end-brace?
+     * 
+     * @param targetString Target-string. (NotNull)
+     * @return Determination.
+     */
+    protected boolean isEndsWithEndBrace(String targetString) {
+        if (targetString == null) {
+            String msg = "Argument[targetString] must not be null: " + targetString;
+            throw new IllegalArgumentException(msg);
+        }
+        targetString = targetString.trim();
+        if (targetString.endsWith(_endBrace)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    // ==========================================================================================
+    //                                                                                      Other
+    //                                                                                      =====
+    /**
+     * Setup nest map.
+     * 
+     * @param currentMap Current-map. (NotNull)
+     * @param mapKey Map-key. (NotNull)
+     * @return Nest map. (NotNull)
+     */
+    protected Map${database.filterGenericsString('String, Object')} setupNestMap(Map${database.filterGenericsString('String, Object')} currentMap, String mapKey) {
+        final Map${database.filterGenericsString('String, Object')} nestMap = newStringObjectMap();
+        currentMap.put(mapKey, nestMap);
+        return nestMap;
+    }
+
+    /**
+     * Setup nest map.
+     * 
+     * @param currentList Current-list. (NotNull)
+     * @return Nest map. (NotNull)
+     */
+    protected Map${database.filterGenericsString('String, Object')} setupNestMap(List${database.filterGenericsString('Object')} currentList) {
+        final Map${database.filterGenericsString('String, Object')} nestMap = newStringObjectMap();
+        currentList.add(nestMap);
+        return nestMap;
+    }
+
+    /**
+     * Setup nest list.
+     * 
+     * @param currentMap Current-map. (NotNull)
+     * @param mapKey Map-key. (NotNull)
+     * @return Nest list. (NotNull)
+     */
+    protected List${database.filterGenericsString('Object')} setupNestList(Map${database.filterGenericsString('String, Object')} currentMap, String mapKey) {
+        final List${database.filterGenericsString('Object')} nestList = newObjectList();
+        currentMap.put(mapKey, nestList);
+        return nestList;
+    }
+
+    /**
+     * Setup nest list.
+     * 
+     * @param currentList Current-list. (NotNull)
+     * @return Nest list. (NotNull)
+     */
+    protected List${database.filterGenericsString('Object')} setupNestList(List${database.filterGenericsString('Object')} currentList) {
+        final List${database.filterGenericsString('Object')} nestList = newObjectList();
+        currentList.add(nestList);
+        return nestList;
+    }
+
+    /**
+     * New string-object-map.
+     * 
+     * @return String-object-map. (NotNull)
+     */
+    protected Map${database.filterGenericsString('String, Object')} newStringObjectMap() {
+        return new LinkedHashMap${database.filterGenericsString('String, Object')}();
+    }
+
+    /**
+     * New object-list.
+     * 
+     * @return String-object-list. (NotNull)
+     */
+    protected List${database.filterGenericsString('Object')} newObjectList() {
+        return new ArrayList${database.filterGenericsString('Object')}();
+    }
+
+    /**
+     * Get new-line and indent.
+     * 
+     * @return New-line and indent. (NotNull)
+     */
+    protected String getNewLineAndIndent() {
+        return NEW_LINE + "    ";
+    }
+
+    /**
+     * Get count that target string exist in the base string.
+     * 
+     * @param targetString Target string.
+     * @param delimiter Delimiter
+     * @return Delimiter count that _remainderString contains.
+     */
+    protected int getDelimiterCount(String targetString, String delimiter) {
+        int result = 0;
+        for (int i = 0;;) {
+            if (targetString.indexOf(delimiter, i) != -1) {
+                result++;
+                i = targetString.indexOf(delimiter, i) + 1;
+            } else {
+                break;
+            }
+        }
+        if (result == 0) {
+            result = -1;
+        }
+        return result;
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilder.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilder.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilder.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,67 @@
+package ${glPackageBaseCommonHelper};
+
+/**
+ * The interface of map-string-builder.
+ *
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glMapStringBuilderName} {
+
+    // =====================================================================================
+    //                                                                                Setter
+    //                                                                                ======
+    public void setColumnNames(String[] columnNames);
+
+    public void setColumnNameList(java.util.List${database.filterGenericsString('String')} columnNameList);
+
+    public void setMsMapMark(String value);
+
+    public void setMsStartBrace(String value);
+
+    public void setMsEndBrace(String value);
+
+    public void setMsDelimiter(String value);
+
+    public void setMsEqual(String value);
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    public String buildByDelimiter(String values, String delimiter);
+
+    public String buildFromList(java.util.List${database.filterGenericsString('String')} valueList);
+
+    // =====================================================================================
+    //                                                                Exception Static Class
+    //                                                                ======================
+    public static class DifferentDelimiterCountException extends RuntimeException {
+
+        /** Serial version UID. (Default) */
+        private static final long serialVersionUID = 1L;
+
+        // =====================================================================================
+        //                                                                             Attribute
+        //                                                                             =========
+        protected java.util.List${database.filterGenericsString('String')} _columnNameList;
+        protected java.util.List${database.filterGenericsString('String')} _valueList;
+
+        // =====================================================================================
+        //                                                                           Constructor
+        //                                                                           ===========
+        public DifferentDelimiterCountException(String msg, java.util.List${database.filterGenericsString('String')} columnNameList, java.util.List${database.filterGenericsString('String')} valueList) {
+            super(msg);
+            _columnNameList = columnNameList;
+            _valueList = valueList;
+        }
+
+        // =====================================================================================
+        //                                                                              Accessor
+        //                                                                              ========
+        public java.util.List${database.filterGenericsString('String')} getColumnNameList() {
+            return _columnNameList;
+        }
+        public java.util.List${database.filterGenericsString('String')} getValueList() {
+            return _valueList;
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilderImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilderImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/MapStringBuilderImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,177 @@
+package ${glPackageBaseCommonHelper};
+
+import ${glPackageBaseCommonHelperTokenLine}.${glLineTokenName};
+import ${glPackageBaseCommonHelperTokenLine}.${glLineTokenizingOptionName};
+import ${glPackageBaseCommonHelperTokenLineImpl}.${glLineTokenImplName};
+
+/**
+ * The implementation of map-string-builder.
+ *
+ * @author ${database.ClassAuthor}
+ */
+public class ${glMapStringBuilderImplName} implements ${glMapStringBuilderName} {
+
+    protected java.util.List${database.filterGenericsString('String')} _columnNameList;
+
+    protected String _msMapMark;
+
+    protected String _msStartBrace;
+
+    protected String _msEndBrace;
+
+    protected String _msDelimiter;
+
+    protected String _msEqual;
+
+    protected boolean _trimDoubleQuotation;
+
+    public void setColumnNames(String[] columnNames) {
+        _columnNameList = java.util.Arrays.asList(columnNames);
+    }
+
+    public void setColumnNameList(java.util.List${database.filterGenericsString('String')} columnNameList) {
+        _columnNameList = columnNameList;
+    }
+
+    public void setMsMapMark(String value) {
+        _msMapMark = value;
+    }
+
+    public void setMsStartBrace(String value) {
+        _msStartBrace = value;
+    }
+
+    public void setMsEndBrace(String value) {
+        _msEndBrace = value;
+    }
+
+    public void setMsDelimiter(String value) {
+        _msDelimiter = value;
+    }
+
+    public void setMsEqual(String value) {
+        _msEqual = value;
+    }
+
+    public void trimDoubleQuotation() {
+        _trimDoubleQuotation = true;
+    }
+
+    public String buildByDelimiter(String values, String delimiter) {
+        if (values == null) {
+            String msg = "The argument[values] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (delimiter == null) {
+            String msg = "The argument[delimiter] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        assertStringComponent();
+
+        final java.util.List${database.filterGenericsString('String')} valueList = tokenize(values, delimiter);
+        assertColumnValueList(_columnNameList, valueList);
+
+        final StringBuffer sb = new StringBuffer();
+        sb.append(_msMapMark).append(_msStartBrace);
+        for (int i = 0; i < _columnNameList.size(); i++ ) {
+            sb.append(_columnNameList.get(i)).append(_msEqual).append(valueList.get(i)).append(_msDelimiter);
+        }
+
+        sb.delete(sb.length() - _msDelimiter.length(), sb.length());
+        sb.append(_msEndBrace);
+        return sb.toString(); 
+    }
+
+    public String buildFromList(java.util.List${database.filterGenericsString('String')} valueList) {
+        if (valueList == null) {
+            String msg = "The argument[valueList] should not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        assertStringComponent();
+        assertColumnValueList(_columnNameList, valueList);
+
+        final StringBuffer sb = new StringBuffer();
+        sb.append(_msMapMark).append(_msStartBrace);
+        for (int i = 0; i < _columnNameList.size(); i++ ) {
+            sb.append(_columnNameList.get(i)).append(_msEqual).append(valueList.get(i)).append(_msDelimiter);
+        }
+
+        sb.delete(sb.length() - _msDelimiter.length(), sb.length());
+        sb.append(_msEndBrace);
+        return sb.toString(); 
+    }
+
+    protected java.util.List${database.filterGenericsString('String')} tokenize(String value, String delimiter) {
+        final ${glLineTokenName} lineToken = new ${glLineTokenImplName}();
+        final ${glLineTokenizingOptionName} lineTokenizingOption = new ${glLineTokenizingOptionName}();
+        lineTokenizingOption.setDelimiter(delimiter);
+        if (_trimDoubleQuotation) {
+            lineTokenizingOption.trimDoubleQuotation();
+        }
+        return lineToken.tokenize(value, lineTokenizingOption);
+    }
+
+    protected void assertStringComponent() {
+        if (_columnNameList == null) {
+            String msg = "The columnNameList should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        if (_columnNameList.isEmpty()) {
+            String msg = "The columnNameList should not be empty.";
+            throw new IllegalStateException(msg);
+        }
+        if (_msMapMark == null) {
+            String msg = "The msMapMark should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        if (_msStartBrace == null) {
+            String msg = "The msStartBrace should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        if (_msEndBrace == null) {
+            String msg = "The msEndBrace should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        if (_msDelimiter == null) {
+            String msg = "The msDelimiter should not be null.";
+            throw new IllegalStateException(msg);
+        }
+        if (_msEqual == null) {
+            String msg = "The msEqual should not be null.";
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    protected void assertColumnValueList(java.util.List${database.filterGenericsString('String')} columnNameList, java.util.List${database.filterGenericsString('String')} valueList) {
+        if (columnNameList.size() != valueList.size()) {
+            String msg = "The length of columnNameList and valueList are difference. (" + columnNameList.size() + ", " + valueList.size() + ")";
+            msg = msg + " columnNameList=" + columnNameList;
+            msg = msg + " valueList=" + valueList;
+            throw new DifferentDelimiterCountException(msg, columnNameList, valueList);
+        }
+    }
+
+    protected static final String replace(String text, String fromText, String toText) {
+        if (text == null || fromText == null || toText == null) {
+            return null;
+        }
+        final StringBuffer buf = new StringBuffer(100);
+        int pos = 0;
+        int pos2 = 0;
+        while (true) {
+            pos = text.indexOf(fromText, pos2);
+            if (pos == 0) {
+                buf.append(toText);
+                pos2 = fromText.length();
+            } else if (pos > 0) {
+                buf.append(text.substring(pos2, pos));
+                buf.append(toText);
+                pos2 = pos + fromText.length();
+            } else {
+                buf.append(text.substring(pos2));
+                break;
+            }
+        }
+        return buf.toString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/GeneralCharacter.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/GeneralCharacter.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/GeneralCharacter.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,17 @@
+package ${glPackageBaseCommonHelperCharacter};
+
+/**
+ * The interface of general character.
+ *
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glGeneralCharacterName} {
+
+    public String toSingleByteAlphabet(String s);
+
+    public String toSingleByteNumber(String s);
+
+    public String toSingleByteAlphabetNumber(String target);
+
+    public String toSingleByteAlphabetNumberMark(String target);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/JapaneseCharacter.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/JapaneseCharacter.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/JapaneseCharacter.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${glPackageBaseCommonHelperCharacter};
+
+/**
+ * The interface of Japanese character.
+ *
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glJapaneseCharacterName} {
+
+    public String toDoubleByteKatakana(String target);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/GeneralCharacterImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/GeneralCharacterImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/GeneralCharacterImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,100 @@
+package ${glPackageBaseCommonHelperCharacterImpl};
+
+import ${glPackageBaseCommonHelperCharacter}.${glGeneralCharacterName};
+
+/**
+ * The implementation of general character.
+ *
+ * @author ${database.ClassAuthor}
+ */
+public class ${glGeneralCharacterImplName} implements ${glGeneralCharacterName} {
+
+    public String toSingleByteAlphabet(String target) {
+        if (target == null || target.trim().length() == 0) {
+            return target;
+        }
+        final StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < target.length(); i++) {
+            final char currentChar = target.charAt(i);
+
+            if (currentChar >= 0xff21 && currentChar <= 0xff3a) {
+                sb.append(toSingleByteCharacter(currentChar));
+            } else if (currentChar >= 0xff41 && currentChar <= 0xff5a) {
+                sb.append(toSingleByteCharacter(currentChar));
+            } else {
+                sb.append(currentChar);
+            }
+        }
+        return sb.toString();
+    }
+
+    public String toSingleByteNumber(String target) {
+        if (target == null || target.trim().length() == 0) {
+            return target;
+        }
+        final StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < target.length(); i++) {
+            final char currentChar = target.charAt(i);
+            if (currentChar >= 0xff10 && currentChar <= 0xff19) {
+                sb.append(toSingleByteCharacter(currentChar));
+            } else {
+                sb.append(currentChar);
+            }
+        }
+        return sb.toString();
+    }
+
+    public String toSingleByteAlphabetNumber(String target) {
+        if (target == null || target.trim().length() == 0) {
+            return target;
+        }
+        final StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < target.length(); i++) {
+            final char currentChar = target.charAt(i);
+
+            if (currentChar >= 0xff10 && currentChar <= 0xff19) {
+                sb.append(toSingleByteCharacter(currentChar));
+            } else if (currentChar >= 0xff21 && currentChar <= 0xff3a) {
+                sb.append(toSingleByteCharacter(currentChar));
+            } else if (currentChar >= 0xff41 && currentChar <= 0xff5a) {
+                sb.append(toSingleByteCharacter(currentChar));
+            } else {
+                sb.append(currentChar);
+            }
+        }
+        return sb.toString();
+    }
+
+    public String toSingleByteAlphabetNumberMark(String target) {
+        if (target == null || target.trim().length() == 0) {
+            return target;
+        }
+        final StringBuffer sb = new StringBuffer(target.length());
+        for (int i = 0; i < target.length(); i++) {
+            final char currentChar = target.charAt(i);
+            if (currentChar >= 0xff01 && currentChar <= 0xff5e) {
+                sb.append(toSingleByteCharacter(currentChar));
+
+            // TODO: @jflute - I will append mark...
+            } else if (currentChar == '\u2019' || currentChar == '\u2018' || currentChar == '\u2032') {
+                sb.append('\'');
+            } else if (currentChar == '\u201d' || currentChar == '\u201c' || currentChar == '\u2033') {
+                sb.append('\"');
+            } else if (currentChar == '\uffe5') {
+                sb.append('\\');
+            } else if (currentChar == '\u2010') {
+                sb.append('-');
+            } else if (currentChar == '\uff5e') {
+                sb.append('~');
+
+            } else {
+                sb.append(currentChar);
+            }
+        }
+        return sb.toString();
+    }
+
+    protected char toSingleByteCharacter(final char currentChar) {
+        return (char) (currentChar - 0xfee0);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/JapaneseCharacterImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/JapaneseCharacterImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/character/impl/JapaneseCharacterImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,87 @@
+package ${glPackageBaseCommonHelperCharacterImpl};
+
+import ${glPackageBaseCommonHelperCharacter}.${glJapaneseCharacterName};
+
+/**
+ * The implementation of Japanese character.
+ *
+ * @author ${database.ClassAuthor}
+ */
+public class ${glJapaneseCharacterImplName} implements ${glJapaneseCharacterName} {
+
+    // Double-byte Katakana
+    protected static final String TABLE_ZENKANA = 
+              "\u3002\u300c\u300d\u3001\u30fb\u30f2\u30a1\u30a3\u30a5"
+            + "\u30a7\u30a9\u30e3\u30e5\u30e7\u30c3\u30fc\u30a2\u30a4"
+            + "\u30a6\u30a8\u30aa\u30ab\u30ad\u30af\u30b1\u30b3\u30b5"
+            + "\u30b7\u30b9\u30bb\u30bd\u30bf\u30c1\u30c4\u30c6\u30c8"
+            + "\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d2\u30d5\u30d8"
+            + "\u30db\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8"
+            + "\u30e9\u30ea\u30eb\u30ec\u30ed\u30ef\u30f3\u309b\u309c";
+
+    // (uff71 - uff9d)
+    protected static final String DEF_DOUBLE_BYTE_VOICED_SOUND_NORMAL_KATAKANA = 
+            "\u30a2\u30a4\u30f4\u30a8\u30aa" +
+            "\u30ac\u30ae\u30b0\u30b2\u30b4" +
+            "\u30b6\u30b8\u30ba\u30bc\u30be" +
+            "\u30c0\u30c2\u30c5\u30c7\u30c9" +
+            "\u30ca\u30cb\u30cc\u30cd\u30ce" +
+            "\u30d0\u30d3\u30d6\u30d9\u30dc" +
+            "\u30de\u30df\u30e0\u30e1\u30e2" +
+            "\u30e4\u30e6\u30e8" +
+            "\u30e9\u30ea\u30eb\u30ec\u30ed" +
+            "\u30ef\u30f3";
+
+    // (uff66 - uff6f)
+    protected static final String DEF_DOUBLE_BYTE_VOICED_SOUND_SPECIAL_KATAKANA = "\u30fa\u30a1\u30a3\u30a5\u30a7\u30a9\u30e3\u30e5\u30e7";
+
+    // (u30cf - u30dd)
+    protected static final String DEF_DOUBLE_BYTE_SEMI_VOICED_SOUND_KATAKANA = "\u30d1\u30d4\u30d7\u30da\u30dd";
+
+    public String toDoubleByteKatakana(String target) {
+        if (target == null || target.trim().length() == 0) {
+            return target;
+        }
+
+        final StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < target.length(); i++) {
+            final char currentChar = target.charAt(i);
+            final char nextChar;
+            if (i < target.length() - 1) {
+                nextChar = target.charAt(i + 1);
+            } else {
+                nextChar = ' ';
+            }
+
+            if (isVoicedSoundKatakana(currentChar, nextChar)) {
+                if (currentChar >= 0xff66 && currentChar <= 0xff6f) {// Voiced sound special Katakana
+                    sb.append(DEF_DOUBLE_BYTE_VOICED_SOUND_SPECIAL_KATAKANA.charAt(currentChar - 0xff66));
+                    i++;
+                } else if (currentChar >= 0xff71 && currentChar <= 0xff9d) {// Voiced sound normal Katakana
+                    sb.append(DEF_DOUBLE_BYTE_VOICED_SOUND_NORMAL_KATAKANA.charAt(currentChar - 0xff71));
+                    i++;
+                }
+
+            } else if (isSemiVoicedSoundKatakana(currentChar, nextChar)) {
+                sb.append(DEF_DOUBLE_BYTE_SEMI_VOICED_SOUND_KATAKANA.charAt(currentChar - 0xff8a));
+                i++;
+            } else if (currentChar != 0xff9e && currentChar != 0xff9f) {
+                if (currentChar >= 0xff61 && currentChar <= 0xff9f) {
+                    sb.append(TABLE_ZENKANA.charAt(currentChar - 0xff61));
+                } else {
+                    sb.append(currentChar);
+                }
+            }
+        }
+        return sb.toString();
+    }
+
+    protected boolean isVoicedSoundKatakana(final char currentChar, final char nextChar) {
+        return ((currentChar >= 0xff66 && currentChar <= 0xff6f) || (currentChar >= 0xff71 && (currentChar <= 0xff9d)))
+                && (nextChar == 0xff9e);
+    }
+
+    protected boolean isSemiVoicedSoundKatakana(final char currentChar, final char nextChar) {
+        return (currentChar >= 0xff8a && currentChar <= 0xff8e) && (nextChar == 0xff9f);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingCallback.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingCallback.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingCallback.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,17 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glFileMakingCallbackName} {
+
+    /**
+     * Get file-making header information.
+     * <pre>
+     * You should return your row resource for file-making.
+     * It continues invoking until this method returns null.
+     * </pre>
+     * @return File-making header information. (Nullable)
+     */
+    public ${glFileMakingRowResourceName} getRowResource();
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingHeaderInfo.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingHeaderInfo.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingHeaderInfo.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,23 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+import java.util.List;
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileMakingHeaderInfoName} {
+
+    protected List${database.filterGenericsString('String')} columnNameList = new java.util.ArrayList${database.filterGenericsString('String')}();
+
+    public List${database.filterGenericsString('String')} getColumnNameList() {
+        return columnNameList;
+    }
+
+    public void setColumnNameList(List${database.filterGenericsString('String')} columnNameList) {
+        this.columnNameList = columnNameList;
+    }
+
+    public boolean isEmpty() {
+        return this.columnNameList.isEmpty();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,103 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileMakingOptionName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** Encoding. (Required) */
+    protected String _encoding;
+
+    /** Delimiter. (Required) */
+    protected String _delimiter;
+
+    /** Line separator. (NotRequired) */
+    protected String _lineSeparator;
+
+    /** Good bye double quotation. (NotRequired) */
+    protected boolean _goodByeDoubleQuotation;
+
+    /** File-making header information. (NotRequired) */
+    protected ${glFileMakingHeaderInfoName} _fileMakingHeaderInfo;
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+    public ${glFileMakingOptionName} delimitateByComma() {
+        _delimiter = ",";
+        return this;
+    }
+
+    public ${glFileMakingOptionName} delimitateByTab() {
+        _delimiter = "\t";
+        return this;
+    }
+
+    public ${glFileMakingOptionName} encodeAsUTF8() {
+        _encoding = "UTF-8";
+        return this;
+    }
+
+    public ${glFileMakingOptionName} encodeAsWindows31J() {
+        _encoding = "Windows-31J";
+        return this;
+    }
+
+    public ${glFileMakingOptionName} separateCrLf() {
+        _lineSeparator = "\r\n";
+        return this;
+    }
+
+    public ${glFileMakingOptionName} separateLf() {
+        _lineSeparator = "\n";
+        return this;
+    }
+
+    public ${glFileMakingOptionName} goodByeDoubleQuotation() {
+        _goodByeDoubleQuotation = true;
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public String getEncoding() {
+        return _encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        _encoding = encoding;
+    }
+
+    public String getDelimiter() {
+        return _delimiter;
+    }
+
+    public void setDelimiter(String delimiter) {
+        _delimiter = delimiter;
+    }
+
+    public String getLineSeparator() {
+        return _lineSeparator;
+    }
+
+    public void setLineSeparator(String lineSeparator) {
+        _lineSeparator = lineSeparator;
+    }
+
+    public boolean isGoodByeDoubleQuotation() {
+        return _goodByeDoubleQuotation;
+    }
+
+    public ${glFileMakingHeaderInfoName} getFileMakingHeaderInfo() {
+        return _fileMakingHeaderInfo;
+    }
+
+    public void setFileMakingHeaderInfo(${glFileMakingHeaderInfoName} fileMakingHeaderInfo) {
+        _fileMakingHeaderInfo = fileMakingHeaderInfo;
+    }
+
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingRowResource.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingRowResource.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingRowResource.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,23 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileMakingRowResourceName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected java.util.List${database.filterGenericsString('String')} _valueList;
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public java.util.List${database.filterGenericsString('String')} getValueList() {
+        return _valueList;
+    }
+
+    public void setValueList(java.util.List${database.filterGenericsString('String')} valueList) {
+        this._valueList = valueList;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingSimpleFacade.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingSimpleFacade.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileMakingSimpleFacade.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,29 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glFileMakingSimpleFacadeName} {
+
+    /**
+     * Make token-file from row-list.
+     * 
+     * @param filename Output target file name. (NotNull)
+     * @param rowList Row-list composed of value-list. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void makeFromRowList(final String filename, final java.util.List${database.filterGenericsString('java.util.List<String>')} rowList, final ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * Make bytes from row-list.
+     * 
+     * @param rowList Row-list composed of value-list. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @return Result byte array. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public byte[] makeFromRowList(final java.util.List${database.filterGenericsString('java.util.List<String>')} rowList, final ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException;
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileToken.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileToken.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileToken.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,59 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * File-Token.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glFileTokenName} {
+
+    /**
+     * Tokenize token-file data of a specified file.
+     * 
+     * @param filename Input target file name. (NotNull)
+     * @param fileTokenizingCallback File-tokenizing callback. (NotNull)
+     * @param fileTokenizingOption File-tokenizing option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void tokenize(String filename, ${glFileTokenizingCallbackName} fileTokenizingCallback, ${glFileTokenizingOptionName} fileTokenizingOption) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * Tokenize token-file data of a specified file.
+     * <pre>
+     * This method uses java.io.InputStreamReader and java.io.BufferedReader that wrap the argument[inputStream].
+     * These objects are closed. (Invoking close() at finally)
+     * </pre>
+     * @param inputStream Input target stream. (NotNull)
+     * @param fileTokenizingCallback File-tokenizing callback. (NotNull)
+     * @param fileTokenizingOption File-tokenizing option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void tokenize(java.io.InputStream inputStream, ${glFileTokenizingCallbackName} fileTokenizingCallback, ${glFileTokenizingOptionName} fileTokenizingOption) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * Make token-file from specified row resources.
+     * 
+     * @param filename Output target file name. (NotNull)
+     * @param fileMakingCallback File-making callback. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void make(String filename, ${glFileMakingCallbackName} fileMakingCallback, ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException;
+
+    /**
+     * Make token-file from specified row resources.
+     * <pre>
+     * This method uses java.io.BufferedOutputStream and java.io.OutputStreamWriter that wrap the argument[outputStream].
+     * These objects are closed. (Invoking close() at finally)
+     * </pre>
+     * @param outputStream Output target stream. (NotNull)
+     * @param fileMakingCallback File-making callback. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void make(java.io.OutputStream outputStream, ${glFileMakingCallbackName} fileMakingCallback, ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException;
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingCallback.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingCallback.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingCallback.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,8 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glFileTokenizingCallbackName} {
+    public void handleRowResource(${glFileTokenizingRowResourceName} fileTokenizingRowResource);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingHeaderInfo.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingHeaderInfo.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingHeaderInfo.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,42 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+import java.util.List;
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileTokenizingHeaderInfoName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected List${database.filterGenericsString('String')} _columnNameList = new java.util.ArrayList${database.filterGenericsString('String')}();
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+    protected String _columnNameRowString;
+
+    public boolean isEmpty() {
+        return this._columnNameList.isEmpty();
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public List${database.filterGenericsString('String')} getColumnNameList() {
+        return _columnNameList;
+    }
+
+    public void setColumnNameList(List${database.filterGenericsString('String')} columnNameList) {
+        this._columnNameList = columnNameList;
+    }
+
+    public String getColumnNameRowString() {
+        return _columnNameRowString;
+    }
+
+    public void setColumnNameRowString(String columnNameRowString) {
+        _columnNameRowString = columnNameRowString;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,78 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileTokenizingOptionName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected String _encoding;
+
+    protected String _delimiter;
+
+    protected boolean _beginFirstLine;
+
+    protected boolean _handleEmptyAsNull;
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+    public ${glFileTokenizingOptionName} delimitateByComma() {
+        _delimiter = ",";
+        return this;
+    }
+
+    public ${glFileTokenizingOptionName} delimitateByTab() {
+        _delimiter = "\t";
+        return this;
+    }
+
+    public ${glFileTokenizingOptionName} encodeAsUTF8() {
+        _encoding = "UTF-8";
+        return this;
+    }
+
+    public ${glFileTokenizingOptionName} encodeAsWindows31J() {
+        _encoding = "Windows-31J";
+        return this;
+    }
+
+    public ${glFileTokenizingOptionName} beginFirstLine() {
+        _beginFirstLine = true;
+        return this;
+    }
+
+    public ${glFileTokenizingOptionName} handleEmptyAsNull() {
+        _handleEmptyAsNull = true;
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public String getDelimiter() {
+        return _delimiter;
+    }
+
+    public void setDelimiter(String delimiter) {
+        _delimiter = delimiter;
+    }
+
+    public String getEncoding() {
+        return _encoding;
+    }
+
+    public void setEncoding(String encoding) {
+        _encoding = encoding;
+    }
+
+    public boolean isBeginFirstLine() {
+        return _beginFirstLine;
+    }
+
+    public boolean isHandleEmptyAsNull() {
+        return _handleEmptyAsNull;
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingRowResource.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingRowResource.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/FileTokenizingRowResource.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,65 @@
+package ${glPackageBaseCommonHelperTokenFile};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileTokenizingRowResourceName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected ${glFileTokenizingHeaderInfoName} fileTokenizingHeaderInfo;
+
+    protected java.util.List${database.filterGenericsString('String')} valueList;
+
+    protected String rowString;
+
+    /** The row number. */
+    protected int _rowNumber;
+
+    /** The line number. */
+    protected int _lineNumber;
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public ${glFileTokenizingHeaderInfoName} getFileTokenizingHeaderInfo() {
+        return fileTokenizingHeaderInfo;
+    }
+
+    public void setFirstLineInfo(${glFileTokenizingHeaderInfoName} fileTokenizingHeaderInfo) {
+        this.fileTokenizingHeaderInfo = fileTokenizingHeaderInfo;
+    }
+
+    public java.util.List${database.filterGenericsString('String')} getValueList() {
+        return valueList;
+    }
+
+    public void setValueList(java.util.List${database.filterGenericsString('String')} valueList) {
+        this.valueList = valueList;
+    }
+
+    public String getRowString() {
+        return rowString;
+    }
+
+    public void setRowString(String rowString) {
+        this.rowString = rowString;
+    }
+
+    public int getRowNumber() {
+        return _rowNumber;
+    }
+
+    public void setRowNumber(int rowNumber) {
+        _rowNumber = rowNumber;
+    }
+
+    public int getLineNumber() {
+        return _lineNumber;
+    }
+
+    public void setLineNumber(int lineNumber) {
+        _lineNumber = lineNumber;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileMakingSimpleFacadeImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileMakingSimpleFacadeImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileMakingSimpleFacadeImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,74 @@
+package ${glPackageBaseCommonHelperTokenFileImpl};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenName};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingCallbackName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingOptionName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingRowResourceName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingSimpleFacadeName};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileMakingSimpleFacadeImplName} implements ${glFileMakingSimpleFacadeName} {
+
+    protected ${glFileTokenName} _fileToken = new ${glFileTokenImplName}();
+
+    public void setFileToken(${glFileTokenName} fileToken) {
+        this._fileToken = fileToken;
+    }
+
+    /**
+     * Make token-file from row-list.
+     * 
+     * @param filename Output target file name. (NotNull)
+     * @param rowList Row-list composed of value-list. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void makeFromRowList(final String filename, final java.util.List${database.filterGenericsString('java.util.List<String>')} rowList, final ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException {
+        final ${glFileMakingCallbackName} fileMakingCallback = new ${glFileMakingCallbackName}() {
+            protected int rowCount = 0;
+            public ${glFileMakingRowResourceName} getRowResource() {
+                ++rowCount;
+                if (rowList.size() < rowCount) {
+                    return null;// The End!
+                }
+                final java.util.List${database.filterGenericsString('String')} valueList = (java.util.List${database.filterGenericsString('String')})rowList.get(rowCount - 1);
+                final ${glFileMakingRowResourceName} fileMakingRowResource = new ${glFileMakingRowResourceName}();
+                fileMakingRowResource.setValueList(valueList);
+                return fileMakingRowResource;
+            }
+        };
+        _fileToken.make(filename, fileMakingCallback, fileMakingOption);
+    }
+
+    /**
+     * Make bytes from row-list.
+     * 
+     * @param rowList Row-list composed of value-list. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @return Result byte array. (NotNull)
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public byte[] makeFromRowList(final java.util.List${database.filterGenericsString('java.util.List<String>')} rowList, final ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException {
+        final ${glFileMakingCallbackName} fileMakingCallback = new ${glFileMakingCallbackName}() {
+            protected int rowCount = 0;
+            public ${glFileMakingRowResourceName} getRowResource() {
+                ++rowCount;
+                if (rowList.size() < rowCount) {
+                    return null;// The End!
+                }
+                final java.util.List${database.filterGenericsString('String')} valueList = (java.util.List${database.filterGenericsString('String')})rowList.get(rowCount - 1);
+                final ${glFileMakingRowResourceName} fileMakingRowResource = new ${glFileMakingRowResourceName}();
+                fileMakingRowResource.setValueList(valueList);
+                return fileMakingRowResource;
+            }
+        };
+        final java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
+        _fileToken.make(baos, fileMakingCallback, fileMakingOption);
+        return baos.toByteArray();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileTokenImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileTokenImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/file/impl/FileTokenImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,502 @@
+package ${glPackageBaseCommonHelperTokenFileImpl};
+
+import java.util.List;
+import java.util.ArrayList;
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenName};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingCallbackName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingOptionName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingRowResourceName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileTokenizingHeaderInfoName};
+
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingCallbackName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingOptionName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingRowResourceName};
+import ${glPackageBaseCommonHelperTokenFile}.${glFileMakingHeaderInfoName};
+
+import ${glPackageBaseCommonHelperTokenLine}.${glLineTokenName};
+import ${glPackageBaseCommonHelperTokenLine}.${glLineTokenizingOptionName};
+import ${glPackageBaseCommonHelperTokenLine}.${glLineMakingOptionName};
+import ${glPackageBaseCommonHelperTokenLineImpl}.${glLineTokenImplName};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFileTokenImplName} implements ${glFileTokenName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** Line-token for help. */
+    protected final ${glLineTokenName} _lineToken = new ${glLineTokenImplName}();
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    /**
+     * Tokenize token-file data of a specified file.
+     * 
+     * @param filename File name. (NotNull)
+     * @param fileTokenizingCallback File-tokenizing callback. (NotNull)
+     * @param fileTokenizingOption File-tokenizing option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void tokenize(String filename, ${glFileTokenizingCallbackName} fileTokenizingCallback, ${glFileTokenizingOptionName} fileTokenizingOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertStringNotNullAndNotTrimmedEmpty("filename", filename);
+
+        java.io.FileInputStream fis = null;
+        try {
+            fis = new java.io.FileInputStream(filename);
+            tokenize(fis, fileTokenizingCallback, fileTokenizingOption);
+        } catch (java.io.FileNotFoundException e) {
+            throw e;
+        } catch (java.io.IOException e) {
+            throw e;
+        } finally {
+            try {
+                if (fis != null) {
+                    fis.close();
+                }
+            } catch (java.io.IOException ignored) {
+            }
+        }
+    }
+
+
+    /**
+     * Tokenize token-file data of a specified file.
+     * <pre>
+     * This method uses java.io.InputStreamReader and java.io.BufferedReader that wrap the argument[inputStream].
+     * These objects are closed. (Invoking close() at finally)
+     * </pre>
+     * @param inputStream Input target stream. (NotNull)
+     * @param fileTokenizingCallback File-tokenizing callback. (NotNull)
+     * @param fileTokenizingOption File-tokenizing option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void tokenize(java.io.InputStream inputStream, ${glFileTokenizingCallbackName} fileTokenizingCallback, ${glFileTokenizingOptionName} fileTokenizingOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertObjectNotNull("inputStream", inputStream);
+        assertObjectNotNull("fileTokenizingCallback", fileTokenizingCallback);
+        assertObjectNotNull("fileTokenizingOption", fileTokenizingOption);
+        final String delimiter = fileTokenizingOption.getDelimiter();
+        final String encoding = fileTokenizingOption.getEncoding();
+        assertStringNotNullAndNotTrimmedEmpty("encoding", encoding);
+        assertObjectNotNull("delimiter", delimiter);
+
+        java.io.InputStreamReader ir = null;
+        java.io.BufferedReader br = null;
+
+        String lineString = null;
+        String preContinueString = "";
+        final List${database.filterGenericsString('String')} temporaryValueList = new ArrayList${database.filterGenericsString('String')}();
+        final List${database.filterGenericsString('String')} filteredValueList = new ArrayList${database.filterGenericsString('String')}();
+
+        try {
+            ir = new java.io.InputStreamReader(inputStream, encoding);
+            br = new java.io.BufferedReader(ir);
+
+            ${glFileTokenizingHeaderInfoName} fileTokenizingHeaderInfo = null;
+            int count = -1;
+            int rowNumber = 1;
+            int lineNumber = 0;
+            while (true) {
+                ++count;
+                if ("".equals(preContinueString)) {
+                    lineNumber = count + 1;
+                }
+
+                lineString = br.readLine();
+                if (lineString == null) {
+                    break;
+                }
+                if (count == 0) {
+                    if (fileTokenizingOption.isBeginFirstLine()) {
+                        fileTokenizingHeaderInfo = new ${glFileTokenizingHeaderInfoName}();// As empty
+                    } else {
+                        fileTokenizingHeaderInfo = analyzeHeaderInfo(delimiter, lineString);
+                        continue;
+                    }
+                }
+                final String rowString;
+                if (preContinueString.equals("")) {
+                    rowString = lineString;
+                } else {
+                    final String lineSeparator = System.getProperty("line.separator");
+                    rowString = preContinueString + lineSeparator + lineString;
+                }
+                final ValueLineInfo valueLineInfo = arrangeValueList(rowString, delimiter);
+                final List${database.filterGenericsString('String')} ls = valueLineInfo.getValueList();
+                if (valueLineInfo.isContinueNextLine()) {
+                    preContinueString = (String)ls.remove(ls.size() - 1);
+                    temporaryValueList.addAll(ls);
+                    continue;
+                }
+                temporaryValueList.addAll(ls);
+
+                try {
+                    final ${glFileTokenizingRowResourceName} fileTokenizingRowResource = new ${glFileTokenizingRowResourceName}();
+                    fileTokenizingRowResource.setFirstLineInfo(fileTokenizingHeaderInfo);
+
+                    if (fileTokenizingOption.isHandleEmptyAsNull()) {
+                        for (final java.util.Iterator ite = temporaryValueList.iterator(); ite.hasNext(); ) {
+                            final String value = (String)ite.next();
+                            if ("".equals(value)) {
+                                filteredValueList.add(null);
+                            } else {
+                                filteredValueList.add(value);
+                            }
+                        }
+                        fileTokenizingRowResource.setValueList(filteredValueList);
+                    } else {
+                        fileTokenizingRowResource.setValueList(temporaryValueList);
+                    }
+
+                    fileTokenizingRowResource.setRowString(rowString);
+                    fileTokenizingRowResource.setRowNumber(rowNumber);
+                    fileTokenizingRowResource.setLineNumber(lineNumber);
+                    fileTokenizingCallback.handleRowResource(fileTokenizingRowResource);
+                } finally {
+                    ++rowNumber;
+                    temporaryValueList.clear();
+                    filteredValueList.clear();
+                    preContinueString = "";
+                }
+            }
+        } catch (java.io.FileNotFoundException e) {
+            throw e;
+        } catch (java.io.IOException e) {
+            throw e;
+        } finally {
+            try {
+                if (ir != null) {
+                    ir.close();
+                }
+                if (br != null) {
+                    br.close();
+                }
+            } catch (java.io.IOException ignored) {
+            }
+        }
+    }
+
+    protected ValueLineInfo arrangeValueList(final String lineString, String delimiter) {
+        final List${database.filterGenericsString('String')} valueList = new ArrayList${database.filterGenericsString('String')}();
+
+        // Don't use split!
+        //        final String[] values = lineString.split(delimiter);
+        final ${glLineTokenizingOptionName} tokenizingOption = new ${glLineTokenizingOptionName}();
+        tokenizingOption.setDelimiter(delimiter);
+        final List${database.filterGenericsString('String')} list = _lineToken.tokenize(lineString, tokenizingOption);
+        final String[] values = (String[])list.toArray(new String[list.size()]);
+        for (int i=0; i < values.length; i++) {
+            valueList.add(values[i]);
+        }
+        return arrangeValueList(valueList, delimiter);
+    }
+
+    protected ValueLineInfo arrangeValueList(List${database.filterGenericsString('String')} valueList, String delimiter) {
+        final ValueLineInfo valueLineInfo = new ValueLineInfo();
+        final ArrayList${database.filterGenericsString('String')} resultList = new ArrayList${database.filterGenericsString('String')}();
+        String preString = "";
+        for (int i = 0; i < valueList.size(); i++) {
+            final String value = (String)valueList.get(i);
+            if (value == null) {
+                continue;
+            }
+            if (i == valueList.size() - 1) {// The last loop
+                if (preString.equals("")) {
+                    if (isFrontQOnly(value)) {
+                        valueLineInfo.setContinueNextLine(true);
+                        resultList.add(value);
+                        break;
+                    } else if (isRearQOnly(value)) {
+                        resultList.add(value);
+                        break;
+                    } else if (isNotBothQ(value)) {
+                        resultList.add(value);
+                        break;
+                    } else {
+                        resultList.add(removeDoubleQuotation(value));
+                        break;
+                    }
+                } else {
+                    if (isFrontQOnly(value)) {
+                        valueLineInfo.setContinueNextLine(true);
+                        resultList.add(connectPreString(preString, delimiter, value));
+                        break;
+                    } else if (isRearQOnly(value)) {
+                        resultList.add(removeDoubleQuotation(connectPreString(preString, delimiter, value)));
+                        break;
+                    } else if (isNotBothQ(value)) {
+                        valueLineInfo.setContinueNextLine(true);
+                        resultList.add(connectPreString(preString, delimiter, value));
+                        break;
+                    } else {
+                        resultList.add(removeDoubleQuotation(connectPreString(preString, delimiter, value)));
+                        break;
+                    }
+                }
+            }
+
+            if (preString.equals("")) {
+                if (isFrontQOnly(value)) {
+                    preString = value;
+                    continue;
+                } else if (isRearQOnly(value)) {
+                    preString = value;
+                    continue;
+                } else if (isNotBothQ(value)) {
+                    resultList.add(value);
+                } else {
+                    resultList.add(removeDoubleQuotation(value));
+                }
+            } else {
+                if (isFrontQOnly(value)) {
+                    preString = connectPreString(preString, delimiter, value);
+                    continue;
+                } else if (isRearQOnly(value)) {
+                    resultList.add(removeDoubleQuotation(connectPreString(preString, delimiter, value)));
+                } else if (isNotBothQ(value)) {
+                    preString = connectPreString(preString, delimiter, value);
+                    continue;
+                } else {
+                    resultList.add(removeDoubleQuotation(connectPreString(preString, delimiter, value)));
+                }
+            }
+            preString = "";
+        }
+        valueLineInfo.setValueList(resultList);
+        return valueLineInfo;
+    }
+
+    protected String connectPreString(String preString, String delimiter, String value) {
+        if (preString.equals("")) {
+            return value;
+        } else {
+            return preString + delimiter + value;
+        }
+    }
+
+    protected boolean isNotBothQ(final String value) {
+        return !value.startsWith("\"") && !value.endsWith("\"");
+    }
+
+    protected boolean isRearQOnly(final String value) {
+        return !value.startsWith("\"") && value.endsWith("\"");
+    }
+
+    protected boolean isFrontQOnly(final String value) {
+        return value.startsWith("\"") && !value.endsWith("\"");
+    }
+
+    protected String removeDoubleQuotation(String value) {
+        if (!value.startsWith("\"") && !value.endsWith("\"")) {
+            return value;
+        }
+        if (value.startsWith("\"")) {
+            value = value.substring(1);
+        }
+        if (value.endsWith("\"")) {
+            value = value.substring(0, value.length() - 1);
+        }
+        return value;
+    }
+
+    protected String removeRightDoubleQuotation(String value) {
+        if (value.endsWith("\"")) {
+            value = value.substring(0, value.length() - 1);
+        }
+        return value;
+    }
+
+    protected ${glFileTokenizingHeaderInfoName} analyzeHeaderInfo(String delimiter, final String lineString) {
+        final java.util.List${database.filterGenericsString('String')} columnNameList = new ArrayList${database.filterGenericsString('String')}();
+        final String[] values = lineString.split(delimiter);
+        int count = 0;
+        for (int i=0; i < values.length; i++) {
+            String value = values[i];
+            if (value == null) {
+                columnNameList.add("");
+            }
+            value = value.trim();// Trimming is Header Only!
+            if (value.startsWith("\"") && value.endsWith("\"")) {
+                columnNameList.add(value.substring(1, value.length() - 1));
+            } else {
+                columnNameList.add(value);
+            }
+            count++;
+        }
+        final ${glFileTokenizingHeaderInfoName} fileTokenizingHeaderInfo = new ${glFileTokenizingHeaderInfoName}();
+        fileTokenizingHeaderInfo.setColumnNameList(columnNameList);
+        fileTokenizingHeaderInfo.setColumnNameRowString(lineString);
+        return fileTokenizingHeaderInfo;
+    }
+
+    public static class ValueLineInfo {
+        protected java.util.List${database.filterGenericsString('String')} valueList;
+
+        protected boolean continueNextLine;
+
+        public java.util.List${database.filterGenericsString('String')} getValueList() {
+            return valueList;
+        }
+
+        public void setValueList(List${database.filterGenericsString('String')} valueList) {
+            this.valueList = valueList;
+        }
+
+        public boolean isContinueNextLine() {
+            return continueNextLine;
+        }
+
+        public void setContinueNextLine(boolean continueNextLine) {
+            this.continueNextLine = continueNextLine;
+        }
+    }
+
+    /**
+     * Make token-file from specified row resources.
+     * 
+     * @param filename File name. (NotNull)
+     * @param fileMakingCallback File-making callback. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void make(String filename, ${glFileMakingCallbackName} fileMakingCallback, ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertStringNotNullAndNotTrimmedEmpty("filename", filename);
+
+        java.io.FileOutputStream fos = null;
+        try {
+            fos = new java.io.FileOutputStream(filename);
+            make(fos, fileMakingCallback, fileMakingOption);
+        } catch (java.io.FileNotFoundException e) {
+            throw e;
+        } catch (java.io.IOException e) {
+            throw e;
+        } finally {
+            if (fos != null) {
+                fos.close();
+            }
+        }
+    }
+
+    /**
+     * Make token-file from specified row resources.
+     * <pre>
+     * This method uses java.io.BufferedOutputStream and java.io.OutputStreamWriter that wrap the argument[outputStream].
+     * These objects are closed. (Invoking close() at finally)
+     * </pre>
+     * @param outputStream Output target stream. (NotNull)
+     * @param fileMakingCallback File-making callback. (NotNull)
+     * @param fileMakingOption File-making option. (NotNull and Required{encoding and delimiter})
+     * @throws java.io.FileNotFoundException
+     * @throws java.io.IOException
+     */
+    public void make(java.io.OutputStream outputStream, ${glFileMakingCallbackName} fileMakingCallback, ${glFileMakingOptionName} fileMakingOption) throws java.io.FileNotFoundException, java.io.IOException {
+        assertObjectNotNull("outputStream", outputStream);
+        assertObjectNotNull("fileMakingCallback", fileMakingCallback);
+        assertObjectNotNull("fileMakingOption", fileMakingOption);
+        final String encoding = fileMakingOption.getEncoding();
+        final String delimiter = fileMakingOption.getDelimiter();
+        assertStringNotNullAndNotTrimmedEmpty("encoding", encoding);
+        assertObjectNotNull("delimiter", delimiter);
+        final String lineSeparator;
+        if (fileMakingOption.getLineSeparator() != null && !fileMakingOption.getLineSeparator().equals("")) {
+            lineSeparator = fileMakingOption.getLineSeparator();
+        } else {
+            lineSeparator = System.getProperty("line.separator");// Default!
+        }
+
+        java.io.BufferedOutputStream bos = null;
+        java.io.Writer writer = null;
+        try {
+            bos = new java.io.BufferedOutputStream(outputStream);
+            writer = new java.io.OutputStreamWriter(bos, encoding);
+
+            // Make header.
+            final ${glFileMakingHeaderInfoName} fileMakingHeaderInfo = fileMakingOption.getFileMakingHeaderInfo();
+            if (fileMakingHeaderInfo != null) {
+                final List${database.filterGenericsString('String')} columnNameList = fileMakingHeaderInfo.getColumnNameList();
+                if (columnNameList != null && !columnNameList.isEmpty()) {
+                    final ${glLineMakingOptionName} lineMakingOption = new ${glLineMakingOptionName}();
+                    lineMakingOption.setDelimiter(delimiter);
+                    lineMakingOption.trimSpace();// Trimming is Header Only!
+                    final String columnHeaderString = _lineToken.make(columnNameList, lineMakingOption);
+                    writer.write(columnHeaderString + lineSeparator);
+                }
+            }
+
+            // Make row.
+            ${glFileMakingRowResourceName} rowResource = null;
+            while (true) {
+                rowResource = fileMakingCallback.getRowResource();
+                if (rowResource == null) {
+                    break;// The End!
+                }
+                final java.util.List${database.filterGenericsString('String')} valueList = rowResource.getValueList();
+                final ${glLineMakingOptionName} lineMakingOption = new ${glLineMakingOptionName}();
+                lineMakingOption.setDelimiter(delimiter);
+                if (!fileMakingOption.isGoodByeDoubleQuotation()) {
+                    lineMakingOption.quoteByDoubleQuotation();
+                }
+                final String lineString = _lineToken.make(valueList, lineMakingOption);
+                writer.write(lineString + lineSeparator);
+            }
+            writer.flush();
+        } catch (java.io.FileNotFoundException e) {
+            throw e;
+        } catch (java.io.IOException e) {
+            throw e;
+        } finally {
+            if (bos != null) {
+                bos.close();
+            }
+            if (writer != null) {
+                writer.close();
+            }
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the object is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertObjectNotNull(String variableName, Object value) {
+        if (variableName == null) {
+            String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "The value should not be null: variableName=" + variableName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the entity is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        assertObjectNotNull("variableName", variableName);
+        assertObjectNotNull(variableName, value);
+        if (value.trim().length() ==0) {
+            String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineMakingOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineMakingOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineMakingOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,49 @@
+package ${glPackageBaseCommonHelperTokenLine};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glLineMakingOptionName} {
+
+    protected String _delimiter;
+
+    protected boolean _quoteByDoubleQuotation;
+
+    protected boolean _trimSpace;
+
+    public ${glLineMakingOptionName} delimitateByComma() {
+        _delimiter = ",";
+        return this;
+    }
+
+    public ${glLineMakingOptionName} delimitateByTab() {
+        _delimiter = "\t";
+        return this;
+    }
+
+    public String getDelimiter() {
+        return _delimiter;
+    }
+
+    public void setDelimiter(String delimiter) {
+        _delimiter = delimiter;
+    }
+
+    public ${glLineMakingOptionName} quoteByDoubleQuotation() {
+        _quoteByDoubleQuotation = true;
+        return this;
+    }
+
+    public boolean isQuoteByDoubleQuotation() {
+        return _quoteByDoubleQuotation;
+    }
+
+    public ${glLineMakingOptionName} trimSpace() {
+        _trimSpace = true;
+        return this;
+    }
+
+    public boolean isTrimSpace() {
+        return _trimSpace;
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineToken.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineToken.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineToken.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${glPackageBaseCommonHelperTokenLine};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glLineTokenName} {
+
+    public java.util.List${database.filterGenericsString('String')} tokenize(String lineString, ${glLineTokenizingOptionName} lineTokenizingOption);
+
+    public String make(java.util.List${database.filterGenericsString('String')} valueList, ${glLineMakingOptionName} lineMakingOption);
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineTokenizingOption.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineTokenizingOption.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/LineTokenizingOption.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,58 @@
+package ${glPackageBaseCommonHelperTokenLine};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glLineTokenizingOptionName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected String _delimiter;
+
+    protected boolean _trimDoubleQuotation;
+
+    protected boolean _handleEmtpyAsNull;
+
+    // =====================================================================================
+    //                                                                           Easy-to-Use
+    //                                                                           ===========
+    public ${glLineTokenizingOptionName} delimitateByComma() {
+        _delimiter = ",";
+        return this;
+    }
+
+    public ${glLineTokenizingOptionName} delimitateByTab() {
+        _delimiter = "\t";
+        return this;
+    }
+
+    public ${glLineTokenizingOptionName} trimDoubleQuotation() {
+        _trimDoubleQuotation = true;
+        return this;
+    }
+
+    public ${glLineTokenizingOptionName} handleEmtpyAsNull() {
+        _handleEmtpyAsNull = true;
+        return this;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public String getDelimiter() {
+        return _delimiter;
+    }
+
+    public void setDelimiter(String delimiter) {
+        _delimiter = delimiter;
+    }
+
+    public boolean isTrimDoubleQuotation() {
+        return _trimDoubleQuotation;
+    }
+
+    public boolean isHandleEmtpyAsNull() {
+        return _handleEmtpyAsNull;
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/impl/LineTokenImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/impl/LineTokenImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/helper/token/line/impl/LineTokenImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,111 @@
+package ${glPackageBaseCommonHelperTokenLineImpl};
+
+import ${glPackageBaseCommonHelperTokenLine}.${glLineTokenName};
+import ${glPackageBaseCommonHelperTokenLine}.${glLineTokenizingOptionName};
+import ${glPackageBaseCommonHelperTokenLine}.${glLineMakingOptionName};
+
+/**
+ * @author ${database.ClassAuthor}
+ */
+public class ${glLineTokenImplName} implements ${glLineTokenName} {
+
+    public java.util.List${database.filterGenericsString('String')} tokenize(String lineString, ${glLineTokenizingOptionName} lineTokenizingOption) {
+        final String delimiter = lineTokenizingOption.getDelimiter();
+        final java.util.List${database.filterGenericsString('String')} list = new java.util.ArrayList${database.filterGenericsString('String')}();
+        int i = 0;
+        int j = lineString.indexOf(delimiter);
+        for (int h = 0; j >= 0; h++) {
+            final String pureValue = lineString.substring(i, j);
+            if (lineTokenizingOption.isTrimDoubleQuotation()) {
+                final String before = pureValue;
+                if (before.length() > 1 && before.startsWith("\"") && before.endsWith("\"")) {
+                    final String after = before.substring(1, before.length() - 1);
+                    list.add(filterHandlingEmptyAsNull(after, lineTokenizingOption));
+                } else {
+                    list.add(filterHandlingEmptyAsNull(before, lineTokenizingOption));
+                }
+            } else {
+                list.add(filterHandlingEmptyAsNull(pureValue, lineTokenizingOption));
+            }
+            i = j + 1;
+            j = lineString.indexOf(delimiter, i);
+        }
+        list.add(filterHandlingEmptyAsNull(lineString.substring(i), lineTokenizingOption));
+        return list;
+    }
+
+    protected String filterHandlingEmptyAsNull(String target, ${glLineTokenizingOptionName} lineTokenizingOption) {
+        if (target == null) {
+            return null;
+        }
+        if (lineTokenizingOption.isHandleEmtpyAsNull() && "".equals(target)) {
+            return null;
+        }
+        return target;
+    }
+
+    public String make(java.util.List${database.filterGenericsString('String')} valueList, ${glLineMakingOptionName} lineMakingOption) {
+        assertObjectNotNull("valueList", valueList);
+        assertObjectNotNull("lineMakingOption", lineMakingOption);
+        final String delimiter = lineMakingOption.getDelimiter();
+        assertObjectNotNull("lineMakingOption.getDelimiter()", delimiter);
+        return createLineString(valueList, delimiter, lineMakingOption.isQuoteByDoubleQuotation(), lineMakingOption.isTrimSpace());
+    }
+
+    protected String createLineString(java.util.List${database.filterGenericsString('String')} valueList, String delimiter, boolean quoteByDoubleQuotation, boolean trimSpace) {
+        final StringBuffer sb = new StringBuffer();
+        for (final java.util.Iterator ite = valueList.iterator(); ite.hasNext(); ) {
+            String value = (String)ite.next();
+            value = (value != null ? value : "");
+            if (trimSpace) {
+                value = value.trim();
+            }
+            if (quoteByDoubleQuotation) {
+                sb.append(delimiter).append("\"").append(value).append("\"");
+            } else {
+                sb.append(delimiter).append(value);
+            }
+        }
+        sb.delete(0, delimiter.length());
+        return sb.toString();
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert Object
+    //                                                    -------------
+    /**
+     * Assert that the object is not null.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     * @exception IllegalArgumentException
+     */
+    protected void assertObjectNotNull(String variableName, Object value) {
+        if (variableName == null) {
+            String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+        if (value == null) {
+            String msg = "The value should not be null: variableName=" + variableName;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    // ----------------------------------------------------------------
+    //                                                    Assert String
+    //                                                    -------------
+    /**
+     * Assert that the entity is not null and not trimmed empty.
+     * 
+     * @param variableName Variable name. (NotNull)
+     * @param value Value. (NotNull)
+     */
+    protected void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
+        assertObjectNotNull("variableName", variableName);
+        assertObjectNotNull(variableName, value);
+        if (value.trim().length() ==0) {
+            String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
+            throw new IllegalArgumentException(msg);
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupAbstractInterceptor.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,127 @@
+package ${glPackageBaseCommonInterceptor};
+
+import org.aopalliance.intercept.MethodInvocation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommon}.${glEntityDefinedCommonColumnInterfaceName};
+
+/**
+ * CommonColumn-Setup Abstract Interceptor.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${glCommonColumnSetupAbstractInterceptor} extends org.seasar.framework.aop.interceptors.AbstractInterceptor {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glCommonColumnSetupAbstractInterceptor}.class);
+
+    /**
+     * Invoke.
+     * 
+     * @param invocation Method invocation.
+     * @return Result of the method.
+     * @throws Throwable
+     */
+    public Object invoke(MethodInvocation invocation) throws Throwable {
+        final java.lang.reflect.Method method = invocation.getMethod();
+        final Object[] args = invocation.getArguments();
+
+        if (!(args != null && args.length != 0)) {
+            return invocation.proceed();
+        }
+        final Object firstArgument = args[0];
+        if (isEntityDefinedCommonColumn(firstArgument)) {
+            final ${glEntityDefinedCommonColumnInterfaceName} entity = (${glEntityDefinedCommonColumnInterfaceName})firstArgument;
+            if (_log.isDebugEnabled()) {
+                String msg = "Intercepted the method '" + getShortClassName(method.getDeclaringClass()) + "." + method.getName() + "()'";
+                msg = msg + ": entity=" + entity.extractPrimaryKeyMapString();
+                _log.debug(msg);
+            }
+            setupEntity(entity);
+            return invocation.proceed();
+        } else if (isListSaveEntityDefinedCommonColumn(firstArgument)) {
+            final java.util.List ls = (java.util.List)firstArgument;
+                if (_log.isDebugEnabled()) {
+                    String msg = "Intercepted the method '" + getShortClassName(method.getDeclaringClass()) + "." + method.getName() + "()'";
+                    msg = msg + ": entityList.size()=" + ls.size();
+                    _log.debug(msg);
+                }
+            for (final java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+                final ${glEntityDefinedCommonColumnInterfaceName} entity = (${glEntityDefinedCommonColumnInterfaceName})ite.next();
+                setupEntity(entity);
+            }
+            return invocation.proceed();
+        } else {
+            return invocation.proceed();
+        }
+    }
+
+    /**
+     * Is the object entity defined common column?
+     * 
+     * @param obj Object. If the object is null, returns false. (Nullable)
+     * @return Determination.
+     */
+    protected boolean isEntityDefinedCommonColumn(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (obj instanceof ${glEntityDefinedCommonColumnInterfaceName}) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Is the object list that saves entity defined common column?
+     * 
+     * @param obj Object. If the object is null, returns false. (Nullable)
+     * @return Determination.
+     */
+    protected boolean isListSaveEntityDefinedCommonColumn(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof java.util.List)) {
+            return false;
+        }
+        final java.util.List ls = (java.util.List)obj;
+        for (final java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+            final Object currentObj = ite.next();
+            if (!(currentObj instanceof ${glEntityDefinedCommonColumnInterfaceName})) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Set up the entity.
+     * 
+     * @param entity Entity. (Nullable)
+     */
+    abstract protected void setupEntity(${glEntityDefinedCommonColumnInterfaceName} entity);
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+    /**
+     * Get short class name.
+     * 
+     * @param clazz Class instance. (NotNull)
+     * @return Short class name. (NotNull)
+     */
+    protected String getShortClassName(Class clazz) {
+        String s = clazz.getName();
+        int i = s.lastIndexOf('.');
+        if (i > 0) {
+            return s.substring(i + 1);
+        }
+        return s;
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeDeleteInterceptor.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,61 @@
+package ${glPackageBaseCommonInterceptor};
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommon}.${glEntityDefinedCommonColumnInterfaceName};
+
+/**
+ * CommonColumn-Setup-before-Delete Interceptor.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glCommonColumnSetupBeforeDeleteInterceptor} extends ${glCommonColumnSetupAbstractInterceptor} {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glCommonColumnSetupBeforeDeleteInterceptor}.class);
+
+    /**
+     * Set up the entity.
+     * 
+     * @param entity Entity. (Nullable)
+     */
+    protected void setupEntity(${glEntityDefinedCommonColumnInterfaceName} entity) {
+        if (_log.isDebugEnabled()) {
+            _log.debug("  before setup : " + entity.getDBMeta().extractCommonColumnValueMapString(entity));
+        }
+#foreach ($columnName in ${database.CommonColumnNameList})
+  #set ($filteredColumnName = ${database.filterCommonColumn(${columnName})})
+  #set ($entityCommonColumnMap = ${database.CommonColumnMap})
+  #set ($columnType = ${entityCommonColumnMap.get(${columnName})})
+  #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+  #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+  #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+  #if (${database.containsValidColumnNameKeyCommonColumnSetupBeforeDeleteInterceptorLogicMap(${columnName})})
+    #set ($logic = ${database.getCommonColumnSetupBeforeDeleteInterceptorLogicByColumnName(${columnName})})
+    #if ($database.isCommonColumnSetupInvokingLogic($logic))
+      #set ($filteredLogic = $database.removeCommonColumnSetupInvokingMark($logic))
+
+        ${filteredLogic}
+        if (_log.isDebugEnabled()) {
+            _log.debug("    ${filteredColumnName} has been set up: invoking=${filteredLogic}");
+        }
+    #else
+
+        final ${javaNative} ${uncapitalisedJavaName} = ${logic};
+        entity.set${javaName}(${uncapitalisedJavaName});
+        if (_log.isDebugEnabled()) {
+            _log.debug("    ${filteredColumnName} has been set up: value=" + ${uncapitalisedJavaName});
+        }
+    #end
+  #end
+#end
+
+        if (_log.isDebugEnabled()) {
+            _log.debug("  after setup  : " + entity.getDBMeta().extractCommonColumnValueMapString(entity));
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeInsertInterceptor.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,61 @@
+package ${glPackageBaseCommonInterceptor};
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommon}.${glEntityDefinedCommonColumnInterfaceName};
+
+/**
+ * CommonColumn-Setup-before-Insert Interceptor.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glCommonColumnSetupBeforeInsertInterceptor} extends ${glCommonColumnSetupAbstractInterceptor} {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glCommonColumnSetupBeforeInsertInterceptor}.class);
+
+    /**
+     * Set up the entity.
+     * 
+     * @param entity Entity. (Nullable)
+     */
+    protected void setupEntity(${glEntityDefinedCommonColumnInterfaceName} entity) {
+        if (_log.isDebugEnabled()) {
+            _log.debug("  before setup : " + entity.getDBMeta().extractCommonColumnValueMapString(entity));
+        }
+#foreach ($columnName in ${database.CommonColumnNameList})
+  #set ($filteredColumnName = ${database.filterCommonColumn(${columnName})})
+  #set ($entityCommonColumnMap = ${database.CommonColumnMap})
+  #set ($columnType = ${entityCommonColumnMap.get(${columnName})})
+  #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+  #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+  #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+  #if (${database.containsValidColumnNameKeyCommonColumnSetupBeforeInsertInterceptorLogicMap(${columnName})})
+    #set ($logic = ${database.getCommonColumnSetupBeforeInsertInterceptorLogicByColumnName(${columnName})})
+    #if ($database.isCommonColumnSetupInvokingLogic($logic))
+      #set ($filteredLogic = $database.removeCommonColumnSetupInvokingMark($logic))
+
+        ${filteredLogic}
+        if (_log.isDebugEnabled()) {
+            _log.debug("    ${filteredColumnName} has been set up: invoking=${filteredLogic}");
+        }
+    #else
+
+        final ${javaNative} ${uncapitalisedJavaName} = ${logic};
+        entity.set${javaName}(${uncapitalisedJavaName});
+        if (_log.isDebugEnabled()) {
+            _log.debug("    ${filteredColumnName} has been set up: value=" + ${uncapitalisedJavaName});
+        }
+    #end
+  #end
+#end
+
+        if (_log.isDebugEnabled()) {
+            _log.debug("  after setup  : " + entity.getDBMeta().extractCommonColumnValueMapString(entity));
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/interceptor/CommonColumnSetupBeforeUpdateInterceptor.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,61 @@
+package ${glPackageBaseCommonInterceptor};
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommon}.${glEntityDefinedCommonColumnInterfaceName};
+
+/**
+ * CommonColumn-Setup-before-Update Interceptor.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glCommonColumnSetupBeforeUpdateInterceptor} extends ${glCommonColumnSetupAbstractInterceptor} {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glCommonColumnSetupBeforeUpdateInterceptor}.class);
+
+    /**
+     * Set up the entity.
+     * 
+     * @param entity Entity. (Nullable)
+     */
+    protected void setupEntity(${glEntityDefinedCommonColumnInterfaceName} entity) {
+        if (_log.isDebugEnabled()) {
+            _log.debug("  before setup : " + entity.getDBMeta().extractCommonColumnValueMapString(entity));
+        }
+#foreach ($columnName in ${database.CommonColumnNameList})
+  #set ($filteredColumnName = ${database.filterCommonColumn(${columnName})})
+  #set ($entityCommonColumnMap = ${database.CommonColumnMap})
+  #set ($columnType = ${entityCommonColumnMap.get(${columnName})})
+  #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+  #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+  #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+  #if (${database.containsValidColumnNameKeyCommonColumnSetupBeforeUpdateInterceptorLogicMap(${columnName})})
+    #set ($logic = ${database.getCommonColumnSetupBeforeUpdateInterceptorLogicByColumnName(${columnName})})
+    #if ($database.isCommonColumnSetupInvokingLogic($logic))
+      #set ($filteredLogic = $database.removeCommonColumnSetupInvokingMark($logic))
+
+        ${filteredLogic}
+        if (_log.isDebugEnabled()) {
+            _log.debug("    ${filteredColumnName} has been set up: invoking=${filteredLogic}");
+        }
+    #else
+
+        final ${javaNative} ${uncapitalisedJavaName} = ${logic};
+        entity.set${javaName}(${uncapitalisedJavaName});
+        if (_log.isDebugEnabled()) {
+            _log.debug("    ${filteredColumnName} has been set up: value=" + ${uncapitalisedJavaName});
+        }
+    #end
+  #end
+#end
+
+        if (_log.isDebugEnabled()) {
+            _log.debug("  after setup  : " + entity.getDBMeta().extractCommonColumnValueMapString(entity));
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedExecutionBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedExecutionBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedExecutionBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,46 @@
+package ${glPackageBaseCommonJdbcHistory};
+
+/**
+ * The bean of prepared execution.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glPreparedExecutionBeanName} {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    protected java.util.List<${glPreparedParameterElementName}> preparedParameterElementList = new java.util.ArrayList<${glPreparedParameterElementName}>();
+
+    protected String displaySql;
+
+    // ===================================================================================
+    //                                                                         Easy-to-Use
+    //                                                                         ===========
+    public void addParameterElement(${glPreparedParameterElementName} parameterElement) {
+        this.preparedParameterElementList.add(parameterElement);
+    }
+
+    public boolean isEmpty() {
+        return preparedParameterElementList.isEmpty();
+    }
+
+    public int size() {
+        return preparedParameterElementList.size();
+    }
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+    public java.util.List<${glPreparedParameterElementName}> getPreparedParameterElementList() {
+        return preparedParameterElementList;
+    }
+
+    public String getDisplaySql() {
+        return displaySql;
+    }
+
+    public void setDisplaySql(String displaySql) {
+        this.displaySql = displaySql;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedParameterElement.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedParameterElement.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/PreparedParameterElement.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,46 @@
+package ${glPackageBaseCommonJdbcHistory};
+
+/**
+ * The element of prepared parameters.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glPreparedParameterElementName} {
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    protected int settingIndex;
+
+    /** JDBC type. (java.sql.Types) */
+    protected int jdbcType;
+
+    protected Object parameterValue;
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public int getSettingIndex() {
+        return settingIndex;
+    }
+
+    public void setSettingIndex(int settingIndex) {
+        this.settingIndex = settingIndex;
+    }
+
+    public int getJdbcType() {
+        return jdbcType;
+    }
+
+    public void setJdbcType(int jdbcType) {
+        this.jdbcType = jdbcType;
+    }
+
+    public Object getParameterValue() {
+        return parameterValue;
+    }
+
+    public void setParameterValue(Object parameterValue) {
+        this.parameterValue = parameterValue;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistory.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistory.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistory.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,48 @@
+package ${glPackageBaseCommonJdbcHistory};
+
+/**
+ * The history of statement.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glStatementHistoryName} {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    protected java.util.List<${glPreparedExecutionBeanName}> preparedExecutionBeanList = new java.util.ArrayList<${glPreparedExecutionBeanName}>();
+
+    // ===================================================================================
+    //                                                                         Easy-to-Use
+    //                                                                         ===========
+    public void addExecutionBean(${glPreparedExecutionBeanName} parameterBean) {
+        this.preparedExecutionBeanList.add(parameterBean);
+    }
+
+    public ${glPreparedExecutionBeanName} current() {
+        if (preparedExecutionBeanList.isEmpty()) {
+            preparedExecutionBeanList.add(new ${glPreparedExecutionBeanName}());
+        }
+        return preparedExecutionBeanList.get(preparedExecutionBeanList.size() - 1);
+    }
+
+    public ${glPreparedExecutionBeanName} next() {
+        preparedExecutionBeanList.add(new ${glPreparedExecutionBeanName}());
+        return current();
+    }
+
+    public ${glPreparedExecutionBeanName} removeLast() {
+        return preparedExecutionBeanList.remove(preparedExecutionBeanList.size() - 1);
+    }
+
+    public int size() {
+        return preparedExecutionBeanList.size();
+    }
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+    public java.util.List<${glPreparedExecutionBeanName}> getPreparedExecutionBeanList() {
+        return preparedExecutionBeanList;
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistoryWitness.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistoryWitness.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/StatementHistoryWitness.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,16 @@
+package ${glPackageBaseCommonJdbcHistory};
+
+/**
+ * The interface of statement history witness.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${glStatementHistoryWitnessName} {
+
+    /**
+     * Witness the history.
+     * 
+     * @param statementHistory Statement history. (NotNull)
+     */
+    public void witnessTheHistory(${glStatementHistoryName} statementHistory);
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/TraceablePreparedStatement.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/TraceablePreparedStatement.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/jdbc/history/TraceablePreparedStatement.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,525 @@
+package ${glPackageBaseCommonJdbcHistory};
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+/**
+ * The implementation of prepared statement as traceable prepared statement.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glTraceablePreparedStatementName} implements PreparedStatement {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    protected PreparedStatement preparedStatement;
+
+    protected String preparedSql;
+
+    protected ${glStatementHistoryName} statementHistory = new ${glStatementHistoryName}();
+
+    protected ${glStatementHistoryWitnessName} statementHistoryWitness;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     * 
+     * @param preparedStatement Wrap target prepared statement. (NotNull)
+     * @param preparedSql Prepared sql. (NotNull)
+     */
+    public ${glTraceablePreparedStatementName}(PreparedStatement preparedStatement, String preparedSql, ${glStatementHistoryWitnessName} statementHistoryWitness) {
+        this.preparedStatement = preparedStatement;
+        this.preparedSql = preparedSql;
+        this.statementHistoryWitness = statementHistoryWitness;
+    }
+
+    // ===================================================================================
+    //                                                                            Delegate
+    //                                                                            ========
+    // -----------------------------------------------------
+    //                                             Add-Batch
+    //                                             ---------
+    public void addBatch() throws SQLException {
+        moveNextBatchPoint();
+        preparedStatement.addBatch();
+    }
+
+    public void addBatch(String sql) throws SQLException {
+        preparedStatement.addBatch(sql);
+    }
+
+    // -----------------------------------------------------
+    //                                                Cancel
+    //                                                ------
+    public void cancel() throws SQLException {
+        preparedStatement.cancel();
+    }
+
+    // -----------------------------------------------------
+    //                                                 Clear
+    //                                                 -----
+    public void clearBatch() throws SQLException {
+        preparedStatement.clearBatch();
+    }
+
+    public void clearParameters() throws SQLException {
+        preparedStatement.clearParameters();
+    }
+
+    public void clearWarnings() throws SQLException {
+        preparedStatement.clearWarnings();
+    }
+
+    // -----------------------------------------------------
+    //                                                 Close
+    //                                                 -----
+    public void close() throws SQLException {
+        preparedStatement.close();
+    }
+
+    // -----------------------------------------------------
+    //                                               Execute
+    //                                               -------
+    public boolean execute() throws SQLException {
+        traceSql(preparedSql);
+        return preparedStatement.execute();
+    }
+
+    public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.execute(sql, autoGeneratedKeys);
+    }
+
+    public boolean execute(String sql, int[] columnIndexes) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.execute(sql, columnIndexes);
+    }
+
+    public boolean execute(String sql, String[] columnNames) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.execute(sql, columnNames);
+    }
+
+    public boolean execute(String sql) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.execute(sql);
+    }
+
+    public int[] executeBatch() throws SQLException {
+        traceSql(preparedSql);
+        return preparedStatement.executeBatch();
+    }
+
+    public ResultSet executeQuery() throws SQLException {
+        traceSql(preparedSql);
+        return preparedStatement.executeQuery();
+    }
+
+    public ResultSet executeQuery(String sql) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.executeQuery(sql);
+    }
+
+    public int executeUpdate() throws SQLException {
+        traceSql(preparedSql);
+        return preparedStatement.executeUpdate();
+    }
+
+    public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.executeUpdate(sql, autoGeneratedKeys);
+    }
+
+    public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.executeUpdate(sql, columnIndexes);
+    }
+
+    public int executeUpdate(String sql, String[] columnNames) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.executeUpdate(sql, columnNames);
+    }
+
+    public int executeUpdate(String sql) throws SQLException {
+        traceSql(sql);
+        return preparedStatement.executeUpdate(sql);
+    }
+
+    // -----------------------------------------------------
+    //                                                 Other
+    //                                                 -----
+    public Connection getConnection() throws SQLException {
+        return preparedStatement.getConnection();
+    }
+
+    public int getFetchDirection() throws SQLException {
+        return preparedStatement.getFetchDirection();
+    }
+
+    public int getFetchSize() throws SQLException {
+        return preparedStatement.getFetchSize();
+    }
+
+    public ResultSet getGeneratedKeys() throws SQLException {
+        return preparedStatement.getGeneratedKeys();
+    }
+
+    public int getMaxFieldSize() throws SQLException {
+        return preparedStatement.getMaxFieldSize();
+    }
+
+    public int getMaxRows() throws SQLException {
+        return preparedStatement.getMaxRows();
+    }
+
+    public ResultSetMetaData getMetaData() throws SQLException {
+        return preparedStatement.getMetaData();
+    }
+
+    public boolean getMoreResults() throws SQLException {
+        return preparedStatement.getMoreResults();
+    }
+
+    public boolean getMoreResults(int current) throws SQLException {
+        return preparedStatement.getMoreResults(current);
+    }
+
+    public ParameterMetaData getParameterMetaData() throws SQLException {
+        return preparedStatement.getParameterMetaData();
+    }
+
+    public int getQueryTimeout() throws SQLException {
+        return preparedStatement.getQueryTimeout();
+    }
+
+    public ResultSet getResultSet() throws SQLException {
+        return preparedStatement.getResultSet();
+    }
+
+    public int getResultSetConcurrency() throws SQLException {
+        return preparedStatement.getResultSetConcurrency();
+    }
+
+    public int getResultSetHoldability() throws SQLException {
+        return preparedStatement.getResultSetHoldability();
+    }
+
+    public int getResultSetType() throws SQLException {
+        return preparedStatement.getResultSetType();
+    }
+
+    public int getUpdateCount() throws SQLException {
+        return preparedStatement.getUpdateCount();
+    }
+
+    public SQLWarning getWarnings() throws SQLException {
+        return preparedStatement.getWarnings();
+    }
+
+    // -----------------------------------------------------
+    //                                     Setting Parameter
+    //                                     -----------------
+    public void setArray(int parameterIndex, Array x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.ARRAY, x);
+        preparedStatement.setArray(parameterIndex, x);
+    }
+
+    public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
+        preparedStatement.setAsciiStream(parameterIndex, x, length);
+    }
+
+    public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.DECIMAL, x);
+        preparedStatement.setBigDecimal(parameterIndex, x);
+    }
+
+    public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
+        preparedStatement.setBinaryStream(parameterIndex, x, length);
+    }
+
+    public void setBlob(int i, Blob x) throws SQLException {
+        registerPreparedParameter(i, Types.BLOB, x);
+        preparedStatement.setBlob(i, x);
+    }
+
+    public void setBoolean(int parameterIndex, boolean x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.BOOLEAN, x);
+        preparedStatement.setBoolean(parameterIndex, x);
+    }
+
+    public void setByte(int parameterIndex, byte x) throws SQLException {
+        preparedStatement.setByte(parameterIndex, x);
+    }
+
+    public void setBytes(int parameterIndex, byte[] x) throws SQLException {
+        preparedStatement.setBytes(parameterIndex, x);
+    }
+
+    public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
+        // *Out of target about registering prepared parameter.
+        preparedStatement.setCharacterStream(parameterIndex, reader, length);
+    }
+
+    public void setClob(int i, Clob x) throws SQLException {
+        registerPreparedParameter(i, Types.CLOB, x);
+        preparedStatement.setClob(i, x);
+    }
+
+    public void setCursorName(String name) throws SQLException {
+        preparedStatement.setCursorName(name);
+    }
+
+    public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.DATE, x);
+        preparedStatement.setDate(parameterIndex, x, cal);
+    }
+
+    public void setDate(int parameterIndex, Date x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.DATE, x);
+        preparedStatement.setDate(parameterIndex, x);
+    }
+
+    public void setDouble(int parameterIndex, double x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.DOUBLE, x);
+        preparedStatement.setDouble(parameterIndex, x);
+    }
+
+    public void setEscapeProcessing(boolean enable) throws SQLException {
+        preparedStatement.setEscapeProcessing(enable);
+    }
+
+    public void setFetchDirection(int direction) throws SQLException {
+        preparedStatement.setFetchDirection(direction);
+    }
+
+    public void setFetchSize(int rows) throws SQLException {
+        preparedStatement.setFetchSize(rows);
+    }
+
+    public void setFloat(int parameterIndex, float x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.FLOAT, x);
+        preparedStatement.setFloat(parameterIndex, x);
+    }
+
+    public void setInt(int parameterIndex, int x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.INTEGER, x);
+        preparedStatement.setInt(parameterIndex, x);
+    }
+
+    public void setLong(int parameterIndex, long x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.LONGVARCHAR, x);
+        preparedStatement.setLong(parameterIndex, x);
+    }
+
+    public void setMaxFieldSize(int max) throws SQLException {
+        preparedStatement.setMaxFieldSize(max);
+    }
+
+    public void setMaxRows(int max) throws SQLException {
+        preparedStatement.setMaxRows(max);
+    }
+
+    public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException {
+        registerPreparedParameter(paramIndex, Types.NULL, null);
+        preparedStatement.setNull(paramIndex, sqlType, typeName);
+    }
+
+    public void setNull(int parameterIndex, int sqlType) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.NULL, null);
+        preparedStatement.setNull(parameterIndex, sqlType);
+    }
+
+    public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.OTHER, x);
+        preparedStatement.setObject(parameterIndex, x, targetSqlType, scale);
+    }
+
+    public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.OTHER, x);
+        preparedStatement.setObject(parameterIndex, x, targetSqlType);
+    }
+
+    public void setObject(int parameterIndex, Object x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.OTHER, x);
+        preparedStatement.setObject(parameterIndex, x);
+    }
+
+    public void setQueryTimeout(int seconds) throws SQLException {
+        preparedStatement.setQueryTimeout(seconds);
+    }
+
+    public void setRef(int i, Ref x) throws SQLException {
+        preparedStatement.setRef(i, x);
+    }
+
+    public void setShort(int parameterIndex, short x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.INTEGER, x);
+        preparedStatement.setShort(parameterIndex, x);
+    }
+
+    public void setString(int parameterIndex, String x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.VARCHAR, x);
+        preparedStatement.setString(parameterIndex, x);
+    }
+
+    public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.TIME, x);
+        preparedStatement.setTime(parameterIndex, x, cal);
+    }
+
+    public void setTime(int parameterIndex, Time x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.TIME, x);
+        preparedStatement.setTime(parameterIndex, x);
+    }
+
+    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.TIMESTAMP, x);
+        preparedStatement.setTimestamp(parameterIndex, x, cal);
+    }
+
+    public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
+        registerPreparedParameter(parameterIndex, Types.TIMESTAMP, x);
+        preparedStatement.setTimestamp(parameterIndex, x);
+    }
+
+    /**
+     * @deprecated
+     */
+    public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
+        preparedStatement.setUnicodeStream(parameterIndex, x, length);
+    }
+
+    public void setURL(int parameterIndex, URL x) throws SQLException {
+        preparedStatement.setURL(parameterIndex, x);
+    }
+
+    // ===================================================================================
+    //                                                                               Trace
+    //                                                                               =====
+    protected void traceSql(String sql) {
+        if (statementHistory.current().isEmpty()) {
+            statementHistory.removeLast();
+        }
+        setupSqlDisplayList(sql);
+        statementHistoryWitness.witnessTheHistory(statementHistory);
+    }
+
+    protected void registerPreparedParameter(int settingIndex, int jdbcType, Object parameterValue) {
+        final ${glPreparedParameterElementName} parameterElement = createPreparedParameterElement(settingIndex, jdbcType, parameterValue);
+        statementHistory.current().addParameterElement(parameterElement);
+    }
+
+    protected ${glPreparedParameterElementName} createPreparedParameterElement(int settingIndex, int jdbcType, Object parameterValue) {
+        final ${glPreparedParameterElementName} element = new ${glPreparedParameterElementName}();
+        element.setSettingIndex(settingIndex);
+        element.setJdbcType(jdbcType);
+        element.setParameterValue(parameterValue);
+        return element;
+    }
+
+    // ===================================================================================
+    //                                                                              Set up
+    //                                                                              ======
+    protected void setupSqlDisplayList(String realSql) {
+        final java.util.List<${glPreparedExecutionBeanName}> executionBeanList = statementHistory.getPreparedExecutionBeanList();
+        for (${glPreparedExecutionBeanName} executionBean : executionBeanList) {
+            if (executionBean.isEmpty()) {
+                continue;
+            }
+            final Object[] args = new Object[executionBean.size()];
+            int index = 0;
+            final java.util.List<${glPreparedParameterElementName}> parameterElementList = executionBean.getPreparedParameterElementList();
+            for (${glPreparedParameterElementName} parameterElement : parameterElementList) {
+                final Object parameterValue = parameterElement.getParameterValue();
+                args[index] = parameterValue;
+                ++index;
+            }
+            final String displaySql = getCompleteSql(realSql, args);
+            executionBean.setDisplaySql(displaySql);
+        }
+    }
+
+    // ===================================================================================
+    //                                                                               Batch
+    //                                                                               =====
+    protected void moveNextBatchPoint() {
+        statementHistory.next();
+    }
+
+    // ===================================================================================
+    //                                                                              Helper
+    //                                                                              ======
+    protected String getCompleteSql(String sql, Object[] args) {
+        if (args == null || args.length == 0) {
+            return sql;
+        }
+        StringBuffer buf = new StringBuffer(200);
+        int pos = 0;
+        int pos2 = 0;
+        int pos3 = 0;
+        int pos4 = 0;
+        int index = 0;
+        while (true) {
+            pos = sql.indexOf('?', pos2);
+            pos3 = sql.indexOf('\'', pos2);
+            pos4 = sql.indexOf('\'', pos3 + 1);
+            if (pos > 0) {
+                if (pos3 >= 0 && pos3 < pos && pos < pos4) {
+                    buf.append(sql.substring(pos2, pos4 + 1));
+                    pos2 = pos4 + 1;
+                } else {
+                    buf.append(sql.substring(pos2, pos));
+                    buf.append(getBindVariableText(args[index++]));
+                    pos2 = pos + 1;
+                }
+            } else {
+                buf.append(sql.substring(pos2));
+                break;
+            }
+        }
+        return buf.toString();
+    }
+
+    protected String getBindVariableText(Object bindVariable) {
+        if (bindVariable instanceof String) {
+            return "'" + bindVariable + "'";
+        } else if (bindVariable instanceof Number) {
+            return bindVariable.toString();
+        } else if (bindVariable instanceof Timestamp) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss");
+            return "'" + sdf.format((java.util.Date) bindVariable) + "'";
+        } else if (bindVariable instanceof java.util.Date) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            return "'" + sdf.format((java.util.Date) bindVariable) + "'";
+        } else if (bindVariable instanceof Boolean) {
+            return bindVariable.toString();
+        } else if (bindVariable == null) {
+            return "null";
+        } else {
+            return "'" + bindVariable.toString() + "'";
+        }
+    }
+
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetFactory.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetFactory.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetFactory.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,67 @@
+package ${glPackageBaseCommonS2Dao};
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.seasar.extension.jdbc.ResultSetFactory;
+import org.seasar.framework.util.PreparedStatementUtil;
+
+import ${glPackageBaseCommonCBean}.${glFetchNarrowingBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glFetchNarrowingBeanContextName};
+
+/**
+ * Fetch page result set factory.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFetchNarrowingResultSetFactory} implements ResultSetFactory {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glFetchNarrowingResultSetFactory}.class);
+
+    /** Is internal-debug enabled? */
+    private boolean _isInternalDebugEnabled = false;
+
+    /**
+     * Constructor.
+     */
+    public ${glFetchNarrowingResultSetFactory}() {
+    }
+
+    /**
+     * Create result set.
+     * 
+     * @param ps Prepared statement.
+     * @return Result set. (NotNull)
+     */
+    public ResultSet createResultSet(PreparedStatement ps) {
+        if (_isInternalDebugEnabled) {
+            if (_log.isDebugEnabled()) {
+                _log.debug("executeQuery(ps) ps=" + ps);
+            }
+        }
+        final ResultSet resultSet = PreparedStatementUtil.executeQuery(ps);
+
+        if (!${glFetchNarrowingBeanContextName}.isExistFetchNarrowingBeanOnThread()) {
+            return resultSet;
+        }
+
+        final ${glFetchNarrowingBeanInterfaceName} ${glAttachedCBArgsVariableName} = ${glFetchNarrowingBeanContextName}.getFetchNarrowingBeanOnThread();
+        if (!${glAttachedCBArgsVariableName}.isFetchNarrowingEffective()) {
+            return resultSet;// It is not necessary to control.
+        }
+        if (!${glAttachedCBArgsVariableName}.isFetchNarrowingSkipStartIndexEffective() && !${glAttachedCBArgsVariableName}.isFetchNarrowingLoopCountEffective()) {
+            return resultSet;// It is not necessary to control. The sql already have been controlled.
+        }
+
+        if (_isInternalDebugEnabled) {
+            if (_log.isDebugEnabled()) {
+                _log.debug("Necessary to control fetch-narrowing! ${glAttachedCBArgsVariableName}=" + ${glAttachedCBArgsVariableName});
+            }
+        }
+        return new ${glFetchNarrowingResultSetWrapper}(resultSet, ${glAttachedCBArgsVariableName});
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetWrapper.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetWrapper.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/FetchNarrowingResultSetWrapper.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,178 @@
+package ${glPackageBaseCommonS2Dao};
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.seasar.extension.jdbc.impl.ResultSetWrapper;
+import org.seasar.framework.exception.SQLRuntimeException;
+
+import ${glPackageBaseCommonCBean}.${glFetchNarrowingBeanInterfaceName};
+
+/**
+ * Fetch-narrowing-result-set-wrapper.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glFetchNarrowingResultSetWrapper} extends ResultSetWrapper {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glFetchNarrowingResultSetWrapper}.class);
+
+    /** Is internal-debug enabled? */
+    private boolean _isInternalDebugEnabled = false;
+
+    /** Original result set. */
+    private ResultSet _resultSet;
+
+    /** FetchNarrowing-bean. */
+    private ${glFetchNarrowingBeanInterfaceName} _${glAttachedCBArgsVariableName};
+
+    /** Fetch counter. */
+    private long _counter;
+
+    /**
+     * Constructor.
+     * 
+     * @param resultSet Original result set. (NotNull)
+     * @param ${glAttachedCBArgsVariableName} FetchNarrowing-bean. (NotNull)
+     */
+    public ${glFetchNarrowingResultSetWrapper}(ResultSet resultSet, ${glFetchNarrowingBeanInterfaceName} ${glAttachedCBArgsVariableName}) {
+        super(resultSet);
+
+        _resultSet = resultSet;
+        _${glAttachedCBArgsVariableName} = ${glAttachedCBArgsVariableName};
+
+        if (_isInternalDebugEnabled) {
+            if (_log.isDebugEnabled()) {
+                String msg = "    isFetchNarrowingSkipStartIndexEffective()=" + getFetchNarrowingBean().isFetchNarrowingSkipStartIndexEffective();
+                _log.debug(msg);
+                msg = "    isFetchNarrowingLoopCountEffective()=" + getFetchNarrowingBean().isFetchNarrowingLoopCountEffective();
+                _log.debug(msg);
+                msg = "    getFetchNarrowingSkipStartIndex()=" + getFetchNarrowingSkipStartIndex();
+                _log.debug(msg);
+                msg = "    getFetchNarrowingLoopCount()=" + getFetchNarrowingLoopCount();
+                _log.debug(msg);
+            }
+        }
+
+        skip();
+    }
+
+    /**
+     * Skip to start-index.
+     */
+    private void skip() {
+        if (!getFetchNarrowingBean().isFetchNarrowingSkipStartIndexEffective()) {
+            return;
+        }
+        if (isCursorUsed()) {
+            try {
+                if (0 == getFetchNarrowingSkipStartIndex()) {
+                    getResultSet().beforeFirst();
+                } else {
+                    getResultSet().absolute(getFetchNarrowingSkipStartIndex());
+                }
+                _counter = getResultSet().getRow();
+            } catch (SQLException e) {
+                throw new SQLRuntimeException(e);
+            }
+        } else {
+            try {
+                while (getResultSet().getRow() < getFetchNarrowingSkipStartIndex() && getResultSet().next()) {
+                    ++_counter;
+                }
+            } catch (SQLException e) {
+                throw new SQLRuntimeException(e);
+            }
+        }
+    }
+
+    /**
+     * Next.
+     * 
+     * @return Does the result set have next record?
+     * @throws SQLException
+     */
+    public boolean next() throws SQLException {
+        final boolean hasNext = super.next();
+        if (!getFetchNarrowingBean().isFetchNarrowingLoopCountEffective()) {
+            return hasNext;
+        }
+        if (hasNext && _counter < getFetchNarrowingSkipStartIndex() + getFetchNarrowingLoopCount()) {
+            ++_counter;
+            return true;
+        } else {
+            if (_isInternalDebugEnabled) {
+                if (_log.isDebugEnabled()) {
+                    String msg = "    Finally the result of next() is false! Because counter is greater-equal";
+                    msg = msg + " than 'fetch-start-index + real-fetch-size'.";
+                    msg = msg + " " + _counter + " >= " + getFetchNarrowingSkipStartIndex() + " + " + getFetchNarrowingLoopCount();
+                    _log.debug(msg);
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Get result set.
+     * 
+     * @return Result set.
+     */
+    protected ResultSet getResultSet() {
+        return _resultSet;
+    }
+
+    /**
+     * Get fetch-narrowing-bean.
+     * 
+     * @return FetchNarrowing-bean.
+     */
+    protected ${glFetchNarrowingBeanInterfaceName} getFetchNarrowingBean() {
+        return _${glAttachedCBArgsVariableName};
+    }
+
+    /**
+     * Get fetch-start-index from fetch-narrowing-bean.
+     * 
+     * @return Fetch-start-index.
+     */
+    protected int getFetchNarrowingSkipStartIndex() {
+        return _${glAttachedCBArgsVariableName}.getFetchNarrowingSkipStartIndex();
+    }
+
+    /**
+     * Get fetch-size from fetch-narrowing-bean.
+     * 
+     * @return Fetch-size.
+     */
+    protected int getFetchNarrowingLoopCount() {
+        return _${glAttachedCBArgsVariableName}.getFetchNarrowingLoopCount();
+    }
+
+    /**
+     * Is cursor used?
+     * 
+     * @return Determination.
+     */
+    protected boolean isCursorUsed() {
+        return isCursorSupported(getResultSet());
+    }
+
+    /**
+     * Is cursor supported?
+     * 
+     * @param resultSet ResultSet
+     * @return Determation.
+     */
+    public static boolean isCursorSupported(ResultSet resultSet) {
+        try {
+            return !(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY);
+        } catch (SQLException e) {
+            throw new SQLRuntimeException(e);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2BeanMetaDataFactoryImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2BeanMetaDataFactoryImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2BeanMetaDataFactoryImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,14 @@
+package ${glPackageBaseCommonS2Dao};
+
+import org.seasar.dao.impl.BeanMetaDataFactoryImpl;
+
+/**
+ * BeanMetaDataFactoryImpl for DBFlute.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glBeanMetaDataFactoryImpl} extends BeanMetaDataFactoryImpl {
+    protected int getLimitRelationNestLevel() {
+        return 2;
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoInterceptor.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoInterceptor.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoInterceptor.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,351 @@
+package ${glPackageBaseCommonS2Dao};
+
+import org.aopalliance.intercept.MethodInvocation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glConditionBeanContextName};
+import ${glPackageBaseCommonCBean}.${glFetchNarrowingBeanContextName};
+import ${glPackageBaseCommonCBean}.${glFetchNarrowingBeanInterfaceName};
+
+/**
+ * My-DaoInterceptor.
+ * Customises original class 'S2DaoInterceptor'.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glDaoInterceptor} extends org.seasar.framework.aop.interceptors.AbstractInterceptor {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glDaoInterceptor}.class);
+
+    /** Dao meta data factory. */
+    private org.seasar.dao.DaoMetaDataFactory daoMetaDataFactory_;
+
+    /**
+     * Constructor.
+     * 
+     * @param daoMetaDataFactory Dao meta data factory.
+     */
+    public ${glDaoInterceptor}(org.seasar.dao.DaoMetaDataFactory daoMetaDataFactory) {
+        daoMetaDataFactory_ = daoMetaDataFactory;
+    }
+
+    /**
+     * Invoke.
+     * 
+     * @param invocation Method invocation.
+     * @return Result of the method.
+     * @throws Throwable
+     */
+    public Object invoke(MethodInvocation invocation) throws Throwable {
+        final java.lang.reflect.Method method = invocation.getMethod();
+        if (!org.seasar.framework.util.MethodUtil.isAbstract(method)) {
+            return invocation.proceed();
+        }
+        traceMethod(invocation);
+        final long before = System.currentTimeMillis();
+
+        final org.seasar.dao.SqlCommand cmd;
+        {
+            final long beforeCmd = System.currentTimeMillis();
+            final Class targetClass = getTargetClass(invocation);
+            final org.seasar.dao.DaoMetaData dmd = daoMetaDataFactory_.getDaoMetaData(targetClass);
+            cmd = dmd.getSqlCommand(method.getName());
+            final long afterCmd = System.currentTimeMillis();
+            traceSqlCommand(invocation, cmd, beforeCmd, afterCmd);
+        }
+
+        final ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName} = preprocessConditionBean(invocation, cmd);
+        Object ret = null;
+
+        try {
+            ret = cmd.execute(invocation.getArguments());
+        } catch (Exception e) {
+            _log.info("Dao threw the exception: " + e.getClass() + " msg=" + e.getMessage());
+            _log.info("    method   --> " + invocation.getMethod());
+            _log.info("    argument --> " + getObjectArrayString(invocation.getArguments()));
+            if (e instanceof org.seasar.framework.exception.SQLRuntimeException) {
+                final Throwable causeException = ((org.seasar.framework.exception.SQLRuntimeException)e).getCause();
+                if (causeException instanceof org.seasar.framework.exception.SSQLException) {
+                    final String sql = ((org.seasar.framework.exception.SSQLException)causeException).getSql();
+                    _log.info("    sql      --> " + sql);
+                }
+            }
+            throw e;
+        } finally {
+            postprocessConditionBean(invocation, ${glAttachedCBArgsVariableName});
+        }
+        final long after = System.currentTimeMillis();
+
+        final Class retType = method.getReturnType();
+        assertRetType(retType, ret);
+        traceReturn(invocation, retType, ret, before, after);
+
+        if (retType.isPrimitive()) {
+            return org.seasar.framework.util.NumberConversionUtil.convertPrimitiveWrapper(retType, ret);
+        } else if (Number.class.isAssignableFrom(retType)) {
+            return org.seasar.framework.util.NumberConversionUtil.convertNumber(retType, ret);
+        } else {
+            return ret;
+        }
+    }
+
+    protected void traceMethod(MethodInvocation invocation) {
+        if (_log.isDebugEnabled()) {
+            final java.lang.reflect.Method method = invocation.getMethod();
+            final String invokeName = getShortClassName(method.getDeclaringClass()) + "." + method.getName();
+            final int length = invokeName.length();
+            final StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < length; i++) {
+                sb.append("=");
+            }
+            _log.debug("/=====================================================" + sb.toString() + "==");
+            _log.debug("                                                      " + invokeName + "()");
+            _log.debug("                                                      " + sb.toString() + "=/");
+        }
+    }
+
+    protected void traceSqlCommand(MethodInvocation invocation, org.seasar.dao.SqlCommand cmd, long beforeCmd, long afterCmd) {
+        if (_log.isDebugEnabled()) {
+            _log.debug("SqlCommand Initialization Cost: [" + getPerformanceView(afterCmd - beforeCmd) + "]");
+        }
+    }
+
+    protected void assertRetType(Class retType, Object ret) {
+        if (java.util.List.class.isAssignableFrom(retType)) {
+            if (ret != null && !(ret instanceof java.util.List)) {
+                String msg = "The retType is difference from actual return: ";
+                msg = msg + "retType=" + retType + " ret.getClass()=" + ret.getClass() + " ref=" + ret;
+                throw new IllegalStateException(msg);
+            }
+        } else if (${glEntityInterfaceName}.class.isAssignableFrom(retType)) {
+            if (ret != null && !(ret instanceof ${glEntityInterfaceName})) {
+                String msg = "The retType is difference from actual return: ";
+                msg = msg + "retType=" + retType + " ret.getClass()=" + ret.getClass() + " ref=" + ret;
+                throw new IllegalStateException(msg);
+            }
+        }
+    }
+
+    protected void traceReturn(MethodInvocation invocation, Class retType, Object ret, long before, long after)
+            throws Throwable {
+        if (_log.isDebugEnabled()) {
+            try {
+                final String daoResultPrefix = "===========/ [" + getPerformanceView(after - before) + " - ";
+                if (java.util.List.class.isAssignableFrom(retType)) {
+                    if (ret == null) {
+                        _log.debug(daoResultPrefix + "Selected count: null]");
+                    } else {
+                        final java.util.List ls = (java.util.List) ret;
+                        if (ls.isEmpty()) {
+                            _log.debug(daoResultPrefix + "Selected count: 0]");
+                        } else {
+                            _log.debug(daoResultPrefix + "Selected count: " + ls.size() + " first=" + ls.get(0) + "]");
+                        }
+                    }
+                } else if (${glEntityInterfaceName}.class.isAssignableFrom(retType)) {
+                    if (ret == null) {
+                        _log.debug(daoResultPrefix + "Selected entity: null" + "]");
+                    } else {
+                        final ${glEntityInterfaceName} entity = (${glEntityInterfaceName}) ret;
+                        _log.debug(daoResultPrefix + "Selected entity: " + entity + "]");
+                    }
+                } else {
+                    if (isSelectCountIgnoreFetchScopeMethod(invocation)) {
+                        _log.debug(daoResultPrefix + "Selected count: " + ret + "]");
+                    } else {
+                        _log.debug(daoResultPrefix + "Result: " + ret + "]");
+                    }
+                }
+                _log.debug(" ");
+            } catch (Exception e) {
+                String msg = "Result object debug threw the exception: methodName=";
+                msg = msg + invocation.getMethod().getName() + " retType=" + retType;
+                msg = msg + " ret=" + ret;
+                _log.warn(msg, e);
+                throw e;
+            }
+        }
+    }
+
+    // =====================================================================================
+    //                                                                      Pre&Post Process
+    //                                                                      ================
+    /**
+     * Preprocess condition-bean.
+     * <p>
+     * If this method is condition bean select target, make dynamic sql.
+     * Else nothing.
+     * 
+     * @param invocation Method invocation. (NotNull)
+     * @param cmd Sql command. (NotNull)
+     * @return Condition-bean. (Nullable)
+     */
+    protected ${glConditionBeanInterfaceName} preprocessConditionBean(MethodInvocation invocation, org.seasar.dao.SqlCommand cmd) {
+        clearThreadLocal();
+
+        final ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName};
+        {
+            final Object[] args = invocation.getArguments();
+            if (args == null || !(args.length >= 1)) {
+                return null;
+            }
+
+            final Object arg0 = args[0];
+            if (arg0 == null) {
+                return null;
+            }
+
+            if (!${glConditionBeanContextName}.isTheTypeConditionBean(arg0.getClass())) {// The argument is not condition-bean...
+                if (${glFetchNarrowingBeanContextName}.isTheTypeFetchNarrowingBean(arg0.getClass()) && !isSelectCountIgnoreFetchScopeMethod(invocation)) {
+                    // Fetch-narrowing-bean and Not select count!
+                    ${glFetchNarrowingBeanContextName}.setFetchNarrowingBeanOnThread((${glFetchNarrowingBeanInterfaceName})arg0);
+                }
+                return null;
+            }
+
+            ${glAttachedCBArgsVariableName} = (${glConditionBeanInterfaceName})arg0;
+        }
+
+        if (!(cmd instanceof ${glSelectDynamicCommand})) {// The argument is condition-bean, but this method use outer-sql-file...
+            ${glFetchNarrowingBeanContextName}.setFetchNarrowingBeanOnThread(${glAttachedCBArgsVariableName});
+            return null;
+        }
+
+        if (isSelectCountIgnoreFetchScopeMethod(invocation)) {
+            ${glAttachedCBArgsVariableName}.xsetupSelectCountIgnoreFetchScope();
+        } else {
+            ${glFetchNarrowingBeanContextName}.setFetchNarrowingBeanOnThread(cb);
+        }
+
+        ${glConditionBeanContextName}.setConditionBeanOnThread(cb);
+        return ${glAttachedCBArgsVariableName};
+    }
+
+    /**
+     * Postprocess condition-bean.
+     * 
+     * @param invocation Method invocation. (NotNull)
+     * @param ${glAttachedCBArgsVariableName} Condition-bean. (Nullable)
+     */
+    public void postprocessConditionBean(MethodInvocation invocation, ${glConditionBeanInterfaceName} ${glAttachedCBArgsVariableName}) {
+        clearThreadLocal();
+
+        if (${glAttachedCBArgsVariableName} != null && isSelectCountIgnoreFetchScopeMethod(invocation)) {
+            ${glAttachedCBArgsVariableName}.xafterCareSelectCountIgnoreFetchScope();
+        }
+    }
+
+    protected void clearThreadLocal() {
+        if (${glFetchNarrowingBeanContextName}.isExistFetchNarrowingBeanOnThread()) {
+            ${glFetchNarrowingBeanContextName}.clearFetchNarrowingBeanOnThread();
+        }
+        if (${glConditionBeanContextName}.isExistConditionBeanOnThread()) {
+            ${glConditionBeanContextName}.clearConditionBeanOnThread();
+        }
+    }
+
+    // =====================================================================================
+    //                                                                         Determination
+    //                                                                         =============
+    /**
+     * Is select count ignore-fetch-scope method?
+     * 
+     * @param invocation Method invocation. (NotNull)
+     * @return Determination.
+     */
+    protected boolean isSelectCountIgnoreFetchScopeMethod(MethodInvocation invocation) {
+        final String name = invocation.getMethod().getName();
+        if (name.startsWith("readCount")
+                || name.startsWith("selectCount")
+                || name.startsWith("readCountIgnoreFetchScope")
+                || name.startsWith("selectCountIgnoreFetchScope")) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    // =====================================================================================
+    //                                                                                Helper
+    //                                                                                ======
+    /**
+     * Get short class name.
+     * 
+     * @param clazz Class instance. (NotNull)
+     * @return Short class name. (NotNull)
+     */
+    protected String getShortClassName(Class clazz) {
+        String s = clazz.getName();
+        int i = s.lastIndexOf('.');
+        if (i > 0) {
+            return s.substring(i + 1);
+        }
+        return s;
+    }
+
+    /**
+     * Change object array to string divided with comma.
+     * 
+     * @param objArray Object array. (Nullable)
+     * @return String (NotNull: If the argument is null, returns empty string.)
+     */
+    protected String getObjectArrayString(Object[] objArray) {
+        if (objArray == null) {
+            return "";
+        }
+        final StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < objArray.length; i++) {
+            if (i == 0) {
+                sb.append(objArray[i]);
+            } else {
+                sb.append(", ").append(objArray[i]);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Get performance view.
+     * 
+     * @param mil The value of millisecound.
+     * @return Performance view. (ex. 1m23s456ms) (NotNull)
+     */
+    protected String getPerformanceView(long mil) {
+        if (mil < 0) {
+            return String.valueOf(mil);
+        }
+
+        long sec = mil / 1000;
+        long min = sec / 60;
+        sec = sec % 60;
+        mil = mil % 1000;
+
+        StringBuffer sb = new StringBuffer();
+        if (min >= 10) { // Minute
+            sb.append(min).append("m");
+        } else if (min < 10 && min >= 0) {
+            sb.append("0").append(min).append("m");
+        }
+        if (sec >= 10) { // Second
+            sb.append(sec).append("s");
+        } else if (sec < 10 && sec >= 0) {
+            sb.append("0").append(sec).append("s");
+        }
+        if (mil >= 100) { // Millisecond
+            sb.append(mil).append("ms");
+        } else if (mil < 100 && mil >= 10) {
+            sb.append("0").append(mil).append("ms");
+        } else if (mil < 10 && mil >= 0) {
+            sb.append("00").append(mil).append("ms");
+        }
+
+        return sb.toString();
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataExtension.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataExtension.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataExtension.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,1333 @@
+#if ($database.isVersionAfter1040())
+
+package ${glPackageBaseCommonS2Dao};
+
+#if ($database.isAvailableGenerics())
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+#end
+
+import java.lang.reflect.Method;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.sql.DataSource;
+#if ($database.isAvailableOtherConnectionDaoInitialization())
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import org.seasar.framework.exception.EmptyRuntimeException;
+#end
+
+import org.seasar.dao.BeanEnhancer;
+import org.seasar.dao.BeanMetaData;
+import org.seasar.dao.BeanMetaDataFactory;
+import org.seasar.dao.CommandContext;
+#if ($database.isVersionAfter1043())
+
+import org.seasar.dao.DaoAnnotationReader;
+import org.seasar.dao.DtoMetaDataFactory;
+#end
+
+import org.seasar.dao.Dbms;
+import org.seasar.dao.RelationPropertyType;
+import org.seasar.dao.RelationRowCreator;
+import org.seasar.dao.ResultSetHandlerFactory;
+import org.seasar.dao.SqlCommand;
+import org.seasar.dao.impl.BeanMetaDataImpl;
+import org.seasar.dao.impl.DaoMetaDataImpl;
+import org.seasar.dao.impl.RelationRowCreatorImpl;
+import org.seasar.dao.impl.AbstractSqlCommand;
+import org.seasar.dao.impl.SelectDynamicCommand;
+import org.seasar.dao.impl.UpdateAutoDynamicCommand;
+import org.seasar.dao.impl.UpdateAutoStaticCommand;
+import org.seasar.dao.impl.UpdateBatchAutoStaticCommand;
+import org.seasar.dao.impl.UpdateModifiedOnlyCommand;
+import org.seasar.dao.impl.DeleteAutoStaticCommand;
+import org.seasar.dao.impl.DeleteBatchAutoStaticCommand;
+import org.seasar.extension.jdbc.PropertyType;
+import org.seasar.extension.jdbc.ResultSetFactory;
+import org.seasar.extension.jdbc.ResultSetHandler;
+import org.seasar.extension.jdbc.StatementFactory;
+import org.seasar.extension.jdbc.impl.BasicSelectHandler;
+import org.seasar.extension.jdbc.types.ValueTypes;
+import org.seasar.framework.beans.BeanDesc;
+import org.seasar.framework.beans.PropertyDesc;
+import org.seasar.framework.util.StringUtil;
+
+import ${glPackageBaseCommonCBean}.${glConditionBeanContextName};
+#if ($database.isAvailableGenerics())
+
+import ${glPackageBaseCommonAnnotation}.${glOutsideSqlAnnotation};
+#end
+
+/**
+ * DaoMetaDataImpl for DBFlute.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glDaoMetaDataExtension} extends DaoMetaDataImpl {
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     */
+    public ${glDaoMetaDataExtension}() {
+    }
+
+#if ($database.isAvailableOtherConnectionDaoInitialization())
+
+    // =====================================================================================
+    //                                          Other Connection Dao Initialization Override
+    //                                          ============================================
+    protected TransactionManager transactionManager;
+
+    public void setTransactionManager(TransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
+    public void initialize() {// Override!
+        final TransactionSuspendEventInvoker transactionSuspendEventHandler = new TransactionSuspendEventInvoker();
+        transactionSuspendEventHandler.setTransactionManager(transactionManager);
+        final TransactionSuspendEventCallback callback = new TransactionSuspendEventCallback() {
+            public Object callback() {
+                executeSuperInitialize();
+                return null;
+            }
+        };
+        transactionSuspendEventHandler.callbackAfterSuspendAndResumeLater(callback);
+    }
+    
+    protected void executeSuperInitialize() {
+        super.initialize();
+    }
+
+    protected static interface TransactionSuspendEventCallback {
+        public Object callback();
+    }
+
+    protected static class TransactionSuspendEventInvoker {
+
+        private static final org.apache.commons.logging.Log _log = org.apache.commons.logging.LogFactory.getLog(TransactionSuspendEventInvoker.class);
+        
+        protected TransactionManager transactionManager;
+
+        public void setTransactionManager(TransactionManager transactionManager) {
+            this.transactionManager = transactionManager;
+        }
+
+        public boolean hasTransaction() throws SystemException {
+            return transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION;
+        }
+
+        public Transaction suspend() throws SystemException {
+            if (transactionManager == null) {
+                throw new EmptyRuntimeException("transactionManager");
+            }
+            return transactionManager.suspend();
+        }
+
+        public void resume(final Transaction transaction) throws InvalidTransactionException, IllegalStateException, SystemException {
+            if (transactionManager == null) {
+                throw new EmptyRuntimeException("transactionManager");
+            }
+            transactionManager.resume(transaction);
+        }
+
+        public Object callbackAfterSuspendAndResumeLater(TransactionSuspendEventCallback callback) {
+            Transaction tx = null;
+            try {
+                if (!hasTransaction()) {
+                    return callback.callback();
+                }
+                _log.debug("...Suspending the transaction!");
+                tx = suspend();
+                return callback.callback();
+            } catch (Exception e) {
+                String msg = "The initialize() that is overrided threw the exception: tx=" + tx;
+                throw new IllegalStateException(msg, e);
+            } finally {
+                if (tx != null) {
+                    try {
+                        _log.debug("...Resuming the transaction: tx=" + tx);
+                        resume(tx);
+                    } catch (Exception ignored) {
+                        _log.warn("resume(tx) threw the exception: tx=" + tx, ignored);
+                    }
+                }
+            }
+        }
+    }
+#end
+
+    // =====================================================================================
+    //                                                                         Bean Enhancer
+    //                                                                         =============
+    protected BeanEnhancer beanEnhancer;
+
+    public BeanEnhancer getBeanEnhancer() {
+        return beanEnhancer;
+    }
+
+    public void setBeanEnhancer(final BeanEnhancer beanEnhancer) {
+        this.beanEnhancer = beanEnhancer;
+    }
+#if ($database.isAvailableGenerics())
+
+    // =====================================================================================
+    //                                                             OutsideSql Check Override
+    //                                                             =========================
+    protected void setupMethodByAuto(Method method) {
+        final ${glOutsideSqlAnnotation} outsideSql = method.getAnnotation(${glOutsideSqlAnnotation}.class);
+        if (outsideSql != null) {
+            String msg = "This method '" + method.getName() + "()' should use Outside Sql but the file was not found!";
+            msg = msg + " Expected sql file name is '" + method.getDeclaringClass().getSimpleName() + "_" + method.getName() + ".sql'";
+            throw new IllegalStateException(msg);
+        }
+        super.setupMethodByAuto(method);
+    }
+#end
+  #if ($database.isVersionAfter1043())
+
+    // =====================================================================================
+    //                                                      ResultSetHandlerFactory Override
+    //                                                      ================================
+    protected ResultSetHandlerFactory createResultSetHandlerFactory() {
+        return new ResultSetHandlerFactoryExtension(beanMetaData, annotationReader, dtoMetaDataFactory);
+    }
+  #else
+
+    // =====================================================================================
+    //                                                      ResultSetHandlerFactory Override
+    //                                                      ================================
+    protected ResultSetHandlerFactory createResultSetHandlerFactory(final BeanMetaData beanMetaData) {
+        return new ResultSetHandlerFactoryExtension(beanMetaData);
+    }
+  #end
+#if ($database.isAvailableDaoMethodLazyInitializing())
+
+    // =====================================================================================
+    //                                                             SqlCommand Setup Override
+    //                                                             =========================
+    protected void setupSqlCommand() {
+        // Do nothing for lazy initializing!
+    }
+
+    public org.seasar.dao.SqlCommand getSqlCommand(String methodName) throws org.seasar.framework.beans.MethodNotFoundRuntimeException {
+        {
+            final org.seasar.dao.SqlCommand cmd = (org.seasar.dao.SqlCommand) sqlCommands.get(methodName);
+            if (cmd != null) {
+                return cmd;
+            }
+        }
+
+        final Method[] methods = daoBeanDesc.getMethods(methodName);
+        if (methods.length == 1 && org.seasar.framework.util.MethodUtil.isAbstract(methods[0])) {
+            setupMethod(methods[0]);
+        }
+
+        {
+            final org.seasar.dao.SqlCommand cmd = (org.seasar.dao.SqlCommand) sqlCommands.get(methodName);
+            if (cmd != null) {
+                return cmd;
+            }
+            throw new org.seasar.framework.beans.MethodNotFoundRuntimeException(daoClass, methodName, null);
+        }
+    }
+#end
+
+    // =====================================================================================
+    //                                                                ConditionBean Override
+    //                                                                ======================
+
+    protected SelectDynamicCommand setupNonQuerySelectMethodByDto(Method method, ResultSetHandler handler, String[] argNames, String query) {
+        Class[] types = method.getParameterTypes();
+        Class clazz = types[0];
+        if (!${glConditionBeanContextName}.isTheTypeConditionBean(clazz)) {
+            return super.setupNonQuerySelectMethodByDto(method, handler, argNames, query);
+        }
+        // /----------------------------------------------------- [MyExtension]
+        argNames = new String[] { "dto" };
+        final String sqlNormal = getSelectClause(getBeanMetaData(), clazz);
+        final String sqlPKOnly = getSelectClausePKOnly(getBeanMetaData());
+        final ${glSelectDynamicCommand} dynamicCommand = newMySelectDynamicCommand(handler);
+        String sql = sqlNormal;
+        final SelectDynamicCommand cmd = dynamicCommand;
+        dynamicCommand.setSelectClause(sqlNormal);
+        dynamicCommand.setSelectClausePKOnly(sqlPKOnly);
+        // -----------/
+        if (query != null) {
+            sql = sql + " " + query;
+        }
+        cmd.setSql(sql);
+        cmd.setArgNames(argNames);
+        cmd.setArgTypes(types);
+        return cmd;
+    }
+
+    /**
+     * Get select clause.
+     * 
+     * @param beanMetaData BeanMetaData. (NotNull)
+     * @param conditionBeanClass Condition-bean class. (NotNull)
+     * @return Select clause. (NotNull)
+     */
+    protected String getSelectClause(BeanMetaData beanMetaData, Class conditionBeanClass) {
+        final StringBuffer sb = new StringBuffer(100);
+        sb.append("select/*$dto.selectHint*/ ");
+
+        final StringBuffer sbMySelectList = new StringBuffer(100);
+        for (int i = 0; i < beanMetaData.getPropertyTypeSize(); ++i) {
+            final PropertyType pt = beanMetaData.getPropertyType(i);
+            if (pt.isPersistent()) {
+                if (sbMySelectList.length() != 0) {
+                    sbMySelectList.append(", ");
+                }
+                final String columnFullName = beanMetaData.getTableName() + "." + pt.getColumnName();
+                sbMySelectList.append(columnFullName);
+
+                ${glConditionBeanContextName}.addColumnAliasInfo(conditionBeanClass, columnFullName, pt.getColumnName());
+            }
+        }
+        sb.append(sbMySelectList);
+
+        setupRelationSelectClause(sb, beanMetaData, "", "", 1, conditionBeanClass);
+        return sb.toString();
+    }
+
+    protected void setupRelationSelectClause(StringBuffer sb, BeanMetaData baseBmd, String judgeProp, String preNoSuffix, int cqNestNo, Class conditionBeanClass) {
+        for (int i = 0; i < baseBmd.getRelationPropertyTypeSize(); ++i) {
+            final StringBuffer sbYourSelectList = new StringBuffer(100);
+            final RelationPropertyType rpt = baseBmd.getRelationPropertyType(i);
+            if (rpt == null) {
+                String msg = "The baseBmd.GetRelationPropertyType(" + i + ") returned null";
+                msg = msg + ": baseBmd.getTableName()=" + baseBmd.getTableName();
+                msg = msg + ": baseBmd.getRelationPropertyTypeSize()=" + baseBmd.getRelationPropertyTypeSize();
+                throw new IllegalStateException(msg);
+            }
+
+            final BeanMetaData relationBmd = rpt.getBeanMetaData();
+            final String initCapPropertyName = StringUtil.capitalize(rpt.getPropertyName());
+            final String ifComment = "/*IF dto." + judgeProp + "isSelect" + initCapPropertyName + "()*/";
+            final String endComment = "/*END*/";
+            for (int j = 0; j < relationBmd.getPropertyTypeSize(); ++j) {
+                final PropertyType pt = relationBmd.getPropertyType(j);
+                final String tableAliasName = StringUtil.capitalize(rpt.getPropertyName()) + (cqNestNo > 1 ? "_n" + cqNestNo : "");
+                if (pt.isPersistent()) {
+                    final String columnName = pt.getColumnName();
+                    final String columnFullName = tableAliasName + "." + columnName;
+                    final String columnAliasName = pt.getColumnName() + preNoSuffix + "_" + rpt.getRelationNo();
+                    sbYourSelectList.append(", ");
+                    sbYourSelectList.append(columnFullName).append(" AS ").append(columnAliasName);
+
+                    ${glConditionBeanContextName}.addColumnAliasInfo(conditionBeanClass, columnFullName, columnAliasName);
+                }
+            }
+            if (relationBmd.getRelationPropertyTypeSize() > 0) {
+                final String nssString = "nss" + initCapPropertyName + ".";
+                final String nextPreNoSuffix = preNoSuffix + "_" + rpt.getRelationNo();
+                final int nextCQNestNo = cqNestNo + 1;
+                setupRelationSelectClause(sbYourSelectList, relationBmd, nssString, nextPreNoSuffix, nextCQNestNo, conditionBeanClass);
+            }
+            sb.append(ifComment).append(sbYourSelectList).append(endComment);
+        }
+    }
+
+    /**
+     * Get select clause PK only.
+     * 
+     * @param beanMetaData BeanMetaData. (NotNull)
+     * @return Select clause PK only. (NotNull)
+     */
+    protected String getSelectClausePKOnly(BeanMetaData beanMetaData) {
+        final StringBuffer sb = new StringBuffer(100);
+        sb.append("select/*$dto.selectHint*/ ");
+
+        final StringBuffer sbMySelectList = new StringBuffer(100);
+        for (int i = 0; i < beanMetaData.getPropertyTypeSize(); ++i) {
+            final PropertyType pt = beanMetaData.getPropertyType(i);
+            if (pt.isPersistent() && pt.isPrimaryKey()) {
+                if (sbMySelectList.length() != 0) {
+                    sbMySelectList.append(", ");
+                }
+                sbMySelectList.append(beanMetaData.getTableName());
+                sbMySelectList.append(".");
+                sbMySelectList.append(pt.getColumnName());
+            }
+        }
+        sb.append(sbMySelectList);
+
+        return sb.toString();
+    }
+
+    /**
+     * New my select dynamic command for condition-bean.
+     * 
+     * @param handler ResultSetHandler
+     * @return My select dynamic command. (NotNull)
+     */
+    protected ${glSelectDynamicCommand} newMySelectDynamicCommand(ResultSetHandler handler) {// for condition-bean
+        return new ${glSelectDynamicCommand}(dataSource, statementFactory, handler, resultSetFactory);
+    }
+
+    // =====================================================================================
+    //                                                         SelectDynamicCommand Override
+    //                                                         =============================
+    protected SelectDynamicCommand createSelectDynamicCommand(ResultSetHandler rsh) {// for all except condition-bean
+        return new SelectDynamicCommand(dataSource, statementFactory, rsh, resultSetFactory);
+    }
+
+    public static class SelectDynamicCommandExtension extends SelectDynamicCommand {
+#if ($database.isSelectQueryTimeoutValid())
+
+        /** Log-instance. */
+        private static final org.apache.commons.logging.Log _log = org.apache.commons.logging.LogFactory.getLog(SelectDynamicCommandExtension.class);
+#end
+
+        private ResultSetHandler resultSetHandler;
+        private ResultSetFactory resultSetFactory;
+        public SelectDynamicCommandExtension(DataSource dataSource,
+                StatementFactory statementFactory,
+                ResultSetHandler resultSetHandler, ResultSetFactory resultSetFactory) {
+            super(dataSource, statementFactory, resultSetHandler, resultSetFactory);
+            this.resultSetHandler = resultSetHandler;
+            this.resultSetFactory = resultSetFactory;
+        }
+
+        public ResultSetHandler getResultSetHandler() {
+            return resultSetHandler;
+        }
+
+        public Object execute(Object[] args) {
+            CommandContext ctx = apply(args);
+#if ($database.isSelectQueryTimeoutValid())
+
+            final StatementFactory statementFactoryReal = getStatementFactory();
+            final StatementFactory statementFactoryWrapper = new StatementFactory() {
+                public java.sql.PreparedStatement createPreparedStatement(java.sql.Connection arg0, String arg1) {
+                    final java.sql.PreparedStatement ps = statementFactoryReal.createPreparedStatement(arg0, arg1);
+                    try {
+                        final int timeout = ${database.SelectQueryTimeout};
+                        if (_log.isDebugEnabled()) {
+                            _log.debug("@SelectDynamicCommand: ps.setQueryTimeout(" + timeout + ");// from ${database.SelectQueryTimeout}");
+                        }
+                        ps.setQueryTimeout(timeout);
+                    } catch (java.sql.SQLException e) {
+                        throw new org.seasar.framework.exception.SQLRuntimeException(e);
+                    }
+                    return ps;
+                }
+                public java.sql.CallableStatement createCallableStatement(java.sql.Connection arg0, String arg1) {
+                    return statementFactoryReal.createCallableStatement(arg0, arg1);
+                }
+            };
+            final BasicSelectHandler selectHandler = new BasicSelectHandler(getDataSource(), ctx.getSql(), resultSetHandler, statementFactoryWrapper, resultSetFactory);
+#else
+
+            final BasicSelectHandler selectHandler = new BasicSelectHandler(getDataSource(), ctx.getSql(), resultSetHandler, getStatementFactory(), resultSetFactory);
+#end
+
+            selectHandler.setFetchSize(-1);
+            return selectHandler.execute(ctx.getBindVariables(), ctx.getBindVariableTypes());
+        }
+    }
+
+    // =====================================================================================
+    //                                                                 UpdateByAuto Override
+    //                                                                 =====================
+    protected void setupUpdateMethodByAuto(Method method) {
+        checkAutoUpdateMethod(method);
+        String[] propertyNames = getPersistentPropertyNames(method);
+        AbstractSqlCommand cmd;
+        if (isUpdateSignatureForBean(method)) {
+            if (isUnlessNull(method.getName())) {
+                cmd = createUpdateAutoDynamicCommand(method, propertyNames);
+            } else if (isModifiedOnly(method.getName())) {
+                cmd = createUpdateModifiedOnlyCommand(method, propertyNames);
+            } else {
+                cmd = new UpdateAutoStaticCommand(dataSource, statementFactory, createNonConcurrencyBeanMetaData(method), propertyNames);// Extension Point!
+            }
+        } else {
+            cmd = new UpdateBatchAutoStaticCommand(dataSource, statementFactory, createNonConcurrencyBeanMetaData(method), propertyNames);// Extension Point!
+        }
+        sqlCommands.put(method.getName(), cmd);
+    }
+
+    protected AbstractSqlCommand createUpdateAutoDynamicCommand(Method method, String[] propertyNames) {
+        AbstractSqlCommand cmd;
+        UpdateAutoDynamicCommand uac = new UpdateAutoDynamicCommand(dataSource, statementFactory);
+        uac.setBeanMetaData(createNonConcurrencyBeanMetaData(method));// Extension Point!
+        uac.setPropertyNames(propertyNames);
+        uac.setNotSingleRowUpdatedExceptionClass(getNotSingleRowUpdatedExceptionClass(method));
+        cmd = uac;
+        return cmd;
+    }
+
+    protected AbstractSqlCommand createUpdateModifiedOnlyCommand(final Method method, final String[] propertyNames) {
+        UpdateModifiedOnlyCommand uac = new UpdateModifiedOnlyCommand(dataSource, statementFactory);
+        uac.setBeanMetaData(createNonConcurrencyBeanMetaData(method));// Extension Point!
+        uac.setPropertyNames(propertyNames);
+        uac.setNotSingleRowUpdatedExceptionClass(getNotSingleRowUpdatedExceptionClass(method));
+        return uac;
+    }
+
+#if ($database.isAvailableOtherConnectionDaoInitialization())
+
+    protected BeanMetaData createNonConcurrencyBeanMetaData(Method method) {
+        if (method.getName().contains("Nonstrict")) {
+            final TransactionSuspendEventInvoker transactionSuspendEventHandler = new TransactionSuspendEventInvoker();
+            transactionSuspendEventHandler.setTransactionManager(transactionManager);
+            final TransactionSuspendEventCallback callback = new TransactionSuspendEventCallback() {
+                public Object callback() {
+                    return createNonConcurrencyBmdFactory().createBeanMetaData(getBeanClass());
+                }
+            };
+            return (BeanMetaData)transactionSuspendEventHandler.callbackAfterSuspendAndResumeLater(callback);
+        } else {
+            return getBeanMetaData();
+        }
+    }
+#else
+
+    protected BeanMetaData createNonConcurrencyBeanMetaData(Method method) {
+        if (method.getName().contains("Nonstrict")) {
+            return createNonConcurrencyBmdFactory().createBeanMetaData(getBeanClass());
+        } else {
+            return getBeanMetaData();
+        }
+    }
+#end
+
+    protected BeanMetaDataFactory createNonConcurrencyBmdFactory() {
+        final ${glBeanMetaDataFactoryImpl} nonConcurrencyBmdFactory = new ${glBeanMetaDataFactoryImpl}() {
+            protected BeanMetaDataImpl createBeanMetaDataImpl() {
+                return new BeanMetaDataImpl() {
+                    public boolean hasVersionNoPropertyType() {
+                        return false;
+                    }
+
+                    public boolean hasTimestampPropertyType() {
+                        return false;
+                    }
+                };
+            }
+        };
+        nonConcurrencyBmdFactory.setAnnotationReaderFactory(this.annotationReaderFactory);
+        nonConcurrencyBmdFactory.setValueTypeFactory(this.valueTypeFactory);
+        nonConcurrencyBmdFactory.setDataSource(this.dataSource);
+        nonConcurrencyBmdFactory.setDaoNamingConvention(this.daoNamingConvention);
+        nonConcurrencyBmdFactory.setBeanEnhancer(this.beanEnhancer);
+        return nonConcurrencyBmdFactory;
+    }
+
+    // =====================================================================================
+    //                                                                 DeleteByAuto Override
+    //                                                                 =====================
+    protected void setupDeleteMethodByAuto(Method method) {
+        checkAutoUpdateMethod(method);
+        String[] propertyNames = getPersistentPropertyNames(method);
+        SqlCommand cmd = null;
+        if (isUpdateSignatureForBean(method)) {
+            cmd = new DeleteAutoStaticCommand(dataSource, statementFactory, createNonConcurrencyBeanMetaData(method), propertyNames);
+        } else {
+            cmd = new DeleteBatchAutoStaticCommand(dataSource, statementFactory, createNonConcurrencyBeanMetaData(method), propertyNames);
+        }
+        sqlCommands.put(method.getName(), cmd);
+    }
+
+    // =====================================================================================
+    //                                                                     ByManual Override
+    //                                                                     =================
+    protected void setupSelectMethodByManual(Method method, String sql) {
+        final BeanMetaData beanMetaData = buildBeanMetaData(method, this.dataSource);
+  #if ($database.isVersionAfter1043())
+
+        final ResultSetHandlerFactory factory = new ResultSetHandlerFactoryExtension(beanMetaData, annotationReader, dtoMetaDataFactory);
+  #else
+
+        final ResultSetHandlerFactory factory = new ResultSetHandlerFactoryExtension(beanMetaData);
+  #end
+
+        SelectDynamicCommand cmd = createSelectDynamicCommand(factory.createResultSetHandler(method));
+        cmd.setSql(sql);
+        cmd.setArgNames(this.annotationReader.getArgNames(method));
+        cmd.setArgTypes(method.getParameterTypes());
+        this.sqlCommands.put(method.getName(), cmd);
+    }
+
+    protected BeanMetaData buildBeanMetaData(Method method, DataSource ds) {
+        final Class beanClass4SelectMethodByManual = getOriginalBeanClass(method);
+        if (beanClass4SelectMethodByManual.equals(getBeanClass())) {
+            return getBeanMetaData();
+        }
+        return createOriginalBmdFactory().createBeanMetaData(getOriginalBeanClass(method));
+    }
+
+    protected BeanMetaDataFactory createOriginalBmdFactory() {
+        final ${glBeanMetaDataFactoryImpl} originalBmdFactory = new ${glBeanMetaDataFactoryImpl}() {
+            protected BeanMetaDataImpl createBeanMetaDataImpl() {
+                return new BeanMetaDataImpl() {
+                    protected void setupDatabaseMetaData(BeanDesc beanDesc, DatabaseMetaData dbMetaData, Dbms dbms) {
+                        // Nothing.
+                    }
+                };
+            }
+        };
+        originalBmdFactory.setAnnotationReaderFactory(this.annotationReaderFactory);
+        originalBmdFactory.setValueTypeFactory(this.valueTypeFactory);
+        originalBmdFactory.setDataSource(this.dataSource);
+        originalBmdFactory.setDaoNamingConvention(this.daoNamingConvention);
+        originalBmdFactory.setBeanEnhancer(this.beanEnhancer);
+        return originalBmdFactory;
+    }
+
+    protected Class getOriginalBeanClass(Method method) {
+        final Class retType = method.getReturnType();
+        if (java.util.List.class.isAssignableFrom(retType)) {
+            final Class elementType = InternalMethodUtil.getElementTypeOfListFromReturnMethod(method);
+            if (elementType != null) {
+                return elementType;
+            } else {
+                return getBeanClass();
+            }
+        } else if (retType.isArray()) {
+            return retType.getComponentType();
+        } else if (retType.isPrimitive() || !ValueTypes.getValueType(retType).equals(ValueTypes.OBJECT)) {
+            return getBeanClass();
+        } else {
+            return retType;
+        }
+    }
+    
+    protected static class InternalMethodUtil {
+        public static Class getElementTypeOfListFromReturnMethod(Method method) {
+            return ReflectionUtil.getElementTypeOfListFromReturnType(method);
+        }
+    }
+#if ($database.isAvailableGenerics())
+
+    protected static class ReflectionUtil {
+        public static Class<?> getElementTypeOfList(final Type parameterizedList) {
+            if (!(parameterizedList instanceof ParameterizedType)) {
+                return null;
+            }
+
+            final ParameterizedType parameterizedType = ParameterizedType.class.cast(parameterizedList);
+            final Type rawType = parameterizedType.getRawType();
+            if (!(rawType instanceof Class)) {
+                return null;
+            }
+
+            final Class<?> rawClass = Class.class.cast(rawType);
+            if (!rawClass.isAssignableFrom(List.class)) {
+                return null;
+            }
+
+            final Type[] actualTypeArgument = parameterizedType.getActualTypeArguments();
+            if (actualTypeArgument == null || actualTypeArgument.length != 1) {
+                return null;
+            }
+            if (!(actualTypeArgument[0] instanceof Class)) {
+                return null;
+            }
+
+            return Class.class.cast(actualTypeArgument[0]);
+        }
+
+        public static Class<?> getElementTypeOfListFromParameterType(final Method method, final int parameterPosition) {
+            final Type[] parameterTypes = method.getGenericParameterTypes();
+            return getElementTypeOfList(parameterTypes[parameterPosition]);
+        }
+
+        public static Class<?> getElementTypeOfListFromReturnType(final Method method) {
+            return getElementTypeOfList(method.getGenericReturnType());
+        }
+    }
+#else
+
+    protected static class ReflectionUtil {
+        public static Class getElementTypeOfListFromReturnType(final Method method) {
+            return null;
+        }
+    }
+#end
+
+    protected static class ResultSetHandlerFactoryExtension extends ResultSetHandlerFactoryImpl {
+  #if ($database.isVersionAfter1043())
+
+        public ResultSetHandlerFactoryExtension(BeanMetaData beanMetaData, DaoAnnotationReader annotationReader, DtoMetaDataFactory dtoMetaDataFactory) {
+            super(beanMetaData, annotationReader, dtoMetaDataFactory);
+        }
+  #else
+
+        public ResultSetHandlerFactoryExtension(BeanMetaData beanMetaData) {
+            super(beanMetaData);
+        }
+  #end
+
+        protected RelationRowCreator createRelationRowCreator() {
+            return new RelationRowCreatorExtension();
+        }
+    }
+
+    protected static class RelationRowCreatorExtension extends RelationRowCreatorImpl {
+        public Object createRelationRow(ResultSet rs, RelationPropertyType rpt, Set columnNames, Map relKeyValues)
+                throws SQLException {
+            return createRelationRow(rs, rpt, columnNames, relKeyValues, "");
+        }
+
+        public Object createRelationRow(ResultSet rs, RelationPropertyType rpt, Set columnNames, Map relKeyValues,
+                String preRelationNoSuffix) throws SQLException {
+            // It must doesn't need to invoke this!
+            // final Object row = setupRelationKeyValue(rpt, columnNames, relKeyValues);
+
+            return setupRelationAllValue(rs, rpt, columnNames, relKeyValues, preRelationNoSuffix);
+        }
+
+        protected Object setupRelationAllValue(ResultSet rs, RelationPropertyType rpt, Set columnNames,
+                Map relKeyValues, String preRelationNoSuffix) throws SQLException {
+            Object row = null;
+            final String relationNoSuffix = preRelationNoSuffix + "_" + rpt.getRelationNo();
+            final BeanMetaData bmd = rpt.getBeanMetaData();
+            int existColumn = 0;
+            for (int i = 0; i < bmd.getPropertyTypeSize(); ++i) {
+                final PropertyType pt = bmd.getPropertyType(i);
+                final String columnName = pt.getColumnName() + relationNoSuffix;
+                if (!columnNames.contains(columnName)) {
+                    continue;
+                }
+
+                // Return null if the primary key of foreign table is invalid(The foreign key is deadlink).
+                if (pt.isPrimaryKey()) {
+                    if (!isValidValue(rs, pt, columnName, relKeyValues)) {
+                        return null;
+                    }
+                }
+
+                existColumn++;
+                if (row == null) {
+                    row = createRelationRow(rpt);
+                }
+                registerRelationValue(row, rs, rpt, pt, columnName, relKeyValues);
+            }
+
+            // Return null if setupSelect_Xxx() or withXxx() has not been invoked.
+            if (existColumn == 0) {
+                return null;
+            }
+
+            if (rpt.getBeanMetaData().getRelationPropertyTypeSize() != 0) {
+                createParentRelationRow(rs, rpt.getBeanMetaData(), columnNames, relationNoSuffix, row);
+            }
+            return row;
+        }
+
+        protected boolean isValidValue(ResultSet rs, PropertyType pt, String columnName, Map relKeyValues) throws SQLException {
+            Object value = null;
+            if (relKeyValues != null && relKeyValues.containsKey(columnName)) {
+                value = relKeyValues.get(columnName);
+            } else {
+                final org.seasar.extension.jdbc.ValueType valueType = pt.getValueType();
+                value = valueType.getValue(rs, columnName);
+            }
+            return value != null;
+        }
+
+        protected void createParentRelationRow(ResultSet rs, BeanMetaData parentBmd, Set columnNames,
+                String relationNoSuffix, Object row) throws SQLException {
+            for (int i = 0; i < parentBmd.getRelationPropertyTypeSize(); ++i) {
+                RelationPropertyType parentParentRpt = parentBmd.getRelationPropertyType(i);
+                if (parentParentRpt == null) {
+                    continue;
+                }
+                Object relationRow = createRelationRow(rs, parentParentRpt, columnNames, null, relationNoSuffix);
+                if (relationRow != null) {
+                    PropertyDesc pd = parentParentRpt.getPropertyDesc();
+                    pd.setValue(row, relationRow);
+                }
+            }
+        }
+    }
+}
+#else
+
+package ${glPackageBaseCommonS2Dao};
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+#if ($database.isAvailableGenerics())
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+#end
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.sql.DataSource;
+
+import org.seasar.dao.BeanMetaData;
+import org.seasar.dao.Dbms;
+import org.seasar.dao.RelationPropertyType;
+import org.seasar.dao.ResultSetHandlerFactory;
+import org.seasar.dao.dbms.DbmsManager;
+import org.seasar.dao.impl.BeanArrayMetaDataResultSetHandler;
+import org.seasar.dao.impl.BeanListMetaDataResultSetHandler;
+import org.seasar.dao.impl.BeanMetaDataImpl;
+import org.seasar.dao.impl.BeanMetaDataResultSetHandler;
+import org.seasar.dao.impl.DaoMetaDataImpl;
+import org.seasar.dao.impl.RelationPropertyTypeImpl;
+import org.seasar.dao.impl.SelectDynamicCommand;
+import org.seasar.extension.jdbc.PropertyType;
+import org.seasar.extension.jdbc.ResultSetHandler;
+import org.seasar.extension.jdbc.ValueType;
+import org.seasar.extension.jdbc.impl.ObjectResultSetHandler;
+import org.seasar.extension.jdbc.types.ValueTypes;
+import org.seasar.extension.jdbc.util.ConnectionUtil;
+import org.seasar.extension.jdbc.util.DataSourceUtil;
+import org.seasar.framework.beans.BeanDesc;
+import org.seasar.framework.beans.PropertyDesc;
+import org.seasar.framework.beans.factory.BeanDescFactory;
+import org.seasar.framework.util.ClassUtil;
+import org.seasar.framework.util.StringUtil;
+
+import ${glPackageBaseCommonCBean}.${glConditionBeanContextName};
+import ${glPackageBaseCommonCBean}.${glSelectResourceInterfaceName};
+
+/**
+ * DaoMetaDataImpl for DaoGen.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glDaoMetaDataExtension} extends DaoMetaDataImpl {
+
+    /**
+     * Constructor.
+     */
+    public ${glDaoMetaDataExtension}() {
+    }
+
+    public void initialize() {
+        Class daoClass = getDaoClass();
+        daoInterface = getDaoInterface(daoClass);
+        daoBeanDesc = BeanDescFactory.getBeanDesc(daoClass);
+        annotationReader = getAnnotationReaderFactory().createDaoAnnotationReader(daoBeanDesc);
+        setBeanClass(annotationReader.getBeanClass());
+        Connection con = DataSourceUtil.getConnection(dataSource);
+        try {
+            DatabaseMetaData dbMetaData = ConnectionUtil.getMetaData(con);
+            dbms = DbmsManager.getDbms(dbMetaData);
+            BeanMetaDataImpl beanMetaDataImpl = new BeanMetaDataExtension();
+            beanMetaDataImpl.setBeanClass(getBeanClass());
+            beanMetaDataImpl.setDatabaseMetaData(dbMetaData);
+            beanMetaDataImpl.setDbms(dbms);
+            beanMetaDataImpl.setAnnotationReaderFactory(getAnnotationReaderFactory());
+            beanMetaDataImpl.setValueTypeFactory(getValueTypeFactory());
+            beanMetaDataImpl.initialize();
+            this.beanMetaData = beanMetaDataImpl;
+        } finally {
+            ConnectionUtil.close(con);
+        }
+        resultSetHandlerFactory = new ResultSetHandlerFactoryExtension(beanMetaData);
+        setupSqlCommand();
+    }
+
+    // =====================================================================================
+    //                                                                ConditionBean Override
+    //                                                                ======================
+    /**
+     * This method overrides the method that is declared at super.
+     * 
+     * @param method Method instance. (NotNull)
+     */
+    protected void setupSelectMethodByAuto(Method method) {
+        String query = annotationReader.getQuery(method);
+        ResultSetHandler handler = createResultSetHandler(method);
+        SelectDynamicCommand cmd = null;
+        String[] argNames = annotationReader.getArgNames(method);
+        Class[] argTypes = method.getParameterTypes();
+        if (query != null && !startsWithOrderBy(query)) {
+            cmd = createSelectDynamicCommand(handler, query);
+        } else {
+            cmd = createSelectDynamicCommand(handler);
+            String sql = null;
+            if (argNames.length == 0 && argTypes.length == 1) {
+                argNames = new String[] { "dto" };
+                // /----------------------------------------------------- [MyExtension]
+                if (${glConditionBeanContextName}.isTheTypeConditionBean(argTypes[0])) {
+                    final String sqlNormal = getSelectClause(getBeanMetaData(), argTypes[0]);
+                    final String sqlPKOnly = getSelectClausePKOnly(getBeanMetaData());
+                    final ${glSelectDynamicCommand} dynamicCommand = newMySelectDynamicCommand(handler);
+                    sql = sqlNormal;
+                    cmd = dynamicCommand;
+                    dynamicCommand.setSelectClause(sqlNormal);
+                    dynamicCommand.setSelectClausePKOnly(sqlPKOnly);
+                } else {
+                    if (${glSelectResourceInterfaceName}.class.isAssignableFrom(argTypes[0])) {
+                        String msg = "If the first argument type is select-resource(and not condition-bean), ";
+                        msg = msg + "the method should not use auto-select-sql.";
+                        msg = msg + " (Do you want to use outer-file-sql? Please check your sql-file-name and build-action!)";
+                        msg = msg + ": dao=" + method.getDeclaringClass() + " method=" + method.getName() + "()";
+                        msg = msg + " firstArgument=" + argTypes[0] + " argTypes.length=" + argTypes.length;
+                        throw new IllegalStateException(msg);
+                    }
+                    sql = createAutoSelectSqlByDto(argTypes[0]);
+                }
+                // -----------/
+            } else {
+                // /----------------------------------------------------- [MyExtension]
+                if (argTypes.length > 1 && ${glSelectResourceInterfaceName}.class.isAssignableFrom(argTypes[0])) {
+                    String msg = "If the number of argument is more than 1 and the first argument type is select-resource, ";
+                    msg = msg + "the method should not use auto-select-sql.";
+                    msg = msg + " (Do you want to use outer-file-sql? Please check your sql-file-name and build-action!)";
+                    msg = msg + ": dao=" + method.getDeclaringClass() + " method=" + method.getName() + "()";
+                    msg = msg + " firstArgument=" + argTypes[0] + " argTypes.length=" + argTypes.length;
+                    throw new IllegalStateException(msg);
+                }
+                // -----------/
+                sql = createAutoSelectSql(argNames);
+            }
+            if (query != null) {
+                sql = sql + " " + query;
+            }
+            cmd.setSql(sql);
+        }
+        cmd.setArgNames(argNames);
+        cmd.setArgTypes(method.getParameterTypes());
+        sqlCommands.put(method.getName(), cmd);
+    }
+
+    /**
+     * Get select clause.
+     * 
+     * @param beanMetaData BeanMetaData. (NotNull)
+     * @param conditionBeanClass Condition-bean class. (NotNull)
+     * @return Select clause. (NotNull)
+     */
+    protected String getSelectClause(BeanMetaData beanMetaData, Class conditionBeanClass) {
+        final StringBuffer sb = new StringBuffer(100);
+        sb.append("select/*$dto.selectHint*/ ");
+
+        final StringBuffer sbMySelectList = new StringBuffer(100);
+        for (int i = 0; i < beanMetaData.getPropertyTypeSize(); ++i) {
+            final PropertyType pt = beanMetaData.getPropertyType(i);
+            if (pt.isPersistent()) {
+                if (sbMySelectList.length() != 0) {
+                    sbMySelectList.append(", ");
+                }
+                final String columnFullName = beanMetaData.getTableName() + "." + pt.getColumnName();
+                sbMySelectList.append(columnFullName);
+
+                ${glConditionBeanContextName}.addColumnAliasInfo(conditionBeanClass, columnFullName, pt.getColumnName());
+            }
+        }
+        sb.append(sbMySelectList);
+
+        setupRelationSelectClause(sb, beanMetaData, "", "", 1, conditionBeanClass);
+        return sb.toString();
+    }
+
+    protected void setupRelationSelectClause(StringBuffer sb, BeanMetaData baseBmd, String judgeProp, String preNoSuffix, int cqNestNo, Class conditionBeanClass) {
+        for (int i = 0; i < baseBmd.getRelationPropertyTypeSize(); ++i) {
+            final StringBuffer sbYourSelectList = new StringBuffer(100);
+            final RelationPropertyType rpt = baseBmd.getRelationPropertyType(i);
+            if (rpt == null) {
+                String msg = "The baseBmd.GetRelationPropertyType(" + i + ") returned null";
+                msg = msg + ": baseBmd.getTableName()=" + baseBmd.getTableName();
+                msg = msg + ": baseBmd.getRelationPropertyTypeSize()=" + baseBmd.getRelationPropertyTypeSize();
+                throw new IllegalStateException(msg);
+            }
+
+            final BeanMetaData relationBmd = rpt.getBeanMetaData();
+            final String initCapPropertyName = StringUtil.capitalize(rpt.getPropertyName());
+            final String ifComment = "/*IF dto." + judgeProp + "isSelect" + initCapPropertyName + "()*/";
+            final String endComment = "/*END*/";
+            for (int j = 0; j < relationBmd.getPropertyTypeSize(); ++j) {
+                final PropertyType pt = relationBmd.getPropertyType(j);
+                final String tableAliasName = StringUtil.capitalize(rpt.getPropertyName()) + (cqNestNo > 1 ? "_n" + cqNestNo : "");
+                if (pt.isPersistent()) {
+                    final String columnName = pt.getColumnName();
+                    final String columnFullName = tableAliasName + "." + columnName;
+                    final String columnAliasName = pt.getColumnName() + preNoSuffix + "_" + rpt.getRelationNo();
+                    sbYourSelectList.append(", ");
+                    sbYourSelectList.append(columnFullName).append(" AS ").append(columnAliasName);
+
+                    ${glConditionBeanContextName}.addColumnAliasInfo(conditionBeanClass, columnFullName, columnAliasName);
+                }
+            }
+            if (relationBmd.getRelationPropertyTypeSize() > 0) {
+                final String nssString = "nss" + initCapPropertyName + ".";
+                final String nextPreNoSuffix = preNoSuffix + "_" + rpt.getRelationNo();
+                final int nextCQNestNo = cqNestNo + 1;
+                setupRelationSelectClause(sbYourSelectList, relationBmd, nssString, nextPreNoSuffix, nextCQNestNo, conditionBeanClass);
+            }
+            sb.append(ifComment).append(sbYourSelectList).append(endComment);
+        }
+    }
+
+    /**
+     * Get select clause PK only.
+     * 
+     * @param beanMetaData BeanMetaData. (NotNull)
+     * @return Select clause PK only. (NotNull)
+     */
+    protected String getSelectClausePKOnly(BeanMetaData beanMetaData) {
+        final StringBuffer sb = new StringBuffer(100);
+        sb.append("select/*$dto.selectHint*/ ");
+
+        final StringBuffer sbMySelectList = new StringBuffer(100);
+        for (int i = 0; i < beanMetaData.getPropertyTypeSize(); ++i) {
+            final PropertyType pt = beanMetaData.getPropertyType(i);
+            if (pt.isPersistent() && pt.isPrimaryKey()) {
+                if (sbMySelectList.length() != 0) {
+                    sbMySelectList.append(", ");
+                }
+                sbMySelectList.append(beanMetaData.getTableName());
+                sbMySelectList.append(".");
+                sbMySelectList.append(pt.getColumnName());
+            }
+        }
+        sb.append(sbMySelectList);
+
+        return sb.toString();
+    }
+
+    /**
+     * Create select-dynamic-command. (Override)
+     * 
+     * @param handler ResultSetHandler
+     * @return Select dynamic command. (NotNull)
+     */
+    protected SelectDynamicCommand createSelectDynamicCommand(ResultSetHandler handler) {
+        return newMySelectDynamicCommand(handler);
+    }
+
+    /**
+     * New my select dynamic command.
+     * 
+     * @param handler ResultSetHandler
+     * @return My select dynamic command. (NotNull)
+     */
+    protected ${glSelectDynamicCommand} newMySelectDynamicCommand(ResultSetHandler handler) {
+        return new ${glSelectDynamicCommand}(dataSource, statementFactory, handler, resultSetFactory);
+    }
+
+    // =====================================================================================
+    //                                                                     ByManual Override
+    //                                                                     =================
+    protected void setupSelectMethodByManual(Method method, String sql) {
+        final BeanMetaData beanMetaData = buildBeanMetaData(method, this.dbms, this.dataSource);
+        final ResultSetHandlerFactory factory = new ResultSetHandlerFactoryExtension(beanMetaData);
+        SelectDynamicCommand cmd = createSelectDynamicCommand(factory.createResultSetHandler(method));
+        cmd.setSql(sql);
+        cmd.setArgNames(this.annotationReader.getArgNames(method));
+        cmd.setArgTypes(method.getParameterTypes());
+        this.sqlCommands.put(method.getName(), cmd);
+    }
+
+    protected BeanMetaData buildBeanMetaData(Method method, Dbms dbInfo, DataSource ds) {
+        final Class beanClass4SelectMethodByManual = getBeanClass4SelectMethodByManual(method);
+        if (beanClass4SelectMethodByManual.equals(getBeanClass())) {
+            return getBeanMetaData();
+        }
+        final BeanMetaDataImpl beanMetaDataImpl = new BeanMetaDataExtension();
+        final Connection con = DataSourceUtil.getConnection(ds);
+        try {
+            DatabaseMetaData dbMetaData = ConnectionUtil.getMetaData(con);
+            beanMetaDataImpl.setBeanClass(getBeanClass4SelectMethodByManual(method));
+            beanMetaDataImpl.setDatabaseMetaData(dbMetaData);
+            beanMetaDataImpl.setDbms(dbInfo);
+            beanMetaDataImpl.setAnnotationReaderFactory(getAnnotationReaderFactory());
+            beanMetaDataImpl.setValueTypeFactory(getValueTypeFactory());
+            beanMetaDataImpl.initialize();
+        } finally {
+            ConnectionUtil.close(con);
+        }
+        return beanMetaDataImpl;
+    }
+
+    protected Class getBeanClass4SelectMethodByManual(Method method) {
+        final Class retType = method.getReturnType();
+        if (java.util.List.class.isAssignableFrom(retType)) {
+            final Class elementType = InternalMethodUtil.getElementTypeOfListFromReturnMethod(method);
+            if (elementType != null) {
+                return elementType;
+            } else {
+                return getBeanClass();
+            }
+        } else if (retType.isArray()) {
+            return retType.getComponentType();
+        } else if (retType.isPrimitive() || !ValueTypes.getValueType(retType).equals(ValueTypes.OBJECT)) {
+            return getBeanClass();
+        } else {
+            return retType;
+        }
+    }
+    
+    protected static class InternalMethodUtil {
+        public static Class getElementTypeOfListFromReturnMethod(Method method) {
+            return ReflectionUtil.getElementTypeOfListFromReturnType(method);
+        }
+    }
+#if ($database.isAvailableGenerics())
+
+    protected static class ReflectionUtil {
+        public static Class<?> getElementTypeOfList(final Type parameterizedList) {
+            if (!(parameterizedList instanceof ParameterizedType)) {
+                return null;
+            }
+
+            final ParameterizedType parameterizedType = ParameterizedType.class.cast(parameterizedList);
+            final Type rawType = parameterizedType.getRawType();
+            if (!(rawType instanceof Class)) {
+                return null;
+            }
+
+            final Class<?> rawClass = Class.class.cast(rawType);
+            if (!rawClass.isAssignableFrom(List.class)) {
+                return null;
+            }
+
+            final Type[] actualTypeArgument = parameterizedType.getActualTypeArguments();
+            if (actualTypeArgument == null || actualTypeArgument.length != 1) {
+                return null;
+            }
+            if (!(actualTypeArgument[0] instanceof Class)) {
+                return null;
+            }
+
+            return Class.class.cast(actualTypeArgument[0]);
+        }
+
+        public static Class<?> getElementTypeOfListFromParameterType(final Method method, final int parameterPosition) {
+            final Type[] parameterTypes = method.getGenericParameterTypes();
+            return getElementTypeOfList(parameterTypes[parameterPosition]);
+        }
+
+        public static Class<?> getElementTypeOfListFromReturnType(final Method method) {
+            return getElementTypeOfList(method.getGenericReturnType());
+        }
+    }
+#else
+
+    protected static class ReflectionUtil {
+        public static Class getElementTypeOfListFromReturnType(final Method method) {
+            return null;
+        }
+    }
+#end
+
+    protected static class BeanMetaDataExtension extends BeanMetaDataImpl {
+        private int _nestNo;
+        public void setNestNo(int value) {
+            _nestNo = value;
+        }
+        protected RelationPropertyType createRelationPropertyType(
+                BeanDesc beanDesc, PropertyDesc propertyDesc,
+                DatabaseMetaData dbMetaData, Dbms dbms) {
+            String[] myKeys = new String[0];
+            String[] yourKeys = new String[0];
+            int relno = beanAnnotationReader.getRelationNo(propertyDesc);
+            String relkeys = beanAnnotationReader.getRelationKey(propertyDesc);
+            if (relkeys != null) {
+                StringTokenizer st = new StringTokenizer(relkeys, " \t\n\r\f,");
+                List myKeyList = new ArrayList();
+                List yourKeyList = new ArrayList();
+                while (st.hasMoreTokens()) {
+                    String token = st.nextToken();
+                    int index = token.indexOf(':');
+                    if (index > 0) {
+                        myKeyList.add(token.substring(0, index));
+                        yourKeyList.add(token.substring(index + 1));
+                    } else {
+                        myKeyList.add(token);
+                        yourKeyList.add(token);
+                    }
+                }
+                myKeys = (String[]) myKeyList.toArray(new String[myKeyList.size()]);
+                yourKeys = (String[]) yourKeyList.toArray(new String[yourKeyList
+                        .size()]);
+            }
+            Class beanClass = propertyDesc.getPropertyType();
+
+            // /======================================================= {Modify}
+            BeanMetaDataExtension beanMetaData = new BeanMetaDataExtension();
+            // ==============/
+
+            beanMetaData.setBeanClass(beanClass);
+            beanMetaData.setDatabaseMetaData(dbMetaData);
+            beanMetaData.setDbms(dbms);
+            beanMetaData.setAnnotationReaderFactory(getAnnotationReaderFactory());
+            beanMetaData.setValueTypeFactory(getValueTypeFactory());
+
+            // /======================================================= {Modify}
+            if (_nestNo > 0) {
+                beanMetaData.setRelation(true);
+            } else {
+                beanMetaData.setRelation(false);
+            }
+            final int nestNo = _nestNo + 1;
+            beanMetaData.setNestNo(nestNo);
+            // ==============/
+
+            beanMetaData.initialize();
+            RelationPropertyType rpt = new RelationPropertyTypeImpl(propertyDesc,
+                    relno, myKeys, yourKeys, beanMetaData);
+            return rpt;
+        }
+    }
+
+    protected static class ResultSetHandlerFactoryExtension implements ResultSetHandlerFactory {
+        final BeanMetaData beanMetaData;
+
+        public ResultSetHandlerFactoryExtension(BeanMetaData beanMetaData) {
+            this.beanMetaData = beanMetaData;
+        }
+
+        public ResultSetHandler createResultSetHandler(final Method method) {
+            final Class beanClass = beanMetaData.getBeanClass();
+            if (List.class.isAssignableFrom(method.getReturnType())) {
+                return new BeanListMetaDataResultSetHandler(beanMetaData) {
+                    protected Object createRelationRow(ResultSet rs, RelationPropertyType rpt,
+                            Set columnNames, Map relKeyValues) throws SQLException {
+                        return createRelationRow(rs, rpt, columnNames, relKeyValues, "");
+                    }
+                    protected Object createRelationRow(ResultSet rs, RelationPropertyType rpt,
+                            Set columnNames, Map relKeyValues, String preNoSuffix) throws SQLException {
+                        return delegateCreateRelationRow(rs, rpt, columnNames, relKeyValues, preNoSuffix);
+                    }
+                };
+            } else if (isBeanClassAssignable(beanClass, method.getReturnType())) {
+                return new BeanMetaDataResultSetHandler(beanMetaData) {
+                    protected Object createRelationRow(ResultSet rs, RelationPropertyType rpt,
+                            Set columnNames, Map relKeyValues) throws SQLException {
+                        return createRelationRow(rs, rpt, columnNames, relKeyValues, "");
+                    }
+                    protected Object createRelationRow(ResultSet rs, RelationPropertyType rpt,
+                            Set columnNames, Map relKeyValues, String preNoSuffix) throws SQLException {
+                        return delegateCreateRelationRow(rs, rpt, columnNames, relKeyValues, preNoSuffix);
+                    }
+                };
+            } else if (method.getReturnType().isAssignableFrom(Array.newInstance(beanClass, 0).getClass())) {
+                return new BeanArrayMetaDataResultSetHandler(beanMetaData) {
+                    protected Object createRelationRow(ResultSet rs, RelationPropertyType rpt,
+                            Set columnNames, Map relKeyValues) throws SQLException {
+                        return createRelationRow(rs, rpt, columnNames, relKeyValues, "");
+                    }
+                    protected Object createRelationRow(ResultSet rs, RelationPropertyType rpt,
+                            Set columnNames, Map relKeyValues, String preNoSuffix) throws SQLException {
+                        return delegateCreateRelationRow(rs, rpt, columnNames, relKeyValues, preNoSuffix);
+                    }
+                };
+            } else {
+                return new ObjectResultSetHandler();
+            }
+        }
+
+        protected Object delegateCreateRelationRow(ResultSet rs, RelationPropertyType rpt,
+                Set columnNames, Map relKeyValues, String preNoSuffix)
+                throws SQLException {
+            Object row = null;
+            BeanMetaData bmd = rpt.getBeanMetaData();
+            for (int i = 0; i < rpt.getKeySize(); ++i) {
+                String columnName = rpt.getMyKey(i);
+                if (columnNames.contains(columnName)) {
+                    if (row == null) {
+                        row = createRelationRow(rpt);
+                    }
+                    if (relKeyValues != null
+                            && relKeyValues.containsKey(columnName)) {
+                        Object value = relKeyValues.get(columnName);
+                        PropertyType pt = bmd.getPropertyTypeByColumnName(rpt
+                                .getYourKey(i));
+                        PropertyDesc pd = pt.getPropertyDesc();
+                        if (value != null) {
+                            pd.setValue(row, value);
+                        }
+                    }
+                }
+                continue;
+            }
+            final String relationNoSuffix = buildRelationNoSuffix(preNoSuffix, rpt
+                    .getRelationNo());
+            int existColumn = 0;
+            for (int i = 0; i < bmd.getPropertyTypeSize(); ++i) {
+                PropertyType pt = bmd.getPropertyType(i);
+                String columnName = pt.getColumnName() + relationNoSuffix;
+                if (!columnNames.contains(columnName)) {
+                    continue;
+                }
+                existColumn++;
+                if (row == null) {
+                    row = createRelationRow(rpt);
+                }
+                Object value = null;
+                if (relKeyValues != null && relKeyValues.containsKey(columnName)) {
+                    value = relKeyValues.get(columnName);
+                } else {
+                    ValueType valueType = pt.getValueType();
+                    value = valueType.getValue(rs, columnName);
+                }
+                PropertyDesc pd = pt.getPropertyDesc();
+                if (value != null) {
+                    pd.setValue(row, value);
+                }
+            }
+
+            if (existColumn == 0) {
+                return null;
+            }
+
+            if (rpt.getBeanMetaData().getRelationPropertyTypeSize() != 0) {
+                createParentRelationRow(rs, rpt.getBeanMetaData(), columnNames, relationNoSuffix, row);
+            }
+            return row;
+        }
+
+        protected Object createRelationRow(RelationPropertyType rpt) {
+            return ClassUtil.newInstance(rpt.getPropertyDesc().getPropertyType());
+        }
+
+        protected void createParentRelationRow(ResultSet rs, BeanMetaData parentBmd, Set columnNames,
+                String relationNoSuffix, Object row) throws SQLException {
+            for (int i = 0; i < parentBmd.getRelationPropertyTypeSize(); ++i) {
+                RelationPropertyType parentParentRpt = parentBmd.getRelationPropertyType(i);
+                if (parentParentRpt == null) {
+                    continue;
+                }
+                Object relationRow = delegateCreateRelationRow(rs, parentParentRpt, columnNames, null, relationNoSuffix);
+                if (relationRow != null) {
+                    PropertyDesc pd = parentParentRpt.getPropertyDesc();
+                    pd.setValue(row, relationRow);
+                }
+            }
+        }
+
+        private String buildRelationNoSuffix(String preNoSuffix, int relationNo) {
+            return preNoSuffix + "_" + relationNo;
+        }
+
+        private boolean isBeanClassAssignable(Class beanClass, Class clazz) {
+            return beanClass.isAssignableFrom(clazz) || clazz.isAssignableFrom(beanClass);
+        }
+    }
+
+}
+#end
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoMetaDataFactoryImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,194 @@
+package ${glPackageBaseCommonS2Dao};
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import javax.sql.DataSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+#if ($database.isVersionAfter1040())
+  #if ($database.isAvailableOtherConnectionDaoInitialization())
+
+import javax.transaction.TransactionManager;
+  #end
+
+import org.seasar.dao.AnnotationReaderFactory;
+import org.seasar.dao.BeanEnhancer;
+import org.seasar.dao.impl.DaoMetaDataFactoryImpl;
+import org.seasar.dao.impl.DaoMetaDataImpl;
+import org.seasar.extension.jdbc.ResultSetFactory;
+import org.seasar.extension.jdbc.StatementFactory;
+#else
+
+import org.seasar.dao.AnnotationReaderFactory;
+import org.seasar.dao.DaoMetaData;
+import org.seasar.dao.impl.DaoMetaDataFactoryImpl;
+import org.seasar.dao.impl.DaoMetaDataImpl;
+import org.seasar.extension.jdbc.ResultSetFactory;
+import org.seasar.extension.jdbc.StatementFactory;
+#end
+
+import org.seasar.dao.Dbms;
+import org.seasar.dao.dbms.DbmsManager;
+import org.seasar.extension.jdbc.util.ConnectionUtil;
+import org.seasar.extension.jdbc.util.DataSourceUtil;
+
+import ${glPackageBaseCommonCBean}.${glConditionBeanContextName};
+
+/**
+ * DaoMetaDataFactoryImpl for DBFlute.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glDaoMetaDataFactoryImpl} extends DaoMetaDataFactoryImpl {
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glDaoInterceptor}.class);
+#if ($database.isVersionAfter1040() && $database.isAvailableOtherConnectionDaoInitialization())
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    private TransactionManager transactionManager;
+#end
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     * 
+     * @param dataSource Data source.
+     * @param statementFactory Statement factory.
+     * @param resultSetFactory Result set factory.
+     * @param readerFactory Annotation reader factory.
+     */
+    public ${glDaoMetaDataFactoryImpl}(DataSource dataSource,
+            StatementFactory statementFactory,
+            ResultSetFactory resultSetFactory,
+            AnnotationReaderFactory readerFactory) {
+        super(dataSource, statementFactory, resultSetFactory, readerFactory);
+
+        // Stop the LinkageError!
+        ${glConditionBeanContextName}.initialize();
+
+        initializeDatabaseProductNameOfContext(dataSource);
+    }
+
+    // --------------------------------------
+    //                  Database Product Name
+    //                  ---------------------
+    protected void initializeDatabaseProductNameOfContext(DataSource dataSource) {
+        if (getDatabaseProductNameFromContext() != null) {
+            return;
+        }
+        String suffix = null;
+        try {
+            final Connection con = DataSourceUtil.getConnection(dataSource);
+            try {
+                final DatabaseMetaData dbMetaData = ConnectionUtil.getMetaData(con);
+                final Dbms dbms = DbmsManager.getDbms(dbMetaData);
+                suffix = dbms.getSuffix();
+            } finally {
+                ConnectionUtil.close(con);
+            }
+            if (suffix == null) {
+                setDatabaseProductNameToContext("${database.DaoGenDbName}");
+                return;
+            }
+        } catch (RuntimeException e) {
+            _log.info("initializeDatabaseProductNameOfContext threw the exception: " + e.getClass(), e);
+            return;
+        }
+        suffix = suffix.startsWith("_") ? suffix.substring("_".length()) : suffix;
+        setDatabaseProductNameToContext(suffix);
+    }
+
+    protected String getDatabaseProductNameFromContext() {
+        return ${glConditionBeanContextName}.getDatabaseProductName();
+    }
+
+    protected void setDatabaseProductNameToContext(String name) {
+        ${glConditionBeanContextName}.setDatabaseProductName(name);
+    }
+
+#if ($database.isVersionAfter1040())
+
+    // =====================================================================================
+    //                                                        DataMetaData Creation Override
+    //                                                        ==============================
+    protected BeanEnhancer beanEnhancer;
+
+    public BeanEnhancer getBeanEnhancer() {
+        return beanEnhancer;
+    }
+
+    public void setBeanEnhancer(final BeanEnhancer beanEnhancer) {
+        this.beanEnhancer = beanEnhancer;
+    }
+  #if ($database.isAvailableOtherConnectionDaoInitialization())
+
+    protected DaoMetaDataImpl createDaoMetaDataImpl() {// Override!
+        ${glDaoMetaDataExtension} dmdExtension = new ${glDaoMetaDataExtension}();
+        dmdExtension.setBeanEnhancer(this.beanEnhancer);
+        dmdExtension.setTransactionManager(this.transactionManager);
+        return dmdExtension;
+    }
+
+    // =====================================================================================
+    //                                                                              Accessor
+    //                                                                              ========
+    public TransactionManager getTransactionManager() {
+        return transactionManager;
+    }
+
+    public void setTransactionManager(TransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+  #else
+
+    protected DaoMetaDataImpl createDaoMetaDataImpl() {// Override!
+        ${glDaoMetaDataExtension} dmdExtension = new ${glDaoMetaDataExtension}();
+        dmdExtension.setBeanEnhancer(this.beanEnhancer);
+        return dmdExtension;
+    }
+  #end
+#else
+
+    // =====================================================================================
+    //                                                                           DaoMetaData
+    //                                                                           ===========
+    /**
+     * Create data meta data.
+     * 
+     * @param daoClass Dao class
+     * @return Data meta data.
+     */
+    protected DaoMetaData createDaoMetaData(Class daoClass) {
+        DaoMetaDataImpl daoMetaData = new ${glDaoMetaDataExtension}();
+        daoMetaData.setDaoClass(daoClass);
+        daoMetaData.setDataSource(dataSource);
+        daoMetaData.setStatementFactory(statementFactory);
+        daoMetaData.setResultSetFactory(resultSetFactory);
+        daoMetaData.setAnnotationReaderFactory(annotationReaderFactory);
+        daoMetaData.setValueTypeFactory(valueTypeFactory);
+        if (sqlFileEncoding != null) {
+            daoMetaData.setSqlFileEncoding(sqlFileEncoding);
+        }
+        if (daoSuffixes != null) {
+            daoMetaData.setDaoSuffixes(daoSuffixes);
+        }
+        if (insertPrefixes != null) {
+            daoMetaData.setInsertPrefixes(insertPrefixes);
+        }
+        if (updatePrefixes != null) {
+            daoMetaData.setUpdatePrefixes(updatePrefixes);
+        }
+        if (deletePrefixes != null) {
+            daoMetaData.setDeletePrefixes(deletePrefixes);
+        }
+        daoMetaData.initialize();
+        return daoMetaData;
+    }
+#end
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoSelectDynamicCommand.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoSelectDynamicCommand.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoSelectDynamicCommand.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,610 @@
+package ${glPackageBaseCommonS2Dao};
+#if ($database.isSelectQueryTimeoutValid())
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+#end
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import javax.sql.DataSource;
+
+import org.seasar.dao.CommandContext;
+import org.seasar.dao.EndCommentNotFoundRuntimeException;
+import org.seasar.dao.IfConditionNotFoundRuntimeException;
+import org.seasar.dao.Node;
+import org.seasar.dao.SqlParser;
+import org.seasar.dao.SqlTokenizer;
+import org.seasar.dao.impl.SelectDynamicCommand;
+import org.seasar.dao.node.BeginNode;
+import org.seasar.dao.node.BindVariableNode;
+import org.seasar.dao.node.ContainerNode;
+import org.seasar.dao.node.ElseNode;
+import org.seasar.dao.node.EmbeddedValueNode;
+import org.seasar.dao.node.IfNode;
+import org.seasar.dao.node.ParenBindVariableNode;
+import org.seasar.dao.node.PrefixSqlNode;
+import org.seasar.dao.node.SqlNode;
+import org.seasar.dao.parser.SqlTokenizerImpl;
+import org.seasar.extension.jdbc.ResultSetFactory;
+import org.seasar.extension.jdbc.ResultSetHandler;
+import org.seasar.extension.jdbc.StatementFactory;
+import org.seasar.extension.jdbc.impl.BasicSelectHandler;
+import org.seasar.framework.beans.BeanDesc;
+import org.seasar.framework.beans.PropertyDesc;
+import org.seasar.framework.beans.factory.BeanDescFactory;
+import org.seasar.framework.util.StringUtil;
+
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glConditionBeanContextName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseInterfaceName};
+
+/**
+ * SelectDynamicCommand for DBFlute.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glSelectDynamicCommand} extends SelectDynamicCommand {
+#if ($database.isSelectQueryTimeoutValid())
+
+    /** Log-instance. */
+    private static final Log _log = LogFactory.getLog(${glDaoInterceptor}.class);
+#end
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+    /** Root node. */
+    private Node rootNode;// Override!
+
+    /** Result-set handler. */
+    private ResultSetHandler resultSetHandler;
+
+    /** Result-set factory. */
+    private ResultSetFactory resultSetFactory;
+
+    /** Cache of select clause command. */
+    protected ${glSelectDynamicCommand} _selectClauseCommand;
+
+    /** Cache of select clause PK-only command. */
+    protected ${glSelectDynamicCommand} _selectClausePKOnlyCommand;
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     * 
+     * @param dataSource Data source.
+     * @param statementFactory Statement factory.
+     * @param resultSetHandler Result-set handler.
+     * @param resultSetFactory Result-set factory.
+     */
+    public ${glSelectDynamicCommand}(DataSource dataSource,
+            StatementFactory statementFactory,
+            ResultSetHandler resultSetHandler, ResultSetFactory resultSetFactory) {
+
+        super(dataSource, statementFactory, resultSetHandler, resultSetFactory);
+
+        this.resultSetHandler = resultSetHandler;
+        this.resultSetFactory = resultSetFactory;
+    }
+
+    // =====================================================================================
+    //                                                                                  Main
+    //                                                                                  ====
+    // --------------------------------------
+    //                Very Important Override
+    //                -----------------------
+    public void setSql(String sql) {// Override!
+        super.setSql(sql);
+        this.rootNode = new InternalSqlParserImpl(sql).parse();
+    }
+
+    protected CommandContext apply(Object[] args) {// Override!
+        CommandContext ctx = createCommandContext(args);
+        rootNode.accept(ctx);
+        return ctx;
+    }
+
+    public void setArgNames(String[] argNames) {
+        if (_selectClauseCommand != null) {
+            _selectClauseCommand.setArgNames(argNames);
+        }
+        if (_selectClausePKOnlyCommand != null) {
+            _selectClausePKOnlyCommand.setArgNames(argNames);
+        }
+        super.setArgNames(argNames);
+    }
+
+    public void setArgTypes(Class[] argTypes) {
+        if (_selectClauseCommand != null) {
+            _selectClauseCommand.setArgTypes(argTypes);
+        }
+        if (_selectClausePKOnlyCommand != null) {
+            _selectClausePKOnlyCommand.setArgTypes(argTypes);
+        }
+        super.setArgTypes(argTypes);
+    }
+
+    // --------------------------------------
+    //                             For Public
+    //                             ----------
+    /**
+     * Do apply. {for delegating to apply()}
+     * 
+     * @param args Arguments. (NotNull)
+     * @return Command context. (NotNull)
+     */
+    public CommandContext doApply(Object[] args) {
+        return apply(args);
+    }
+
+    // --------------------------------------
+    //                          Select-Clause
+    //                          -------------
+    /**
+     * Set select clause.
+     * 
+     * @param value Select clause. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${glSelectDynamicCommand} setSelectClause(String value) {
+        _selectClauseCommand = createMySelectDynamicCommand();
+        _selectClauseCommand.setSql(value);
+        return this;
+    }
+
+    /**
+     * Set select clause PK only.
+     * 
+     * @param value Select clause PK only. (Nullable)
+     * @return this. (NotNull)
+     */
+    public ${glSelectDynamicCommand} setSelectClausePKOnly(String value) {
+        _selectClausePKOnlyCommand = createMySelectDynamicCommand();
+        _selectClausePKOnlyCommand.setSql(value);
+        return this;
+    }
+
+    // --------------------------------------
+    //          SelectDynamicCommand Creation
+    //          -----------------------------
+    protected ${glSelectDynamicCommand} createMySelectDynamicCommand() {
+        return new ${glSelectDynamicCommand}(getDataSource(), getStatementFactory(), resultSetHandler, resultSetFactory);
+    }
+
+    // --------------------------------------
+    //                                Execute
+    //                                -------
+    public Object execute(Object[] args) {
+        if (!${glConditionBeanContextName}.isExistConditionBeanOnThread()) {
+            return super.execute(args);
+        }
+        assertSelectClauseCommand();
+        final List${database.filterGenericsString('Object')} bindVariableList = new ArrayList${database.filterGenericsString('Object')}();
+        final List${database.filterGenericsString('Class')} bindVariableTypeList = new ArrayList${database.filterGenericsString('Class')}();
+
+        final ${glConditionBeanInterfaceName} cb = ${glConditionBeanContextName}.getConditionBeanOnThread();
+        final String finalClause;
+        if (cb.hasUnionQueryOrUnionAllQuery()) {
+            final String selectClause = setupRealSelectClause(args, bindVariableList, bindVariableTypeList);
+            final String fromWhereClause = setupRealFromWhereClause(args, bindVariableList, bindVariableTypeList);
+            if (cb.isSelectCountIgnoreFetchScope()) {
+                // If the query uses union and it selects count, the way of select-count is as follows.
+                // (Then it needs included-select-column)
+                finalClause = "select count(*) from (" + InternalStringUtil.replace(fromWhereClause, ${glSqlClauseInterfaceName}.INCLUDE_SELECT_CLAUSE_MARK, selectClause) + ") base";
+            } else {
+                finalClause = InternalStringUtil.replace(fromWhereClause, ${glSqlClauseInterfaceName}.INCLUDE_SELECT_CLAUSE_MARK, selectClause);
+            }
+        } else {
+            final String selectClause;
+            if (cb.isSelectCountIgnoreFetchScope()) {
+                selectClause = "select count(*)";
+            } else {
+                selectClause = setupRealSelectClause(args, bindVariableList, bindVariableTypeList);
+            }
+            final String fromWhereClause = setupRealFromWhereClause(args, bindVariableList, bindVariableTypeList);
+            finalClause = InternalStringUtil.replace(fromWhereClause, ${glSqlClauseInterfaceName}.INCLUDE_SELECT_CLAUSE_MARK, selectClause);
+        }
+
+        final BasicSelectHandler selectHandler = createBasicSelectHandler(finalClause);
+        selectHandler.setFetchSize(-1);
+
+        return selectHandler.execute(bindVariableList.toArray(), toClassArray(bindVariableTypeList));
+    }
+
+    // --------------------------------------
+    //                           Setup Clause
+    //                           ------------
+    protected String setupRealSelectClause(Object[] args, List${database.filterGenericsString('Object')} bindVariableList, List${database.filterGenericsString('Class')} bindVariableTypeList) {
+        final ${glConditionBeanInterfaceName} cb = ${glConditionBeanContextName}.getConditionBeanOnThread();
+        final String realSelectClause;
+        {
+            final CommandContext ctx;
+            if (cb.isLimitSelect_PKOnly()) {
+                ctx = _selectClausePKOnlyCommand.doApply(args);
+            } else {
+                ctx = _selectClauseCommand.doApply(args);
+            }
+            realSelectClause = ctx.getSql();
+            addBindVariableInfo(ctx, bindVariableList, bindVariableTypeList);
+        }
+        return realSelectClause;
+    }
+
+    protected String setupRealFromWhereClause(Object[] args, List${database.filterGenericsString('Object')} bindVariableList, List${database.filterGenericsString('Class')} bindVariableTypeList) {
+        final ${glConditionBeanInterfaceName} cb = ${glConditionBeanContextName}.getConditionBeanOnThread();
+        final String realFromWhereClause;
+        {
+            final ${glSelectDynamicCommand} fromWhereCommand = createMySelectDynamicCommand();
+            fromWhereCommand.setArgNames(getArgNames());
+            fromWhereCommand.setArgTypes(getArgTypes());
+
+            // for Union
+            cb.getSqlClause().setSelectClauseColumnAliasMap(${glConditionBeanContextName}.getSelectClauseColumnAliasMap(cb.getClass()));
+
+            fromWhereCommand.setSql(cb.getSqlClause().getClause());
+            CommandContext ctx = fromWhereCommand.doApply(args);
+            realFromWhereClause = ctx.getSql();
+            addBindVariableInfo(ctx, bindVariableList, bindVariableTypeList);
+        }
+        return realFromWhereClause;
+    }
+
+    protected BasicSelectHandler createBasicSelectHandler(String realSql) {
+#if ($database.isSelectQueryTimeoutValid())
+
+        final StatementFactory statementFactoryReal = getStatementFactory();
+        final StatementFactory statementFactoryWrapper = new StatementFactory() {
+            public java.sql.PreparedStatement createPreparedStatement(java.sql.Connection arg0, String arg1) {
+                final java.sql.PreparedStatement ps = statementFactoryReal.createPreparedStatement(arg0, arg1);
+                try {
+                    final int timeout = ${database.SelectQueryTimeout};
+                    if (_log.isDebugEnabled()) {
+                        _log.debug("@SelectDynamicCommand: ps.setQueryTimeout(" + timeout + ");// from ${database.SelectQueryTimeout}");
+                    }
+                    ps.setQueryTimeout(timeout);
+                } catch (java.sql.SQLException e) {
+                    throw new org.seasar.framework.exception.SQLRuntimeException(e);
+                }
+                return ps;
+            }
+            public java.sql.CallableStatement createCallableStatement(java.sql.Connection arg0, String arg1) {
+                return statementFactoryReal.createCallableStatement(arg0, arg1);
+            }
+        };
+        return new BasicSelectHandler(getDataSource(), realSql, resultSetHandler, statementFactoryWrapper, resultSetFactory);
+#else
+
+        return new BasicSelectHandler(getDataSource(), realSql, resultSetHandler, getStatementFactory(), resultSetFactory);
+#end
+
+    }
+
+    protected Class[] toClassArray(List${database.filterGenericsString('Class')} bindVariableTypeList) {
+        final Class[] bindVariableTypesArray = new Class[bindVariableTypeList.size()];
+        for (int i = 0; i < bindVariableTypeList.size(); i++) {
+            final Class bindVariableType = (Class) bindVariableTypeList.get(i);
+            bindVariableTypesArray[i] = bindVariableType;
+        }
+        return bindVariableTypesArray;
+    }
+
+    protected void addBindVariableInfo(CommandContext ctx, List${database.filterGenericsString('Object')} bindVariableList, List${database.filterGenericsString('Class')} bindVariableTypeList) {
+        final Object[] bindVariables = ctx.getBindVariables();
+        addBindVariableList(bindVariableList, bindVariables);
+        final Class[] bindVariableTypes = ctx.getBindVariableTypes();
+        addBindVariableTypeList(bindVariableTypeList, bindVariableTypes);
+    }
+
+    protected void addBindVariableList(List${database.filterGenericsString('Object')} bindVariableList, Object[] bindVariables) {
+        for (int i=0; i < bindVariables.length; i++) {
+            bindVariableList.add(bindVariables[i]);
+        }
+    }
+
+    protected void addBindVariableTypeList(List${database.filterGenericsString('Class')} bindVariableTypeList, Class[] bindVariableTypes) {
+        for (int i=0; i < bindVariableTypes.length; i++) {
+            bindVariableTypeList.add(bindVariableTypes[i]);
+        }
+    }
+
+    protected void assertSelectClauseCommand() {
+        if (_selectClauseCommand == null) {
+            String msg = "Select clause command should not be null.";
+            throw new IllegalStateException(msg);
+        }
+    }
+
+    // =====================================================================================
+    //                                                                 Internal Static Class
+    //                                                                 =====================
+    // --------------------------------------
+    //                              SqlParser
+    //                              ---------
+    protected static class InternalSqlParserImpl implements SqlParser {
+
+        private SqlTokenizer tokenizer;
+
+        private Stack nodeStack = new Stack();
+
+        public InternalSqlParserImpl(String sql) {
+            sql = sql.trim();
+            if (sql.endsWith(";")) {
+                sql = sql.substring(0, sql.length() - 1);
+            }
+            tokenizer = new SqlTokenizerImpl(sql);
+        }
+
+        public Node parse() {
+            push(new ContainerNode());
+            while (SqlTokenizer.EOF != tokenizer.next()) {
+                parseToken();
+            }
+            return pop();
+        }
+
+        protected void parseToken() {
+            switch (tokenizer.getTokenType()) {
+            case SqlTokenizer.SQL:
+                parseSql();
+                break;
+            case SqlTokenizer.COMMENT:
+                parseComment();
+                break;
+            case SqlTokenizer.ELSE:
+                parseElse();
+                break;
+            case SqlTokenizer.BIND_VARIABLE:
+                parseBindVariable();
+                break;
+            }
+        }
+
+        protected void parseSql() {
+            String sql = tokenizer.getToken();
+            if (isElseMode()) {
+                sql = StringUtil.replace(sql, "--", "");
+            }
+            Node node = peek();
+            if ((node instanceof IfNode || node instanceof ElseNode) && node.getChildSize() == 0) {
+
+                SqlTokenizer st = new SqlTokenizerImpl(sql);
+                st.skipWhitespace();
+                String token = st.skipToken();
+                st.skipWhitespace();
+                if (sql.startsWith(",")) {
+                    if (sql.startsWith(", ")) {
+                        node.addChild(new PrefixSqlNode(", ", sql.substring(2)));
+                    } else {
+                        node.addChild(new PrefixSqlNode(",", sql.substring(1)));
+                    }
+                } else if ("AND".equalsIgnoreCase(token) || "OR".equalsIgnoreCase(token)) {
+                    node.addChild(new PrefixSqlNode(st.getBefore(), st.getAfter()));
+                } else {
+                    node.addChild(new SqlNode(sql));
+                }
+            } else {
+                node.addChild(new SqlNode(sql));
+            }
+        }
+
+        protected void parseComment() {
+            String comment = tokenizer.getToken();
+            if (isTargetComment(comment)) {
+                if (isIfComment(comment)) {
+                    parseIf();
+                } else if (isBeginComment(comment)) {
+                    parseBegin();
+                } else if (isEndComment(comment)) {
+                    return;
+                } else {
+                    parseCommentBindVariable();
+                }
+            } else if (comment != null && 0 < comment.length()) {
+                String before = tokenizer.getBefore();
+                peek().addChild(new SqlNode(before.substring(before.lastIndexOf("/*"))));
+            }
+        }
+
+        protected void parseIf() {
+            String condition = tokenizer.getToken().substring(2).trim();
+            if (StringUtil.isEmpty(condition)) {
+                throw new IfConditionNotFoundRuntimeException();
+            }
+            IfNode ifNode = new IfNode(condition);
+            peek().addChild(ifNode);
+            push(ifNode);
+            parseEnd();
+        }
+
+        protected void parseBegin() {
+            BeginNode beginNode = new BeginNode();
+            peek().addChild(beginNode);
+            push(beginNode);
+            parseEnd();
+        }
+
+        protected void parseEnd() {
+            while (SqlTokenizer.EOF != tokenizer.next()) {
+                if (tokenizer.getTokenType() == SqlTokenizer.COMMENT && isEndComment(tokenizer.getToken())) {
+
+                    pop();
+                    return;
+                }
+                parseToken();
+            }
+            throw new EndCommentNotFoundRuntimeException();
+        }
+
+        protected void parseElse() {
+            Node parent = peek();
+            if (!(parent instanceof IfNode)) {
+                return;
+            }
+            IfNode ifNode = (IfNode) pop();
+            ElseNode elseNode = new ElseNode();
+            ifNode.setElseNode(elseNode);
+            push(elseNode);
+            tokenizer.skipWhitespace();
+        }
+
+        protected void parseCommentBindVariable() {
+            String expr = tokenizer.getToken();
+            String s = tokenizer.skipToken();
+            if (s.startsWith("(") && s.endsWith(")")) {
+                peek().addChild(new ParenBindVariableNode(expr));
+            } else if (expr.startsWith("$")) {
+                peek().addChild(new EmbeddedValueNode(expr.substring(1)));
+            } else {
+                peek().addChild(new InternalBindVariableNode(expr));// Extension!
+            }
+        }
+
+        protected void parseBindVariable() {
+            String expr = tokenizer.getToken();
+            peek().addChild(new InternalBindVariableNode(expr));// Extension!
+        }
+
+        protected Node pop() {
+            return (Node) nodeStack.pop();
+        }
+
+        protected Node peek() {
+            return (Node) nodeStack.peek();
+        }
+
+        protected void push(Node node) {
+            nodeStack.push(node);
+        }
+
+        protected boolean isElseMode() {
+            for (int i = 0; i < nodeStack.size(); ++i) {
+                if (nodeStack.get(i) instanceof ElseNode) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        private static boolean isTargetComment(String comment) {
+            return comment != null && comment.length() > 0 && Character.isJavaIdentifierStart(comment.charAt(0));
+        }
+
+        private static boolean isIfComment(String comment) {
+            return comment.startsWith("IF");
+        }
+
+        private static boolean isBeginComment(String content) {
+            return content != null && "BEGIN".equals(content);
+        }
+
+        private static boolean isEndComment(String content) {
+            return content != null && "END".equals(content);
+        }
+    }
+
+    // --------------------------------------
+    //                       BindVariableNode
+    //                       ----------------
+    protected static class InternalBindVariableNode extends BindVariableNode {
+        private String expression;
+
+        private String[] names;
+
+        public InternalBindVariableNode(String expression) {
+            super(expression);
+            
+            this.expression = expression;
+            names = StringUtil.split(expression, ".");
+            // baseName_ = array[0];
+            // if (array.length > 1) {
+            // propertyName_ = array[1];
+            // }
+        }
+
+        public String getExpression() {
+            return expression;
+        }
+
+        public void accept(CommandContext ctx) {
+            Object value = ctx.getArg(names[0]);
+            Class clazz = ctx.getArgType(names[0]);
+            for (int pos = 1; pos < names.length; pos++) {
+                if (value == null) {
+                    break;
+                }
+                if (java.util.Map.class.isInstance(value)) {// Extension!
+                    final java.util.Map map = (java.util.Map) value;
+                    value = map.get(names[pos]);
+                    if (value == null) {
+                        break;
+                    }
+                    clazz = value.getClass();
+                } else {
+                    BeanDesc beanDesc = BeanDescFactory.getBeanDesc(clazz);
+                    PropertyDesc pd = beanDesc.getPropertyDesc(names[pos]);
+                    value = pd.getValue(value);
+                    clazz = pd.getPropertyType();
+                }
+            }
+            ctx.addSql("?", value, clazz);
+        }
+    }
+
+    // --------------------------------------
+    //                             StringUtil
+    //                             ----------
+    protected static class InternalStringUtil {
+
+        public static final String[] EMPTY_STRINGS = new String[0];
+
+        private InternalStringUtil() {
+        }
+
+        public static final boolean isEmpty(String text) {
+            return text == null || text.length() == 0;
+        }
+
+        public static final String replace(String text, String fromText,
+                String toText) {
+
+            if (text == null || fromText == null || toText == null) {
+                return null;
+            }
+            StringBuffer buf = new StringBuffer(100);
+            int pos = 0;
+            int pos2 = 0;
+            while (true) {
+                pos = text.indexOf(fromText, pos2);
+                if (pos == 0) {
+                    buf.append(toText);
+                    pos2 = fromText.length();
+                } else if (pos > 0) {
+                    buf.append(text.substring(pos2, pos));
+                    buf.append(toText);
+                    pos2 = pos + fromText.length();
+                } else {
+                    buf.append(text.substring(pos2));
+                    break;
+                }
+            }
+            return buf.toString();
+        }
+
+        public static String[] split(String str, String delim) {
+            if (str == null) {
+                return EMPTY_STRINGS;
+            }
+            java.util.List${database.filterGenericsString('String')} list = new java.util.ArrayList${database.filterGenericsString('String')}();
+            java.util.StringTokenizer st = new java.util.StringTokenizer(str, delim);
+            while (st.hasMoreElements()) {
+                list.add(st.nextToken());
+            }
+            return (String[]) list.toArray(new String[list.size()]);
+        }
+    }
+}
\ No newline at end of file

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoStatementFactory.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoStatementFactory.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/allcommon/s2dao/S2DaoStatementFactory.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,44 @@
+package ${glPackageBaseCommonS2Dao};
+#if (${database.isStatementResultSetTypeValid()})
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.seasar.extension.jdbc.impl.BasicStatementFactory;
+import org.seasar.framework.exception.SQLRuntimeException;
+
+#else
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+
+import org.seasar.extension.jdbc.impl.BasicStatementFactory;
+import org.seasar.extension.jdbc.util.ConnectionUtil;
+#end
+
+/**
+ * Statement factory.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${glDaoStatementFactory} extends BasicStatementFactory {
+#if (${database.isStatementResultSetTypeValid()})
+
+    public PreparedStatement createPreparedStatement(Connection con, String sql) {
+        try {
+            return con.prepareStatement(sql, ${database.StatementResultSetType}, ${database.StatementResultSetConcurrency});
+        } catch (SQLException e) {
+            throw new SQLRuntimeException(e);
+        }
+    }
+#else
+
+    public PreparedStatement createPreparedStatement(Connection con, String sql) {
+        return ConnectionUtil.prepareStatement(con, sql);
+    }
+#end
+
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsbhv/BaseBhv.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsbhv/BaseBhv.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsbhv/BaseBhv.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,1309 @@
+#set ($myClassName = "${myBaseBhvClassName}")
+
+package ${glPackageBaseBhv};
+
+import ${glPackageBaseCommon}.*;
+#if ($database.isAvailableGenerics())
+import ${glPackageBaseCommonBhvLoad}.${glLoadRefererOptionName};
+import ${glPackageBaseCommonBhvSetup}.${glConditionBeanSetupperName};
+import ${glPackageBaseCommonBhvSetup}.${glValueLabelSetupperName};
+#end
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glListResultBeanName};
+import ${glPackageBaseCommonCBean}.${glPagingBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glPagingResultBeanName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+#if (${table.hasOnlyOnePrimaryKey()})
+  #if (${table.hasReferrer()})
+
+import ${glPackageExtendedBhv}.*;
+  #end
+#end
+
+import ${glPackageExtendedDao}.*;
+import ${glPackageExtendedEntity}.*;
+import ${myDBMetaPackageName}.*;
+import ${glPackageCB}.*;
+
+#set ($myExtendClassName = "")
+#if ($table.isWritable())
+  #set ($myExtendClassName = "${glBehaviorWritableAbstractName}")
+#else
+  #set ($myExtendClassName = "${glBehaviorReadableAbstractName}")
+#end
+
+
+/**
+ * The behavior of ${table.Name}.
+ * 
+ * <pre>
+ * [primary-key]
+ *     ${table.PrimaryKeyNameCommaString}
+ * 
+ * [column-property]
+ *     ${table.ColumnNameCommaString}
+ * 
+ * [foreign-property]
+ *     ${table.ForeignPropertyNameCommaString}
+ * 
+ * [refferer-property]
+ *     ${table.ReferrerPropertyNameCommaString}
+ * 
+ * [sequence]
+ *     ${table.DefinedSequenceName}
+ * 
+ * [identity]
+ *     ${table.IdentityPropertyName}
+ * 
+ * [update-date]
+ *     ${table.UpdateDateJavaName}
+ * 
+ * [version-no]
+ *     ${table.VersionNoJavaName}
+ * 
+ * </pre>
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${myClassName} extends ${glPackageBaseCommonBhv}.${myExtendClassName} {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    /** Dao instance. */
+    protected ${myExtendedDaoClassName} _dao;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // ===================================================================================
+    //                                                                          Table name
+    //                                                                          ==========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName() {
+        return "${table.Name}";
+    }
+
+    // ===================================================================================
+    //                                                                              DBMeta
+    //                                                                              ======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return DBMeta. (NotNull)
+     */
+    public ${glDBMetaInterfaceName} getDBMeta() {
+        return ${myDBMetaClassName}.getInstance();
+    }
+
+    /**
+     * Get my dbmeta.
+     * 
+     * @return DBMeta. (NotNull)
+     */
+    public ${myDBMetaClassName} getMyDBMeta() {
+        return ${myDBMetaClassName}.getInstance();
+    }
+
+    // ===================================================================================
+    //                                                                        Dao Accessor
+    //                                                                        ============
+    /**
+     * Get my dao.
+     * 
+     * @return My dao.
+     */
+    public ${myExtendedDaoClassName} getMyDao() {
+        return _dao;
+    }
+
+    /**
+     * Set my dao.
+     * 
+     * @param dao My dao. (NotNull)
+     */
+    public void setMyDao(${myExtendedDaoClassName} dao) {
+        assertObjectNotNull("dao", dao);
+        _dao = dao;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Dao-readable. (NotNull)
+     */
+    public ${glDaoReadableInterfaceName} getDaoReadable() {
+        return getMyDao();
+    }
+
+#if ($table.isWritable())
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Dao-writable. (NotNull)
+     */
+    public ${glDaoWritableInterfaceName} getDaoWritable() {
+        return getMyDao();
+    }
+#end
+
+    // ===================================================================================
+    //                                                                        New Instance
+    //                                                                        ============
+    /**
+     * New entity.
+     * 
+     * @return Entity. (NotNull)
+     */
+    public ${glEntityInterfaceName} newEntity() {
+        return newMyEntity();
+    }
+
+    /**
+     * New condition-bean.
+     * 
+     * @return Condition-bean. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} newConditionBean() {
+        return newMyConditionBean();
+    }
+
+    /**
+     * New my entity.
+     * 
+     * @return My entity. (NotNull)
+     */
+    public ${myExtendedObjectClassName} newMyEntity() {
+        return new ${myExtendedObjectClassName}();
+    }
+
+    /**
+     * New my condition-bean.
+     * 
+     * @return My condition-bean. (NotNull)
+     */
+    public ${myConditionBeanClassName} newMyConditionBean() {
+        return new ${myConditionBeanClassName}();
+    }
+
+    // ===================================================================================
+    //                                                                     Delegate Method
+    //                                                                     ===============
+    // -----------------------------------------------------
+    //                                                Select
+    //                                                ------
+    /**
+     * Get count as all. (Delegate-Method)
+     * 
+     * @return All count. (NotNull)
+     */
+    public int delegateGetCountAll() {
+        return getMyDao().getCountAll();
+    }
+
+    /**
+     * Get list as all. (Delegate-Method)
+     * 
+     * @return All list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} delegateGetListAll() {
+        return getMyDao().getListAll();
+    }
+#if ($table.hasPrimaryKey())
+
+    //
+    // Get entity. (Delegate-Method)
+    // 
+    // @param Primary-keys (NotNull)
+    // @return Entity. (NotNull)
+    //
+    public ${myExtendedObjectClassName} delegateGetEntity(${table.PrimaryKeyArgsString}) {
+        return getMyDao().getEntity(${table.getPrimaryKeyUncapitalisedJavaNameCommaString()});
+    }
+#end
+
+    /**
+     * Select count by condition-bean. (Delegate-Method)
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected count. (NotNull)
+     */
+    public int delegateSelectCount(${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        return getMyDao().selectCount(cb);
+    }
+
+    /**
+     * Select entity by condition-bean. (Delegate-Method)
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected entity. If the select result is zero, it returns null. (Nullable)
+     */
+    public ${myExtendedObjectClassName} delegateSelectEntity(${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        return getMyDao().selectEntity(cb);
+    }
+
+    /**
+     * Select list by condition-bean. (Delegate-Method)
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected list. If the select result is zero, it returns empty list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} delegateSelectList(${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        return getMyDao().selectList(cb);
+    }
+
+#if ($table.isUseSequence())
+
+    /**
+     * Select next value as sequence. (Delegate-Method)
+     * 
+     * @return Next value. (NotNull)
+     */
+    public ${database.sequenceReturnType} delegateSelectNextVal() {
+        return getMyDao().selectNextVal();
+    }
+#end
+
+#if ($table.isWritable())
+    // -----------------------------------------------------
+    //                                                Update
+    //                                                ------
+    /**
+     * Insert one entity. (Delegate-Method)
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Inserted count.
+     */
+    public int delegateInsert(${myExtendedObjectClassName} entity) {
+        assertEntityNotNull(entity);// If this table use identity, the entity does not have primary-key.
+        filterEntityOfInsert(entity);
+        assertEntityOfInsert(entity);
+        return getMyDao().insert(entity);
+    }
+
+    /**
+     * Update one entity. (Delegate-Method)
+     * {modified only}
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Updated count.
+     */
+    public int delegateUpdate(${myExtendedObjectClassName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        filterEntityOfUpdate(entity);
+        assertEntityOfUpdate(entity);
+        return getMyDao().updateModifiedOnly(entity);
+    }
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+    /**
+     * Update one entity. (Delegate-Method)
+     * {non strict & modified only}
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Updated count.
+     */
+    public int delegateUpdateNonstrict(${myExtendedObjectClassName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        filterEntityOfUpdate(entity);
+        assertEntityOfUpdate(entity);
+        return getMyDao().updateNonstrictModifiedOnly(entity);
+    }
+  #end
+
+    /**
+     * Delete one entity. (Delegate-Method)
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Deleted count.
+     */
+    public int delegateDelete(${myExtendedObjectClassName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        filterEntityOfDelete(entity);
+        assertEntityOfDelete(entity);
+        return getMyDao().delete(entity);
+    }
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+    /**
+     * Delete one entity. (Delegate-Method)
+     * {non strict}
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Deleted count.
+     */
+    public int delegateDeleteNonstrict(${myExtendedObjectClassName} entity) {
+        assertEntityNotNullAndHasPrimaryKeyValue(entity);
+        filterEntityOfDelete(entity);
+        assertEntityOfDelete(entity);
+        return getMyDao().deleteNonstrict(entity);
+    }
+  #end
+
+    /**
+     * Insert several entities. (Delegate-Method)
+     * 
+     * @param entityList Entity-list. (NotNull & NotEmpty)
+     * @return Inserted count.
+     */
+    public int delegateInsertList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        return getMyDao().insertList(entityList);
+    }
+
+    /**
+     * Update several entities. (Delegate-Method)
+     * 
+     * @param entityList Entity-list. (NotNull & NotEmpty)
+     * @return Updated count.
+     */
+    public int delegateUpdateList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        return getMyDao().updateList(entityList);
+    }
+
+    /**
+     * Delete several entities. (Delegate-Method)
+     * 
+     * @param entityList Entity-list. (NotNull & NotEmpty)
+     * @return Deleted count.
+     */
+    public int delegateDeleteList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} entityList) {
+        assertListNotNullAndNotEmpty(entityList);
+        return getMyDao().deleteList(entityList);
+    }
+#else
+  #if ($table.isAvailableNonPrimaryKeyWritable())
+
+    /**
+     * Insert one entity. (Delegate-Method)
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Inserted count.
+     */
+    public int delegateInsert(${myExtendedObjectClassName} entity) {
+        assertEntityNotNull(entity);// If this table use identity, the entity does not have primary-key.
+        return getMyDao().insert(entity);
+    }
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                  Basic Select Count
+    //                                                                  ==================
+    /**
+     * Select count by condition-bean.
+     * <pre>
+     * If the argument 'condition-bean' is effective about fetch-scope,
+     * this method invoke select count ignoring the fetch-scope.
+     * </pre>
+     * @param cb Condition-bean. This condition-bean should not be set up about fetch-scope. (NotNull)
+     * @return Selected count.
+     */
+    public int selectCount(${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        return delegateSelectCount(cb);
+    }
+
+    // ===================================================================================
+    //                                                                 Basic Select Entity
+    //                                                                 ===================
+    /**
+     * Select entity by condition-bean.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected entity. (Nullalble)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public ${myExtendedObjectClassName} selectEntity(${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        final java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ls = selectList(cb);
+        if (ls.isEmpty()) {
+            return null;
+        }
+        assertRecordHasBeenSelectedAsOne(ls, cb);
+        return (${myExtendedObjectClassName})ls.get(0);
+    }
+
+    /**
+     * Select entity by condition-bean with deleted check.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public ${myExtendedObjectClassName} selectEntityWithDeletedCheck(${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        final java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ls = selectList(cb);
+        assertRecordHasNotBeenDeleted(ls, cb);
+        assertRecordHasBeenSelectedAsOne(ls, cb);
+        return (${myExtendedObjectClassName})ls.get(0);
+    }
+#if ($table.hasPrimaryKey())
+
+    /*
+     * Select entity with deleted check. {by primary-key}
+     * 
+     * @param primaryKey
+     * @return Selected entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public ${myExtendedObjectClassName} selectByPKValueWithDeletedCheck(${table.PrimaryKeyArgsString}) {
+        ${myExtendedObjectClassName} entity = new ${myExtendedObjectClassName}();
+        ${table.getPrimaryKeyArgsSetupString('entity')}
+        final ${myConditionBeanClassName} cb = newMyConditionBean();
+        cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(entity));
+        return selectEntityWithDeletedCheck(cb);
+    }
+#end
+#if ($table.hasPrimaryKey() && $database.isMakeBehaviorForUpdate())
+
+    /*
+     * Select entity for update with deleted check. {by primary-key}
+     * 
+     * @param primaryKey
+     * @return Selected entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     * @deprecated This method is deprecated.
+     */
+    public ${myExtendedObjectClassName} selectByPKValueWithDeletedCheckForUpdate(${table.PrimaryKeyArgsString}) {
+        ${myExtendedObjectClassName} entity = new ${myExtendedObjectClassName}();
+        ${table.getPrimaryKeyArgsSetupString('entity')}
+        final ${myConditionBeanClassName} cb = newMyConditionBean();
+        cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(entity));
+        cb.lockForUpdate();
+        return selectEntityWithDeletedCheck(cb);
+    }
+#end
+
+    // ===================================================================================
+    //                                                                   Basic Select List
+    //                                                                   =================
+    /**
+     * Select list as result-bean.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected list-result-bean. (NotNull)
+     */
+    public ${glListResultBeanName}${database.filterGenericsString(${myExtendedObjectClassName})} selectList(${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        return new ResultBeanBuilder${database.filterGenericsString(${myExtendedObjectClassName})}(this).buildListResultBean(cb, delegateSelectList(cb));
+    }
+
+    /**
+     * Select page as result-bean.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected paging-result-bean. (NotNull)
+     */
+    public ${glPagingResultBeanName}${database.filterGenericsString(${myExtendedObjectClassName})} selectPage(final ${myConditionBeanClassName} cb) {
+        assertConditionBeanNotNull(cb);
+        return selectPage(cb, new SelectPageSimpleInvoker${database.filterGenericsString(${myExtendedObjectClassName})}(this));
+    }
+
+    /**
+     * Select page.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @param invoker Select-page-invoker (NotNull)
+     * @return Selected paging-result-bean. (NotNull)
+     */
+    public ${glPagingResultBeanName}${database.filterGenericsString(${myExtendedObjectClassName})} selectPage(final ${myConditionBeanClassName} cb, SelectPageInvoker${database.filterGenericsString(${myExtendedObjectClassName})} invoker) {
+        assertConditionBeanNotNull(cb);
+        final SelectPageCallback${database.filterGenericsString(${myExtendedObjectClassName})} pageCallback = new SelectPageCallback${database.filterGenericsString(${myExtendedObjectClassName})}() {
+            public ${glPagingBeanInterfaceName} getPagingBean() { return cb; }
+            public int selectCountIgnoreFetchScope() {
+                return selectCount(cb);
+            }
+            public java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} selectListWithFetchScope() {
+                return selectList(cb);
+            }
+        };
+        return invoker.invokeSelectPage(pageCallback);
+    }
+
+#if ($database.isAvailableGenerics())
+    // ===================================================================================
+    //                                                                      Various Select
+    //                                                                      ==============
+    /**
+     * Select value-label list.
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @param valueLabelSetupper Value-label-setupper. (NotNull)
+     * @return Value-label list. (NotNull)
+     */
+    public java.util.List<java.util.Map<String, Object>> selectValueLabelList(${myConditionBeanClassName} cb, ${glValueLabelSetupperName}<${myExtendedObjectClassName}> valueLabelSetupper) {
+        return createValueLabelList(selectList(cb), valueLabelSetupper);
+    }
+#end
+#if ($table.isUseSequence())
+
+    // ===================================================================================
+    //                                                                            Sequence
+    //                                                                            ========
+    /**
+     * Select next value as sequence.
+     * 
+     * @return Next value. (NotNull)
+     */
+    public ${database.sequenceReturnType} selectNextVal() {
+        return delegateSelectNextVal();
+    }
+#end
+#if (${table.hasOnlyOnePrimaryKey()})
+
+    // ===================================================================================
+    //                                                                        Load Referer
+    //                                                                        ============
+  #foreach ($refferer in $table.Referrers)
+    #set ($reffererTable = $refferer.Table)
+    #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+    #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+    #set ($reffererBhvClassName = "${reffererEntityClassName}Bhv")
+    #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+    #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+    #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+    #set ($genericPKMyEntityMap = "${table.getPrimaryKeyJavaNativeAsOne()}, ${myExtendedObjectClassName}")
+    #set ($genericPKChildListMap = "${table.getPrimaryKeyJavaNativeAsOne()}, java.util.List${database.filterGenericsString(${reffererEntityClassName})}")
+
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   RefererTable    = [${refferer.table.name}]
+    //   RefererProperty = [${refferer.reffererPropertyName}]
+    // * * * * * * * * */
+    #if ($database.isAvailableGenerics())
+
+    /**
+     * Load referer of ${refferer.ReffererPropertyName}.
+     * <pre>
+     *   You can load referer.
+     * 
+     *   ex) {Client Example}
+     *     final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *     cb.query().setXxx_Equal("xxx");
+     *     final List&lt;${myExtendedObjectClassName}&gt; ${myEntityListVariableName} = ${myBehaviorVariableName}.selectList(cb);
+     *     ${myBehaviorVariableName}.load${refferer.reffererPropertyNameInitCap}(${myEntityListVariableName});
+     * 
+     *   *About internal policy, the value of primary key(and others too) is treated as CaseInsensitive.
+     * </pre>
+     * 
+     * @param ${myEntityListVariableName} Entity list of ${table.uncapitalisedJavaName}. (NotNull)
+     */
+    public void load${refferer.ReffererPropertyNameInitCap}(java.util.List<${myExtendedObjectClassName}> ${myEntityListVariableName}) {
+        final ${glConditionBeanSetupperName}<${reffererCBClassName}> conditionBeanSetupper = new ${glConditionBeanSetupperName}<${reffererCBClassName}>() {
+            public void setup(${reffererCBClassName} cb) {
+            }
+        };
+        load${refferer.reffererPropertyNameInitCap}(${myEntityListVariableName}, conditionBeanSetupper);
+    }
+
+    /**
+     * Load referer of ${refferer.ReffererPropertyName}.
+     * <pre>
+     *   You can load referer with your original condition.
+     * 
+     *   ex) {Client Example}: Referer conditions are 'Xxx' is not null and order-by 'Yyy' desc
+     *     /- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+     *     final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *     cb.query().setXxx_Equal("xxx");
+     *     final List&lt;${myExtendedObjectClassName}&gt; ${myEntityListVariableName} = ${myBehaviorVariableName}.selectList(cb);
+     *     final ${glConditionBeanSetupperName}&lt;${reffererCBClassName}&gt; conditionBeanSetupper = new ${glConditionBeanSetupperName}&lt;${reffererCBClassName}&gt;() {
+     *         public void setup(${reffererCBClassName} cb) {
+     *             cb.query().setXxx_IsNotNull();
+     *             cb.query().addOrderBy_Yyy_Desc();
+     *         }
+     *     };
+     *     ${myBehaviorVariableName}.load${refferer.reffererPropertyNameInitCap}(${myEntityListVariableName}, conditionBeanSetupper);
+     *     - - - - - - - - - -/
+     * 
+     *   The condition-bean that the setupper provides have settings before you touch it. It is as follows:
+     *     /- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+     *     cb.query().set${refferer.getLocalColumnJavaNameAsOne()}_InScope(pkList);
+     *     cb.query().addOrderBy_${refferer.getLocalColumnJavaNameAsOne()}_Asc();
+     *     - - - - - - - - - -/
+     * 
+     *   *About internal policy, the value of primary key(and others too) is treated as CaseInsensitive.
+     * </pre>
+     * 
+     * @param ${myEntityListVariableName} Entity list of ${table.uncapitalisedJavaName}. (NotNull)
+     * @param conditionBeanSetupper Referer condition setupper instance for registering referer condition. (NotNull)
+     */
+    public void load${refferer.ReffererPropertyNameInitCap}(java.util.List<${myExtendedObjectClassName}> ${myEntityListVariableName}, ${glConditionBeanSetupperName}<${reffererCBClassName}> conditionBeanSetupper) {
+        assertObjectNotNull("${myEntityListVariableName}<${myExtendedObjectClassName}>", ${myEntityListVariableName});
+        assertObjectNotNull("conditionBeanSetupper<${reffererCBClassName}>", conditionBeanSetupper);
+        if (${myEntityListVariableName}.isEmpty()) {
+            return;
+        }
+        load${refferer.reffererPropertyNameInitCap}(${myEntityListVariableName}, new ${glLoadRefererOptionName}<${reffererCBClassName}, ${reffererEntityClassName}>(conditionBeanSetupper));
+    }
+
+    /**
+     * Load referer of ${refferer.ReffererPropertyName}.
+     * <pre>
+     *   You can load referer with your original condition.
+     * 
+     *   ex) {Client Example}: Referer conditions are 'Xxx' is not null and order-by 'Yyy' desc
+     *     /- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+     *     final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *     cb.query().setXxx_Equal("xxx");
+     *     final List&lt;${myExtendedObjectClassName}&gt; ${myEntityListVariableName} = ${myBehaviorVariableName}.selectList(cb);
+     *     final ${glConditionBeanSetupperName}&lt;${reffererCBClassName}&gt; cbSetupper = new ${glConditionBeanSetupperName}&lt;${reffererCBClassName}&gt;() {
+     *         public void setup(${reffererCBClassName} cb) {
+     *             cb.query().setXxx_IsNotNull();
+     *             cb.query().addOrderBy_Yyy_Desc();
+     *         }
+     *     };
+     *     ${myBehaviorVariableName}.load${refferer.reffererPropertyNameInitCap}(${myEntityListVariableName}, new ${glLoadRefererOptionName}<${reffererCBClassName}, ${reffererEntityClassName}>(cbSetupper));
+     *     - - - - - - - - - -/
+     * 
+     *   The condition-bean that the setupper provides have settings before you touch it. It is as follows:
+     *     /- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
+     *     cb.query().set${refferer.getLocalColumnJavaNameAsOne()}_InScope(pkList);
+     *     cb.query().addOrderBy_${refferer.getLocalColumnJavaNameAsOne()}_Asc();
+     *     - - - - - - - - - -/
+     * 
+     *   *About internal policy, the value of primary key(and others too) is treated as CaseInsensitive.
+     * </pre>
+     * 
+     * @param ${myEntityListVariableName} Entity list of ${table.uncapitalisedJavaName}. (NotNull)
+     * @param loadRefererOption Load-referer option. (NotNull)
+     */
+    public void load${refferer.reffererPropertyNameInitCap}(java.util.List<${myExtendedObjectClassName}> ${myEntityListVariableName}, ${glLoadRefererOptionName}<${reffererCBClassName}, ${reffererEntityClassName}> loadRefererOption) {
+        assertObjectNotNull("${myEntityListVariableName}<${myExtendedObjectClassName}>", ${myEntityListVariableName});
+        assertObjectNotNull("loadRefererOption<${reffererEntityClassName}, ${reffererCBClassName}>", loadRefererOption);
+        if (${myEntityListVariableName}.isEmpty()) {
+            return;
+        }
+
+        final java.util.Map<${genericPKMyEntityMap}> pkMyEntityMap = new java.util.LinkedHashMap<${genericPKMyEntityMap}>();
+        final java.util.List<${table.getPrimaryKeyJavaNativeAsOne()}> pkList = new java.util.ArrayList<${table.getPrimaryKeyJavaNativeAsOne()}>();
+        for (${myExtendedObjectClassName} ${myEntityVariableName} : ${myEntityListVariableName}) {
+            pkList.add(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}());
+            pkMyEntityMap.put((${table.getPrimaryKeyJavaNativeAsOne()})toLowerCaseIfString(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}()), ${myEntityVariableName});
+        }
+        final ${reffererBhvClassName} refererBhv = getDaoSelector().getBehavior(${reffererBhvClassName}.class);
+        final ${reffererCBClassName} cb = loadRefererOption.getReffererConditionBean() != null ? loadRefererOption.getReffererConditionBean() : refererBhv.newMyConditionBean();
+        cb.query().set${refferer.getLocalColumnJavaNameAsOne()}_InScope(pkList);
+        loadRefererOption.delegateKeyConditionExchangingFirstWhereClauseForLastOne(cb);
+        if (!loadRefererOption.isStopOrderByKey()) {
+            cb.query().addOrderBy_${refferer.getLocalColumnJavaNameAsOne()}_Asc();
+            cb.getSqlComponentOfOrderByClause().exchangeFirstOrderByElementForLastOne();
+        }
+        loadRefererOption.delegateConditionBeanSettingUp(cb);
+        final java.util.List${database.filterGenericsString(${reffererEntityClassName})} reffererList = refererBhv.selectList(cb);
+        loadRefererOption.delegateEntitySettingUp(reffererList);
+
+        final java.util.Map<${genericPKChildListMap}> pkReffererListMap = new java.util.LinkedHashMap<${genericPKChildListMap}>();
+        for (${reffererEntityClassName} reffererEntity : reffererList) {
+            if (!pkReffererListMap.containsKey(toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()))) {
+                pkReffererListMap.put((${table.getPrimaryKeyJavaNativeAsOne()})toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()), new java.util.ArrayList<${reffererEntityClassName}>());
+            }
+            (pkReffererListMap.get(toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()))).add(reffererEntity);
+
+            // for Reverse Reference.
+            final ${myExtendedObjectClassName} myEntity = pkMyEntityMap.get(toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()));
+            reffererEntity.set${refferer.ForeignPropertyNameInitCap}(myEntity);
+        }
+
+        for (${myExtendedObjectClassName} ${myEntityVariableName} : ${myEntityListVariableName}) {
+            if (pkReffererListMap.containsKey(toLowerCaseIfString(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}()))) {
+                ${myEntityVariableName}.set${refferer.ReffererPropertyNameInitCap}((java.util.List${database.filterGenericsString(${reffererEntityClassName})})pkReffererListMap.get(toLowerCaseIfString(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}())));
+            } else {
+                ${myEntityVariableName}.set${refferer.ReffererPropertyNameInitCap}(new java.util.ArrayList<${reffererEntityClassName}>());
+            }
+        }
+    }
+    #else
+
+    /**
+     * Load refferer of ${refferer.ReffererPropertyName}.
+     * <pre>
+     *   Default refferer order-by is 'primary-key asc'.
+     * 
+     *   ex) {Client Example}
+     *     final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *     cb.query().setXxx_Equal("xxx");
+     *     final List<${myExtendedObjectClassName}> ls = ${myBehaviorVariableName}.selectList(cb);
+     *     ${myBehaviorVariableName}.load${refferer.ReffererPropertyNameInitCap}(ls);
+     * 
+     *   *About internal policy, the value of primary key(and others too) is treated as CaseInsensitive.
+     * </pre>
+     * 
+     * @param ls Entity list of main table. (NotNull)
+     */
+    public void load${refferer.ReffererPropertyNameInitCap}(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ls) {
+        final ${reffererBhvClassName}.CBSetupper cbSetupper = new ${reffererBhvClassName}.CBSetupper() {
+            public void setup(${reffererCBClassName} cb) {
+                cb.addOrderBy_PK_Asc();// Default OrderBy for Refferer.
+            }
+        };
+        load${refferer.ReffererPropertyNameInitCap}(ls, cbSetupper);
+    }
+
+    /**
+     * Load refferer of ${refferer.ReffererPropertyName}.
+     * <pre>
+     *   You can load refferer with your original condition.
+     * 
+     *   ex) {Client Example}: Refferer conditions are 'Xxx' is not null and order-by 'Yyy' desc
+     *     final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *     cb.query().setXxx_Equal("xxx");
+     *     final List<${myExtendedObjectClassName}> ls = ${myBehaviorVariableName}.selectList(cb);
+     *     final ${reffererBhvClassName}.CBSetupper cbSetupper = new ${reffererBhvClassName}.CBSetupper() {
+     *         public void setup(${reffererCBClassName} cb) {
+     *             cb.query().setXxx_IsNotNull();
+     *             cb.query().addOrderBy_Yyy_Desc();
+     *         }
+     *     };
+     *     ${myBehaviorVariableName}.load${refferer.ReffererPropertyNameInitCap}(ls, cbSetupper);
+     * 
+     *   *About internal policy, the value of primary key(and others too) is treated as CaseInsensitive.
+     * </pre>
+     * 
+     * @param ls Entity list of main table. (NotNull)
+     * @param cbSetupper Refferer condition setupper instance for registering refferer condition. (NotNull)
+     */
+    public void load${refferer.ReffererPropertyNameInitCap}(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ls, ${reffererBhvClassName}.CBSetupper cbSetupper) {
+        assertObjectNotNull("ls", ls);
+        assertObjectNotNull("cbSetupper", cbSetupper);
+        if (ls.isEmpty()) {
+            return;
+        }
+
+        final java.util.Map${database.filterGenericsString(${genericPKMyEntityMap})} pkMyEntityMap = new java.util.LinkedHashMap${database.filterGenericsString(${genericPKMyEntityMap})}();
+        final java.util.List${database.filterGenericsString(${table.getPrimaryKeyJavaNativeAsOne()})} pkList = new java.util.ArrayList${database.filterGenericsString(${table.getPrimaryKeyJavaNativeAsOne()})}();
+        for (final java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+            final ${myExtendedObjectClassName} ${myEntityVariableName} = (${myExtendedObjectClassName})ite.next();
+            pkList.add(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}());
+            pkMyEntityMap.put((${table.getPrimaryKeyJavaNativeAsOne()})toLowerCaseIfString(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}()), ${myEntityVariableName});
+        }
+        final ${reffererBhvClassName} reffererBhv = (${reffererBhvClassName})getDaoSelector().getRBhv(${reffererBhvClassName}.class);
+        final ${reffererCBClassName} cb = reffererBhv.newMyConditionBean();
+        cb.query().set${refferer.getLocalColumnJavaNameAsOne()}_InScope(pkList);
+        cb.query().addOrderBy_${refferer.getLocalColumnJavaNameAsOne()}_Asc();
+        cbSetupper.setup(cb);
+        final java.util.List${database.filterGenericsString(${reffererEntityClassName})} reffererList = reffererBhv.selectList(cb);
+
+        final java.util.Map${database.filterGenericsString(${genericPKChildListMap})} pkReffererListMap;
+        pkReffererListMap = new java.util.LinkedHashMap${database.filterGenericsString(${genericPKChildListMap})}();
+        for (final java.util.Iterator ite = reffererList.iterator(); ite.hasNext(); ) {
+            final ${reffererEntityClassName} reffererEntity = (${reffererEntityClassName})ite.next();
+            if (!pkReffererListMap.containsKey(toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()))) {
+                pkReffererListMap.put((${table.getPrimaryKeyJavaNativeAsOne()})toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()), new java.util.ArrayList${database.filterGenericsString(${reffererEntityClassName})}());
+            }
+            ((java.util.List${database.filterGenericsString(${reffererEntityClassName})})pkReffererListMap.get(toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()))).add(reffererEntity);
+
+            // for Reverse Reference.
+            final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})pkMyEntityMap.get(toLowerCaseIfString(reffererEntity.get${refferer.getLocalColumnJavaNameAsOne()}()));
+            reffererEntity.set${refferer.ForeignPropertyNameInitCap}(myEntity);
+        }
+
+        for (final java.util.Iterator ite = ls.iterator(); ite.hasNext(); ) {
+            final ${myExtendedObjectClassName} ${myEntityVariableName} = (${myExtendedObjectClassName})ite.next();
+            if (pkReffererListMap.containsKey(toLowerCaseIfString(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}()))) {
+                ${myEntityVariableName}.set${refferer.ReffererPropertyNameInitCap}((java.util.List${database.filterGenericsString(${reffererEntityClassName})})pkReffererListMap.get(toLowerCaseIfString(${myEntityVariableName}.get${table.getPrimaryKeyJavaNameAsOne()}())));
+            } else {
+                ${myEntityVariableName}.set${refferer.ReffererPropertyNameInitCap}(new java.util.ArrayList${database.filterGenericsString(${reffererEntityClassName})}());
+            }
+        }
+    }
+    #end
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                    Pull Out Foreign
+    //                                                                    ================
+#foreach ($foreignKeys in $table.ForeignKeys)
+  #set ($foreignEntityClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}")
+
+    /**
+     * Pull out the list of foreign table '${foreignEntityClassName}'.
+     * 
+     * @param ${myEntityListVariableName} The list of ${table.uncapitalisedJavaName}. (NotNull)
+     * @return The list of foreign table. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${foreignEntityClassName})} pullout${foreignKeys.foreignPropertyNameInitCap}(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ${myEntityListVariableName}) {
+        assertObjectNotNull("${myEntityListVariableName}", ${myEntityListVariableName});
+        final java.util.Set${database.filterGenericsString(${foreignEntityClassName})} foreignSet = new java.util.LinkedHashSet${database.filterGenericsString(${foreignEntityClassName})}();
+        for (java.util.Iterator ite = ${myEntityListVariableName}.iterator(); ite.hasNext(); ) {
+            final ${myExtendedObjectClassName} ${myEntityVariableName} = (${myExtendedObjectClassName})ite.next();
+            final ${foreignEntityClassName} foreignEntity = ${myEntityVariableName}.get${foreignKeys.foreignPropertyNameInitCap}();
+            if (foreignEntity == null || foreignSet.contains(foreignEntity)) {
+                continue;
+            }
+            foreignSet.add(foreignEntity);
+        }
+        return new java.util.ArrayList${database.filterGenericsString(${foreignEntityClassName})}(foreignSet);
+    }
+#end
+#foreach ($refferer in $table.Referrers)
+  #set ($reffererTable = $refferer.Table)
+  #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+  #if (${refferer.isOneToOne()})
+
+    /**
+     * Pull out the list of referer-as-one table '${foreignEntityClassName}'.
+     * 
+     * @param ${myEntityListVariableName} The list of ${table.uncapitalisedJavaName}. (NotNull)
+     * @return The list of referer-as-one table. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${reffererEntityClassName})} pullout${refferer.reffererPropertyNameInitCapAsOne}(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ${myEntityListVariableName}) {
+        final java.util.Set${database.filterGenericsString(${reffererEntityClassName})} reffererAsOneSet = new java.util.LinkedHashSet${database.filterGenericsString(${reffererEntityClassName})}();
+        for (java.util.Iterator ite = ${myEntityListVariableName}.iterator(); ite.hasNext(); ) {
+            final ${myExtendedObjectClassName} ${myEntityVariableName} = (${myExtendedObjectClassName})ite.next();
+            final ${reffererEntityClassName} refererEntity = ${myEntityVariableName}.get${refferer.reffererPropertyNameInitCapAsOne}();
+            if (refererEntity == null || reffererAsOneSet.contains(refererEntity)) {
+                continue;
+            }
+            reffererAsOneSet.add(refererEntity);
+        }
+        return new java.util.ArrayList${database.filterGenericsString(${reffererEntityClassName})}(reffererAsOneSet);
+    }
+  #end
+#end
+#if ($table.isWritable())
+
+    // ===================================================================================
+    //                                                                 Basic Entity Update
+    //                                                                 ===================
+    /**
+     * Insert.
+     * 
+     * @param ${myEntityVariableName} Entity. (NotNull)
+     */
+    public void insert(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        delegateInsert(${myEntityVariableName});
+    }
+
+    protected void doCreate(${glEntityInterfaceName} ${myEntityVariableName}) {
+        insert((${myExtendedObjectClassName})${myEntityVariableName});
+    }
+
+    /**
+     * Update.
+     * <pre>
+     * If it updates count zero, throws exception.
+     * If concurrency control of this table is valid, this update have it.
+     * </pre>
+     * @param ${myEntityVariableName} Entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public void update(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        final int updatedCount = delegateUpdate(${myEntityVariableName});
+        if (updatedCount == 0) {
+            throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(${myEntityVariableName}.toString());
+        } else if (updatedCount > 1) {
+            String msg = "updatedCount=" + updatedCount + ": " + ${myEntityVariableName}.toString();
+            throw new ${glPackageBaseCommonException}.${glRecordHasOverlappedException}(msg);
+        }
+    }
+
+    protected void doModify(${glEntityInterfaceName} ${myEntityVariableName}) {
+        update((${myExtendedObjectClassName})${myEntityVariableName});
+    }
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+    /**
+     * Update non stritct.
+     * <pre>
+     * This update ignores concurrency control.
+     * This method is faster than updateAfterSelect().
+     * </pre>
+     * @param ${myEntityVariableName} Entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public void updateNonstrict(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        final int updatedCount = delegateUpdateNonstrict(${myEntityVariableName});
+        if (updatedCount == 0) {
+            throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(${myEntityVariableName}.toString());
+        } else if (updatedCount > 1) {
+            String msg = "updatedCount=" + updatedCount + ": " + ${myEntityVariableName}.toString();
+            throw new ${glPackageBaseCommonException}.${glRecordHasOverlappedException}(msg);
+        }
+    }
+  #end
+
+    /**
+     * Update after select.
+     * 
+     * @param ${myEntityVariableName} Entity. This must contain primary-key value at least. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    public void updateAfterSelect(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNullAndHasPrimaryKeyValue(${myEntityVariableName});
+        final ${myConditionBeanClassName} cb = newMyConditionBean();
+        cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(${myEntityVariableName}));
+        final ${myExtendedObjectClassName} currentEntity = selectEntityWithDeletedCheck(cb);
+        mergeEntity(${myEntityVariableName}, currentEntity);
+        update(currentEntity);
+    }
+
+    protected void doModifyAfterSelect(${glEntityInterfaceName} ${myEntityVariableName}) {
+        updateAfterSelect((${myExtendedObjectClassName})${myEntityVariableName});
+    }
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+    /**
+     * Insert or update non strict.
+     * {update: modified only}
+     * <pre>
+     * This method is faster than insertOrUpdateAfterSelect().
+     * </pre>
+     * @param ${myEntityVariableName} Entity. This should contain primary-key value at least(Except use identity). (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public void insertOrUpdateNonStrict(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        if (!${myEntityVariableName}.hasPrimaryKeyValue()) {
+            insert(${myEntityVariableName});
+        } else {
+            try {
+                updateNonstrict(${myEntityVariableName});
+            } catch (org.seasar.dao.NotSingleRowUpdatedRuntimeException e) {
+                insert(${myEntityVariableName});
+            } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException} e) {
+                insert(${myEntityVariableName});
+            }
+        }
+    }
+  #else
+
+    /**
+     * Insert or update.
+     * {update: modified only}
+     * 
+     * @param ${myEntityVariableName} Entity. This should contain primary-key value at least(Except use identity). (NotNull)
+     */
+    public void insertOrUpdate(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        if (!${myEntityVariableName}.hasPrimaryKeyValue()) {
+            insert(${myEntityVariableName});
+        } else {
+            try {
+                update(${myEntityVariableName});
+            } catch (org.seasar.dao.NotSingleRowUpdatedRuntimeException e) {
+                insert(${myEntityVariableName});
+            } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException} e) {
+                insert(${myEntityVariableName});
+            }
+        }
+    }
+  #end
+
+    protected void doCreateOrUpdateNonstrict(${glEntityInterfaceName} ${myEntityVariableName}) {
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+        insertOrUpdateNonStrict((${myExtendedObjectClassName})${myEntityVariableName});
+  #else
+
+        insertOrUpdate((${myExtendedObjectClassName})${myEntityVariableName});
+  #end
+
+    }
+
+    /**
+     * Insert or update after select.
+     * {update: modified only}
+     * 
+     * @param ${myEntityVariableName} Entity. This should contain primary-key value at least(Except use identity). (NotNull)
+     */
+    public void insertOrUpdateAfterSelect(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        if (!${myEntityVariableName}.hasPrimaryKeyValue()) {
+            insert(${myEntityVariableName});
+            return;
+        }
+        ${myExtendedObjectClassName} currentEntity = null;
+        try {
+            final ${myConditionBeanClassName} cb = newMyConditionBean();
+            cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(${myEntityVariableName}));
+            currentEntity = selectEntityWithDeletedCheck(cb);
+        } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException} e) {
+            insert(${myEntityVariableName});
+            return;
+        }
+        assertEntityNotNullAndHasPrimaryKeyValue(${myEntityVariableName});
+        mergeEntity(${myEntityVariableName}, currentEntity);
+        update(currentEntity);
+    }
+
+    protected void doCreateOrModifyAfterSelect(${glEntityInterfaceName} entity) {
+        insertOrUpdateAfterSelect((${myExtendedObjectClassName})entity);
+    }
+  #if ($database.isMakeBehaviorForUpdate())
+
+    /**
+     * Update after select-for-update.
+     * 
+     * @param ${myEntityVariableName} Entity. This must contain primary-key value at least. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @deprecated This method is deprecated.
+     */
+    public void updateAfterSelectForUpdate(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNullAndHasPrimaryKeyValue(${myEntityVariableName});
+        final ${myConditionBeanClassName} cb = newMyConditionBean();
+        cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(${myEntityVariableName}));
+        cb.lockForUpdate();
+        final ${myExtendedObjectClassName} currentEntity = selectEntityWithDeletedCheck(cb);
+        mergeEntity(${myEntityVariableName}, currentEntity);
+        update(currentEntity);
+    }
+
+    protected void doModifyAfterSelectForUpdate(${glEntityInterfaceName} entity) {
+        updateAfterSelectForUpdate((${myExtendedObjectClassName})entity);
+    }
+
+    /**
+     * Insert or update after select-for-update.
+     * {update: modified only}
+     * 
+     * @param ${myEntityVariableName} Entity. This must contain primary-key value at least(Except use identity). (NotNull)
+     * @deprecated This method is deprecated.
+     */
+    public void insertOrUpdateAfterSelectForUpdate(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        if (!${myEntityVariableName}.hasPrimaryKeyValue()) {
+            insert(${myEntityVariableName});
+            return;
+        }
+        ${myExtendedObjectClassName} currentEntity = null;
+        try {
+            final ${myConditionBeanClassName} cb = newMyConditionBean();
+            cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(${myEntityVariableName}));
+            cb.lockForUpdate();
+            currentEntity = selectEntityWithDeletedCheck(cb);
+        } catch (${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException} e) {
+            insert(${myEntityVariableName});
+            return;
+        }
+        assertEntityNotNullAndHasPrimaryKeyValue(${myEntityVariableName});
+        mergeEntity(${myEntityVariableName}, currentEntity);
+        update(${myEntityVariableName});
+    }
+
+    protected void doCreateOrModifyAfterSelectForUpdate(${glEntityInterfaceName} ${myEntityVariableName}) {
+        insertOrUpdateAfterSelectForUpdate((${myExtendedObjectClassName})${myEntityVariableName});
+    }
+  #end
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param sourceEntity Source entity. (NotNull)
+     * @param destinationEntity Destination entity. (NotNull)
+     */
+    protected void mergeEntity(${glEntityInterfaceName} sourceEntity, ${glEntityInterfaceName} destinationEntity) {
+        assertEntityNotNull(sourceEntity);
+        assertEntityNotNull(destinationEntity);
+        final ${myExtendedObjectClassName} sourceMyEntity = (${myExtendedObjectClassName})sourceEntity;
+        final ${myExtendedObjectClassName} destinationMyEntity = (${myExtendedObjectClassName})destinationEntity;
+        destinationMyEntity.clearModifiedPropertyNames();
+        final java.util.Set${database.filterGenericsString('String')} names = sourceMyEntity.getModifiedPropertyNames();
+
+#foreach ($col in $table.Columns)
+        if (names.contains("${col.UncapitalisedJavaName}")) { destinationMyEntity.set${col.JavaName}(sourceMyEntity.get${col.JavaName}()); }
+#end
+
+    }
+
+    /**
+     * Delete.
+     * 
+     * @param ${myEntityVariableName} Entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public void delete(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        final int deletedCount = delegateDelete(${myEntityVariableName});
+        if (deletedCount == 0) {
+            throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(${myEntityVariableName}.toString());
+        } else if (deletedCount > 1) {
+            String msg = "deletedCount=" + deletedCount + ": " + ${myEntityVariableName}.toString();
+            throw new ${glPackageBaseCommonException}.${glRecordHasOverlappedException}(msg);
+        }
+    }
+
+    protected void doRemove(${glEntityInterfaceName} ${myEntityVariableName}) {
+        delete((${myExtendedObjectClassName})${myEntityVariableName});
+    }
+
+    /**
+     * Delete after select.
+     * 
+     * @param ${myEntityVariableName} Entity. This must contain primary-key value at least. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    public void deleteAfterSelect(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNullAndHasPrimaryKeyValue(${myEntityVariableName});
+        final ${myConditionBeanClassName} cb = newMyConditionBean();
+        cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(${myEntityVariableName}));
+        selectEntityWithDeletedCheck(cb);
+        delete(${myEntityVariableName});
+    }
+
+    protected void doRemoveAfterSelect(${glEntityInterfaceName} ${myEntityVariableName}) {
+        deleteAfterSelect((${myExtendedObjectClassName})${myEntityVariableName});
+    }
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+    /**
+     * Delete non stritct.
+     * <pre>
+     * This delete ignores concurrency control.
+     * This method is faster than deleteAfterSelect().
+     * </pre>
+     * @param ${myEntityVariableName} Entity. (NotNull)
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     * @exception ${glPackageBaseCommonException}.${glRecordHasOverlappedException}
+     */
+    public void deleteNonstrict(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        final int deletedCount = delegateDeleteNonstrict(${myEntityVariableName});
+        if (deletedCount == 0) {
+            throw new ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}(${myEntityVariableName}.toString());
+        } else if (deletedCount > 1) {
+            String msg = "deletedCount=" + deletedCount + ": " + ${myEntityVariableName}.toString();
+            throw new ${glPackageBaseCommonException}.${glRecordHasOverlappedException}(msg);
+        }
+    }
+  #end
+
+    // ===================================================================================
+    //                                                                  Basic Batch Update
+    //                                                                  ==================
+    /**
+     * Insert list.
+     * 
+     * @param ${myEntityListVariableName} Entity-list. (NotNull & NotEmpty)
+     * @return Inserted count.
+     */
+    public int insertList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ${myEntityListVariableName}) {
+        assertListNotNullAndNotEmpty(${myEntityListVariableName});
+        return delegateInsertList(${myEntityListVariableName});
+    }
+
+    /**
+     * Update list.
+     * 
+     * @param ${myEntityListVariableName} Entity-list. (NotNull & NotEmpty)
+     * @return Updated count.
+     */
+    public int updateList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ${myEntityListVariableName}) {
+        assertListNotNullAndNotEmpty(${myEntityListVariableName});
+        return delegateUpdateList(${myEntityListVariableName});
+    }
+
+    /**
+     * Delete list.
+     * 
+     * @param ${myEntityListVariableName} Entity-list. (NotNull & NotEmpty)
+     * @return Deleted count.
+     */
+    public int deleteList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} ${myEntityListVariableName}) {
+        assertListNotNullAndNotEmpty(${myEntityListVariableName});
+        return delegateDeleteList(${myEntityListVariableName});
+    }
+
+    // ===================================================================================
+    //                                                                      Various Insert
+    //                                                                      ==============
+  #if ($table.isUseIdentity())
+    #if ($table.hasPrimaryKey())
+
+    /* (non-javadoc) 
+     * Copy-insert.
+     * 
+     * @param primaryKey Primary-keys. (NotNull)
+     * @return Inserted count.
+     * @exception ${glPackageBaseCommonException}.${glRecordHasAlreadyBeenDeletedException}
+     */
+    public int copyInsertByPKValueAfterSelect(${table.PrimaryKeyArgsString}) {
+        ${myExtendedObjectClassName} entity = new ${myExtendedObjectClassName}();
+        ${table.getPrimaryKeyArgsSetupString('entity')}
+        final ${myConditionBeanClassName} cb = newMyConditionBean();
+        cb.acceptPrimaryKeyMapString(getDBMeta().extractPrimaryKeyMapString(entity));
+        final ${myExtendedObjectClassName} currentEntity = selectEntityWithDeletedCheck(cb);
+        return delegateInsert(currentEntity);
+    }
+    #end
+
+    /**
+     * Filter 'copy-insert' entity.
+     * 
+     * @param ${myEntityVariableName} Entity. (NotNull)
+     */
+    protected void filterCopyInsertEntity(${myExtendedObjectClassName} ${myEntityVariableName}) {
+    }
+  #end
+#else
+  #if ($table.isAvailableNonPrimaryKeyWritable())
+
+    // ===================================================================================
+    //                                                                 Basic Entity Update
+    //                                                                 ===================
+    /**
+     * Insert.
+     * 
+     * @param ${myEntityVariableName} Entity. (NotNull)
+     */
+    public void insert(${myExtendedObjectClassName} ${myEntityVariableName}) {
+        assertEntityNotNull(${myEntityVariableName});
+        delegateInsert(${myEntityVariableName});
+    }
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                          CBSetupper
+    //                                                                          ==========
+#if ($database.isAvailableGenerics())
+    /**
+     * The interface of condition-bean setupper.
+     */
+    public static interface CBSetupper extends ${glConditionBeanSetupperName}<${myConditionBeanClassName}> {
+
+        /**
+         * Set up condition.
+         * 
+         * @param cb Condition-bean. (NotNull)
+         */
+        public void setup(${myConditionBeanClassName} cb);
+    }
+#else
+    /**
+     * The interface of condition-bean setupper.
+     */
+    public static interface CBSetupper extends SimpleCBSetupper {
+
+        /**
+         * Set up condition.
+         * 
+         * @param cb Condition-bean. (NotNull)
+         */
+        public void setup(${myConditionBeanClassName} cb);
+    }
+#end
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BaseDao.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BaseDao.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BaseDao.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,243 @@
+#set ($myClassName = "${myBaseDaoClassName}")
+
+package ${myBaseDaoPackageName};
+
+import ${glPackageExtendedEntity}.${myExtendedObjectClassName};
+#set ($InterfaceName = "")
+#if ($table.isWritable())
+  #set ($InterfaceName = "${glPackageBaseCommon}.${glDaoWritableInterfaceName}")
+#else
+  #set ($InterfaceName = "${glPackageBaseCommon}.${glDaoReadableInterfaceName}")
+#end
+
+/**
+ * The dao interface of ${table.Name}.
+ * 
+ * <pre>
+ * [primary-key]
+ *     ${table.primaryKeyNameCommaString}
+ * 
+ * [column-property]
+ *     ${table.columnNameCommaString}
+ * 
+ * [foreign-property]
+ *     ${table.foreignPropertyNameCommaString}
+ * 
+ * [refferer-property]
+ *     ${table.referrerPropertyNameCommaString}
+ * 
+ * [sequence]
+ *     ${table.definedSequenceName}
+ * 
+ * [identity]
+ *     ${table.identityPropertyName}
+ * 
+ * [update-date]
+ *     ${table.updateDateJavaName}
+ * 
+ * [version-no]
+ *     ${table.versionNoJavaName}
+ * 
+ * </pre>
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${myClassName} extends ${InterfaceName} {
+
+    /** BEAN-Annotation. */
+    public Class BEAN = ${glPackageExtendedEntity}.${myExtendedObjectClassName}.class;
+
+    /** SQL-Annotation for getCountAll(). */
+    public static final String getCountAll_SQL = "select count(*) from ${table.Name}";
+
+    /**
+     * Get count as all.
+     * 
+     * @return All count.
+     */
+    public int getCountAll();
+
+    /** SQL-Annotation for getListAll(). */
+    public static final String getListAll_SQL = "select * from ${table.Name}";
+
+    /**
+     * Get list as all.
+     * 
+     * @return All list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} getListAll();
+#if ($table.isWritable())
+
+    /** SQL-Annotation for getEntity(). */
+    public static final String getEntity_SQL = "select * from ${table.Name} where ${table.PrimaryKeyWhereStringWithSqlComment}";
+
+    /** Args-Annotation for getEntity(). */
+    public static final String getEntity_ARGS = "${table.PrimaryKeyUncapitalisedJavaNameCommaString}";
+
+    /* (non-javadoc)
+     * Get entity by primary key.
+     * 
+     * @param primaryKey Primary key. (NotNull)
+     */
+    public ${myExtendedObjectClassName} getEntity(${table.PrimaryKeyArgsString});
+#end
+
+    /**
+     * Select count by condition-bean.
+     * <pre>
+     * Ignore fetchFirst() and fetchScope() and fetchPage().
+     * But the fetch status of the condition-bean remains as it is.
+     * This select method generates SQL based on condition-bean.
+     * 
+     * Example)
+     *   final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *   cb.query().setXxx_GreaterEqual(new BigDecimal(14));
+     *   final int count = dao.selectCount(cb);
+     * </pre>
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected count. (NotNull)
+     */
+    public int selectCount(${myAttachedCBArgsString});
+
+    /**
+     * Select entity '${myExtendedObjectClassName}' by condition-bean.
+     * <pre>
+     * This select method generates SQL based on condition-bean.
+     * 
+     * Example)
+     *   final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *   cb.query().setXxxCode_Equal("abc");// It is assumed that this is the primary key...
+     *   cb.lockForUpdate();
+     *   final ${myExtendedObjectClassName} entity = dao.selectEntity(cb);
+     * </pre>
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected entity. If the select result is zero, it returns null. (Nullable)
+     */
+    public ${myExtendedObjectClassName} selectEntity(${myAttachedCBArgsString});
+
+    /**
+     * Select list by condition-bean.
+     * <pre>
+     * This select method generates SQL based on condition-bean.
+     * 
+     * Example)
+     *   final ${myConditionBeanClassName} cb = new ${myConditionBeanClassName}();
+     *   cb.setupSelect_Xxx(); // Including the foreign table in select clause
+     *   cb.query().setXxxName_PrefixSearch("abc");
+     *   cb.query().setXxxStartDate_IsNotNull();
+     *   cb.addOrderBy_PK_Asc().fetchFirst(20);
+     *   final List resultList = dao.selectList(cb);
+     * </pre>
+     * 
+     * @param cb Condition-bean. (NotNull)
+     * @return Selected list. If the select result is zero, it returns empty list. (NotNull)
+     */
+    public java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} selectList(${myAttachedCBArgsString});
+
+#if ($table.isWritable())
+
+    /**
+     * Insert one entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Inserted count.
+     */
+    public int insert(${myExtendedObjectClassName} entity);
+
+    /**
+     * Update one entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Updated count.
+     */
+    public int update(${myExtendedObjectClassName} entity);
+
+    /**
+     * Update one entity. (modified only)
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Updated count.
+     */
+    public int updateModifiedOnly(${myExtendedObjectClassName} entity);
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+    /**
+     * Update one entity. (non strict & modified only)
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Updated count.
+     */
+    public int updateNonstrictModifiedOnly(${myExtendedObjectClassName} entity);
+  #end
+
+    /**
+     * Delete one entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Deleted count.
+     */
+    public int delete(${myExtendedObjectClassName} entity);
+  #if ($database.isVersionAfter1040() && ($table.isUseUpdateDate() || $table.isUseVersionNo()))
+
+    /**
+     * Delete one entity. (non strict)
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Deleted count.
+     */
+    public int deleteNonstrict(${myExtendedObjectClassName} entity);
+  #end
+
+    /**
+     * Insert several entities.
+     * 
+     * @param entityList Entity-list. (NotNull)
+     * @return Inserted count.
+     */
+    public int insertList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} entityList);
+
+    /**
+     * Update several entities.
+     * 
+     * @param entityList Entity-list. (NotNull)
+     * @return Updated count.
+     */
+    public int updateList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} entityList);
+
+    /**
+     * Delete several entities.
+     * 
+     * @param entityList Entity-list. (NotNull)
+     * @return Deleted count.
+     */
+    public int deleteList(java.util.List${database.filterGenericsString(${myExtendedObjectClassName})} entityList);
+#else
+  #if ($table.isAvailableNonPrimaryKeyWritable())
+
+    /** SQL-Annotation for insert(). */
+    public static final String insert_SQL = "insert into ${table.Name}(${table.columnNameCommaString}) values(${table.insertClauseValuesAsSqlComment})";
+
+    /**
+     * Insert one entity.
+     * 
+     * @param entity Entity. (NotNull)
+     * @return Inserted count.
+     */
+    public int insert(${myExtendedObjectClassName} entity);
+  #end
+#end
+#if ($table.isUseSequence())
+
+    /** SQL-Annotation for selectNextVal(). */
+    public String selectNextVal_SQL = "${table.SequenceNextSql}";
+
+    /**
+     * Select next value as sequence.
+     * 
+     * @return Next value. (NotNull)
+     */
+    public ${database.sequenceReturnType} selectNextVal();
+#end
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BsParameterBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BsParameterBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/BsParameterBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,73 @@
+package ${glPackageBaseParameterBean};
+
+#set ($myClassName = "${myBaseParameterBeanClassName}")
+
+/**
+ * The parametaer-bean of ${pmbClassName}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} ${database.getPmbMetaDataSuperClassDefinition($pmbClassName)}{
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+#foreach ($propertyName in $database.getPmbMetaDataPropertySet($pmbClassName))
+  #set ($propertyType = $database.getPmbMetaDataPropertyType($pmbClassName, $propertyName))
+
+    /** The value of ${propertyName}. */
+    protected ${propertyType} _${propertyName};
+#end
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+#foreach ($propertyName in $database.getPmbMetaDataPropertySet($pmbClassName))
+  #set ($propertyType = $database.getPmbMetaDataPropertyType($pmbClassName, $propertyName))
+
+    /**
+     * Get the value of ${propertyName}.
+     * 
+     * @return The value of ${propertyName}.
+     */
+    public ${propertyType} get${database.initCap($propertyName)}() {
+        return _${propertyName};
+    }
+
+    /**
+     * Set the value of ${propertyName}.
+     * 
+     * @param value The value of ${propertyName}.
+     */
+    public void set${database.initCap($propertyName)}(${propertyType} ${propertyName}) {
+        _${propertyName} = ${propertyName};
+    }
+#end
+
+    // ===================================================================================
+    //                                                                      Basic Override
+    //                                                                      ==============
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Property-string. (NotNull)
+     */
+    public String toString() {
+        final StringBuffer sb = new StringBuffer();
+#foreach ($propertyName in $database.getPmbMetaDataPropertySet($pmbClassName))
+
+        sb.append(" ${propertyName}=").append(_${propertyName});
+#end
+
+        return sb.toString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/customize/BaseCustomizeDao.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/customize/BaseCustomizeDao.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsdao/customize/BaseCustomizeDao.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,30 @@
+#set ($myClassName = "${myBaseDaoClassName}")
+
+package ${myBaseDaoPackageName};
+
+import ${glPackageExtendedCustomizeEntity}.${myExtendedObjectClassName};
+import ${glPackageBaseCommon}.${glDaoReadableInterfaceName};
+#foreach ($import in $table.getCustomizeDaoImportList())
+
+${import};
+#end
+
+/**
+ * The customize dao interface of ${table.Name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${myClassName} extends ${glDaoReadableInterfaceName} {
+
+    /** BEAN-Annotation. */
+    public Class BEAN = ${myExtendedObjectClassName}.class;
+
+#foreach ($methodName in $table.getCustomizeDaoMethodNameList())
+  #set ($argument = $table.getCustomizeDaoMethodMap().get($methodName))
+
+    public String ${methodName}_ARGS = "${table.getCustomizeDaoArgumentVariableCommaString(${methodName})}";
+
+    public ${table.getCustomizeDaoReturnType(${methodName})} ${methodName}(${argument});
+#end
+
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/BaseEntity.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/BaseEntity.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/BaseEntity.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,745 @@
+package ${myBaseEntityPackageName};
+#set ($myClassName = "${myBaseObjectClassName}")
+
+#if (${table.hasAllCommonColumn()})
+
+import ${glPackageBaseCommon}.${glEntityDefinedCommonColumnInterfaceName};
+#else
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+#end
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+#if (!$isSql2Entity)
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInstanceHandlerName};
+#end
+#set ($myEntityInterfaceName = "")
+#if (${table.hasAllCommonColumn()})
+  #set ($myEntityInterfaceName = ${glEntityDefinedCommonColumnInterfaceName})
+#else
+  #set ($myEntityInterfaceName = ${glEntityInterfaceName})
+#end
+
+/**
+ * The entity of ${table.Name}.
+ * 
+ * <pre>
+ * [primary-key]
+ *     ${table.PrimaryKeyNameCommaString}
+ * 
+ * [column-property]
+ *     ${table.ColumnNameCommaString}
+ * 
+ * [foreign-property]
+ *     ${table.ForeignPropertyNameCommaString}
+ * 
+ * [refferer-property]
+ *     ${table.ReferrerPropertyNameCommaString}
+ * 
+ * [sequence]
+ *     ${table.DefinedSequenceName}
+ * 
+ * [identity]
+ *     ${table.IdentityPropertyName}
+ * 
+ * [update-date]
+ *     ${table.UpdateDateJavaName}
+ * 
+ * [version-no]
+ *     ${table.VersionNoJavaName}
+ * 
+ * </pre>
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class $myClassName implements ${myEntityInterfaceName}, java.io.Serializable {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    /** TABLE-Annotation for S2Dao */
+    public static final String TABLE = "${table.AnnotationTableName}";
+
+#if ($table.isUseUpdateDate())
+    
+    /** TIMESTAMP-Annotation */
+    public static final String TIMESTAMP_PROPERTY = "$table.UpdateDateUncapitalisedJavaName";
+#end
+#if ($table.isUseVersionNo())
+    
+    /** VERSION_NO-Annotation */
+    public static final String VERSION_NO_PROPERTY = "$table.VersionNoUncapitalisedJavaName";
+#end
+#if ($table.isUseIdentity())
+    
+    /** ID-Annotation */
+    public static final String ${table.IdentityPropertyName}_ID = "identity";
+#end
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    /** Entity modified properties. (for S2Dao) */
+    protected EntityModifiedProperties _modifiedProperties = newEntityModifiedProperties();
+
+#foreach ($col in $table.Columns)
+  #if ($database.isMakeDeprecated())
+
+    /** The value of ${col.UncapitalisedJavaName}. ColumnDefinition -- ${col.columnDefinitionLineDisp}*/
+    protected ${col.JavaNative} _${col.UncapitalisedJavaName};
+
+    /** Has the setter of ${col.UncapitalisedJavaName} been invoked? */
+    protected boolean _isSetterInvoked${col.JavaName};
+  #else
+
+    /** The value of ${col.UncapitalisedJavaName}. ColumnDefinition -- ${col.columnDefinitionLineDisp}*/
+    protected ${col.JavaNative} _${col.UncapitalisedJavaName};
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+#if ($isSql2Entity)
+    // ===================================================================================
+    //                                                                              DBMeta
+    //                                                                              ======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return DBMeta. (NotNull)
+     */
+    public ${glDBMetaInterfaceName} getDBMeta() {
+        return ${myDBMetaPackageName}.${myDBMetaClassName}.getInstance();
+    }
+#else
+
+    // ===================================================================================
+    //                                                                              DBMeta
+    //                                                                              ======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return DBMeta. (NotNull)
+     */
+    public ${glDBMetaInterfaceName} getDBMeta() {
+        return ${glDBMetaInstanceHandlerName}.getInstanceByTableDbName(getTableDbName());
+    }
+#end
+
+    // ===================================================================================
+    //                                                                          Table Name
+    //                                                                          ==========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName() {
+        return "${table.name}";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table cap-prop-name. (NotNull)
+     */
+    public String getTableCapPropName() {
+        return "${table.javaName}";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table uncap-prop-name. (NotNull)
+     */
+    public String getTableUncapPropName() {
+        return "${table.uncapitalisedJavaName}";
+    }
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+#foreach ($col in $table.Columns)
+
+    /** Column-Annotation for S2Dao. ColumnDefinition -- ${col.columnDefinitionLineDisp}*/
+    public static final String ${col.JavaBeansRulePropertyName}_COLUMN = "${col.Name}";
+
+    /**
+     * Get the value of ${col.UncapitalisedJavaName}. <br />
+     * {${col.columnDefinitionLineDisp}}
+     * 
+     * @return The value of ${col.UncapitalisedJavaName}. (Nullable)
+     */
+    public ${col.JavaNative} get${col.JavaName}() {
+        return _${col.UncapitalisedJavaName};
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName}. <br />
+     * {${col.columnDefinitionLineDisp}}
+     * 
+     * @param ${col.UncapitalisedJavaName} The value of ${col.UncapitalisedJavaName}. (Nullable)
+     */
+    public void set${col.JavaName}(${col.JavaNative} ${col.UncapitalisedJavaName}) {
+        _modifiedProperties.addPropertyName("${col.JavaBeansRulePropertyName}");
+        _${col.UncapitalisedJavaName} = ${col.UncapitalisedJavaName};
+    }
+#end
+
+#if ($table.hasAllCommonColumn())
+  #foreach ($columnName in ${database.commonColumnNameConvertionList})
+    #set ($filteredColumnName = ${database.filterCommonColumn(${columnName})})
+    #set ($commonColumnMap = ${database.commonColumnMap})
+    #set ($columnType = ${commonColumnMap.get(${columnName})})
+    #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+    #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+    #set ($uncapitalisedJavaName = ${database.convertUncapitalisedJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+    #set ($targetJavaName = ${table.findTargetColumnJavaNameByCommonColumnName(${columnName})})
+
+    /**
+     * Get the value of ${uncapitalisedJavaName}. <br />
+     * 
+     * @return The value of ${uncapitalisedJavaName}. (Nullable)
+     */
+    public ${javaNative} get${javaName}() {
+        return get${targetJavaName}();
+    }
+
+    /**
+     * Set the value of ${uncapitalisedJavaName}. <br />
+     * 
+     * @param ${uncapitalisedJavaName} The value of ${uncapitalisedJavaName}. (Nullable)
+     */
+    public void set${javaName}(${javaNative} ${uncapitalisedJavaName}) {
+        set${targetJavaName}(${uncapitalisedJavaName});
+    }
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                     Classify Method
+    //                                                                     ===============
+#foreach ($col in $table.Columns)
+  #if (${col.hasClassification()})
+    #foreach ($classificationMap in $col.ClassificationMapList)
+
+    /**
+     * Classify the value of ${col.UncapitalisedJavaName} as ${classificationMap.get('name')}. <br />
+     * ${classificationMap.get('comment')} <br />
+     */
+    public void classify${col.JavaName}${classificationMap.get('name')}() {
+        String code = ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+        set${col.JavaName}(new ${col.JavaNative}(code));
+    }
+    #end
+  #end
+#end
+
+    // ===================================================================================
+    //                                                        Classification Determination
+    //                                                        ============================
+#foreach ($col in $table.Columns)
+  #if (${col.hasClassification()})
+    #foreach ($classificationMap in $col.ClassificationMapList)
+
+    /**
+     * Is the value of ${col.UncapitalisedJavaName} '${classificationMap.get('name')}'? <br />
+     * ${classificationMap.get('comment')} <br />
+     * <pre>
+     * The difference of capital letters and small letters is NOT distinguished.
+     * If the value is null, this method returns false!
+     * </pre>
+     * 
+     * @return Determanation.
+     */
+    public boolean is${col.JavaName}${classificationMap.get('name')}() {
+        return helpEqualingIgnoreCaseClassification(_${col.UncapitalisedJavaName}, ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')});
+    }
+    #end
+  #end
+#end
+
+#if (${table.hasClassification()})
+    private boolean helpEqualingIgnoreCaseClassification(Object value, String code) {
+        if (value == null) { return false; }
+        return code.equalsIgnoreCase(value.toString());
+    }
+#end
+
+    // ===================================================================================
+    //                                                               Classification Getter
+    //                                                               =====================
+#foreach ($col in $table.Columns)
+  #if (${col.hasClassification()})
+    #if (${col.hasClassificationName()})
+
+    /**
+     * Get the value of ${col.UncapitalisedJavaName} as classification-name.
+     * 
+     * @return The value of ${col.UncapitalisedJavaName} as classification-name. (Nullable)
+     */
+    public String get${col.JavaName}Name() {
+        return helpGettingFromClassificationMap(_${col.UncapitalisedJavaName}, ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_NAME_MAP_${col.ClassificationName});
+    }
+    #end
+    #if (${col.hasClassificationAlias()})
+
+    /**
+     * Get the value of ${col.UncapitalisedJavaName} as classification-alias.
+     * 
+     * @return The value of ${col.UncapitalisedJavaName} as classification-alias. (Nullable)
+     */
+    public String get${col.JavaName}Alias() {
+        return helpGettingFromClassificationMap(_${col.UncapitalisedJavaName}, ${glPackageBaseCommon}.${glClassificationDefinition}.CODE_ALIAS_MAP_${col.ClassificationName});
+    }
+    #end
+  #end
+#end
+
+#if (${table.hasClassification()})
+    private String helpGettingFromClassificationMap(Object key, java.util.Map${database.filterGenericsString('String, String')} map) {
+        if (key == null) { return null; }
+        return (String)map.get(key.toString()); 
+    }
+#end
+
+    // ===================================================================================
+    //                                                                       Foreign Table
+    //                                                                       =============
+#set ($foreignKeysIndex = 0)
+#foreach ($foreignKeys in $table.ForeignKeys)
+  #set ($foreignVariableName = "${glParentVariablePrefix}${foreignKeys.ForeignPropertyNameInitCap}")
+  #set ($foreignDaoClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}Dao")
+  #set ($foreignEntityClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}")
+  #set ($parentCBClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}${glConditionBeanInitialName}")
+
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   ForeignTable    = [${foreignKeys.foreignTable.name}]
+    //   ForeignProperty = [${foreignKeys.foreignPropertyName}]
+    // * * * * * * * * */
+
+    /** RELNO of foreign table for s2dao. */
+    public static final int ${foreignKeys.ForeignJavaBeansRulePropertyName}_RELNO = ${foreignKeysIndex};
+
+    /** RELKEYS of foreign table for s2dao. */
+    public static final String ${foreignKeys.ForeignJavaBeansRulePropertyName}_RELKEYS = "$foreignKeys.RelationKeysCommaString";
+
+    /** The entity of foreign table. */
+    protected ${glPackageExtendedEntity}.${foreignEntityClassName} ${foreignVariableName};
+
+    /**
+     * Get the entity of foreign table without lazyload.
+     * 
+     * @return The entity of foreign table.
+     */
+    public ${glPackageExtendedEntity}.${foreignEntityClassName} get${foreignKeys.foreignPropertyNameInitCap}() {
+        return ${foreignVariableName};
+    }
+
+    /**
+     * Set the entity of foreign table.
+     * 
+     * @param v The entity of foreign table.
+     */
+    public void set${foreignKeys.foreignPropertyNameInitCap}(${glPackageExtendedEntity}.${foreignEntityClassName} entity) {
+        this.${foreignVariableName} = entity;
+    }
+
+    /**
+     * Has relation object of ${foreignKeys.foreignPropertyName}.
+     * 
+     * @return Determination.
+     */
+    public boolean hasRelation${foreignKeys.foreignPropertyNameInitCap}() {
+        return ${foreignVariableName} != null && ${foreignVariableName}.hasPrimaryKeyValue();
+    }
+
+  #set ($foreignKeysIndex = $foreignKeysIndex + 1)
+#end
+
+    // ===================================================================================
+    //                                                                      Refferer Table
+    //                                                                      ==============
+#foreach ($refferer in $table.Referrers)
+  #set ($reffererTable = $refferer.Table)
+  #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+  #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+  #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+  #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+  #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+
+  #if (${refferer.isOneToOne()})
+
+    // /* * * * * * * * * * * * * * * * * * * * * * * {as one}
+    //   ReffererTable    = [${refferer.Table.Name}]
+    //   ReffererProperty = [${refferer.ReffererPropertyName}]
+    // * * * * * * * * */
+
+    /** RELNO of foreign table for s2dao. */
+    public static final int ${refferer.ReffererJavaBeansRulePropertyNameAsOne}_RELNO = ${foreignKeysIndex};
+
+    /** RELKEYS of foreign table for s2dao. */
+    public static final String ${refferer.ReffererJavaBeansRulePropertyNameAsOne}_RELKEYS = "$refferer.RelationKeysCommaStringForOneToOneRefferer";
+    #set ($foreignKeysIndex = $foreignKeysIndex + 1)
+  #else
+
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   ReffererTable    = [${refferer.Table.Name}]
+    //   ReffererProperty = [${refferer.ReffererPropertyName}]
+    // * * * * * * * * */
+  #end
+
+    /** The list of refferer table. */
+    protected java.util.List${database.filterGenericsString(${reffererEntityLongClassName})} $reffererVariableName;
+
+    /**
+     * Get the list of refferer table without lazyload.
+     * If it's not loaded yet, returns null.
+     * 
+     * @return The list of refferer table. (Nullable)
+     */
+    public java.util.List${database.filterGenericsString(${reffererEntityLongClassName})} get${refferer.ReffererPropertyNameInitCap}() {
+        return ${reffererVariableName};
+    }
+
+    /**
+     * Set the list of refferer table.
+     * 
+     * @param value The list of refferer table. (Nullable)
+     */
+    public void set${refferer.ReffererPropertyNameInitCap}(java.util.List${database.filterGenericsString(${reffererEntityLongClassName})} entity) {
+        this.${reffererVariableName} = entity;
+    }
+  #if (${refferer.isOneToOne()})
+
+    /**
+     * Get the entity of refferer table as one without lazyload.
+     * If it's not loaded yet, returns null.
+     * If the size of the refferer table list is zero, throws the exception.
+     * 
+     * @return The entity of refferer table. (Nullable)
+     */
+    public ${reffererEntityLongClassName} get${refferer.reffererPropertyNameInitCapAsOne}() {
+        final java.util.List${database.filterGenericsString(${reffererEntityLongClassName})} ls = get${refferer.ReffererPropertyNameInitCap}();
+        if (ls == null || ls.isEmpty()) {
+            return null;
+        }
+        if (ls.size() > 1) {
+            String msg = "The size of the list must be one because this relation is 'one-to-one'";
+            msg = msg + ": list=" + ls + ": toString()=" + toString();
+            throw new IllegalStateException(msg);
+        }
+        return (${reffererEntityLongClassName})ls.get(0);
+    }
+
+    /**
+     * Set the entity of refferer table as one.
+     * 
+     * @param entity The entity of refferer table. (Nullable)
+     */
+    public void set${refferer.reffererPropertyNameInitCapAsOne}(${reffererEntityLongClassName} entity) {
+        if (entity == null) {
+            ${reffererVariableName} = null;
+            return;
+        }
+        final java.util.List${database.filterGenericsString(${reffererEntityLongClassName})} ls = new java.util.ArrayList${database.filterGenericsString(${reffererEntityLongClassName})}();
+        ls.add(entity);
+        ${reffererVariableName} = ls;
+    }
+
+    /**
+     * Has relation of ${refferer.reffererPropertyNameAsOne}.
+     * 
+     * @return Determination.
+     */
+    public boolean hasRelation${refferer.reffererPropertyNameInitCapAsOne}() {
+        return get${refferer.reffererPropertyNameInitCapAsOne}() != null && get${refferer.reffererPropertyNameInitCapAsOne}().hasPrimaryKeyValue();
+    }
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                              Accept
+    //                                                                              ======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param primaryKeyMap Primary key map. (NotNull and NotEmpty)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().acceptPrimaryKeyMap(entity, primaryKeyMap);
+     */
+    public void acceptPrimaryKeyMap(java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap) {
+        getDBMeta().acceptPrimaryKeyMap(this, primaryKeyMap);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param primaryKeyMapString Primary-key map-string. (NotNull and NotEmpty)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().acceptPrimaryKeyMapString(entity, primaryKeyMapString);
+     */
+    public void acceptPrimaryKeyMapString(String primaryKeyMapString) {
+        getDBMeta().acceptPrimaryKeyMapString(this, primaryKeyMapString);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param columnValueMap Column-value map. (NotNull and NotEmpty)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().acceptColumnValueMap(entity, columnValueMap);
+     */
+    public void acceptColumnValueMap(java.util.Map${database.filterGenericsString('String, ? extends Object')} columnValueMap) {
+        getDBMeta().acceptColumnValueMap(this, columnValueMap);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param columnValueMapString Column-value map-string. (NotNull and NotEmpty)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().acceptColumnValueMap(entity, columnValueMapString);
+     */
+    public void acceptColumnValueMapString(String columnValueMapString) {
+        getDBMeta().acceptColumnValueMapString(this, columnValueMapString);
+    }
+
+    // ===================================================================================
+    //                                                                             Extract
+    //                                                                             =======
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Primary-key map-string. (NotNull)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().extractPrimaryKeyMapString(entity);
+     */
+    public String extractPrimaryKeyMapString() {
+        return getDBMeta().extractPrimaryKeyMapString(this);
+    }
+
+    /**
+     * Extract primary-key map-string.
+     * 
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Primary-key map-string. (NotNull)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().extractPrimaryKeyMapString(entity, startBrace, endBrace, delimiter, equal);
+     */
+    public String extractPrimaryKeyMapString(String startBrace, String endBrace, String delimiter, String equal) {
+        return getDBMeta().extractPrimaryKeyMapString(this, startBrace, endBrace, delimiter, equal);
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Column-value map-string. (NotNull)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().extractColumnValueMapString(entity);
+     */
+    public String extractColumnValueMapString() {
+        return getDBMeta().extractColumnValueMapString(this);
+    }
+
+    /**
+     * Extract column-value map-string.
+     * 
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().extractColumnValueMapString(entity, startBrace, endBrace, delimiter, equal);
+     */
+    public String extractColumnValueMapString(String startBrace, String endBrace, String delimiter, String equal) {
+        return getDBMeta().extractColumnValueMapString(this, startBrace, endBrace, delimiter, equal);
+    }
+
+#if (${table.hasAllCommonColumn()})
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Column-value map-string. (NotNull)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().extractCommonColumnValueMapString(entity);
+     */
+    public String extractCommonColumnValueMapString() {
+        return getDBMeta().extractCommonColumnValueMapString(this);
+    }
+
+    /**
+     * Extract common-column-value map-string.
+     * 
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Common-column-value map-string. (NotNull)
+     * @deprecated Please use ${myDBMetaClassName}.getInstance().extractCommonColumnValueMapString(entity, startBrace, endBrace, delimiter, equal);
+     */
+    public String extractCommonColumnValueMapString(String startBrace, String endBrace, String delimiter, String equal) {
+        return getDBMeta().extractCommonColumnValueMapString(this, startBrace, endBrace, delimiter, equal);
+    }
+#end
+
+    // ===================================================================================
+    //                                                                       Determination
+    //                                                                       =============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determination.
+     */
+    public boolean hasPrimaryKeyValue() {
+
+#foreach ($col in $table.PrimaryKey)
+        if (_${col.UncapitalisedJavaName} == null) {
+            return false;
+        }
+#end
+
+        return true;
+    }
+
+    // ===================================================================================
+    //                                                                 Modified Properties
+    //                                                                 ===================
+    /**
+     * Get modified property names. (S2Dao uses this for updateModifiedProperties())
+     * 
+     * @return Modified property names. (NotNull)
+     */
+    public java.util.Set${database.filterGenericsString('String')} getModifiedPropertyNames() {
+        return _modifiedProperties.getPropertyNames();
+    }
+
+    /**
+     * New entity modified properties. You can override this at the sub-class if you need it.
+     * 
+     * @return Entity modified properties. (NotNull)
+     */
+    protected EntityModifiedProperties newEntityModifiedProperties() {
+        return new EntityModifiedProperties();
+    }
+
+    /**
+     * Clear modified property names.
+     */
+    public void clearModifiedPropertyNames() {
+        _modifiedProperties.clear();
+    }
+
+    // ===================================================================================
+    //                                                                      Basic Override
+    //                                                                      ==============
+#if ($table.hasPrimaryKey())
+
+    /**
+     * ${database.OverrideComment}
+     * If the primary-key of the other is same as this one, returns true.
+     * 
+     * @param other Other entity.
+     * @return Comparing result.
+     */
+    public boolean equals(Object other) {
+        if (other == null) {
+            return false;
+        }
+        if (!(other instanceof $myClassName)) {
+            return false;
+        }
+        final $myClassName otherEntity = ($myClassName)other;
+
+#foreach ($col in $table.PrimaryKey)
+        if (get${col.JavaName}() == null || !get${col.JavaName}().equals(otherEntity.get${col.JavaName}())) {
+            return false;
+        }
+#end
+
+        return true;
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * Calculates hash-code from primary-key.
+     * 
+     * @return Hash-code from primary-keys.
+     */
+    public int hashCode() {
+        int result = 0;
+
+#foreach ($col in $table.PrimaryKey)
+        if (this.get${col.JavaName}() != null) {
+            result = result + get${col.JavaName}().hashCode();
+        }
+#end
+
+        return result;
+    }
+#else
+
+    /**
+     * ${database.OverrideComment}
+     * If the all-column value of the other is same as this one, returns true.
+     * 
+     * @param other Other entity. (Nullable)
+     * @return Comparing result. If other is null, returns false.
+     */
+    public boolean equals(Object other) {
+        if (other == null) {
+            return false;
+        }
+        if (!(other instanceof $myClassName)) {
+            return false;
+        }
+        final $myClassName otherEntity = ($myClassName)other;
+
+#foreach ($col in $table.Columns)
+        if (get${col.JavaName}() == null || !get${col.JavaName}().equals(otherEntity.get${col.JavaName}())) {
+            return false;
+        }
+#end
+
+        return true;
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * Calculates hash-code from all-columns.
+     * 
+     * @return Hash-code from all-columns.
+     */
+    public int hashCode() {
+        int result = 0;
+
+#foreach ($col in $table.Columns)
+        if (this.get${col.JavaName}() != null) {
+            result = result + this.get${col.JavaName}().hashCode();
+        }
+#end
+
+        return result;
+    }
+#end
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Column-value map-string. (NotNull)
+     */
+    public String toString() {
+        final String delimiter = ",";
+        final StringBuffer sb = new StringBuffer();
+
+#foreach ($col in $table.Columns)
+        sb.append(delimiter).append(get${col.JavaName}());
+#end
+
+        sb.delete(0, delimiter.length());
+        sb.insert(0, "{").append("}");
+        return sb.toString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/PlainBaseEntity.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/PlainBaseEntity.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/PlainBaseEntity.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,157 @@
+package ${myBaseEntityPackageName};
+#set ($myClassName = "${myBaseObjectClassName}")
+
+/**
+ * The entity of ${table.Name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} implements java.io.Serializable {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+#foreach ($col in $table.Columns)
+    
+    /** The value of ${col.UncapitalisedJavaName}. */
+    protected ${col.JavaNative} _${col.UncapitalisedJavaName};
+#end
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+#foreach ($col in $table.Columns)
+
+    /**
+     * Get the value of ${col.UncapitalisedJavaName}.
+     * 
+     * @return The value of ${col.UncapitalisedJavaName}. (Nullable)
+     */
+    public ${col.JavaNative} get${col.JavaName}() {
+        return _${col.UncapitalisedJavaName};
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName}.
+     * 
+     * @param ${col.UncapitalisedJavaName} The value of ${col.UncapitalisedJavaName}. (Nullable)
+     */
+    public void set${col.JavaName}(${col.JavaNative} ${col.UncapitalisedJavaName}) {
+        _${col.UncapitalisedJavaName} = ${col.UncapitalisedJavaName};
+    }
+#end
+
+    // ===================================================================================
+    //                                                                      Basic Override
+    //                                                                      ==============
+#if ($table.hasPrimaryKey())
+
+    /**
+     * ${database.OverrideComment}
+     * If the primary-key of the other is same as this one, returns true.
+     * 
+     * @param other Other entity.
+     * @return Comparing result.
+     */
+    public boolean equals(Object other) {
+        if (other == null) {
+            return false;
+        }
+        if (!(other instanceof $myClassName)) {
+            return false;
+        }
+        final $myClassName otherEntity = ($myClassName)other;
+  #foreach ($col in $table.PrimaryKey)
+
+        if (get${col.JavaName}() == null || !get${col.JavaName}().equals(otherEntity.get${col.JavaName}())) {
+            return false;
+        }
+  #end
+
+        return true;
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * Calculates hash-code from primary-key.
+     * 
+     * @return Hash-code from primary-keys.
+     */
+    public int hashCode() {
+        int result = 0;
+  #foreach ($col in $table.PrimaryKey)
+
+        if (this.get${col.JavaName}() != null) {
+            result = result + get${col.JavaName}().hashCode();
+        }
+  #end
+
+        return result;
+    }
+#else
+
+    /**
+     * ${database.OverrideComment}
+     * If the all-column value of the other is same as this one, returns true.
+     * 
+     * @param other Other entity. (Nullable)
+     * @return Comparing result. If other is null, returns false.
+     */
+    public boolean equals(Object other) {
+        if (other == null) {
+            return false;
+        }
+        if (!(other instanceof $myClassName)) {
+            return false;
+        }
+        final $myClassName otherEntity = ($myClassName)other;
+  #foreach ($col in $table.Columns)
+
+        if (get${col.JavaName}() == null || !get${col.JavaName}().equals(otherEntity.get${col.JavaName}())) {
+            return false;
+        }
+  #end
+
+        return true;
+    }
+
+    /**
+     * ${database.OverrideComment}
+     * Calculates hash-code from all-columns.
+     * 
+     * @return Hash-code from all-columns.
+     */
+    public int hashCode() {
+        int result = 0;
+  #foreach ($col in $table.Columns)
+
+        if (this.get${col.JavaName}() != null) {
+            result = result + this.get${col.JavaName}().hashCode();
+        }
+  #end
+
+        return result;
+    }
+#end
+
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Column-value map-string. (NotNull)
+     */
+    public String toString() {
+        final String delimiter = ",";
+        final StringBuffer sb = new StringBuffer();
+#foreach ($col in $table.Columns)
+
+        sb.append(delimiter).append(get${col.JavaName}());
+#end
+
+        sb.delete(0, delimiter.length());
+        sb.insert(0, "{").append("}");
+        return sb.toString();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/dbmeta/DBMetaImpl.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/dbmeta/DBMetaImpl.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/bsentity/dbmeta/DBMetaImpl.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,989 @@
+package ${myDBMetaPackageName};
+
+#set ($myClassName = "${myDBMetaClassName}")
+
+import ${glPackageBaseCommon}.${glEntityInterfaceName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaInterfaceName};
+import ${glPackageBaseCommonDBMeta}.${glDBMetaAbstractName};
+import ${myExtendedEntityPackageName}.${myExtendedObjectClassName};
+
+/**
+ * The dbmeta of ${table.Name}. (Singleton)
+ * 
+ * <pre>
+ * [primary-key]
+ *     ${table.PrimaryKeyNameCommaString}
+ * 
+ * [column-property]
+ *     ${table.ColumnNameCommaString}
+ * 
+ * [foreign-property]
+ *     ${table.ForeignPropertyNameCommaString}
+ * 
+ * [refferer-property]
+ *     ${table.ReferrerPropertyNameCommaString}
+ * 
+ * [sequence]
+ *     ${table.DefinedSequenceName}
+ * 
+ * [identity]
+ *     ${table.IdentityPropertyName}
+ * 
+ * [update-date]
+ *     ${table.UpdateDateJavaName}
+ * 
+ * [version-no]
+ *     ${table.VersionNoJavaName}
+ * 
+ * </pre>
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glDBMetaAbstractName} {
+
+    // ===================================================================================
+    //                                                                          Definition
+    //                                                                          ==========
+    /** The type of entity. */
+    protected static final Class ENTITY_TYPE = ${myExtendedObjectClassName}.class;
+
+    /** Singleton instance. */
+    private static final ${myClassName} _instance = new ${myClassName}();
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     */
+    private ${myClassName}() {
+    }
+
+    // ===================================================================================
+    //                                                                           Singleton
+    //                                                                           =========
+    /**
+     * Get instance.
+     * 
+     * @return Singleton instance. (NotNull)
+     */
+    public static ${myClassName} getInstance() {
+        return _instance;
+    }
+
+    // ===================================================================================
+    //                                                                     Name Definition
+    //                                                                     ===============
+    /** Table db name. */
+    public static final String TABLE_DB_NAME = "$table.Name";
+
+    /** Table cap-prop name. */
+    public static final String TABLE_CAP_PROP_NAME = "$table.JavaName";
+
+    /** Table uncap-prop name. */
+    public static final String TABLE_UNCAP_PROP_NAME = "$table.UncapitalisedJavaName";
+
+#foreach ($col in $table.Columns)
+    /** Db-name of ${col.JavaName}. */
+    public static final String COLUMN_DB_NAME_OF_${col.JavaName} = "$col.Name";
+#end
+
+#foreach ($col in $table.Columns)
+    /** Cap-prop-name of ${col.JavaName}. */
+    public static final String COLUMN_CAP_PROP_NAME_OF_${col.JavaName} = "$col.JavaName";
+#end
+
+#foreach ($foreignKeys in $table.ForeignKeys)
+    /** Cap-prop-name of ${foreignKeys.ForeignPropertyName}. */
+    public static final String COLUMN_CAP_PROP_NAME_OF_${foreignKeys.foreignPropertyNameInitCap} = "$foreignKeys.ForeignPropertyNameInitCap";
+#end
+
+#foreach ($children in $table.Referrers)
+    /** Cap-prop-name of ${children.ReffererPropertyNameInitCap}. */
+    public static final String COLUMN_CAP_PROP_NAME_OF_${children.ReffererPropertyNameInitCap} = "$children.ReffererPropertyNameInitCap";
+#end
+
+#foreach ($col in $table.Columns)
+    /** Uncap-prop-name of ${col.JavaName}. */
+    public static final String COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName} = "$col.UncapitalisedJavaName";
+#end
+
+#foreach ($foreignKeys in $table.ForeignKeys)
+    /** Uncap-prop-name of ${foreignKeys.ForeignPropertyName}. */
+    public static final String COLUMN_UNCAP_PROP_NAME_OF_${foreignKeys.foreignPropertyNameInitCap} = "$foreignKeys.ForeignPropertyName";
+#end
+
+#foreach ($children in $table.Referrers)
+    /** Uncap-prop-name of ${children.ReffererPropertyName}. */
+    public static final String COLUMN_UNCAP_PROP_NAME_OF_${children.ReffererPropertyNameInitCap} = "$children.ReffererPropertyName";
+#end
+
+    /** {db-name : cap-prop-name} map. */
+    private static java.util.Map${database.filterGenericsString('String, String')} _dbNameCapPropNameMap;
+    protected static java.util.Map${database.filterGenericsString('String, String')} createDbNameCapPropNameMap() {
+        if (_dbNameCapPropNameMap != null) {
+            return _dbNameCapPropNameMap;
+        }
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        map.put(TABLE_DB_NAME, TABLE_CAP_PROP_NAME);
+
+#foreach ($col in $table.Columns)
+        map.put(COLUMN_DB_NAME_OF_${col.JavaName}, COLUMN_CAP_PROP_NAME_OF_${col.JavaName});
+#end
+
+        _dbNameCapPropNameMap = java.util.Collections.unmodifiableMap(map);
+        return _dbNameCapPropNameMap;
+    }
+
+    /** {db-name : uncap-prop-name} map. */
+    private static java.util.Map${database.filterGenericsString('String, String')} _dbNameUncapPropNameMap;
+    protected static java.util.Map${database.filterGenericsString('String, String')} createDbNameUncapPropNameMap() {
+        if (_dbNameUncapPropNameMap != null) {
+            return _dbNameUncapPropNameMap;
+        }
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        map.put(TABLE_DB_NAME, TABLE_UNCAP_PROP_NAME);
+
+#foreach ($col in $table.Columns)
+        map.put(COLUMN_DB_NAME_OF_${col.JavaName}, COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName});
+#end
+
+        _dbNameUncapPropNameMap = java.util.Collections.unmodifiableMap(map);
+        return _dbNameUncapPropNameMap;
+    }
+
+    /** {cap-prop-name : db-name} map. */
+    private static java.util.Map${database.filterGenericsString('String, String')} _capPropNameDbNameMap;
+    protected static java.util.Map${database.filterGenericsString('String, String')} createCapPropNameDbNameMap() {
+        if (_capPropNameDbNameMap != null) {
+            return _capPropNameDbNameMap;
+        }
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        map.put(TABLE_CAP_PROP_NAME, TABLE_DB_NAME);
+
+#foreach ($col in $table.Columns)
+        map.put(COLUMN_CAP_PROP_NAME_OF_${col.JavaName}, COLUMN_DB_NAME_OF_${col.JavaName});
+#end
+
+        _capPropNameDbNameMap = java.util.Collections.unmodifiableMap(map);
+        return _capPropNameDbNameMap;
+    }
+
+    /** {cap-prop-name : uncap-prop-name} map. */
+    private static java.util.Map${database.filterGenericsString('String, String')} _capPropNameUncapPropNameMap;
+    protected static java.util.Map${database.filterGenericsString('String, String')} createCapPropNameUncapPropNameMap() {
+        if (_capPropNameUncapPropNameMap != null) {
+            return _capPropNameUncapPropNameMap;
+        }
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        map.put(TABLE_CAP_PROP_NAME, TABLE_UNCAP_PROP_NAME);
+
+#foreach ($col in $table.Columns)
+        map.put(COLUMN_CAP_PROP_NAME_OF_${col.JavaName}, COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName});
+#end
+
+        _capPropNameUncapPropNameMap = java.util.Collections.unmodifiableMap(map);
+        return _capPropNameUncapPropNameMap;
+    }
+
+    /** {uncap-prop-name : db-name} map. */
+    private static java.util.Map${database.filterGenericsString('String, String')} _uncapPropNameDbNameMap;
+    protected static java.util.Map${database.filterGenericsString('String, String')} createUncapPropNameDbNameMap() {
+        if (_uncapPropNameDbNameMap != null) {
+            return _uncapPropNameDbNameMap;
+        }
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        map.put(TABLE_UNCAP_PROP_NAME, TABLE_DB_NAME);
+
+#foreach ($col in $table.Columns)
+        map.put(COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName}, COLUMN_DB_NAME_OF_${col.JavaName});
+#end
+
+        _uncapPropNameDbNameMap = java.util.Collections.unmodifiableMap(map);
+        return _uncapPropNameDbNameMap;
+    }
+
+    /** {uncap-prop-name : cap-prop-name} map. */
+    private static java.util.Map${database.filterGenericsString('String, String')} _uncapPropNameCapPropNameMap;
+    protected static java.util.Map${database.filterGenericsString('String, String')} createUncapPropNameCapPropNameMap() {
+        if (_uncapPropNameCapPropNameMap != null) {
+            return _uncapPropNameCapPropNameMap;
+        }
+        final java.util.Map${database.filterGenericsString('String, String')} map = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        map.put(TABLE_UNCAP_PROP_NAME, TABLE_CAP_PROP_NAME);
+
+#foreach ($col in $table.Columns)
+        map.put(COLUMN_UNCAP_PROP_NAME_OF_${col.JavaName}, COLUMN_CAP_PROP_NAME_OF_${col.JavaName});
+#end
+
+        _uncapPropNameCapPropNameMap = java.util.Collections.unmodifiableMap(map);
+        return _uncapPropNameCapPropNameMap;
+    }
+
+    // ===================================================================================
+    //                                                                            Name-Map
+    //                                                                            ========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {db-name : cap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getDbNameCapPropNameMap() {
+        return createDbNameCapPropNameMap();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {db-name : uncap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getDbNameUncapPropNameMap() {
+        return createDbNameUncapPropNameMap();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {cap-prop-name : db-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getCapPropNameDbNameMap() {
+        return createCapPropNameDbNameMap();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {cap-prop-name : uncap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getCapPropNameUncapPropNameMap() {
+        return createCapPropNameUncapPropNameMap();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {uncap-prop-name : db-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getUncapPropNameDbNameMap() {
+        return createUncapPropNameDbNameMap();
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return {uncap-prop-name : cap-prop-name} map.
+     */
+    public java.util.Map${database.filterGenericsString('String, String')} getUncapPropNameCapPropNameMap() {
+        return createUncapPropNameCapPropNameMap();
+    }
+
+    // ===================================================================================
+    //                                                                          Table Name
+    //                                                                          ==========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    public String getTableDbName() {
+        return TABLE_DB_NAME;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table cap-prop-name. (NotNull)
+     */
+    public String getTableCapPropName() {
+        return TABLE_CAP_PROP_NAME;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table property-name. (NotNull)
+     */
+    public String getTableUncapPropName() {
+        return TABLE_UNCAP_PROP_NAME;
+    }
+
+    // ===================================================================================
+    //                                                                         Column Name
+    //                                                                         ===========
+    public java.util.List${database.filterGenericsString('String')} getColumnDbNameList() {
+        final String[] columns = getColumnDbNameCommaString().split(",");
+        final java.util.List${database.filterGenericsString('String')} resultList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        for (int i=0; i < columns.length; i++) {
+            resultList.add(columns[i].trim());
+        }
+        return resultList;
+    }
+
+    public java.util.List${database.filterGenericsString('String')} getColumnCapPropNameList() {
+        final java.util.List${database.filterGenericsString('String')} columnDbNameList = getColumnDbNameList();
+        final java.util.List${database.filterGenericsString('String')} resultList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        for (final java.util.Iterator ite = columnDbNameList.iterator(); ite.hasNext(); ) {
+            resultList.add(getDbNameCapPropNameMap().get((String)ite.next()));
+        }
+        return resultList;
+    }
+
+    public java.util.List${database.filterGenericsString('String')} getColumnUncapPropNameList() {
+        final java.util.List${database.filterGenericsString('String')} columnDbNameList = getColumnDbNameList();
+        final java.util.List${database.filterGenericsString('String')} resultList = new java.util.ArrayList${database.filterGenericsString('String')}();
+        for (final java.util.Iterator ite = columnDbNameList.iterator(); ite.hasNext(); ) {
+            resultList.add(getDbNameUncapPropNameMap().get((String)ite.next()));
+        }
+        return resultList;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Column-db-name comma-string. (NotNull)
+     */
+    public String getColumnDbNameCommaString() {
+        return "${table.columnNameCommaString}";
+    }
+
+    // ===================================================================================
+    //                                                                           Type Name
+    //                                                                           =========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type-name of entity. (NotNull)
+     */ 
+    public String getEntityTypeName() {
+        return "${myExtendedEntityPackageName}.${myExtendedObjectClassName}";
+    }
+#if ($isExistConditionBean)
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type-name of condition-bean. (NotNull)
+     */ 
+    public String getConditionBeanTypeName() {
+        return "${glPackageBaseCB}.${myConditionBeanClassName}";
+    }
+#else
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type-name of condition-bean. (Nullable: If the condition-bean does not exist)
+     */ 
+    public String getConditionBeanTypeName() {
+        return null;
+    }
+#end
+#if ($isExistDao)
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type-name of dao. (NotNull)
+     */ 
+    public String getDaoTypeName() {
+        return "${myExtendedDaoPackageName}.${myExtendedDaoClassName}";
+    }
+#else
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type-name of dao. (Nullable: If the dao does not exist)
+     */ 
+    public String getDaoTypeName() {
+        return null;
+    }
+#end
+#if ($isExistBehavior)
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type-name of behavior. (NotNull)
+     */ 
+    public String getBehaviorTypeName() {
+        return "${myExtendedBhvPackageName}.${myExtendedBhvClassName}";
+    }
+#else
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type-name of behavior. (Nullable: If the behavior does not exist)
+     */ 
+    public String getBehaviorTypeName() {
+        return null;
+    }
+#end
+
+    // ===================================================================================
+    //                                                                                Type
+    //                                                                                ====
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type of entity. (NotNull)
+     */ 
+    public Class getEntityType() {
+        return ENTITY_TYPE;
+    }
+
+    // ===================================================================================
+    //                                                                            Instance
+    //                                                                            ========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return The type of entity. (NotNull)
+     */ 
+    public ${glEntityInterfaceName} newEntity() {
+        return newMyEntity();
+    }
+
+    /**
+     * New the instance of my entity.
+     * 
+     * @return The instance of my entity. (NotNull)
+     */ 
+    public ${myExtendedObjectClassName} newMyEntity() {
+        return new ${myExtendedObjectClassName}();
+    }
+
+    // ===================================================================================
+    //                                                                      Foreign DBMeta
+    //                                                                      ==============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param foreignPropertyName Foreign-property-name(Both OK - InitCap or not). (NotNull)
+     * @return Foreign DBMeta. (NotNull)
+     */ 
+    public ${glDBMetaInterfaceName} getForeignDBMeta(String foreignPropertyName) {
+        assertStringNotNullAndNotTrimmedEmpty("foreignPropertyName", foreignPropertyName);
+        final String methodName = "getForeignDBMeta_" + foreignPropertyName.substring(0, 1) + foreignPropertyName.substring(1);
+
+        java.lang.reflect.Method method = null;
+        try {
+            method = this.getClass().getMethod(methodName, new Class[]{});
+        } catch (NoSuchMethodException e) {
+            String msg = "The foreignPropertyName is not found: foreignPropertyName=" + foreignPropertyName;
+            msg = msg + " tableName=" + TABLE_DB_NAME + " methodName=" + methodName;
+            throw new RuntimeException(msg, e);
+        }
+        try {
+            return (${glDBMetaInterfaceName})method.invoke(this, new Object[]{});
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException(e);
+        } catch (java.lang.reflect.InvocationTargetException e) {
+            throw new RuntimeException(e.getCause());
+        }
+    }
+#foreach ($foreignKeys in $table.ForeignKeys)
+
+    /**
+     * Get foreign dbmeta of ${foreignKeys.foreignPropertyNameInitCap}.
+     * 
+     * @return Foreign DBMeta. (NotNull)
+     */
+    public ${glProjectPrefix}${foreignKeys.ForeignTable.JavaName}Dbm getForeignDBMeta_${foreignKeys.foreignPropertyNameInitCap}() {
+        return ${glProjectPrefix}${foreignKeys.ForeignTable.JavaName}Dbm.getInstance();
+    }
+#end
+#foreach ($refferer in $table.Referrers)
+  #set ($reffererTable = $refferer.Table)
+  #set ($reffererEntityClassName = "${glProjectPrefix}${reffererTable.JavaName}")
+  #set ($reffererDaoClassName = "${reffererEntityClassName}Dao")
+  #set ($reffererCBClassName = "${reffererEntityClassName}${glConditionBeanInitialName}")
+  #set ($reffererVariableName = "${glChildrenVariablePrefix}${refferer.ReffererPropertyNameInitCap}")
+  #set ($reffererEntityLongClassName = "${glPackageExtendedEntity}.${reffererEntityClassName}")
+  #if (${refferer.isOneToOne()})
+
+    /**
+     * Get foreign dbmeta of ${refferer.reffererPropertyNameInitCapAsOne}.
+     * 
+     * @return Foreign DBMeta. (NotNull)
+     */
+    public ${glProjectPrefix}${refferer.Table.JavaName}Dbm getForeignDBMeta_${refferer.reffererPropertyNameInitCapAsOne}() {
+        return ${glProjectPrefix}${refferer.Table.JavaName}Dbm.getInstance();
+    }
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                       Determination
+    //                                                                       =============
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determination.
+     */
+    public boolean hasTwoOrMorePrimaryKeys() {
+        return ${table.hasTwoOrMorePrimaryKeys()};
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Determination.
+     */
+    public boolean hasCommonColumn() {
+        return ${table.hasAllCommonColumn()};
+    }
+
+    // ===================================================================================
+    //                                                                     Entity Handling
+    //                                                                     ===============
+#if ($database.isAvailableGenerics())
+    // -----------------------------------------------------
+    //                                                Accept
+    //                                                ------
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param primaryKeyMap Primary key map. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMap(${glEntityInterfaceName} entity, java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap) {
+#if ($table.hasPrimaryKey())
+        final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})entity;
+        MapAssertUtil.assertPrimaryKeyMapNotNullAndNotEmpty(primaryKeyMap);
+        final MapStringValueAnalyzer analyzer = new MapStringValueAnalyzer(primaryKeyMap, entity.getModifiedPropertyNames());
+
+#foreach ($col in $table.primaryKey)
+        MapAssertUtil.assertColumnExistingInPrimaryKeyMap(primaryKeyMap, "${col.Name}");
+#if ($col.isJavaNativeStringObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeString(${col.JavaNative}.class)); };
+#end
+#if ($col.isJavaNativeNumberObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeNumber(${col.JavaNative}.class)); };
+#end
+#if ($col.isJavaNativeDateObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeDate(${col.JavaNative}.class)); };
+#end
+#if (!$col.isJavaNativeStringObject() && !$col.isJavaNativeNumberObject() && !$col.isJavaNativeDateObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeOther(${col.JavaNative}.class)); };
+#end
+#end
+
+#else
+
+        String msg = "This table has no primary-keys: " + getTableDbName();
+        throw new IllegalStateException(msg);
+#end
+
+    }
+#else
+    // -----------------------------------------------------
+    //                                                Accept
+    //                                                ------
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param primaryKeyMap Primary key map. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMap(${glEntityInterfaceName} entity, java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap) {
+#if ($table.hasPrimaryKey())
+        final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})entity;
+        MapAssertUtil.assertPrimaryKeyMapNotNullAndNotEmpty(primaryKeyMap);
+  #foreach ($col in $table.PrimaryKey)
+
+        MapAssertUtil.assertColumnExistingInPrimaryKeyMap(primaryKeyMap, "${col.Name}");
+        {
+            final Object obj = primaryKeyMap.get("${col.Name}");
+            if (obj == null) {
+                myEntity.set${col.JavaName}(null); entity.getModifiedPropertyNames().remove("${col.JavaBeansRulePropertyName}");
+            } else {
+    #if ($col.isJavaNativeStringObject())
+
+                helpCheckingTypeString(obj, "${col.UncapitalisedJavaName}", "${col.JavaNative}");
+                myEntity.set${col.JavaName}((String)obj);
+            }
+        }
+    #else
+      #if ($col.isJavaNativeDateObject())
+
+                if (obj instanceof ${col.JavaNative}) {
+                    myEntity.set${col.JavaName}((${col.JavaNative})obj);
+                } else {
+                    myEntity.set${col.JavaName}(new ${col.JavaNative}(helpParsingDateString(obj, "${col.UncapitalisedJavaName}", "${col.JavaNative}")));
+                }
+            }
+        }
+      #else
+        #if (${col.isJavaNativeBinaryObject()})
+
+                if (obj instanceof ${col.JavaNative}) {
+                    myEntity.set${col.JavaName}((${col.JavaNative})obj);
+                } else {
+                    myEntity.set${col.JavaName}(null);// Binary as String is out of target.
+                }
+            }
+        }
+        #else
+
+                if (obj instanceof ${col.JavaNative}) {
+                    myEntity.set${col.JavaName}((${col.JavaNative})obj);
+                } else {
+                    try {
+                        myEntity.set${col.JavaName}(new ${col.JavaNative}((String)obj));
+                    } catch (RuntimeException e) {
+                        String msg = "entity.set${col.JavaName}(new ${col.JavaNative}((String)obj))";
+                        throw new RuntimeException(msg + " threw the exception: value=[" + obj + "]", e);
+                    }
+                }
+            }
+        }
+        #end
+      #end
+    #end
+  #end
+#else
+
+        String msg = "This table has no primary-keys: " + getTableDbName();
+        throw new IllegalStateException(msg);
+#end
+
+    }
+#end
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param primaryKeyMapString Primary-key map-string. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMapString(${glEntityInterfaceName} entity, String primaryKeyMapString) {
+        MapStringUtil.acceptPrimaryKeyMapString(primaryKeyMapString, entity);
+    }
+
+#if ($database.isAvailableGenerics())
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param columnValueMap Column-value map. (NotNull and NotEmpty)
+     */
+    public void acceptColumnValueMap(${glEntityInterfaceName} entity, java.util.Map${database.filterGenericsString('String, ? extends Object')} columnValueMap) {
+        final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})entity;
+        MapAssertUtil.assertColumnValueMapNotNullAndNotEmpty(columnValueMap);
+        final MapStringValueAnalyzer analyzer = new MapStringValueAnalyzer(columnValueMap, entity.getModifiedPropertyNames());
+
+#foreach ($col in $table.columns)
+#if ($col.isJavaNativeStringObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeString(${col.JavaNative}.class)); };
+#end
+#if ($col.isJavaNativeNumberObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeNumber(${col.JavaNative}.class)); };
+#end
+#if ($col.isJavaNativeDateObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeDate(${col.JavaNative}.class)); };
+#end
+#if (!$col.isJavaNativeStringObject() && !$col.isJavaNativeNumberObject() && !$col.isJavaNativeDateObject())
+        if (analyzer.init("${col.Name}", "${col.UncapitalisedJavaName}", "${col.JavaBeansRulePropertyName}")) { myEntity.set${col.javaName}(analyzer.analyzeOther(${col.JavaNative}.class)); };
+#end
+#end
+
+    }
+
+#else
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param columnValueMap Column-value map. (NotNull and NotEmpty)
+     */
+    public void acceptColumnValueMap(${glEntityInterfaceName} entity, java.util.Map${database.filterGenericsString('String, ? extends Object')} columnValueMap) {
+        final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})entity;
+        MapAssertUtil.assertColumnValueMapNotNullAndNotEmpty(columnValueMap);
+  #foreach ($col in $table.columns)
+
+        {
+            final Object obj = columnValueMap.get("${col.Name}");
+            if (obj == null) {
+                myEntity.set${col.JavaName}(null); entity.getModifiedPropertyNames().remove("${col.JavaBeansRulePropertyName}");
+            } else {
+    #if ($col.isJavaNativeStringObject())
+
+                helpCheckingTypeString(obj, "${col.UncapitalisedJavaName}", "${col.JavaNative}");
+                myEntity.set${col.JavaName}((String)obj);
+            }
+        }
+    #else
+      #if ($col.isJavaNativeDateObject())
+
+                if (obj instanceof ${col.JavaNative}) {
+                    myEntity.set${col.JavaName}((${col.JavaNative})obj);
+                } else {
+                    myEntity.set${col.JavaName}(new ${col.JavaNative}(helpParsingDateString(obj, "${col.UncapitalisedJavaName}", "${col.JavaNative}")));
+                }
+            }
+        }
+      #else
+        #if (${col.isJavaNativeBinaryObject()})
+
+                if (obj instanceof ${col.JavaNative}) {
+                    myEntity.set${col.JavaName}((${col.JavaNative})obj);
+                } else {
+                    myEntity.set${col.JavaName}(null);// Binary as String is out of target.
+                }
+            }
+        }
+        #else
+
+                if (obj instanceof ${col.JavaNative}) {
+                    myEntity.set${col.JavaName}((${col.JavaNative})obj);
+                } else {
+                    try {
+                        myEntity.set${col.JavaName}(new ${col.JavaNative}((String)obj));
+                    } catch (RuntimeException e) {
+                        String msg = "set${col.JavaName}(new ${col.JavaNative}((String)obj))";
+                        throw new RuntimeException(msg + " threw the exception: value=[" + obj + "]", e);
+                    }
+                }
+            }
+        }
+        #end
+      #end
+    #end
+  #end
+
+    }
+#end
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param columnValueMapString Column-value map-string. (NotNull and NotEmpty)
+     */
+    public void acceptColumnValueMapString(${glEntityInterfaceName} entity, String columnValueMapString) {
+        MapStringUtil.acceptColumnValueMapString(columnValueMapString, entity);
+    }
+
+#if (!$database.isAvailableGenerics())
+    private void helpCheckingTypeString(Object value, String propertyName, String typeName) {
+        MapStringUtil.checkTypeString(value, propertyName, typeName);
+    }
+
+    private long helpParsingDateString(Object value, String propertyName, String typeName) {
+        return MapStringUtil.parseDateStringAsMillis(value, propertyName, typeName);
+    }
+#end
+
+    // -----------------------------------------------------
+    //                                               Extract
+    //                                               -------
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Primary-key map-string. (NotNull)
+     */
+    public String extractPrimaryKeyMapString(${glEntityInterfaceName} entity) {
+        return MapStringUtil.extractPrimaryKeyMapString(entity);
+    }
+
+    /**
+     * Extract primary-key map-string.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Primary-key map-string. (NotNull)
+     */
+    public String extractPrimaryKeyMapString(${glEntityInterfaceName} entity, String startBrace, String endBrace, String delimiter, String equal) {
+        final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})entity;
+#if ($table.hasPrimaryKey())
+        final String mapMarkAndStartBrace = MAP_STRING_MAP_MARK + startBrace;
+        final StringBuffer sb = new StringBuffer();
+#foreach ($col in $table.PrimaryKey)
+        helpAppendingColumnValueString(sb, delimiter, equal, "${col.Name}", myEntity.get${col.JavaName}());
+#end
+
+        sb.delete(0, delimiter.length()).insert(0, mapMarkAndStartBrace).append(endBrace);
+        return sb.toString();
+#else
+        return extractColumnValueMapString(entity, startBrace, endBrace, delimiter, equal);
+#end
+
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     */
+    public String extractColumnValueMapString(${glEntityInterfaceName} entity) {
+        return MapStringUtil.extractColumnValueMapString(entity);
+    }
+
+    /**
+     * Extract column-value map-string.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     */
+    public String extractColumnValueMapString(${glEntityInterfaceName} entity, String startBrace, String endBrace, String delimiter, String equal) {
+        final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})entity;
+        final String mapMarkAndStartBrace = MAP_STRING_MAP_MARK + startBrace;
+        final StringBuffer sb = new StringBuffer();
+#foreach ($col in $table.Columns)
+        helpAppendingColumnValueString(sb, delimiter, equal, "${col.Name}", myEntity.get${col.JavaName}());
+#end
+
+        sb.delete(0, delimiter.length()).insert(0, mapMarkAndStartBrace).append(endBrace);
+        return sb.toString();
+    }
+
+    private void helpAppendingColumnValueString(StringBuffer sb, String delimiter, String equal, String colName, Object value) {
+        sb.append(delimiter).append(colName).append(equal);
+        sb.append(helpGettingColumnStringValue(value));
+    }
+
+#if (${table.hasAllCommonColumn()})
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     */
+    public String extractCommonColumnValueMapString(${glEntityInterfaceName} entity) {
+        final String startBrace = MAP_STRING_START_BRACE;
+        final String endBrace = MAP_STRING_END_BRACE;
+        final String delimiter = MAP_STRING_DELIMITER;
+        final String equal = MAP_STRING_EQUAL;
+        return extractCommonColumnValueMapString(entity, startBrace, endBrace, delimiter, equal);
+    }
+
+    /**
+     * Extract common-column-value map-string.
+     * 
+     * @param entity Target entity. (NotNull)
+     * @param startBrace Start-brace. (NotNull)
+     * @param endBrace End-brace. (NotNull)
+     * @param delimiter Delimiter. (NotNull)
+     * @param equal Equal. (NotNull)
+     * @return Common-column-value map-string. (NotNull)
+     */
+    public String extractCommonColumnValueMapString(${glEntityInterfaceName} entity, String startBrace, String endBrace, String delimiter, String equal) {
+        final ${myExtendedObjectClassName} myEntity = (${myExtendedObjectClassName})entity;
+        final String mapMarkAndStartBrace = MAP_STRING_MAP_MARK + startBrace;
+        final StringBuffer sb = new StringBuffer();
+  #foreach ($columnName in ${database.commonColumnNameList})
+    #set ($filteredColumnName = ${database.filterCommonColumn(${columnName})})
+    #set ($commonColumnMap = ${database.commonColumnMap})
+    #set ($columnType = ${commonColumnMap.get(${columnName})})
+    #set ($javaNative = ${database.convertJavaNativeByJdbcType(${columnType})})
+    #set ($javaName = ${database.convertJavaNameByJdbcNameAsColumn(${filteredColumnName})})
+    #set ($targetColumnName = ${table.findTargetColumnNameByCommonColumnName(${columnName})})
+    #set ($targetJavaName = ${table.findTargetColumnJavaNameByCommonColumnName(${columnName})})
+    #set ($col = $table.getColumnByFlexibleName($targetJavaName))
+    #if ($col.isJavaNativeDateObject())
+
+        sb.append(delimiter).append("${targetColumnName}").append(equal);
+        sb.append((myEntity.get${javaName}() != null ? helpFormatingDate(myEntity.get${javaName}()) : ""));
+    #else
+
+        sb.append(delimiter).append("${targetColumnName}").append(equal);
+        sb.append((myEntity.get${javaName}() != null ? myEntity.get${javaName}().toString() : ""));
+    #end
+  #end
+
+        sb.delete(0, delimiter.length()).insert(0, mapMarkAndStartBrace).append(endBrace);
+        return sb.toString();
+    }
+#else
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     */
+    public String extractCommonColumnValueMapString(${glEntityInterfaceName} entity) {
+        return "map:{}";
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param entity Target entity. (NotNull)
+     * @return Column-value map-string. (NotNull)
+     */
+    public String extractCommonColumnValueMapString(${glEntityInterfaceName} entity, String startBrace, String endBrace, String delimiter, String equal) {
+        return "map:" + startBrace + endBrace;
+    }
+
+#end
+
+    // -----------------------------------------------------
+    //                                               Convert
+    //                                               -------
+    public java.util.List${database.filterGenericsString('Object')} convertToColumnValueList(${glEntityInterfaceName} entity) {
+        return new java.util.ArrayList${database.filterGenericsString('Object')}(convertToColumnValueMap(entity).values());
+    }
+
+    public java.util.Map${database.filterGenericsString('String, Object')} convertToColumnValueMap(${glEntityInterfaceName} entity) {
+        final ${myExtendedObjectClassName} myEntity = downcast(entity);
+        final java.util.Map${database.filterGenericsString('String, Object')} valueMap = new java.util.LinkedHashMap${database.filterGenericsString('String, Object')}();
+#foreach ($col in $table.columns)
+        valueMap.put("${col.name}", myEntity.get${col.JavaName}());
+#end
+        return valueMap;
+    }
+
+    public java.util.List${database.filterGenericsString('String')} convertToColumnStringValueList(${glEntityInterfaceName} entity) {
+        return new java.util.ArrayList${database.filterGenericsString('String')}(convertToColumnStringValueMap(entity).values());
+    }
+
+    public java.util.Map${database.filterGenericsString('String, String')} convertToColumnStringValueMap(${glEntityInterfaceName} entity) {
+        final ${myExtendedObjectClassName} myEntity = downcast(entity);
+        final java.util.Map${database.filterGenericsString('String, String')} valueMap = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+#foreach ($col in $table.columns)
+        valueMap.put("${col.name}", helpGettingColumnStringValue(myEntity.get${col.JavaName}()));
+#end
+        return valueMap;
+    }
+
+    // ===================================================================================
+    //                                                                        JDBC Support
+    //                                                                        ============
+    public String getPreparedInsertClause() {
+        return "insert into ${table.name}(${table.ColumnNameCommaString}) values(${table.insertClauseValuesAsQuetionMark})";
+    }
+
+    public String getPreparedInsertClause(String tablePrefix) {
+        return "insert into " + tablePrefix + "${table.name}(${table.ColumnNameCommaString}) values(${table.insertClauseValuesAsQuetionMark})";
+    }
+
+    // ===================================================================================
+    //                                                                              Helper
+    //                                                                              ======
+    protected ${myExtendedObjectClassName} downcast(${glEntityInterfaceName} entity) {
+        assertObjectNotNull("entity", entity);
+        try {
+            return (${myExtendedObjectClassName})entity;
+        } catch (ClassCastException e) {
+            String msg = "The entity should be ${myExtendedObjectClassName} but it was: " + entity.getClass();
+            throw new IllegalStateException(msg, e);
+        }
+    }
+
+    protected void checkDowncast(${glEntityInterfaceName} entity) {
+        downcast(entity);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/AbstractBsConditionQuery.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/AbstractBsConditionQuery.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/AbstractBsConditionQuery.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,686 @@
+
+package ${glPackageBaseCQ};
+
+#set ($myClassName = "${myAbstractBaseConditionQueryClassName}")
+
+#if ($table.hasClassification())
+
+import ${glPackageBaseCommon}.${glClassificationDefinition};
+#end
+
+import ${glPackageBaseCommonCBean}.*;
+import ${glPackageBaseCommonCKey}.*;
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+import ${glPackageCQ}.*;
+
+/**
+ * The condition-query of ${table.name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public abstract class ${myClassName} extends ${glConditionQueryAbstractName} {
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     * 
+     * @param childQuery Child query as abstract class. (Nullable: If null, this is base instance.)
+     * @param sqlClause SQL clause instance. (NotNull)
+     * @param aliasName My alias name. (NotNull)
+     * @param nestLevel Nest level.
+     */
+    public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel) {
+        super(childQuery, sqlClause, aliasName, nestLevel);
+    }
+
+    // ===================================================================================
+    //                                                                          Table Name
+    //                                                                          ==========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    final public String getTableDbName() {
+        return "${table.Name}";
+    }
+
+    // ===================================================================================
+    //                                                                               Query
+    //                                                                               =====
+  ## --------------------------------------------------------------------------------
+  ##                                                  Make getter and setter methods.
+  ##                                                  -------------------------------
+
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   MyTable = [$table.Name]
+    // * * * * * * * * */
+
+  #foreach ($col in $table.Columns)
+    #set ($tmpJavaName = "${col.JavaName}")
+    #set ($tmpUncapitalisedJavaName = "${col.UncapitalisedJavaName}")
+    
+    /** Column db name of ${col.UncapitalisedJavaName}. */
+    protected static final String COL_${col.Name} = "${col.Name}";
+
+    /** Column java name of ${col.UncapitalisedJavaName}. */
+    protected static final String J_${col.JavaName} = "${col.JavaName}";
+
+    /** Column uncapitalised java name of ${col.UncapitalisedJavaName}. */
+    protected static final String UJ_${col.UncapitalisedJavaName} = "${col.UncapitalisedJavaName}";
+    #if (${col.isJavaNativeStringObject()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as equal.
+     */
+    public void set${tmpJavaName}_Equal($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, filterRemoveEmptyString(${tmpUncapitalisedJavaName}));
+    }
+      #if ($database.isMakeConditionQueryEqualEmptyString())
+
+    /**
+     * Set the empty-string of ${col.UncapitalisedJavaName} as equal. { = }
+     * 
+     * @return this. (NotNull)
+     */
+    public void set${tmpJavaName}_Equal_EmptyString() {
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, "");
+    }
+      #end
+      #if (${col.hasClassification()})
+        #foreach ($classificationMap in $col.ClassificationMapList)
+
+    /**
+     * Set the value of ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal. { = } <br />
+     * ${classificationMap.get('comment')} <br />
+     * 
+     * @return this. (NotNull)
+     */
+    public void set${tmpJavaName}_Equal_${classificationMap.get('name')}() {
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')});
+    }
+        #end
+      #end
+      #if (${col.isAvailableStringNotEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual. { != }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as notEqual.
+     */
+    public void set${tmpJavaName}_NotEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, filterRemoveEmptyString(${tmpUncapitalisedJavaName}));
+    }
+      #end
+      #if (${col.isAvailableStringGreaterThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan. { &gt; }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterThan.
+     */
+    public void set${tmpJavaName}_GreaterThan($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, filterRemoveEmptyString(${tmpUncapitalisedJavaName}));
+    }
+      #end
+      #if (${col.isAvailableStringLessThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan. { &lt; }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessThan.
+     */
+    public void set${tmpJavaName}_LessThan($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, filterRemoveEmptyString(${tmpUncapitalisedJavaName}));
+    }
+      #end
+      #if (${col.isAvailableStringGreaterEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual. { &gt;= }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     */
+    public void set${tmpJavaName}_GreaterEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, filterRemoveEmptyString(${tmpUncapitalisedJavaName}));
+    }
+      #end
+      #if (${col.isAvailableStringLessEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual. { &lt;= }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessEqual.
+     */
+    public void set${tmpJavaName}_LessEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, filterRemoveEmptyString(${tmpUncapitalisedJavaName}));
+    }
+      #end
+      #if (${col.isAvailableStringPrefixSearch()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using prefixSearch. { like 'xxx%' }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as prefixSearch.
+     */
+    public void set${tmpJavaName}_PrefixSearch($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_PREFIX_SEARCH, filterRemoveEmptyString(${tmpUncapitalisedJavaName}));
+    }
+      #end
+      #if (${col.isAvailableStringLikeSearch()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using likeSearch. { like '%xxx%' }
+     * If the value is null or empty-string, this condition is ignored.
+     * You can invoke this method several times and the conditions are set up.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as likeSearch.
+     * @param likeSearchOption Like search option. (NotNull)
+     */
+    public void set${tmpJavaName}_LikeSearch($col.JavaNative ${tmpUncapitalisedJavaName}, ${glPackageBaseCommonCOption}.${glConditionOptionLikeSearchName} likeSearchOption) {
+        registerLikeSearchQuery(${glConditionKeyName}.CK_LIKE_SEARCH, filterRemoveEmptyString(${tmpUncapitalisedJavaName}), getCValue${tmpJavaName}(), COL_${col.Name}, J_${col.JavaName}, UJ_${col.UncapitalisedJavaName}, likeSearchOption);
+    }
+      #end
+      #if (${col.isAvailableStringInScope()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using inScope. { in ('a', 'b') }
+     * If the element in the list is null or empty-string, the condition-element is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName}List The value of ${col.UncapitalisedJavaName} as inScope.
+     */
+    public void set${tmpJavaName}_InScope(java.util.List${database.filterGenericsString(${col.JavaNative})} ${tmpUncapitalisedJavaName}List) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_IN_SCOPE, filterRemoveEmptyStringFromList(${tmpUncapitalisedJavaName}List));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using inScope. { in ('a', 'b') }
+     * If the element in the list is null or empty-string, the condition-element is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as inScope.
+     */
+    public void set${tmpJavaName}_InScope(${col.JavaNative} ${tmpUncapitalisedJavaName}, ${glPackageBaseCommonCOption}.${glConditionOptionInScopeName} option) {
+        registerInScopeQuery(${glConditionKeyName}.CK_IN_SCOPE, filterRemoveEmptyString(${tmpUncapitalisedJavaName}), getCValue${tmpJavaName}(), COL_${col.Name}, J_${col.JavaName}, UJ_${col.UncapitalisedJavaName}, option);
+    }
+      #end
+      #if (${col.isAvailableStringNotInScope()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notInScope. { not in ('a', 'b') }
+     * If the element in the list is null or empty-string, the condition-element is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName}List The value of ${col.UncapitalisedJavaName} as notInScope.
+     */
+    public void set${tmpJavaName}_NotInScope(java.util.List${database.filterGenericsString(${col.JavaNative})} ${tmpUncapitalisedJavaName}List) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_NOT_IN_SCOPE, filterRemoveEmptyStringFromList(${tmpUncapitalisedJavaName}List));
+    }
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * { in (select xxx.${col.foreignKey.firstForeignColumnName} from ${col.foreignKey.foreignTable.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)
+     */
+    public void set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+        registerInScopeSubQuery(subQuery, COL_${col.Name}, "${col.foreignKey.firstForeignColumnName}", "${subQueryPropertyName}");
+    }
+
+    abstract public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.reffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.reffererPropertyNameInitCap}")
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)
+     */
+    public void set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+        registerInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyName}");
+    }
+
+    abstract public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+     * { exists (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery. (NotNull)
+     */
+    public void set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+        registerExistsSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyName}");
+    }
+
+    abstract public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeNumberObject()})
+    
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as equal.
+     */
+    public void set${tmpJavaName}_Equal($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #if (${col.hasClassification()})
+        #foreach ($classificationMap in $col.ClassificationMapList)
+
+    /**
+     * Set the value of ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal. { = } <br />
+     * ${classificationMap.get('comment')} <br />
+     */
+    public void set${tmpJavaName}_Equal_${classificationMap.get('name')}() {
+        final String code = ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, new ${col.JavaNative}(code));
+    }
+        #end
+      #end
+      #if (${col.isAvailableNumberNotEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual. { != }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as notEqual.
+     */
+    public void set${tmpJavaName}_NotEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableNumberGreaterThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan. { &gt; }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterThan.
+     */
+    public void set${tmpJavaName}_GreaterThan($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableNumberLessThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan. { &lt; }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessThan.
+     */
+    public void set${tmpJavaName}_LessThan($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableNumberGreaterEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual. { &gt;= }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     */
+    public void set${tmpJavaName}_GreaterEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableNumberLessEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual. { &lt;= }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessEqual.
+     */
+    public void set${tmpJavaName}_LessEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if ($database.isMakeConditionQueryNumericArgumentLong())
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as equal.
+     */
+    public void set${tmpJavaName}_Equal(long ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, new ${col.JavaNative}(String.valueOf(${tmpUncapitalisedJavaName})));
+    }
+        #if (${col.isAvailableNumberNotEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual. { != }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as notEqual.
+     */
+    public void set${tmpJavaName}_NotEqual(long ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, new ${col.JavaNative}(String.valueOf(${tmpUncapitalisedJavaName})));
+    }
+        #end
+        #if (${col.isAvailableNumberGreaterThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan. { &gt; }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterThan.
+     */
+    public void set${tmpJavaName}_GreaterThan(long ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, new ${col.JavaNative}(String.valueOf(${tmpUncapitalisedJavaName})));
+    }
+        #end
+        #if (${col.isAvailableNumberLessThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan. { &lt; }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessThan.
+     */
+    public void set${tmpJavaName}_LessThan(long ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, new ${col.JavaNative}(String.valueOf(${tmpUncapitalisedJavaName})));
+    }
+        #end
+        #if (${col.isAvailableNumberGreaterEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual. { &gt;= }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     */
+    public void set${tmpJavaName}_GreaterEqual(long ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, new ${col.JavaNative}(String.valueOf(${tmpUncapitalisedJavaName})));
+    }
+        #end
+        #if (${col.isAvailableNumberLessEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual. { &lt;= }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessEqual.
+     */
+    public void set${tmpJavaName}_LessEqual(long ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, new ${col.JavaNative}(String.valueOf(${tmpUncapitalisedJavaName})));
+    }
+        #end
+      #end
+      #if (${col.isAvailableNumberInScope()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using inScope. { in (a, b) }
+     * If the element in the list is null or empty-string, the condition-element is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName}List The value of ${col.UncapitalisedJavaName} as inScope.
+     */
+    public void set${tmpJavaName}_InScope(java.util.List${database.filterGenericsString(${col.JavaNative})} ${tmpUncapitalisedJavaName}List) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_IN_SCOPE, ${tmpUncapitalisedJavaName}List);
+    }
+      #end
+      #if (${col.isAvailableNumberNotInScope()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notInScope. { not in (a, b) }
+     * If the element in the list is null or empty-string, the condition-element is ignored.
+     * 
+     * @param ${tmpUncapitalisedJavaName}List The value of ${col.UncapitalisedJavaName} as notInScope.
+     */
+    public void set${tmpJavaName}_NotInScope(java.util.List${database.filterGenericsString(${col.JavaNative})} ${tmpUncapitalisedJavaName}List) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_NOT_IN_SCOPE, ${tmpUncapitalisedJavaName}List);
+    }
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * { in (select xxx.${col.foreignKey.firstForeignColumnName} from ${col.foreignKey.foreignTable.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)
+     */
+    public void set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+        registerInScopeSubQuery(subQuery, COL_${col.Name}, "${col.foreignKey.firstForeignColumnName}", "${subQueryPropertyName}");
+    }
+
+    abstract public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (NotNull)
+     */
+    public void set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+        registerInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyName}");
+    }
+
+    abstract public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+     * { exists (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery. (NotNull)
+     */
+    public void set${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        keep${subQueryPropertyNameInitCap}(subQuery);// for saving query-value.
+        registerExistsSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyName}");
+    }
+
+    abstract public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery);
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeDateObject()})
+    
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as equal.
+     */
+    public void set${tmpJavaName}_Equal($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #if (${col.isAvailableDateNotEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual. { != }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as notEqual.
+     */
+    public void set${tmpJavaName}_NotEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableDateGreaterThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan. { &gt; }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterThan.
+     */
+    public void set${tmpJavaName}_GreaterThan($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableDateLessThan()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan. { &lt; }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessThan.
+     */
+    public void set${tmpJavaName}_LessThan($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableDateGreaterEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual. { &gt;= }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     */
+    public void set${tmpJavaName}_GreaterEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableDateLessEqual()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual. { &lt;= }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as lessEqual.
+     */
+    public void set${tmpJavaName}_LessEqual($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+      #end
+      #if (${col.isAvailableDateFromTo()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using from-to. { $fromDate <= COLUMN_NAME <= $toDate }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as from-to.
+     * @param fromToOption From-To option. (NotNull)
+     */
+    public void set${tmpJavaName}_FromTo($col.JavaNative fromDate, $col.JavaNative toDate, ${glPackageBaseCommonCOption}.${glConditionOptionFromToName} fromToOption) {
+        registerFromToQuery(fromDate, toDate, getCValue${tmpJavaName}(), COL_${col.Name}, J_${col.JavaName}, UJ_${col.UncapitalisedJavaName}, fromToOption);
+    }
+      #end
+    #end
+    #if (${col.isJavaNativeBooleanObject()})
+    
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal. { = }
+     * 
+     * @param ${tmpUncapitalisedJavaName} The value of ${col.UncapitalisedJavaName} as equal.
+     */
+    public void set${tmpJavaName}_Equal($col.JavaNative ${tmpUncapitalisedJavaName}) {
+        register${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${tmpUncapitalisedJavaName});
+    }
+    #end
+    #if (${col.isJavaNativeBinaryObject()})
+    #end
+    #if (!${col.isNotNull()})
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using isNull. { is null }
+     */
+    public void set${tmpJavaName}_IsNull() {
+        register${tmpJavaName}(${glConditionKeyName}.CK_IS_NULL, DUMMY_OBJECT);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using isNotNull. { is not null }
+     */
+    public void set${tmpJavaName}_IsNotNull() {
+        register${tmpJavaName}(${glConditionKeyName}.CK_IS_NOT_NULL, DUMMY_OBJECT);
+    }
+    #end
+    
+    /**
+     * Register condition of ${col.UncapitalisedJavaName}.
+     * 
+     * @param key Condition key. (NotNull)
+     * @param value The value of ${col.UncapitalisedJavaName}. (Nullable)
+     */
+    protected void register${tmpJavaName}(${glConditionKeyName} key, Object value) {
+        registerQuery(key, value, getCValue${tmpJavaName}(), COL_${col.Name}, J_${col.JavaName}, UJ_${col.UncapitalisedJavaName});
+    }
+
+    /**
+     * Register inline condition of ${col.UncapitalisedJavaName}.
+     * 
+     * @param key Condition key. (NotNull)
+     * @param value The value of ${col.UncapitalisedJavaName}. (Nullable)
+     */
+    protected void registerInline${tmpJavaName}(${glConditionKeyName} key, Object value) {
+        registerInlineQuery(key, value, getCValue${tmpJavaName}(), COL_${col.Name}, J_${col.JavaName}, UJ_${col.UncapitalisedJavaName});
+    }
+
+    abstract protected ${glConditionValueName} getCValue${tmpJavaName}();
+  #end
+
+    // ===================================================================================
+    //                                                                      Basic Override
+    //                                                                      ==============
+    /**
+     * This method overrides the method that is declared at super.
+     * 
+     * @return Clause string. (NotNull)
+     */
+    public String toString() {
+        return getSqlClause().getClause();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,365 @@
+package ${glPackageBaseCB};
+
+#set ($myClassName = "${myBaseConditionBeanClassName}")
+
+import ${glPackageBaseCommonCBean}.${glConditionBeanAbstractName};
+import ${glPackageBaseCommonCBean}.${glConditionBeanInterfaceName};
+import ${glPackageBaseCommonCBean}.${glConditionQueryInterfaceName};
+
+import ${glPackageCQ}.*;
+import ${glPackageNss}.*;
+
+/**
+ * The condition-bean of ${table.Name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glConditionBeanAbstractName} {
+
+    // ===================================================================================
+    //                                                                          Annotation
+    //                                                                          ==========
+    /** TABLE-Annotation */
+    public static final String TABLE = "$table.Name";
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    /** Condition query. */
+    protected ${myConditionQueryClassName} _conditionQuery;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   MyTable = [$table.Name]
+    // * * * * * * * * */
+
+    // ===================================================================================
+    //                                                                          Table Name
+    //                                                                          ==========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Table db-name. (NotNull)
+     */
+    final public String getTableDbName() {
+        return "${table.Name}";
+    }
+
+    // ===================================================================================
+    //                                                                  Accept Primary-Key
+    //                                                                  ==================
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @param primaryKeyMap Primary key map. (NotNull and NotEmpty)
+     */
+    public void acceptPrimaryKeyMap(java.util.Map${database.filterGenericsString('String, ? extends Object')} primaryKeyMap) {
+        if (primaryKeyMap == null) {
+            String msg = "The argument[primaryKeyMap] must not be null.";
+            throw new IllegalArgumentException(msg);
+        }
+        if (primaryKeyMap.isEmpty()) {
+            String msg = "The argument[primaryKeyMap] must not be empty.";
+            throw new IllegalArgumentException(msg);
+        }
+#if ($table.hasPrimaryKey())
+  #foreach ($col in $table.PrimaryKey)
+
+        if (!primaryKeyMap.containsKey("${col.Name}")) {
+            String msg = "The primaryKeyMap must have the value of ${col.Name}";
+            throw new IllegalStateException(msg + ": primaryKeyMap --> " + primaryKeyMap);
+        }
+        {
+            Object obj = primaryKeyMap.get("${col.Name}");
+            if (obj instanceof ${col.JavaNative}) {
+                query().set${col.JavaName}_Equal((${col.JavaNative})obj);
+            } else {
+    #if ($col.isJavaNativeStringObject())
+
+                checkTypeString(obj, "${col.UncapitalisedJavaName}", "${col.JavaNative}");
+                query().set${col.JavaName}_Equal((String)obj);
+            }
+        }
+    #else
+      #if ($col.isJavaNativeDateObject())
+
+                if (obj instanceof ${col.JavaNative}) {
+                    query().set${col.JavaName}_Equal((${col.JavaNative})obj);
+                } else {
+                    query().set${col.JavaName}_Equal(new ${col.JavaNative}(parseDateString(obj, "${col.UncapitalisedJavaName}", "${col.JavaNative}")));
+                }
+            }
+        }
+      #else
+        #if (${col.isJavaNativeBinaryObject()})
+
+                if (obj instanceof ${col.JavaNative}) {
+                    query().set${col.JavaName}_Equal((${col.JavaNative})obj);
+                } else {
+                    query().set${col.JavaName}_Equal(null);// Binary as String is out of target.
+                }
+            }
+        }
+        #else
+
+                if (obj instanceof ${col.JavaNative}) {
+                    query().set${col.JavaName}_Equal((${col.JavaNative})obj);
+                } else {
+                    try {
+                        query().set${col.JavaName}_Equal(new ${col.JavaNative}((String)obj));
+                    } catch (RuntimeException e) {
+                        String msg = "set${col.JavaName}(new ${col.JavaNative}((String)obj))";
+                        throw new RuntimeException(msg + " threw the exception: value=[" + obj + "]", e);
+                    }
+                }
+            }
+        }
+        #end
+      #end
+    #end
+  #end
+#else
+
+        String msg = "This table has no primary-keys: " + getTableDbName();
+        throw new IllegalStateException(msg);
+#end
+
+    }
+
+    // ===================================================================================
+    //                                                                            Order-By
+    //                                                                            ========
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} addOrderBy_PK_Asc() {
+#if ($table.hasPrimaryKey())
+  #foreach ($col in $table.PrimaryKey)
+
+        query().addOrderBy_${col.JavaName}_Asc();
+  #end
+
+        return this;
+#else
+  #foreach ($col in $table.Columns)
+
+        query().addOrderBy_${col.JavaName}_Asc();
+  #end
+
+        return this;
+#end
+
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return this. (NotNull)
+     */
+    public ${glConditionBeanInterfaceName} addOrderBy_PK_Desc() {
+#if ($table.hasPrimaryKey())
+  #foreach ($col in $table.PrimaryKey)
+
+        query().addOrderBy_${col.JavaName}_Desc();
+  #end
+
+        return this;
+#else
+  #foreach ($col in $table.Columns)
+
+        query().addOrderBy_${col.JavaName}_Desc();
+  #end
+
+        return this;
+#end
+
+    }
+
+    // ===================================================================================
+    //                                                                               Query
+    //                                                                               =====
+    /**
+     * Query.
+     * 
+     * @return Instance of query. (NotNull)
+     */
+    public ${myConditionQueryClassName} query() {
+        return getConditionQuery();
+    }
+
+    /**
+     * Get condition query. {Internal method for s2dao}
+     * 
+     * @return Instance of condition query. (NotNull)
+     */
+    public ${myConditionQueryClassName} getConditionQuery() {
+        if (_conditionQuery == null) {
+            _conditionQuery = new ${myConditionQueryClassName}(null, getSqlClause(), getTableDbName(), 0);
+        }
+        return _conditionQuery;
+    }
+
+    /**
+     * ${database.ImplementComment}
+     * 
+     * @return Instance of query as interface. (NotNull)
+     */
+    public ${glConditionQueryInterfaceName} getConditionQueryAsInterface() {
+        return getConditionQuery();
+    }
+
+    // ===================================================================================
+    //                                                                               Union
+    //                                                                               =====
+    /**
+     * Union.
+     * <pre>
+     * Add union query to condition bean.
+     * </pre>
+     * @param unionQuery Union query. (NotNull)
+     */
+    public void union(${myConditionQueryClassName} unionQuery) {
+        query().xsetUnionQuery(unionQuery);
+    }
+
+    /**
+     * Union all.
+     * <pre>
+     * Add union all query to condition bean.
+     * </pre>
+     * @param unionAllQuery Union all query. (NotNull)
+     */
+    public void unionAll(${myConditionQueryClassName} unionAllQuery) {
+        query().xsetUnionAllQuery(unionAllQuery);
+    }
+
+    public boolean hasUnionQueryOrUnionAllQuery() {
+        return query().hasUnionQueryOrUnionAllQuery();
+    }
+
+    // ===================================================================================
+    //                                                                        Setup-Select
+    //                                                                        ============
+  #foreach ($foreignKeys in $table.ForeignKeys)
+    #set ($tmpPropertyName = "${foreignKeys.foreignPropertyName}")
+    #set ($tmpPropertyNameInitCap = "${foreignKeys.foreignPropertyNameInitCap}")
+    #set ($nestSelectSetuppperClassName = "${glProjectPrefix}${foreignKeys.foreignTable.javaName}Nss")
+
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   ForeignTable    = [${foreignKeys.foreignTable.name}]
+    //   ForeignProperty = [${tmpPropertyName}]
+    // * * * * * * * * */
+
+    /** Is select for ${tmpPropertyName}? */
+    protected boolean _isSelect${tmpPropertyNameInitCap};
+    /** Nest select setupper for ${tmpPropertyName}. */
+    protected ${nestSelectSetuppperClassName} _nss${tmpPropertyNameInitCap};
+    /**
+     * Is select for ${tmpPropertyName}? {For Internal}
+     * 
+     * @return Determination.
+     */
+    public boolean isSelect${tmpPropertyNameInitCap}() {
+        return _isSelect${tmpPropertyNameInitCap};
+    }
+    /**
+     * Get nest select setupper for ${tmpPropertyName}. {For Internal}
+     * 
+     * @return Nest select setupper. (NotNull)
+     */
+    public ${nestSelectSetuppperClassName} getNss${tmpPropertyNameInitCap}() {
+        if (_nss${tmpPropertyNameInitCap} == null) {
+            _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(null);// for Dummy
+        }
+        return _nss${tmpPropertyNameInitCap};
+    }
+    /**
+     * Set up select for ${tmpPropertyName}.
+     * If you invoke this, this entity is target of select.
+     * 
+     * @return Nest select setupper for ${tmpPropertyName}. (NotNull)
+     */
+    public ${nestSelectSetuppperClassName} setupSelect_${tmpPropertyNameInitCap}() {
+        query().query${tmpPropertyNameInitCap}();// For setting outer join.
+        if (_nss${tmpPropertyNameInitCap} == null || !_nss${tmpPropertyNameInitCap}.hasConditionQuery()) {
+            _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(query().query${tmpPropertyNameInitCap}());
+        }
+        _isSelect${tmpPropertyNameInitCap} = true;
+        limitSelect_Off();
+        return _nss${tmpPropertyNameInitCap};
+    }
+  #end
+  #foreach ($refferer in $table.Referrers)
+    #if (${refferer.isOneToOne()})
+      #set ($tmpPropertyName = "${refferer.ReffererPropertyNameAsOne}")
+      #set ($tmpPropertyNameInitCap = "${refferer.ReffererPropertyNameInitCapAsOne}")
+      #set ($nestSelectSetuppperClassName = "${glProjectPrefix}${refferer.table.javaName}Nss")
+
+    // /* * * * * * * * * * * * * * * * * * * * * * * {as one}
+    //   RefferTable    = [${refferer.table.name}]
+    //   RefferProperty = [${tmpPropertyName}]
+    // * * * * * * * * */
+
+    /** Is select for ${tmpPropertyName}? */
+    protected boolean _isSelect${tmpPropertyNameInitCap};
+    /** Nest select setupper for ${tmpPropertyName}. */
+    protected ${nestSelectSetuppperClassName} _nss${tmpPropertyNameInitCap};
+    /**
+     * Is select for ${tmpPropertyName}? {For Internal}
+     * 
+     * @return Determination.
+     */
+    public boolean isSelect${tmpPropertyNameInitCap}() {
+        return _isSelect${tmpPropertyNameInitCap};
+    }
+    /**
+     * Get nest select setupper for ${tmpPropertyName}. {For Internal}
+     * 
+     * @return Nest select setupper. (NotNull)
+     */
+    public ${nestSelectSetuppperClassName} getNss${tmpPropertyNameInitCap}() {
+        if (_nss${tmpPropertyNameInitCap} == null) {
+            _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(null);// for Dummy
+        }
+        return _nss${tmpPropertyNameInitCap};
+    }
+    /**
+     * Set up select for ${tmpPropertyName}.
+     * If you invoke this, this entity is target of select.
+     * 
+     * @return Nest select setupper for ${tmpPropertyName}. (NotNull)
+     */
+    public ${nestSelectSetuppperClassName} setupSelect_${tmpPropertyNameInitCap}() {
+        query().query${tmpPropertyNameInitCap}();// For setting outer join.
+        if (_nss${tmpPropertyNameInitCap} == null || !_nss${tmpPropertyNameInitCap}.hasConditionQuery()) {
+            _nss${tmpPropertyNameInitCap} = new ${nestSelectSetuppperClassName}(query().query${tmpPropertyNameInitCap}());
+        }
+        _isSelect${tmpPropertyNameInitCap} = true;
+        limitSelect_Off();
+        return _nss${tmpPropertyNameInitCap};
+    }
+    #end
+  #end
+
+    // ===================================================================================
+    //                                                                      Basic Override
+    //                                                                      ==============
+    /**
+     * This method overrides the method that is declared at super.
+     * 
+     * @return Clause string. (NotNull)
+     */
+    public String toString() {
+        return getSqlClause().getClause();
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionInlineQuery.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionInlineQuery.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionInlineQuery.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,171 @@
+package ${glPackageCIQ};
+
+#set ($myClassName = "${myConditionInlineQueryClassName}")
+#set ($myCQClassName = "")
+#if ($database.isJavaDirOnlyOne())
+  #set ($myCQClassName = "${myBaseConditionQueryClassName}")
+#else
+  #set ($myCQClassName = "${myConditionQueryClassName}")
+#end
+import ${glPackageBaseCQ}.*;
+import ${glPackageCQ}.*;
+
+import ${glPackageBaseCommonCBean}.*;
+import ${glPackageBaseCommonCKey}.*;
+import ${glPackageBaseCommonCOption}.${glConditionOptionInterfaceName};
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+
+/**
+ * The condition-inline-query of ${table.name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${myAbstractBaseConditionQueryClassName} {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    /** Corresponding condition query. */
+    protected ${myCQClassName} _myCQ;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     * 
+     * @param childQuery Child query as abstract class. (Nullable: If null, this is base instance.)
+     * @param sqlClause SQL clause instance. (NotNull)
+     * @param aliasName My alias name. (NotNull)
+     * @param nestLevel Nest level.
+     */
+    public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel, ${myCQClassName} myCQ) {
+        super(childQuery, sqlClause, aliasName, nestLevel);
+        _myCQ = myCQ;
+    }
+
+    // ===================================================================================
+    //                                                             Override about Register
+    //                                                             =======================
+    protected void reflectRelationOnUnionQuery(${glConditionQueryInterfaceName} baseQueryAsSuper, ${glConditionQueryInterfaceName} unionQueryAsSuper) {
+        throw new UnsupportedOperationException("InlineQuery must not need UNION method: " + baseQueryAsSuper + " : " + unionQueryAsSuper);
+    }
+
+    protected void setupConditionValueAndRegisterWhereClause(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                                             , String colName, String capPropName, String uncapPropName) {
+        registerInlineQuery(key, value, cvalue, colName, capPropName, uncapPropName);
+    }
+
+    protected void setupConditionValueAndRegisterWhereClause(${glConditionKeyName} key, Object value, ${glConditionValueName} cvalue
+                                                             , String colName, String capPropName, String uncapPropName, ${glConditionOptionInterfaceName} option) {
+        registerInlineQuery(key, value, cvalue, colName, capPropName, uncapPropName, option);
+    }
+
+    protected void registerWhereClause(String whereClause) {
+        registerInlineWhereClause(whereClause);
+    }
+
+    // ===================================================================================
+    //                                                                Override about Query
+    //                                                                ====================
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   MyTable = [$table.Name]
+    // * * * * * * * * */
+
+  #foreach ($col in $table.Columns)
+    #set ($tmpJavaName = "${col.JavaName}")
+    #set ($tmpUncapitalisedJavaName = "${col.UncapitalisedJavaName}")
+
+    // /- - - - - - - - - - - - - - - - - - - - - - -
+    //   Column = [$col.Name]
+    // - - - - - - - - -/
+    protected ${glConditionValueName} getCValue${tmpJavaName}() {
+        return _myCQ.get${tmpJavaName}();
+    }
+
+    #if (${col.isJavaNativeStringObject()})
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _myCQ.keep${subQueryPropertyNameInitCap}(subQuery);
+    }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _myCQ.keep${subQueryPropertyNameInitCap}(subQuery);
+    }
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        throw new UnsupportedOperationException("ExistsSubQuery at inline() is unsupported! Sorry!");
+        // _myCQ.keep${subQueryPropertyNameInitCap}(subQuery);
+    }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeNumberObject()})
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _myCQ.keep${subQueryPropertyNameInitCap}(subQuery);
+    }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _myCQ.keep${subQueryPropertyNameInitCap}(subQuery);
+    }
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}CQ")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        throw new UnsupportedOperationException("ExistsSubQuery at inline() is unsupported! Sorry!");
+        // _myCQ.keep${subQueryPropertyNameInitCap}(subQuery);
+    }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeDateObject()})
+    #end
+    #if (${col.isJavaNativeBooleanObject()})
+    #end
+    #if (${col.isJavaNativeBinaryObject()})
+    #end
+    #if (!${col.isNotNull()})
+    #end
+    #if (!${col.isJavaNativeBinaryObject()})
+    #end
+  #end
+
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionQuery.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionQuery.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/BsConditionQuery.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,847 @@
+#set ($myClassName = "")
+#if ($database.isJavaDirOnlyOne())
+
+package ${glPackageBaseCQ};
+
+import ${glPackageCQ}.*;
+  #set ($myClassName = "${myBaseConditionQueryClassName}")
+#else
+
+package ${glPackageCQ};
+
+import ${glPackageBaseCQ}.*;
+  #set ($myClassName = "${myConditionQueryClassName}")
+#end
+#if ($database.hasClassificationDefinitionMap())
+
+import ${glPackageBaseCommon}.${glClassificationDefinition};
+#end
+
+import ${glPackageBaseCommonCBean}.*;
+import ${glPackageBaseCommonCKey}.*;
+import ${glPackageBaseCommonCValue}.${glConditionValueName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+import ${glPackageCIQ}.*;
+
+/**
+ * The condition-query of ${table.name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${myAbstractBaseConditionQueryClassName} {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    /** Corresponding inline query. */
+    protected ${myConditionInlineQueryClassName} _inlineQuery;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     * 
+     * @param childQuery Child query as abstract class. (Nullable: If null, this is base instance.)
+     * @param sqlClause SQL clause instance. (NotNull)
+     * @param aliasName My alias name. (NotNull)
+     * @param nestLevel Nest level.
+     */
+    public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel) {
+        super(childQuery, sqlClause, aliasName, nestLevel);
+    }
+
+    // ===================================================================================
+    //                                                                              Inline
+    //                                                                              ======
+    /**
+     * Get inline query.
+     * 
+     * @return Inline query. (NotNull)
+     */
+    public ${myConditionInlineQueryClassName} inline() {
+        if (_inlineQuery == null) {
+            _inlineQuery = new ${myConditionInlineQueryClassName}(getChildQuery(), getSqlClause(), getAliasName(), getNestLevel(), this);
+        }
+        return _inlineQuery;
+    }
+
+    // ===================================================================================
+    //                                                                     Include-as-Mine
+    //                                                                     ===============
+  #foreach ($col in $table.Columns)
+
+    /**
+     * Include select-column of ${col.UncapitalisedJavaName} as mine.
+     * Alias name is java-name of this column.
+     * Be careful to whether your table have the same column.
+     */
+    public void includeAsMine_${col.JavaName}() {
+        registerIncludedSelectColumn("${col.JavaName}", getRealColumnName("${col.Name}"));
+    }
+
+    /**
+     * Include select-column of ${col.UncapitalisedJavaName} as mine.
+     * 
+     * @param aliasName Alias name. {select columnName as aliasName from ...} This should not contain comma. (NotNull)
+     */
+    public void includeAsMine_${col.JavaName}(String aliasName) {
+        registerIncludedSelectColumn(aliasName, getRealColumnName("${col.Name}"));
+    }
+  #end
+
+    // ===================================================================================
+    //                                                                               Query
+    //                                                                               =====
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   MyTable = [$table.Name]
+    // * * * * * * * * */
+  #foreach ($col in $table.Columns)
+    #set ($tmpJavaName = "${col.JavaName}")
+    #set ($tmpUncapitalisedJavaName = "${col.UncapitalisedJavaName}")
+
+    // /- - - - - - - - - - - - - - - - - - - - - - -
+    //   Column = [$col.Name]
+    // - - - - - - - - -/
+
+    /** The attribute of ${col.UncapitalisedJavaName}. */
+    protected ${glConditionValueName} _${tmpUncapitalisedJavaName};
+
+    /**
+     * Get the value of ${col.UncapitalisedJavaName}.
+     * 
+     * @return The value of ${col.UncapitalisedJavaName}.
+     */
+    public ${glConditionValueName} get${tmpJavaName}() {
+        if (_${tmpUncapitalisedJavaName} == null) {
+            _${tmpUncapitalisedJavaName} = new ${glConditionValueName}();
+        }
+        return _${tmpUncapitalisedJavaName};
+    }
+
+    protected ${glConditionValueName} getCValue${tmpJavaName}() {
+        return get${tmpJavaName}();
+    }
+
+    #if (${col.isJavaNativeStringObject()})
+      #if ($database.isMakeDeprecated())
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal as inline. { = }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as equal.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_Equal_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, filterRemoveEmptyString(value));
+    }
+      #if (${col.hasClassification()})
+        #foreach ($classificationMap in $col.ClassificationMapList)
+
+    /**
+     * Set the value of ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal as inline. { = }
+     * 
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_Equal_${classificationMap.get('name')}_AsInline() {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')});
+    }
+        #end
+      #end
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual as inline. { != }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as notEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_NotEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, filterRemoveEmptyString(value));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan as inline. { &gt; }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterThan_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, filterRemoveEmptyString(value));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan as inline. { &lt; }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessThan_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, filterRemoveEmptyString(value));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual as inline. { &gt;= }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, filterRemoveEmptyString(value));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual as inline. { &lt;= }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, filterRemoveEmptyString(value));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using prefixSearch as inline. { like 'xxx%' }
+     * If the value is null or empty-string, this condition is ignored.
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as prefixSearch.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_PrefixSearch_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_PREFIX_SEARCH, filterRemoveEmptyString(value));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using inScope as inline. { in ('a', 'b') }
+     * If the element in the list is null or empty-string, the condition-element is ignored.
+     * 
+     * @param valueList The value of ${col.UncapitalisedJavaName} as inScope.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_InScope_AsInline(java.util.List${database.filterGenericsString(${col.JavaNative})} valueList) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_IN_SCOPE, filterRemoveEmptyStringFromList(valueList));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notInScope as inline. { not in ('a', 'b') }
+     * If the element in the list is null or empty-string, the condition-element is ignored.
+     * 
+     * @param valueList The value of ${col.UncapitalisedJavaName} as notInScope.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_NotInScope_AsInline(java.util.List${database.filterGenericsString(${col.JavaNative})} valueList) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_IN_SCOPE, filterRemoveEmptyStringFromList(valueList));
+    }
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. */
+    protected ${relatedCQClassName} _${subQueryPropertyName};
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (Nullable)
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}() {
+        return _${subQueryPropertyName};
+    }
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _${subQueryPropertyName} = subQuery;
+    }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. */
+    protected ${relatedCQClassName} _${subQueryPropertyName};
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (Nullable)
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}() {
+        return _${subQueryPropertyName};
+    }
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _${subQueryPropertyName} = subQuery;
+    }
+
+          #if ($database.isMakeDeprecated())
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. */
+    protected ${relatedCQClassName} _${subQueryPropertyName}_AsInline;
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. (Nullable)
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}_AsInline() {
+        return _${subQueryPropertyName}_AsInline;
+    }
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+     * { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. (NotNull)
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${subQueryPropertyNameInitCap}_AsInline(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        _${subQueryPropertyName}_AsInline = subQuery;// for saving query-value.
+        registerInlineInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyName}_AsInline");
+    }
+          #end
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery. */
+    protected ${relatedCQClassName} _${subQueryPropertyName};
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (Nullable)
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}() {
+        return _${subQueryPropertyName};
+    }
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _${subQueryPropertyName} = subQuery;
+    }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeNumberObject()})
+      #if ($database.isMakeDeprecated())
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal as inline. { = }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as equal.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_Equal_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal as inline. { = }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as equal.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_Equal_AsInline(long value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, new ${col.JavaNative}(String.valueOf(value)));
+    }
+      #if (${col.hasClassification()})
+        #foreach ($classificationMap in $col.ClassificationMapList)
+
+    /**
+     * Set the value of ${classificationMap.get('name')} of ${col.UncapitalisedJavaName} as equal as inline. { = }
+     * 
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_Equal_${classificationMap.get('name')}_AsInline() {
+        final String code = ${glClassificationDefinition}.CODE_${col.ClassificationName}_${classificationMap.get('name')};
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, new ${col.JavaNative}(code));
+    }
+        #end
+      #end
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual as inline. { != }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as notEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_NotEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual as inline. { != }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as notEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_NotEqual_AsInline(long value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, new ${col.JavaNative}(String.valueOf(value)));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan as inline. { &gt; }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterThan_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan as inline. { &gt; }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterThan_AsInline(long value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, new ${col.JavaNative}(String.valueOf(value)));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan as inline. { &lt; }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessThan_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan as inline. { &lt; }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessThan_AsInline(long value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, new ${col.JavaNative}(String.valueOf(value)));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual as inline. { &gt;= }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual as inline. { &gt;= }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterEqual_AsInline(long value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, new ${col.JavaNative}(String.valueOf(value)));
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual as inline. { &lt;= }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual as inline. { &lt;= }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessEqual_AsInline(long value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, new ${col.JavaNative}(String.valueOf(value)));
+    }
+      #end
+      #if (${col.isSingleKeyForeignKey()})
+        #set ($relatedCQClassName = "${glProjectPrefix}${col.foreignKey.foreignTable.javaName}CQ")
+        #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+        #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${col.foreignKey.foreignPropertyNameInitCap}")
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. */
+    protected ${relatedCQClassName} _${subQueryPropertyName};
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (Nullable)
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}() {
+        return _${subQueryPropertyName};
+    }
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _${subQueryPropertyName} = subQuery;
+    }
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+          #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+          #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_InScopeSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. */
+    protected ${relatedCQClassName} _${subQueryPropertyName};
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery. (Nullable)
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}() {
+        return _${subQueryPropertyName};
+    }
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _${subQueryPropertyName} = subQuery;
+    }
+          #if ($database.isMakeDeprecated())
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. */
+    protected ${relatedCQClassName} _${subQueryPropertyName}_AsInline;
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. (Nullable)
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}_AsInline() {
+        return _${subQueryPropertyName}_AsInline;
+    }
+
+    /**
+     * Set the sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline.
+     * { in (select xxx.${refferer.FirstLocalColumnName} from ${refferer.Table.Name} where ...) }
+     * This method use from clause and where clause of the sub-query instance.
+     * this query keep the sub-query instance for query-value.
+     * After you invoke this, If you set query in the argument[subQuery], the query is ignored.
+     * 
+     * @param subQuery The sub-query of ${subQueryPropertyNameInitCap} using inScopeSubQuery as inline. (NotNull)
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${subQueryPropertyNameInitCap}_AsInline(${relatedCQClassName} subQuery) {
+        assertObjectNotNull("subQuery", subQuery);
+        _${subQueryPropertyName}_AsInline = subQuery;// for saving query-value.
+        registerInlineInScopeSubQuery(subQuery, COL_${col.Name}, "${refferer.FirstLocalColumnName}", "${subQueryPropertyName}_AsInline");
+    }
+          #end
+        #end
+      #end
+      #if (${col.hasSingleKeyReferrer()})
+        #foreach ($refferer in $col.SingleKeyReferrers)
+          #if (!$refferer.isSelfReference())
+            #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+            #set ($subQueryPropertyNameInitCap = "${tmpJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+            #set ($subQueryPropertyName = "${tmpUncapitalisedJavaName}_ExistsSubQuery_${refferer.ReffererPropertyNameInitCap}")
+
+    /** The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery. */
+    protected ${relatedCQClassName} _${subQueryPropertyName};
+
+    /**
+     * Get the sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery.
+     * 
+     * @return The sub-query of ${subQueryPropertyNameInitCap} using existsSubQuery. (Nullable)
+     */
+    public ${relatedCQClassName} get${subQueryPropertyNameInitCap}() {
+        return _${subQueryPropertyName};
+    }
+
+    public void keep${subQueryPropertyNameInitCap}(${relatedCQClassName} subQuery) {
+        _${subQueryPropertyName} = subQuery;
+    }
+          #end
+        #end
+      #end
+    #end
+    #if (${col.isJavaNativeDateObject()})
+      #if ($database.isMakeDeprecated())
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using equal as inline. { = }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as equal.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_Equal_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_EQUAL, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using notEqual as inline. { != }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as notEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_NotEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_NOT_EQUAL, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterThan as inline. { &gt; }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterThan_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_THAN, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessThan as inline. { &lt; }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessThan.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessThan_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_THAN, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using greaterEqual as inline. { &gt;= }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as greaterEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_GreaterEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_GREATER_EQUAL, value);
+    }
+
+    /**
+     * Set the value of ${col.UncapitalisedJavaName} using lessEqual as inline. { &lt;= }
+     * 
+     * @param value The value of ${col.UncapitalisedJavaName} as lessEqual.
+     * @deprecated This method is deprecated. Please use query().inline().setXxx_Xxx()!
+     */
+    public void set${tmpJavaName}_LessEqual_AsInline($col.JavaNative value) {
+        registerInline${tmpJavaName}(${glConditionKeyName}.CK_LESS_EQUAL, value);
+    }
+      #end
+    #end
+    #if (${col.isJavaNativeBooleanObject()})
+    #end
+    #if (${col.isJavaNativeBinaryObject()})
+    #end
+    #if (!${col.isNotNull()})
+    #end
+    #if (!${col.isJavaNativeBinaryObject()})
+
+    /**
+     * Add order-by of ${col.UncapitalisedJavaName} as ASC.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} addOrderBy_${tmpJavaName}_Asc() {
+        getSqlClause().registerOrderBy(getRealColumnName(COL_${col.Name}), null, true);return this;
+    }
+
+    /**
+     * Add order-by of ${col.UncapitalisedJavaName} as DESC.
+     * 
+     * @return this. (NotNull)
+     */
+    public ${myClassName} addOrderBy_${tmpJavaName}_Desc() {
+        getSqlClause().registerOrderBy(getRealColumnName(COL_${col.Name}), null, false);return this;
+    }
+    #end
+  #end
+
+    // ===================================================================================
+    //                                                                         Union Query
+    //                                                                         ===========
+    protected void reflectRelationOnUnionQuery(${glConditionQueryInterfaceName} baseQueryAsSuper, ${glConditionQueryInterfaceName} unionQueryAsSuper) {
+        final ${myConditionQueryClassName} baseQuery = (${myConditionQueryClassName})baseQueryAsSuper;
+        final ${myConditionQueryClassName} unionQuery = (${myConditionQueryClassName})unionQueryAsSuper;
+  #foreach ($foreignKeys in $table.ForeignKeys)
+
+        if (baseQuery.hasConditionQuery${foreignKeys.foreignPropertyNameInitCap}()) {
+            unionQuery.query${foreignKeys.foreignPropertyNameInitCap}().reflectRelationOnUnionQuery(baseQuery.query${foreignKeys.foreignPropertyNameInitCap}(), unionQuery.query${foreignKeys.foreignPropertyNameInitCap}());
+        }
+  #end
+  #foreach ($refferer in $table.Referrers)
+    #if (${refferer.isOneToOne()})
+
+        if (baseQuery.hasConditionQuery${refferer.reffererPropertyNameInitCapAsOne}()) {
+            unionQuery.query${refferer.reffererPropertyNameInitCapAsOne}().reflectRelationOnUnionQuery(baseQuery.query${refferer.reffererPropertyNameInitCapAsOne}(), unionQuery.query${refferer.reffererPropertyNameInitCapAsOne}());
+        }
+    #end
+  #end
+
+    }
+
+    // ===================================================================================
+    //                                                                       Foreign Query
+    //                                                                       =============
+  #foreach ($foreignKeys in $table.ForeignKeys)
+    #set ($foreignCQClassName = "${glProjectPrefix}${foreignKeys.foreignTable.JavaName}${glConditionQueryInitialName}")
+    
+    // /* * * * * * * * * * * * * * * * * * * * * * *
+    //   ForeignTable    = [${foreignKeys.ForeignTable.Name}]
+    //   ForeignProperty = [${foreignKeys.ForeignPropertyName}]
+    // * * * * * * * * */
+
+    /**
+     * Query for ${foreignKeys.ForeignPropertyName}.
+     * 
+     * @return Instance of ${foreignCQClassName} as ${foreignKeys.ForeignPropertyName}. (NotNull)
+     */
+    public ${foreignCQClassName} query${foreignKeys.ForeignPropertyNameInitCap}() {
+        return getConditionQuery${foreignKeys.ForeignPropertyNameInitCap}();
+    }
+
+    /** Condition-query for ${foreignKeys.ForeignPropertyName}. */
+    protected ${foreignCQClassName} _conditionQuery${foreignKeys.ForeignPropertyNameInitCap};
+
+    /**
+     * Get condition-query for ${foreignKeys.ForeignPropertyName}.
+     * 
+     * @return Instance of ${foreignCQClassName} as ${foreignKeys.ForeignPropertyName}. (NotNull)
+     */
+    public ${foreignCQClassName} getConditionQuery${foreignKeys.ForeignPropertyNameInitCap}() {
+        if (_conditionQuery${foreignKeys.foreignPropertyNameInitCap} == null) {
+            _conditionQuery${foreignKeys.foreignPropertyNameInitCap} = newQuery${foreignKeys.ForeignPropertyNameInitCap}();
+            setupOuterJoin_${foreignKeys.foreignPropertyNameInitCap}();
+        }
+        return _conditionQuery${foreignKeys.ForeignPropertyNameInitCap};
+    }
+
+    /**
+     * Setup outer join for ${foreignPropertyName}.
+     */
+    protected void setupOuterJoin_${foreignKeys.ForeignPropertyNameInitCap}() {
+        final java.util.Map${database.filterGenericsString('String, String')} joinOnMap = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        String key = null;
+        String value = null;
+    #foreach ($columnName in $foreignKeys.LocalColumns)
+      #set ($localColumn = $table.getColumn($columnName))
+      #set ($foreignColumnName = $foreignKeys.getLocalForeignMapping().get($columnName))
+
+        key = getRealColumnName("${localColumn.Name}");
+        value = getConditionQuery${foreignKeys.ForeignPropertyNameInitCap}().getRealColumnName("${foreignColumnName}");
+        joinOnMap.put(key, value);
+    #end
+
+        final String joinTableName = "${foreignKeys.foreignTable.Name}";
+        final String aliasName = getConditionQuery${foreignKeys.ForeignPropertyNameInitCap}().getRealAliasName();
+        getSqlClause().registerOuterJoin(joinTableName, aliasName, joinOnMap);
+    }
+
+    /**
+     * New query for ${foreignKeys.ForeignPropertyName}.
+     * 
+     * @return Query for ${foreignKeys.ForeignPropertyName}. (NotNull)
+     */
+    protected ${foreignCQClassName} newQuery${foreignKeys.ForeignPropertyNameInitCap}() {
+        return new ${foreignCQClassName}(this, getSqlClause(), "${foreignKeys.ForeignPropertyNameInitCap}", getNextNestLevel());
+    }
+
+    /**
+     * Has condition query?
+     * 
+     * @return Determination.
+     */
+    public boolean hasConditionQuery${foreignKeys.ForeignPropertyNameInitCap}() {
+        return _conditionQuery${foreignKeys.ForeignPropertyNameInitCap} != null;
+    }
+  #end
+
+  #foreach ($refferer in $table.Referrers)
+    #set ($relatedCQClassName = "${glProjectPrefix}${refferer.Table.JavaName}${glConditionQueryInitialName}")
+    #if (${refferer.isOneToOne()})
+
+    // /* * * * * * * * * * * * * * * * * * * * * * * {as one}
+    //   ReffererTable    = [${refferer.Table.Name}]
+    //   ReffererProperty = [${refferer.ReffererPropertyNameAsOne}]
+    // * * * * * * * * */
+
+    /**
+     * Query for ${refferer.ReffererPropertyNameAsOne}.
+     * 
+     * @return Instance of ${relatedCQClassName} as ${refferer.ReffererPropertyNameAsOne}. (NotNull)
+     */
+    public ${relatedCQClassName} query${refferer.ReffererPropertyNameInitCapAsOne}() {
+        return getConditionQuery${refferer.ReffererPropertyNameInitCapAsOne}();
+    }
+
+    /** Condition-query for ${refferer.ReffererPropertyNameAsOne}. */
+    protected ${relatedCQClassName} _conditionQuery${refferer.ReffererPropertyNameInitCapAsOne};
+
+    /**
+     * Get condition-query for ${refferer.ReffererPropertyNameAsOne}.
+     * 
+     * @return Instance of ${relatedCQClassName} as ${refferer.ReffererPropertyNameAsOne}. (NotNull)
+     */
+    public ${relatedCQClassName} getConditionQuery${refferer.ReffererPropertyNameInitCapAsOne}() {
+        if (_conditionQuery${refferer.ReffererPropertyNameInitCapAsOne} == null) {
+            _conditionQuery${refferer.ReffererPropertyNameInitCapAsOne} = newQuery${refferer.ReffererPropertyNameInitCapAsOne}();
+            setupOuterJoin_${refferer.ReffererPropertyNameInitCapAsOne}();
+        }
+        return _conditionQuery${refferer.ReffererPropertyNameInitCapAsOne};
+    }
+
+    /**
+     * Setup outer join for ${refferer.ReffererPropertyName}.
+     */
+    protected void setupOuterJoin_${refferer.ReffererPropertyNameInitCapAsOne}() {
+        final java.util.Map${database.filterGenericsString('String, String')} joinOnMap = new java.util.LinkedHashMap${database.filterGenericsString('String, String')}();
+        String key = null;
+        String value = null;
+      #foreach ($columnName in $refferer.ForeignColumns)
+        #set ($foreignColumn = $table.getColumn($columnName))
+        #set ($reffererColumnName = $refferer.getLocalForeignMapping().get($columnName))
+
+        key = getRealColumnName("${foreignColumn.Name}");
+        value = getConditionQuery${refferer.ReffererPropertyNameInitCapAsOne}().getRealColumnName("${reffererColumnName}");
+        joinOnMap.put(key, value);
+      #end
+
+        final String joinTableName = "${refferer.Table.Name}";
+        final String aliasName = getConditionQuery${refferer.ReffererPropertyNameInitCapAsOne}().getRealAliasName();
+        getSqlClause().registerOuterJoin(joinTableName, aliasName, joinOnMap);
+    }
+
+    /**
+     * New query for ${refferer.ReffererPropertyNameAsOne}.
+     * 
+     * @return Query for ${refferer.ReffererPropertyNameAsOne}. (NotNull)
+     */
+    protected ${relatedCQClassName} newQuery${refferer.ReffererPropertyNameInitCapAsOne}() {
+        return new ${relatedCQClassName}(this, getSqlClause(), "${refferer.ReffererPropertyNameInitCapAsOne}", getNextNestLevel());
+    }
+
+    /**
+     * Has condition query?
+     * 
+     * @return Determination.
+     */
+    public boolean hasConditionQuery${refferer.ReffererPropertyNameInitCapAsOne}() {
+        return _conditionQuery${refferer.ReffererPropertyNameInitCapAsOne} != null;
+    }
+    #end
+  #end
+
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${glPackageCB};
+
+#set ($myClassName = "${myConditionBeanClassName}")
+
+/**
+ * The condition-bean of ${table.Name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glPackageBaseCB}.${myBaseConditionBeanClassName} {
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionQuery.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionQuery.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/ExConditionQuery.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,30 @@
+package ${glPackageCQ};
+
+#set ($myClassName = "${myConditionQueryClassName}")
+
+import ${glPackageBaseCommonCBean}.${glConditionQueryInterfaceName};
+import ${glPackageBaseCommonSqlClause}.${glSqlClauseName};
+import ${glPackageBaseCQ}.${myBaseConditionQueryClassName};
+
+/**
+ * The condition-query of ${table.name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${myBaseConditionQueryClassName} {
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /**
+     * Constructor.
+     * 
+     * @param childQuery Child query as abstract class. (Nullable: If null, this is base instance.)
+     * @param sqlClause SQL clause instance. (NotNull)
+     * @param aliasName My alias name. (NotNull)
+     * @param nestLevel Nest level.
+     */
+    public ${myClassName}(${glConditionQueryInterfaceName} childQuery, ${glSqlClauseName} sqlClause, String aliasName, int nestLevel) {
+        super(childQuery, sqlClause, aliasName, nestLevel);
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/NestSelectSetupper.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/NestSelectSetupper.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/cbean/NestSelectSetupper.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,117 @@
+package ${glPackageNss};
+
+#set ($myClassName = "${myNestSelectSetupperClassName}")
+
+import ${glPackageCQ}.${myConditionQueryClassName};
+
+
+/**
+ * The nest select setupper of ${table.name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    /** Base query. */
+    protected ${myConditionQueryClassName} _query;
+
+    // ===================================================================================
+    //                                                                         Constructor
+    //                                                                         ===========
+    /**
+     * Constructor.
+     * 
+     * @param query Base query. (NotNull)
+     */
+    public ${myClassName}(${myConditionQueryClassName} query) {
+        _query = query;
+    }
+
+    // ===================================================================================
+    //                                                                            Accessor
+    //                                                                            ========
+    /**
+     * @deprecated This method is INTERNAL! Please use cb.query().queryXxx().setXxx_Equal()...
+     */
+    public ${myConditionQueryClassName} query() {
+        return _query;
+    }
+
+    /**
+     * Has condition query?
+     * 
+     * @return Determination.
+     */
+    public boolean hasConditionQuery() {
+        return _query != null;
+    }
+
+    // ===================================================================================
+    //                                                                             With...
+    //                                                                             =======
+#foreach ($foreignKeys in $table.ForeignKeys)
+  #set ($tmpPropertyName = "${foreignKeys.foreignPropertyName}")
+  #set ($tmpPropertyNameInitCap = "${foreignKeys.foreignPropertyNameInitCap}")
+
+    /** Is select ${tmpPropertyName}? */
+    protected boolean _isSelect${tmpPropertyNameInitCap};
+
+    /**
+     * Is select ${tmpPropertyName}?
+     * 
+     * @return Determination.
+     */
+    public boolean isSelect${tmpPropertyNameInitCap}() {
+        return _isSelect${tmpPropertyNameInitCap};
+    }
+
+    /**
+     * Set up select with ${tmpPropertyName}.
+     */
+    public void with${tmpPropertyNameInitCap}() {
+        assertConditionQuery();
+        _query.query${tmpPropertyNameInitCap}();
+        _isSelect${tmpPropertyNameInitCap} = true;
+    }
+#end
+#foreach ($refferer in $table.Referrers)
+  #if (${refferer.isOneToOne()})
+    #set ($tmpPropertyName = "${refferer.reffererPropertyNameAsOne}")
+    #set ($tmpPropertyNameInitCap = "${refferer.reffererPropertyNameInitCapAsOne}")
+
+    /** Is select ${tmpPropertyName}? */
+    protected boolean _isSelect${tmpPropertyNameInitCap};
+
+    /**
+     * Is select ${tmpPropertyName}?
+     * 
+     * @return Determination.
+     */
+    public boolean isSelect${tmpPropertyNameInitCap}() {
+        return _isSelect${tmpPropertyNameInitCap};
+    }
+
+    /**
+     * Set up select with ${tmpPropertyName}.
+     */
+    public void with${tmpPropertyNameInitCap}() {
+        assertConditionQuery();
+        query().query${tmpPropertyNameInitCap}();
+        _isSelect${tmpPropertyNameInitCap} = true;
+    }
+  #end
+#end
+
+    // ===================================================================================
+    //                                                                              Helper
+    //                                                                              ======
+    protected void assertConditionQuery() {
+        if (!hasConditionQuery()) {
+            String msg = "The query should not be null.";
+            throw new IllegalStateException(msg);
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exbhv/ExtendedBhv.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exbhv/ExtendedBhv.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exbhv/ExtendedBhv.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${glPackageExtendedBhv};
+
+#set ($myClassName = "${myExtendedBhvClassName}")
+
+/**
+ * The behavior of ${table.Name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class $myClassName extends ${glPackageBaseBhv}.${myBaseBhvClassName} {
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExParameterBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExParameterBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExParameterBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${glPackageExtendedParameterBean};
+
+#set ($myClassName = "${myExtendedParameterBeanClassName}")
+
+/**
+ * The parameter-bean of ${pmbClassName}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glPackageBaseParameterBean}.${myBaseParameterBeanClassName} {
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExtendedDao.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExtendedDao.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exdao/ExtendedDao.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${myExtendedDaoPackageName};
+
+#set ($myClassName = "${myExtendedDaoClassName}")
+
+/**
+ * The dao interface of ${table.Name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public interface ${myClassName} extends ${myBaseDaoPackageName}.${myBaseDaoClassName} {
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exentity/ExtendedEntity.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exentity/ExtendedEntity.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/exentity/ExtendedEntity.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,14 @@
+package ${myExtendedEntityPackageName};
+
+#set ($myClassName = "${myExtendedObjectClassName}")
+
+/**
+ * The entity of ${table.Name}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class $myClassName extends ${myBaseEntityPackageName}.${myBaseObjectClassName} {
+
+    /** Serial version UID. (Default) */
+    private static final long serialVersionUID = 1L;
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/ArgumentBean.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/ArgumentBean.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/ArgumentBean.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,139 @@
+package ${glPackageArgumentBean};
+
+#set ($myClassName = "${myArgumentBeanClassName}")
+
+/**
+ * The argument-bean of ${myArgumentBeanName}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // =====================================================================================
+    //                                                                     Static Definition
+    //                                                                     =================
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+
+    /// <summary>The java name of ${propertyName}</summary>
+    public static final String JAVA_NAME_OF_${database.initCap($propertyName)} = "${database.initCap($propertyName)}";
+#end
+
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+
+    /// <summary>The property name of ${propertyName}</summary>
+    public static final String PROPERTY_NAME_OF_${database.initCap($propertyName)} = "${propertyName}";
+#end
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+    /// <summary>The value of ${propertyName}.</summary>
+    protected ${propertyJavaNative} _${propertyName};
+
+    /// <summary>Has the setter of ${col.UncapitalisedJavaName} been invoked?</summary>
+    protected boolean _isSetterInvoked${database.initCap($propertyName)};
+#end
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /// <summary>
+    /// Constructor.
+    /// </summary>
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // =====================================================================================
+    //                                                                         Getter Setter
+    //                                                                         =============
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+    /**
+     * Get the value of ${propertyName}.
+     * 
+     * @return The value of ${propertyName}.
+     */
+    public ${propertyJavaNative} get${database.initCap($propertyName)}() {
+        return _${propertyName};
+        set { _isSetterInvoked${database.initCap($propertyName)} = true; _${propertyName} = value; }
+    }
+
+    /**
+     * Set the value of ${propertyName}.
+     * 
+     * @param value The value of ${propertyName}.
+     */
+    public ${propertyJavaNative} set${database.initCap($propertyName)}(${propertyJavaNative} value) {
+        _isSetterInvoked${database.initCap($propertyName)} = true;
+        _${propertyName} = value;
+    }
+#end
+
+    // =====================================================================================
+    //                                                                Invoking Determination
+    //                                                                ======================
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+    /**
+     * Has the setter of ${propertyName} been invoked?
+     * 
+     * @return Determination.
+     */
+    public boolean isSetterInvoked${database.initCap($propertyName)}() {
+        return _isSetterInvoked${database.initCap($propertyName)};
+    }
+#end
+
+#if (${database.isAvailableSqlParameterBeanGeneration()})
+
+    // =====================================================================================
+    //                                                                 Prepared SqlParameter
+    //                                                                 =====================
+  #foreach ($sqlParameterName in $database.getArgumentBeanRelatedSqlParameterSqlParameterNameList($myArgumentBeanName))
+
+    /// <summary>
+    /// Get prepared parameter bean of ${sqlParameterName}.
+    /// </summary>
+    public ${glPackageExtendedSqlParameterBean}.${sqlParameterName} generatePreparedSqlParameter${sqlParameterName}() {
+        final ${glPackageExtendedSqlParameterBean}.${sqlParameterName} pmb = new ${glPackageExtendedSqlParameterBean}.${sqlParameterName}();
+    #foreach ($propertyName in $propertyDefinitionMap.keySet())
+      #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+      #if ($database.isSqlParameterBeanHaveTheProperty($sqlParameterName, $propertyName))
+
+        pmb.set${database.initCap($propertyName)}(get${database.initCap($propertyName)});
+      #end
+    #end
+
+        return pmb;
+    }
+  #end
+#end
+
+    // =====================================================================================
+    //                                                                 Basic Override Method
+    //                                                                 =====================
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Property-string. (NotNull)
+     */
+    public override String ToString() {
+        StringBuffer sb = new StringBuffer();
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getArgumentBeanPropertyType($myArgumentBeanName, $propertyName))
+
+            sb.append(" ${propertyName}=").append(this.${database.initCap($propertyName)});
+#end
+
+            return sb.toString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanBs.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanBs.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanBs.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,114 @@
+package ${glPackageBaseSqlParameterBean};
+
+#set ($myClassName = "${myBaseSqlParameterClassName}")
+
+/**
+ * The sql-parametaer-bean of ${mySqlParameterBeanName}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} {
+
+    // =====================================================================================
+    //                                                                     Static Definition
+    //                                                                     =================
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+
+    /// <summary>The java name of ${propertyName}</summary>
+    public static final String JAVA_NAME_OF_${database.initCap($propertyName)} = "${database.initCap($propertyName)}";
+#end
+
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+
+    /// <summary>The property name of ${propertyName}</summary>
+    public static final String PROPERTY_NAME_OF_${database.initCap($propertyName)} = "${propertyName}";
+#end
+
+    // =====================================================================================
+    //                                                                             Attribute
+    //                                                                             =========
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+    /// <summary>The value of ${propertyName}.</summary>
+    protected ${propertyJavaNative} _${propertyName};
+
+    /// <summary>Has the setter of ${col.UncapitalisedJavaName} been invoked?</summary>
+    protected boolean _isSetterInvoked${database.initCap($propertyName)};
+#end
+
+    // =====================================================================================
+    //                                                                           Constructor
+    //                                                                           ===========
+    /// <summary>
+    /// Constructor.
+    /// </summary>
+    /**
+     * Constructor.
+     */
+    public ${myClassName}() {
+    }
+
+    // =====================================================================================
+    //                                                                         Getter Setter
+    //                                                                         =============
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+    /**
+     * Get the value of ${propertyName}.
+     * 
+     * @return The value of ${propertyName}.
+     */
+    public ${propertyJavaNative} get${database.initCap($propertyName)}() {
+        return _${propertyName};
+        set { _isSetterInvoked${database.initCap($propertyName)} = true; _${propertyName} = value; }
+    }
+
+    /**
+     * Set the value of ${propertyName}.
+     * 
+     * @param value The value of ${propertyName}.
+     */
+    public ${propertyJavaNative} set${database.initCap($propertyName)}(${propertyJavaNative} value) {
+        _isSetterInvoked${database.initCap($propertyName)} = true;
+        _${propertyName} = value;
+    }
+#end
+
+    // =====================================================================================
+    //                                                                Invoking Determination
+    //                                                                ======================
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+    /**
+     * Has the setter of ${propertyName} been invoked?
+     * 
+     * @return Determination.
+     */
+    public boolean isSetterInvoked${database.initCap($propertyName)}() {
+        return _isSetterInvoked${database.initCap($propertyName)};
+    }
+#end
+
+    // =====================================================================================
+    //                                                                 Basic Override Method
+    //                                                                 =====================
+    /**
+     * ${database.OverrideComment}
+     * 
+     * @return Property-string. (NotNull)
+     */
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+#foreach ($propertyName in $propertyDefinitionMap.keySet())
+  #set ($propertyJavaNative = $database.getSqlParameterBeanPropertyType($mySqlParameterBeanName, $propertyName))
+
+            sb.append(" ${propertyName}=").append(this.${database.initCap($propertyName)});
+#end
+
+            return sb.toString();
+        }
+    }
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanEx.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanEx.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/java/sbean/SqlParameterBeanEx.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,11 @@
+package ${glPackageExtendedSqlParameterBean};
+
+#set ($myClassName = "${myExtendedSqlParameterClassName}")
+
+/**
+ * The sql-parameter-bean of ${mySqlParameterBeanName}.
+ * 
+ * @author ${database.ClassAuthor}
+ */
+public class ${myClassName} extends ${glPackageBaseSqlParameterBean}.${myBaseSqlParameterClassName} {
+}

Added: pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/sql2entity-Control.vm
===================================================================
--- pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/sql2entity-Control.vm	2007-07-10 13:19:59 UTC (rev 228)
+++ pompei/trunk/mydbflute/dbflute-0.5.2/templates/om/sql2entity-Control.vm	2007-07-10 13:21:18 UTC (rev 229)
@@ -0,0 +1,174 @@
+
+
+targetdatabase = $targetDatabase
+
+##
+## Loop by data-model.
+##
+#foreach ($dataModel in $dataModels)
+
+  ##
+  ## Loop by database.
+  ##
+  #foreach ($database in $dataModel.Databases)
+
+    ## ------------------------------------------------------------------
+    ##                                                    Global-Paramter
+    ##                                                    ---------------
+    ## [Language]
+    #set ($glTargetLanguage = ${database.TargetLanguage})
+
+    ## [Extension]
+    #set ($glTemplateFileExtension = ${database.TemplateFileExtension})
+    #set ($glClassFileExtension = ${database.ClassFileExtension})
+
+    ## [Prefix-and-Suffix]
+    #set ($glProjectPrefix = ${database.ProjectPrefix})
+    #set ($glBasePrefix = ${database.BasePrefix})
+    #set ($glBaseSuffixForEntity = ${database.BaseSuffixForEntity})
+
+    #set ($glDaoReadableInterfaceName = "${glProjectPrefix}DaoReadable")
+    #set ($glDaoWritableInterfaceName = "${glProjectPrefix}DaoWritable")
+
+    ## [Common-Entity]
+    #set ($glEntityInterfaceName = "${glProjectPrefix}Entity")
+    #set ($glEntityDefinedCommonColumnInterfaceName = "${glProjectPrefix}EntityDefinedCommonColumn")
+
+    ## [ConditionBean]
+    #set ($glConditionBeanInterfaceName = "${glProjectPrefix}ConditionBean")
+
+    ## [DBMeta]
+    #set ($glDBMetaInterfaceName = "${glProjectPrefix}DBMeta")
+    #set ($glDBMetaAbstractName = "${glProjectPrefix}AbstractDBMeta")
+    #set ($glDBMetaInstanceHandlerName = "${glProjectPrefix}DBMetaInstanceHandler")
+
+    ## [Helper]
+    #set ($glMapListStringName = "${glProjectPrefix}MapListString")
+    #set ($glMapListStringImplName = "${glProjectPrefix}MapListStringImpl")
+    #set ($glMapStringBuilderName = "${glProjectPrefix}MapStringBuilder")
+    #set ($glMapStringBuilderImplName = "${glProjectPrefix}MapStringBuilderImpl")
+
+    ## [ClassificationDefinition]
+    #set ($glClassificationDefinition = "${glProjectPrefix}ClassificationDefinition")
+
+    ## [Package]
+    #set ($glPackageBaseCommon = "${database.baseCommonPackage}")
+    #set ($glPackageBaseCommonCBean = "${database.baseCommonPackage}.cbean")
+    #set ($glPackageBaseCommonDBMeta = "${database.baseCommonPackage}.dbmeta")
+    #set ($glPackageBaseCommonHelper = "${database.baseCommonPackage}.helper")
+    #set ($glPackageBaseDao = "${database.baseDaoPackage}" )
+    #set ($glPackageBaseEntity = "${database.baseEntityPackage}")
+    #set ($glPackageExtendedDao = "${database.extendedDaoPackage}")
+    #set ($glPackageExtendedEntity = "${database.extendedEntityPackage}")
+
+    ## [Other]
+    #set ($glConditionBeanInitialName = "CB")
+    #set ($glConditionQueryInitialName = "CQ")
+    #set ($glAttachedCBArgsVariableName = "cb")
+    #set ($glParentVariablePrefix = "_parent")
+    #set ($glChildrenVariablePrefix = "_children")
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                                 Parse cutomize entity
+    ##                                                                                 ---------------------
+    ## Setup java directory.
+    $database.setupJavaDir_for_sql2entity()
+
+    ## for Sql2Entity
+    #set ($isSql2Entity = true)
+
+    #set ($glPackageBaseCustomizeEntity = "${database.Sql2EntityBaseEntityPackage}" )
+    #set ($glPackageCustomizeDBMeta = "${database.Sql2EntityDBMetaPackage}")
+    #set ($glPackageExtendedCustomizeEntity = "${database.Sql2EntityExtendedEntityPackage}" )
+
+    #set ($path = $strings.getPackageAsPath(${glPackageBaseCustomizeEntity}))
+    $database.makeDirectory($path)
+
+    #if (!$database.isSql2EntityPlainEntity())
+      #set ($path = $strings.getPackageAsPath(${glPackageCustomizeDBMeta}))
+      $database.makeDirectory($path)
+    #end
+
+    #set ($path = $strings.getPackageAsPath(${glPackageExtendedCustomizeEntity}))
+    $database.makeDirectory($path)
+
+    $database.debug("public void parseCustomizeEntity() {")
+    $database.debug("    final List<String> tableNameList = getTableList();")
+    $database.debug("    for (String tableName : tableNameList) {")
+    #foreach ($table in $database.TableList)
+      #set ($myBaseObjectClassName = "${glProjectPrefix}${glBasePrefix}${table.JavaName}")
+      #set ($myBaseEntityPackageName = "${glPackageBaseCustomizeEntity}")
+      #set ($myExtendedObjectClassName = "${glProjectPrefix}${table.JavaName}")
+      #set ($myExtendedEntityPackageName = "${glPackageExtendedCustomizeEntity}")
+      #set ($myDBMetaClassName = "${glProjectPrefix}${table.JavaName}Dbm")
+      #set ($myDBMetaPackageName = "${glPackageCustomizeDBMeta}")
+
+      #set ($myEntityVariableName = "${table.uncapitalisedJavaName}")
+      #set ($myEntityListVariableName = "${table.uncapitalisedJavaName}List")
+      #set ($myCBVariableName = "${table.uncapitalisedJavaName}")
+
+      #set ($isExistDao = false)
+      #set ($isExistConditionBean = false)
+
+      #if ($database.isSql2EntityPlainEntity())
+        $database.debug("        parseBaseCustomizeEntity(tableName);     // ${myBaseObjectClassName}")
+        #set ( $path = "${strings.getPackageAsPath(${myBaseEntityPackageName})}${myBaseObjectClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsentity/PlainBaseEntity.${glTemplateFileExtension}",$path ,"" ,"")
+      #else
+        $database.debug("        parseBaseCustomizeEntity(tableName);     // ${myBaseObjectClassName}")
+        #set ( $path = "${strings.getPackageAsPath(${myBaseEntityPackageName})}${myBaseObjectClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsentity/BaseEntity.${glTemplateFileExtension}",$path ,"" ,"")
+
+        $database.debug("        parseCustomizeDBMeta(tableName);         // ${myDBMetaClassName}")
+        #set ( $path = "${strings.getPackageAsPath(${myDBMetaPackageName})}${myDBMetaClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsentity/dbmeta/DBMetaImpl.${glTemplateFileExtension}",$path,"", "")
+      #end
+
+      #set ( $path = "${strings.getPackageAsPath(${myExtendedEntityPackageName})}${myExtendedObjectClassName}.${glClassFileExtension}" )
+      #if (!$files.file(${generator.OutputPath},$path).exists())
+        $database.debug("        parseExtendedCustomizeEntity(tableName); // ${myExtendedObjectClassName}")
+        $generator.parse("om/${glTargetLanguage}/exentity/ExtendedEntity.${glTemplateFileExtension}",$path ,"" ,"")
+      #end
+
+    #end
+    $database.debug("    }")
+    $database.debug("}")
+
+    ## -----------------------------------------------------------------------------------------------------
+    ##                                                                                  Parse parameter bean
+    ##                                                                                  --------------------
+    #if ($database.isExistPmbMetaData())
+    $database.debug("public void parseParameterBean() {")
+    $database.debug("    final List<DfParameterBeanMetaData> parameterBeanList = getParameterBeanList();")
+    $database.debug("    for (DfParameterBeanMetaData parameterBean : parameterBeanList) {")
+
+    #set ($glPackageBaseParameterBean = "${database.Sql2EntityBaseParameterBeanPackage}" )
+    #set ($glPackageExtendedParameterBean = "${database.Sql2EntityExtendedParameterBeanPackage}" )
+
+      #set ($path = $strings.getPackageAsPath(${glPackageBaseParameterBean}))
+      $database.makeDirectory($path)
+      #set ($path = $strings.getPackageAsPath(${glPackageExtendedParameterBean}))
+      $database.makeDirectory($path)
+
+      #foreach ($pmbMetaData in $database.pmbMetaDataList)
+        #set ($pmbClassName = "$pmbMetaData.className")
+        #set ($pmbSuperClassName = "$pmbMetaData.superClassName")
+        #set ($myBaseParameterBeanClassName = "${glProjectPrefix}${glBasePrefix}${pmbClassName}")
+        #set ($myExtendedParameterBeanClassName = "${glProjectPrefix}${pmbClassName}")
+
+        $database.debug("        parseBaseParameterBean(parameterBean);     // ${myBaseParameterBeanClassName}")
+        #set ( $path = "${strings.getPackageAsPath(${glPackageBaseParameterBean})}${myBaseParameterBeanClassName}.${glClassFileExtension}" )
+        $generator.parse("om/${glTargetLanguage}/bsdao/BsParameterBean.${glTemplateFileExtension}",$path ,"" ,"")
+
+        #set ( $path = "${strings.getPackageAsPath(${glPackageExtendedParameterBean})}${myExtendedParameterBeanClassName}.${glClassFileExtension}" )
+        #if (!$files.file(${generator.OutputPath},$path).exists())
+          $database.debug("        parseExtendedParameterBean(parameterBean); // ${myExtendedParameterBeanClassName}")
+          $generator.parse("om/${glTargetLanguage}/exdao/ExParameterBean.${glTemplateFileExtension}",$path ,"" ,"")
+        #end
+      #end
+    $database.debug("    }")
+    $database.debug("}")
+    #end
+
+  #end
+#end


pal-cvs メーリングリストの案内
Back to archive index