从下面的文章中,我明白Mule在插入语句后不会返回自动生成的主键。是否有任何解决方法来获取PrimaryKey?我不喜欢这篇文章中提到的mybatis。Mule - 在插入后获取主键
任何帮助表示赞赏!
http://ricston.com/blog/rant-mule-jdbc-transport-introduction-mule-module-mybatis/
从下面的文章中,我明白Mule在插入语句后不会返回自动生成的主键。是否有任何解决方法来获取PrimaryKey?我不喜欢这篇文章中提到的mybatis。Mule - 在插入后获取主键
任何帮助表示赞赏!
http://ricston.com/blog/rant-mule-jdbc-transport-introduction-mule-module-mybatis/
备选:使用的UUID主键和生成插入之前在骡子的UUID。
尝试在3.5.0-M4中使用新的数据库模块,或等待Mule ESB 3.5.0数周。 Here是这一新功能的使用示例:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">
<flow name="insertWithAutoGeneratedKeys">
<inbound-endpoint address="vm://insertWithAutoGeneratedKeys" exchange-pattern="request-response"/>
<db:insert config-ref="dbConfig" autoGeneratedKeys="true" autoGeneratedKeysColumnIndexes="1">
<db:parameterized-query>INSERT INTO PLANET(POSITION, NAME) VALUES (777, 'Mercury')</db:parameterized-query>
</db:insert>
</flow>
谢谢!我正在使用Mule 3.3.2。但是,使用此链接中提到的strategyFactory,我可以取回主键。 https://www.mulesoft.org/jira/browse/MULE-6306 – Kgan
感谢戴夫!但在这种情况下,主键是由数据库自动生成的。但是,使用此链接中提到的strategyFactory,我可以取回主键。 https://www.mulesoft.org/jira/browse/MULE-6306 – Kgan