when you use exchange.getIn().getBody(Table1Record.class) to get the Table1Record object, camel converter doesn't know to unmarshal the Json String. You need to user the umarshal() DSL to do that kind of job yourself.
-- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: willemjiang On Sunday, November 4, 2012 at 7:22 AM, nico wrote: > Hello I've a route like the following: > > from("direct:a") > .setBody(constant("SELECT * FROM \"schema1\".\"table1\"")) > .to("jdbc:pgDS") > .split(body()) > .marshal().json(JsonLibrary.XStream, Table1Record.class) > .to("direct:b") > .end(); > > > And the following class: > > @XStreamAlias("Table1Record") > public class Table1Record { > @XStreamAlias("Field1") > public Long field1; > > public Long getField1() { > return field1; > } > public void setField1(Long field1) { > this.field1 = field1; > } > } > > But eveen marshalling it to Table1Record, annotated with xstream, this > expression: exchange.getIn().getBody(String.class) returns me something like > this: {"linked-hash-map":{"entry":[{"string":"Field1","int":5}]}} > > And exchange.getIn().getBody(Table1Record.class) returns me null... > > Any clue on this? > > If more information is needed please ask me. > > Thanks. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Marshaling-to-json-from-jdbc-tp5722094.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
