遵循实体定义:
<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”和来自嵌套实体“位置”的字段,即“位置名称”。我怎么能意识到这一点?两个字段都应该被索引。只有机会合并两个字符串?