Jdbc Mule-插入后取回主键
从下面的文章中,我了解到Mule不会在insert语句之后返回自动生成的主键。有什么办法可以拿到PrimaryKey吗?我不喜欢这篇文章中提到的mybatis 感谢您的帮助Jdbc Mule-插入后取回主键,jdbc,primary-key,mule,auto-generate,Jdbc,Primary Key,Mule,Auto Generate,从下面的文章中,我了解到Mule不会在insert语句之后返回自动生成的主键。有什么办法可以拿到PrimaryKey吗?我不喜欢这篇文章中提到的mybatis 感谢您的帮助 备选方案:使用UUID作为主键并在插入前在Mule中生成UUID。备选方案:使用UUID作为主键并在插入前在Mule中生成UUID。备选方案:使用UUID作为主键并在插入前在Mule中生成UUID。备选方案:使用UUID作为主键并生成UUIDUUID在Mule中插入。尝试使用3.5.0-M4中提供的新DB模块,或等待几周,以
备选方案:使用UUID作为主键并在插入前在Mule中生成UUID。备选方案:使用UUID作为主键并在插入前在Mule中生成UUID。备选方案:使用UUID作为主键并在插入前在Mule中生成UUID。备选方案:使用UUID作为主键并生成UUIDUUID在Mule中插入。尝试使用3.5.0-M4中提供的新DB模块,或等待几周,以获得Mule ESB 3.5.0。以下是此新功能的使用示例:
<?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>
插入行星(位置、名称)值(777,‘水星’)
尝试使用3.5.0-M4中提供的新DB模块,或等待几周以获得Mule ESB 3.5.0。以下是此新功能的使用示例:
<?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>
插入行星(位置、名称)值(777,‘水星’)
尝试使用3.5.0-M4中提供的新DB模块,或等待几周以获得Mule ESB 3.5.0。以下是此新功能的使用示例:
<?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>
插入行星(位置、名称)值(777,‘水星’)
尝试使用3.5.0-M4中提供的新DB模块,或等待几周以获得Mule ESB 3.5.0。以下是此新功能的使用示例:
<?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>
插入行星(位置、名称)值(777,‘水星’)
谢谢你,戴夫!但在这种情况下,主键是由DB自动生成的。然而,使用本文中提到的strategyFactory,我可以取回主键。谢谢你,戴夫!但在这种情况下,主键是由DB自动生成的。然而,使用本文中提到的strategyFactory,我可以取回主键。谢谢你,戴夫!但在这种情况下,主键是由DB自动生成的。然而,使用本文中提到的strategyFactory,我可以取回主键。谢谢你,戴夫!但在这种情况下,主键是由DB自动生成的。然而,使用本文中提到的strategyFactory,我可以取回主键。谢谢,麦酒!我正在使用Mule 3.3.2。然而,使用本文中提到的strategyFactory,我可以取回主键。谢谢,麦酒!我正在使用Mule 3.3.2。然而,使用本文中提到的strategyFactory,我可以取回主键。谢谢,麦酒!我正在使用Mule 3.3.2。然而,使用本文中提到的strategyFactory,我可以取回主键。谢谢,麦酒!我正在使用Mule 3.3.2。然而,使用本文中提到的strategyFactory,我可以取回主键。