読者です 読者をやめる 読者になる 読者になる

LucyとDBFluteの連携(その2、一応動く)

jfluteさんのコメントで「」とあったのでひたすら書いてみました。


とはいえ下記のテストが通るだけの最小限の設定。


テストは通ったけど、一度ちゃんとdao.diconとj2ee.diconを見ながら、ちゃんと書き直す必要があるなぁ。

テストコードはその1と同じ。

以下、lucy-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE lucy-config PUBLIC "-//LUCY//DTD LUCY//EN" "http://www.lucy.org/dtd/lucy-config.dtd">
<lucy-config>
    
    <component name="xaDataSource" class="org.seasar.extension.dbcp.impl.XADataSourceImpl">
        <inject method="setDriverClassName">"org.h2.Driver"</inject>
        <inject method="setURL">t2DbUrl.object</inject>
        <inject method="setUser">"sa"</inject>
        <!-- <inject method="setPassword"></inject> -->
    </component>
     
    <component name="t2DbUrl" class="org.t2framework.samples.todo.EmbeddedH2UrlFactoryBean">
        <inject method="setUrlSuffix">"/t2db/t2db"</inject>
        <inject method="setReferenceClassName">"org.t2framework.samples.todo.dbflute.allcommon.Entity"</inject>
    </component>
    
    <component name="connectionPool" class="org.seasar.extension.dbcp.impl.ConnectionPoolImpl">
        <destroy method="close" />
        <inject method="setTransactionManager">transactionManager</inject>
        <inject method="setXADataSource">xaDataSource</inject>
    </component>
    
    <component name="transactionManager" class="org.seasar.extension.jta.TransactionManagerImpl"/>

    <component name="dataSource" class="org.seasar.extension.dbcp.impl.DataSourceImpl">
        <inject>connectionPool</inject>
    </component>

    <component name="dbfluteInitializer" class="org.t2framework.samples.todo.dbflute.allcommon.DBFluteInitializer">
        <inject>xaDataSource</inject>
    </component>
    
    <component name="behaviorCommandInvoker" class="org.t2framework.samples.todo.dbflute.allcommon.bhv.core.BehaviorCommandInvoker">
        <inject method="setDataSource">dataSource</inject>
        <inject method="setBeanMetaDataFactory">beanMetaDataFactory</inject>
        <inject method="setValueTypeFactory">valueTypeFactory</inject>
        <inject method="setInvokerAssistant">invokerAssistant</inject>
    </component>
    
    <component name="invokerAssistant" class="org.t2framework.samples.todo.dbflute.allcommon.ImplementedInvokerAssistant"/>
    <component name="commonColumnAutoSetupper" class="org.t2framework.samples.todo.dbflute.allcommon.ImplementedCommonColumnAutoSetupper"/>
    <component name="behaviorSelector" class="org.t2framework.samples.todo.dbflute.allcommon.CacheBehaviorSelector">
        <destroy method="destroy" />
    </component>

    <component name="beanMetaDataFactoryExtension" class="org.t2framework.samples.todo.dbflute.allcommon.s2dao.BeanMetaDataFactoryExtension"/>
    <component name="propertyTypeFactoryBuilderExtension" class="org.t2framework.samples.todo.dbflute.allcommon.s2dao.PropertyTypeFactoryBuilderExtension"/>
    <component name="latestSqlProvider" class="org.t2framework.samples.todo.dbflute.allcommon.s2dao.SqlLogRegistryLatestSqlProvider"/>
    <component name="dbfluteStringClobType" class="org.seasar.extension.jdbc.types.StringClobType"/>
    <component name="dbfluteBytesOidType" class="org.t2framework.samples.todo.dbflute.allcommon.s2dao.internal.valuetype.InternalBytesOidType" />

    <component name="beanMetaDataFactory" class="org.seasar.dao.impl.BeanMetaDataFactoryImpl">
        <inject method="setDataSource">dataSource</inject>
        <inject method="setBeanEnhancer">beanEnhancer</inject>
        <inject method="setAnnotationReaderFactory">annotationReaderFactory</inject>
        <inject method="setDaoNamingConvention">daoNamingConvention</inject>
        <inject method="setRelationPropertyTypeFactoryBuilder">relationPropertyTypeFactoryBuilder</inject>
        <inject method="setTableNaming">tableNaming</inject>
        <inject method="setPropertyTypeFactoryBuilder">propertyTypeFactoryBuilder</inject>
    </component>
    
    <!-- dao.dicon -->
    <component name="beanEnhancer" class="org.seasar.dao.impl.NullBeanEnhancer" />
    <component name="annotationReaderFactory" class="org.seasar.dao.impl.AnnotationReaderFactoryImpl" />
    <component name="daoNamingConvention" class="org.seasar.dao.impl.DaoNamingConventionImpl"/>
    <component name="relationPropertyTypeFactoryBuilder" class="org.seasar.dao.impl.RelationPropertyTypeFactoryBuilderImpl">
        <inject method="setBeanEnhancer">beanEnhancer</inject>
        <inject method="setBeanMetaDataFactory">beanMetaDataFactory</inject>
    </component>
    <component name="tableNaming" class="org.seasar.dao.impl.DefaultTableNaming"/>
    <component name="columnNaming" class="org.seasar.dao.impl.DefaultColumnNaming"/>
    <component name="valueTypeFactory" class="org.seasar.dao.impl.ValueTypeFactoryImpl"/>
    <component name="propertyTypeFactoryBuilder" class="org.seasar.dao.impl.PropertyTypeFactoryBuilderImpl">
        <inject method="setColumnNaming">columnNaming</inject>
        <inject method="setDaoNamingConvention">daoNamingConvention</inject>
        <inject method="setValueTypeFactory">valueTypeFactory</inject>
    </component>
    
    <component name="memberBhv" class="org.t2framework.samples.todo.dbflute.exbhv.MemberBhv">
        <inject method="setBehaviorCommandInvoker">behaviorCommandInvoker</inject>
        <inject method="setBehaviorSelector">behaviorSelector</inject>
    </component>

</lucy-config>