我正在使用datamapper将有效载荷转换为集合,然后再将其传递给数据库连接器。我在这里想念什么?
这是代码:
`<data-mapper:config name="CSV_To_Map"`
transformationGraphPath="csv_to_map.grf" doc:name="CSV_To_Map"/>
<batch:job name="batchcustomerimport3.6.0Batch1">
<batch:input>
<file:inbound-endpoint path="C:Usershhernandeztestworkspace411batchcustomerimport3.6.0Collectionsrctestresourcesin" moveToPattern="#[message.inboundProperties.originalFileName]" moveToDirectory="C:Usershhernandeztestworkspace411batchcustomerimport3.6.0Collectionsrctestresourcesout" responseTimeout="10000" doc:name="File">
<file:filename-regex-filter pattern="CustomerImportTest.csv" caseSensitive="true"/>
</file:inbound-endpoint>
<file:file-to-string-transformer doc:name="File to String"/>
<data-mapper:transform config-ref="CSV_To_Map" doc:name="CSV To Map"/>
<logger level="INFO" doc:name="Logger"/>
</batch:input>
<batch:process-records>
<batch:step name="Batch_Step">
<db:update config-ref="Generic_Database_Configuration" bulkMode="true" doc:name="Database">
<db:parameterized-query><![CDATA[UPDATE FBF05P
SET STORE#X = #[payload['STORENO']]
WHERE VIP#X = #[payload['CUSTID']]]]>
</db:update>
</batch:step>
</batch:process-records>
<batch:on-complete>
<logger level="INFO" doc:name="Logger"/>
</batch:on-complete>
</batch:job>
更改批处理步骤以使用批处理提交更新记录。
<batch:step name="Batch_Step">
<batch:commit doc:name="Batch Commit" size="500">
<db:update config-ref="Generic_Database_Configuration" bulkMode="true" doc:name="Database">
<db:parameterized-query>
<![CDATA[
UPDATE FBF05P
SET STORE#X = #[payload['STORENO']]
WHERE VIP#X = #[payload['CUSTID']]
]]>
</db:parameterized-query>
</db:update>
</batch:commit>
</batch:step>
由于您的输入为列表,但在批处理步骤中,它将是单个记录,即映射。因此,使用批处理提交您可以发送一堆记录以进行更新。
希望这会有所帮助。