0

遵循实体定义:

<entity name="mission" dataSource="mssqlDatasource" pk="id" 
        transformer="TemplateTransformer, ClobTransformer" 
        query="SELECT m.id, m.notes, m.missionFocus,m.start_time, 
                      mar.id AS market, mar.name AS marketName 
               FROM mission m 
               INNER JOIN market mar ON m.market = mar.id">

    <field column="start_time" name="startTime" />
    <field column="market" name="market" />
    <field column="marketName" name="marketName" clob="true" />
    <field column="tableType" template="MISSION" />

    <entity name="comment" dataSource="mssqlDatasource" 
            transformer="ClobTransformer" 
            query="SELECT c.message 
                   FROM comment c 
                   WHERE c.source_id = '${mission.id}' AND c.source_type = 'mission'">
        <field name="commentMessage" column="message" clob="true" />
    </entity>

    <entity name="activity" dataSource="mssqlDatasource" 
            query="SELECT a.notes 
                   FROM activity a 
                   WHERE a.mission = '${mission.id}'">
        <field name="activityNotes" column="notes" />
    </entity>        

    <entity name="location" dataSource="mssqlDatasource" 
                query="SELECT l.name 
                       FROM location l 
                       WHERE l.id = '${activity.id}'">
        <field name="locationName" column="name" />            
    </entity>        
</entity>

您看到我的问题是嵌套实体“活动”需要返回 2 个字段,即“activityNotes”和来自嵌套实体“位置”的字段,即“位置名称”。我怎么能意识到这一点?两个字段都应该被索引。只有机会合并两个字符串?

4

1 回答 1

0

您可以在ScriptUpdateProcessor中执行此操作。您只需在单独的字段中从 DIH 获取它们,但在 UpdateProcessor 中您可以附加它们并将其插入到第三个字段中。在 4.0 中,您应该能够在没有 java 代码的情况下使用 ScriptUpdateProcessor 做到这一点

于 2012-10-16T08:24:44.483 回答