You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by robbob <ro...@lynden.com> on 2014/06/14 01:44:42 UTC

JPA entityType always Null

I've create a JPA consumer using the following URI:
jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local

I have also added an @Consumed method to the
com.lynden.peoplenet.Locationhistory class.  The process reads out the
records from the database with no problem, however the @Consumed method is
never called on the Locationhistory class.  Upon debugging further, it looks
like the entityType variable in the JpaEndpoint object is set to null for
some reason, and so the JpaConsumer class can't find the entity class to
invoke its Consumed method.  I've also tried adding the entityType property
to the URI:


jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local&entityType=com.lynden.peoplenet.Locationhistory

But I get the following error:

Failed to resolve endpoint:
jpa://com.lynden.peoplenet.Locationhistory?consumeDelete=false&consumer.namedQuery=Locationhistory.findUnprocessed&entityType=com.lynden.peoplenet.Locationhistory&persistenceUnit=PN-SQL-Local
due to: Could not find a suitable setter for property: entityType as there
isn't a setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type: java.lang.String
to the required type: java.lang.Class with value
com.lynden.peoplenet.Locationhistory.

I'm using camel-core and camel-jpa 2.13.1

Any ideas of what I should be looking for?

thanks,
-Rob



--
View this message in context: http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: JPA entityType always Null

Posted by Babak Vahdat <ba...@swissonline.ch>.
I’m not sure if you’re running into a bug of the Eclipselink 2.0 or something
as it’s really an old version from December 2009.

Regarding the Locationhistory prefix, I guess the Locationhistory name
prefix is given by yourself, correct?

   NamedQuery(name = "Locationhistory.findUnprocessed", query = ...);

Can you maybe try to embedd the newest Eclipselink version into your
WEB-INF/lib folder to see if you can reproduce the problem, or maybe try
another provider, e.g. the Camel JPA component itself makes use of Apache
OpenJPA. So maybe try to put the newest OpenJPA jar:

http://search.maven.org/remotecontent?filepath=org/apache/openjpa/openjpa/2.3.0/openjpa-2.3.0.jar

Into your WEB-INF/lib folder and then inside persistence.xml ask for this
provider:

  
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>

Can you also provide the full stacktrace of the exception you get?

Babak

robbob wrote
> Hi Babak,
> 
> I am using Eclipselink 2.0 and running inside of a web application on
> glassfish.  I tried remove the Locationhistory prefix and the query does
> not run at all, whereas when it runs with the prefix, it executes over and
> over again.
> 
> Thanks,
> -Rob
> 
> 
> From: Babak Vahdat [via Camel] [mailto:

> ml-node+s465427n5752291h54@.nabble

> ]
> Sent: Saturday, June 14, 2014 12:08 AM
> To: Rob Terpilowski
> Subject: Re: JPA entityType always Null
> 
> Hi
> 
> What is your JPA provider and which version of it (Eclipselink, OpenJPA or
> Hibernate-EntityManager, etc.) and how do you run your app? Standalone,
> inside a web-app or?
> Can you also try with the option value consumer.namedQuery=findUnprocessed
> without the Locationhistory prefix?
> 
> Babak
> robbob wrote
> I've create a JPA consumer using the following URI:
> jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local
> 
> I have also added an @Consumed method to the
> com.lynden.peoplenet.Locationhistory class.  The process reads out the
> records from the database with no problem, however the @Consumed method is
> never called on the Locationhistory class.  Upon debugging further, it
> looks like the entityType variable in the JpaEndpoint object is set to
> null for some reason, and so the JpaConsumer class can't find the entity
> class to invoke its Consumed method.  I've also tried adding the
> entityType property to the URI:
> 
> 
> jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local&entityType=com.lynden.peoplenet.Locationhistory
> 
> But I get the following error:
> 
> Failed to resolve endpoint:
> jpa://com.lynden.peoplenet.Locationhistory?consumeDelete=false&consumer.namedQuery=Locationhistory.findUnprocessed&entityType=com.lynden.peoplenet.Locationhistory&persistenceUnit=PN-SQL-Local
> due to: Could not find a suitable setter for property: entityType as there
> isn't a setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type:
> java.lang.String to the required type: java.lang.Class with value
> com.lynden.peoplenet.Locationhistory.
> 
> I'm using camel-core and camel-jpa 2.13.1
> 
> Any ideas of what I should be looking for?
> 
> thanks,
> -Rob
> 
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752291.html
> To unsubscribe from JPA entityType always Null, click
> here&lt;http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&amp;node=5752284&amp;code=cm9idEBseW5kZW4uY29tfDU3NTIyODR8LTQ4NDA1MDM4OA==&gt;.
> NAML&lt;http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml&gt;





--
View this message in context: http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752480.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: JPA entityType always Null

Posted by robbob <ro...@lynden.com>.
Babak,
I've switched over to the latest version of Hibernate and that seems to have taken care of the problem.

Thanks,
-Rob

From: Babak Vahdat [via Camel] [mailto:ml-node+s465427n5752495h78@n5.nabble.com]
Sent: Wednesday, June 18, 2014 2:03 AM
To: Rob Terpilowski
Subject: RE: JPA entityType always Null

There's a camel-jpa's own unit-test verifiying that the @Consumed annotated method below:
https://github.com/apache/camel/blob/master/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java#L81

is properly invoked (step is increased from 1 to 2):
https://github.com/apache/camel/blob/master/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java#L130

With the corresponding log entry as you run the test:
[ache.camel.examples.MultiSteps] MultiSteps                     INFO  Invoked the completion complete method. Now updated the step to: 2

So wonder what the problem could be on your end, as already said the Camel JPA component itself makes use of Apache OpenJPA for unit-testing, so maybe you want to also give this provider a try as the root cause of the problem is probably the old Eclipselink version.

Also assuming the persistenceUnit PN-SQL-Local has a proper declaration for the entity type "com.lynden.peoplenet.Locationhistory".

Babak
robbob wrote
Hi Babak,

I am using Eclipselink 2.0 and running inside of a web application on glassfish.  I tried remove the Locationhistory prefix and the query does not run at all, whereas when it runs with the prefix, it executes over and over again.

Thanks,
-Rob


From: Babak Vahdat [via Camel] [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=5752495&i=0>]
Sent: Saturday, June 14, 2014 12:08 AM
To: Rob Terpilowski
Subject: Re: JPA entityType always Null

Hi

What is your JPA provider and which version of it (Eclipselink, OpenJPA or Hibernate-EntityManager, etc.) and how do you run your app? Standalone, inside a web-app or?
Can you also try with the option value consumer.namedQuery=findUnprocessed without the Locationhistory prefix?

Babak
robbob wrote
I've create a JPA consumer using the following URI:
jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local

I have also added an @Consumed method to the com.lynden.peoplenet.Locationhistory class.  The process reads out the records from the database with no problem, however the @Consumed method is never called on the Locationhistory class.  Upon debugging further, it looks like the entityType variable in the JpaEndpoint object is set to null for some reason, and so the JpaConsumer class can't find the entity class to invoke its Consumed method.  I've also tried adding the entityType property to the URI:

 jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local&entityType=com.lynden.peoplenet.Locationhistory

But I get the following error:

Failed to resolve endpoint: jpa://com.lynden.peoplenet.Locationhistory?consumeDelete=false&consumer.namedQuery=Locationhistory.findUnprocessed&entityType=com.lynden.peoplenet.Locationhistory&persistenceUnit=PN-SQL-Local due to: Could not find a suitable setter for property: entityType as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: java.lang.Class with value com.lynden.peoplenet.Locationhistory.

I'm using camel-core and camel-jpa 2.13.1

Any ideas of what I should be looking for?

thanks,
-Rob

________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752291.html
To unsubscribe from JPA entityType always Null, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5752284&code=cm9idEBseW5kZW4uY29tfDU3NTIyODR8LTQ4NDA1MDM4OA==><http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5752284&code=cm9idEBseW5kZW4uY29tfDU3NTIyODR8LTQ4NDA1MDM4OA==%3e>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml><http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml%3e>

________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752495.html
To unsubscribe from JPA entityType always Null, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5752284&code=cm9idEBseW5kZW4uY29tfDU3NTIyODR8LTQ4NDA1MDM4OA==>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752640.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: JPA entityType always Null

Posted by Babak Vahdat <ba...@swissonline.ch>.
There's a camel-jpa's own unit-test verifiying that the @Consumed annotated
method below:
https://github.com/apache/camel/blob/master/components/camel-jpa/src/test/java/org/apache/camel/examples/MultiSteps.java#L81

is properly invoked (step is increased from 1 to 2):
https://github.com/apache/camel/blob/master/components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaWithNamedQueryTest.java#L130

With the corresponding log entry as you run the test:
[ache.camel.examples.MultiSteps] MultiSteps                     INFO 
Invoked the completion complete method. Now updated the step to: 2

So wonder what the problem could be on your end, as already said the Camel
JPA component itself makes use of Apache OpenJPA for unit-testing, so maybe
you want to also give this provider a try as the root cause of the problem
is probably the old Eclipselink version.

Also assuming the persistenceUnit PN-SQL-Local has a proper declaration for
the entity type "com.lynden.peoplenet.Locationhistory".

Babak

robbob wrote
> Hi Babak,
> 
> I am using Eclipselink 2.0 and running inside of a web application on
> glassfish.  I tried remove the Locationhistory prefix and the query does
> not run at all, whereas when it runs with the prefix, it executes over and
> over again.
> 
> Thanks,
> -Rob
> 
> 
> From: Babak Vahdat [via Camel] [mailto:

> ml-node+s465427n5752291h54@.nabble

> ]
> Sent: Saturday, June 14, 2014 12:08 AM
> To: Rob Terpilowski
> Subject: Re: JPA entityType always Null
> 
> Hi
> 
> What is your JPA provider and which version of it (Eclipselink, OpenJPA or
> Hibernate-EntityManager, etc.) and how do you run your app? Standalone,
> inside a web-app or?
> Can you also try with the option value consumer.namedQuery=findUnprocessed
> without the Locationhistory prefix?
> 
> Babak
> robbob wrote
> I've create a JPA consumer using the following URI:
> jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local
> 
> I have also added an @Consumed method to the
> com.lynden.peoplenet.Locationhistory class.  The process reads out the
> records from the database with no problem, however the @Consumed method is
> never called on the Locationhistory class.  Upon debugging further, it
> looks like the entityType variable in the JpaEndpoint object is set to
> null for some reason, and so the JpaConsumer class can't find the entity
> class to invoke its Consumed method.  I've also tried adding the
> entityType property to the URI:
> 
> 
> jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local&entityType=com.lynden.peoplenet.Locationhistory
> 
> But I get the following error:
> 
> Failed to resolve endpoint:
> jpa://com.lynden.peoplenet.Locationhistory?consumeDelete=false&consumer.namedQuery=Locationhistory.findUnprocessed&entityType=com.lynden.peoplenet.Locationhistory&persistenceUnit=PN-SQL-Local
> due to: Could not find a suitable setter for property: entityType as there
> isn't a setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type:
> java.lang.String to the required type: java.lang.Class with value
> com.lynden.peoplenet.Locationhistory.
> 
> I'm using camel-core and camel-jpa 2.13.1
> 
> Any ideas of what I should be looking for?
> 
> thanks,
> -Rob
> 
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752291.html
> To unsubscribe from JPA entityType always Null, click
> here&lt;http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&amp;node=5752284&amp;code=cm9idEBseW5kZW4uY29tfDU3NTIyODR8LTQ4NDA1MDM4OA==&gt;.
> NAML&lt;http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml&gt;





--
View this message in context: http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752495.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: JPA entityType always Null

Posted by robbob <ro...@lynden.com>.
Hi Babak,

I am using Eclipselink 2.0 and running inside of a web application on glassfish.  I tried remove the Locationhistory prefix and the query does not run at all, whereas when it runs with the prefix, it executes over and over again.

Thanks,
-Rob


From: Babak Vahdat [via Camel] [mailto:ml-node+s465427n5752291h54@n5.nabble.com]
Sent: Saturday, June 14, 2014 12:08 AM
To: Rob Terpilowski
Subject: Re: JPA entityType always Null

Hi

What is your JPA provider and which version of it (Eclipselink, OpenJPA or Hibernate-EntityManager, etc.) and how do you run your app? Standalone, inside a web-app or?
Can you also try with the option value consumer.namedQuery=findUnprocessed without the Locationhistory prefix?

Babak
robbob wrote
I've create a JPA consumer using the following URI:
jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local

I have also added an @Consumed method to the com.lynden.peoplenet.Locationhistory class.  The process reads out the records from the database with no problem, however the @Consumed method is never called on the Locationhistory class.  Upon debugging further, it looks like the entityType variable in the JpaEndpoint object is set to null for some reason, and so the JpaConsumer class can't find the entity class to invoke its Consumed method.  I've also tried adding the entityType property to the URI:

 jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local&entityType=com.lynden.peoplenet.Locationhistory

But I get the following error:

Failed to resolve endpoint: jpa://com.lynden.peoplenet.Locationhistory?consumeDelete=false&consumer.namedQuery=Locationhistory.findUnprocessed&entityType=com.lynden.peoplenet.Locationhistory&persistenceUnit=PN-SQL-Local due to: Could not find a suitable setter for property: entityType as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: java.lang.Class with value com.lynden.peoplenet.Locationhistory.

I'm using camel-core and camel-jpa 2.13.1

Any ideas of what I should be looking for?

thanks,
-Rob

________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752291.html
To unsubscribe from JPA entityType always Null, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5752284&code=cm9idEBseW5kZW4uY29tfDU3NTIyODR8LTQ4NDA1MDM4OA==>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752462.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JPA entityType always Null

Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi

What is your JPA provider and which version of it (Eclipselink, OpenJPA or
Hibernate-EntityManager, etc.) and how do you run your app? Standalone,
inside a web-app or?
Can you also try with the option value consumer.namedQuery=findUnprocessed
without the Locationhistory prefix?

Babak


robbob wrote
> I've create a JPA consumer using the following URI:
> jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local
> 
> I have also added an @Consumed method to the
> com.lynden.peoplenet.Locationhistory class.  The process reads out the
> records from the database with no problem, however the @Consumed method is
> never called on the Locationhistory class.  Upon debugging further, it
> looks like the entityType variable in the JpaEndpoint object is set to
> null for some reason, and so the JpaConsumer class can't find the entity
> class to invoke its Consumed method.  I've also tried adding the
> entityType property to the URI:
> 
> 
> jpa://com.lynden.peoplenet.Locationhistory?consumer.namedQuery=Locationhistory.findUnprocessed&consumeDelete=false&persistenceUnit=PN-SQL-Local&entityType=com.lynden.peoplenet.Locationhistory
> 
> But I get the following error:
> 
> Failed to resolve endpoint:
> jpa://com.lynden.peoplenet.Locationhistory?consumeDelete=false&consumer.namedQuery=Locationhistory.findUnprocessed&entityType=com.lynden.peoplenet.Locationhistory&persistenceUnit=PN-SQL-Local
> due to: Could not find a suitable setter for property: entityType as there
> isn't a setter method with same type: java.lang.String nor type conversion
> possible: No type converter available to convert from type:
> java.lang.String to the required type: java.lang.Class with value
> com.lynden.peoplenet.Locationhistory.
> 
> I'm using camel-core and camel-jpa 2.13.1
> 
> Any ideas of what I should be looking for?
> 
> thanks,
> -Rob





--
View this message in context: http://camel.465427.n5.nabble.com/JPA-entityType-always-Null-tp5752284p5752291.html
Sent from the Camel - Users mailing list archive at Nabble.com.