Forgot to mention, I am using 3.3SNAPSHOT.

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Sun 3/23/2008 3:11 PM
To: [email protected]
Subject: Camel JPA inserts null values



Hi All,

Camel etl example with the following Route works fine

from("file:inbox/data1?noop=true").convertBodyTo(PersonDocument.class)
        //  .intercept(transactionInterceptor())
            .to("jpa:org.apache.camel.example.etl.CustomerEntity");

When I change this use smx filepoller with the following route, this inserts 
null vaues in the customer table. Actually I am using a passthrough bean su.

  from("jbi:endpoint:http://camel.apache.org/example/etl/persist/person";)
      .convertBodyTo(PersonDocument.class)
        //  .intercept(transactionInterceptor())
            .to("jpa:org.apache.camel.example.etl.CustomerEntity");

fillePoller su config..
-------------------------
<beans xmlns:file="http://servicemix.apache.org/file/1.0";
       xmlns:ls="http://servicemix.apache.org/samples/logging-sample";>
<file:poller service="ls:filePoller"
                      endpoint="poller"
                      targetService="ls:beanRouter"
                      targetEndpoint="router"
                      file="inbox/data1">
</file:poller>
</beans>

Bean su
----------------

<beans xmlns:bean="http://servicemix.apache.org/bean/1.0";
      xmlns:ls="http://servicemix.apache.org/samples/logging-sample";>
  <bean:endpoint service="ls:beanRouter" endpoint="router">
      <bean:bean>
          <bean class="org.apache.servicemix.samples.logging.BeanRouter" />
      </bean:bean>
  </bean:endpoint>

</beans>

Bean su code..
----------------------
 public void onMessageExchange(MessageExchange exchange) throws 
MessagingException {

    InOnly in = (InOnly) exchange;
        if (in.getStatus() == ExchangeStatus.DONE) {
            return;
        } else if (in.getStatus() == ExchangeStatus.ERROR) {
            return;
        }
        System.err.println(in.getService().getLocalPart() + " requested");
  try {
    NormalizedMessage message = exchange.getMessage("in");
    Source content = message.getContent();
    QName targetService = new 
QName("http://camel.apache.org/example/etl","persist";);
    MessageExchangeFactory exchangeFact = 
channel.createExchangeFactoryForService(targetService);
    InOnly response = exchangeFact.createInOnlyExchange();
    NormalizedMessage jpaMessage = response.createMessage();
    jpaMessage.setContent(content);
    response.setInMessage(jpaMessage);
    channel.sendSync(response);
    exchange.setStatus(ExchangeStatus.DONE);
    channel.send(exchange);
    } catch (Exception e) {
            in.setError(e);
            channel.sendSync(in);
        }

    }

Has  somone encountered this problem earlier..

Regards,
Rabi Mishra



The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

Reply via email to