2014-04-23 50 views

回答

1

备选:使用的UUID主键和生成插入之前在骡子的UUID。

+0

感谢戴夫!但在这种情况下,主键是由数据库自动生成的。但是,使用此链接中提到的strategyFactory,我可以取回主键。 https://www.mulesoft.org/jira/browse/MULE-6306 – Kgan

2

尝试在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> 

+0

谢谢!我正在使用Mule 3.3.2。但是,使用此链接中提到的strategyFactory,我可以取回主键。 https://www.mulesoft.org/jira/browse/MULE-6306 – Kgan