You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by DRy <di...@itellium.com> on 2009/11/03 14:42:40 UTC

JPA: Could not pass Object from jpa to jms

Hi,

if I try to get an object from my jpa-resource and pass it to jms, the
jms-message body is always null! I use the following route dfinition:

    
from("jpa:com.itellium.eai.camelexample.entity.Customer?consumer.namedQuery=findAll&delay=10000&consumeLockEntity=true&consumeDelete=false")
            .routeId(JPAInRouteBuilder.ROUTE_ID)
            .transacted()
                .bean(messageLogBean)
               
.to("jms:jpaIn?exchangePattern=InOnly&transacted=true&jmsMessageType=Object")
        .end();

If I look at the log, I can see that I get an object from the database (at
the point of the bean-call):

2009-11-03 14:30:19,952 [1: JpaComponent] INFO  MessageLogBean                
- jpaIn,cadd73c8-edc5-4764-9ea2-bbeeb76bf9e8,Exchange[Message:
com.itellium.eai.camelexample.entity.Customer@509bfc(oid=1,name=Name1,oversion=1)],Body[com.itellium.eai.camelexample.entity.Customer@509bfc(oid=1,name=Name1,oversion=1)]

I had tryed to use a route definition without any ben-call ... same effect
...

Im not sure ... but this may be a problem in the latest snapshot?


... DRy

-- 
View this message in context: http://old.nabble.com/JPA%3A-Could-not-pass-Object-from-jpa-to-jms-tp26160124p26160124.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: JPA: Could not pass Object from jpa to jms

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Nov 4, 2009 at 10:53 AM, DRy <di...@itellium.com> wrote:
>
> Hi,
>
>
> Claus Ibsen-2 wrote:
>>
>> I guess JPA has instrumented and all sorts to those objects so you
>> cant serialize them and send them over the remote network.
>> Maybe there is something in the JPA API to detach or what it may be
>> called from the JPA EntityFactory so you can send it over network.
>>
>
> I used an old version of the object from our CVS-Repository that did not
> implement Serializable ... :wistle:
>
> But ... I could not see any exceptions when camel tries to put the message
> to the jms queue ... ?
>

Ah I have created a ticket for that so we can get this fixed.
https://issues.apache.org/activemq/browse/CAMEL-2132

>
> ... DRy
> --
> View this message in context: http://old.nabble.com/JPA%3A-Could-not-pass-Object-from-jpa-to-jms-tp26160124p26193494.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: JPA: Could not pass Object from jpa to jms

Posted by DRy <di...@itellium.com>.
Hi,


Claus Ibsen-2 wrote:
> 
> I guess JPA has instrumented and all sorts to those objects so you
> cant serialize them and send them over the remote network.
> Maybe there is something in the JPA API to detach or what it may be
> called from the JPA EntityFactory so you can send it over network.
> 

I used an old version of the object from our CVS-Repository that did not
implement Serializable ... :wistle:

But ... I could not see any exceptions when camel tries to put the message
to the jms queue ... ?


... DRy
-- 
View this message in context: http://old.nabble.com/JPA%3A-Could-not-pass-Object-from-jpa-to-jms-tp26160124p26193494.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: JPA: Could not pass Object from jpa to jms

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Nov 3, 2009 at 2:42 PM, DRy <di...@itellium.com> wrote:
>
> Hi,
>
> if I try to get an object from my jpa-resource and pass it to jms, the
> jms-message body is always null! I use the following route dfinition:
>
>
> from("jpa:com.itellium.eai.camelexample.entity.Customer?consumer.namedQuery=findAll&delay=10000&consumeLockEntity=true&consumeDelete=false")
>            .routeId(JPAInRouteBuilder.ROUTE_ID)
>            .transacted()
>                .bean(messageLogBean)
>
> .to("jms:jpaIn?exchangePattern=InOnly&transacted=true&jmsMessageType=Object")
>        .end();
>
> If I look at the log, I can see that I get an object from the database (at
> the point of the bean-call):
>
> 2009-11-03 14:30:19,952 [1: JpaComponent] INFO  MessageLogBean
> - jpaIn,cadd73c8-edc5-4764-9ea2-bbeeb76bf9e8,Exchange[Message:
> com.itellium.eai.camelexample.entity.Customer@509bfc(oid=1,name=Name1,oversion=1)],Body[com.itellium.eai.camelexample.entity.Customer@509bfc(oid=1,name=Name1,oversion=1)]
>
> I had tryed to use a route definition without any ben-call ... same effect
> ...
>
> Im not sure ... but this may be a problem in the latest snapshot?
>

I guess JPA has instrumented and all sorts to those objects so you
cant serialize them and send them over the remote network.
Maybe there is something in the JPA API to detach or what it may be
called from the JPA EntityFactory so you can send it over network.



>
> ... DRy
>
> --
> View this message in context: http://old.nabble.com/JPA%3A-Could-not-pass-Object-from-jpa-to-jms-tp26160124p26160124.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus