我正在尝试使用 Mule ESB 将列表传递给 Postgresql。
我的 pojo 的简化版本如下所示:
public class NewEntry {
private String positionReference;
private String productID;
@XmlElement(required=true, name="PositionReference")
public String getPositionReference() {
return positionReference;
}
public void setPositionReference(String positionReference) {
this.positionReference = positionReference;
}
@XmlElement(required=true, name="ProductID")
public String getProductID() {
return productID;
}
public void setProductID(String productID) {
this.productID = productID;
}
}
这是通过 SOAP 网络服务传递的 列表
到目前为止,我只是将其转换为 JSON 并将其输出到一个文件中,现在我想将其插入到数据库中,因此在我的数据库步骤中,我在其中插入了一个插入查询的:
<jdbc:query key="insertrecord" value="INSERT INTO f_intraday_rt(version) VALUES (#[message:productDescription]);"/>
无论如何,无论我在 VALUES 部分使用什么消息评估,我都无法让它插入值,只是错误或空白行。
如何解除循环捆绑并为每个列表项插入一行?
谢谢
汤姆
最佳答案
在出站 JDBC 端点之前使用集合拆分器将对象列表拆分为不同的消息。这将执行多次插入。
关于java - 将 POJO 值传递到 Mule ESB 中的数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12959863/