Da du vil gemme hele JSON, er der ingen grund til at deserialisere den som et objekt:Jeg foreslår, at du blot transformerer den HTTP-streamede nyttelast til en java.lang.String
og indsæt det som det er i DB.
Dette ville gøre sådan:
<jdbc:postgresql-data-source name="PostgreSQL_Data_Source"
user="username" password="pwd" url="jdbc:postgresql://localhost:5432/TestDB"
transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source" />
<jdbc:connector name="PostgreSQL_Connector" dataSource-ref="PostgreSQL_Data_Source"
validateConnections="true" queryTimeout="-1" pollingFrequency="0"
doc:name="Database">
<jdbc:query key="InsertRecord"
value="INSERT INTO "AnotherJSonTable"("StoreJsonObject") VALUES (CAST(#[message.payload] AS json))" />
</jdbc:connector>
<flow name="testRestFlow1" doc:name="testRestFlow1">
<http:inbound-endpoint exchange-pattern="request-response"
address="http://localhost:8082/index.html" doc:name="HTTP" />
<http:rest-service-component httpMethod="GET"
serviceUrl="http://localhost:35798/RestServiceImpl.svc/json/567" />
<object-to-string-transformer />
<jdbc:outbound-endpoint exchange-pattern="one-way"
queryKey="InsertRecord" queryTimeout="-1" connector-ref="PostgreSQL_Connector"
doc:name="Database" />
</flow>