JPA: Could not pass Object from jpa to jms

View: New views
4 Messages — Rating Filter:   Alert me  

JPA: Could not pass Object from jpa to jms

by DRy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by Claus Ibsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 2:42 PM, DRy <dirk.rybinski@...> 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

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

by DRy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 ...

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


... DRy

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

by Claus Ibsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 4, 2009 at 10:53 AM, DRy <dirk.rybinski@...> 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
Need professional support or training for Apache Camel? Graphic Design by Hiram and the Nabble Forum configured by James