0

I'm using COALESCE in JPA-NamedQuery. I got always this error message on Eclipse:

       The abstract schema type 'COALESCE' is unknown.

Do you have any idea how to remove it?

Note that the query is working correctly.

Edit

The query is

@NamedQuery(name = "FootBaller.mostActive", 
    query = "SELECT f FROM FootBaller f ORDER BY COALESCE((SELECT count(*) FROM RelatedMatch rm WHERE rm.footBaller=f), 0) DESC")
Riadh
  • 1,088
  • 2
  • 12
  • 25
  • How about sharing with people HOW you are using this in "JPA-NamedQuery"? Maybe you're using it wrong? – Neil Stockton Aug 09 '17 at 08:42
  • It works correctly, but the issue is related with eclipse validation I think. Here the query: @NamedQuery(name = "FootBaller.mostActive", query = "SELECT f FROM FootBaller f ORDER BY COALESCE((SELECT count(*) FROM RelatedMatch rm WHERE rm.footBaller=f), 0) DESC") – Riadh Aug 09 '17 at 09:27
  • 1
    I rate that as invalid JPQL. Use of COALESCE in the ORDER BY clause is not in any JPQL BNF I've ever seen. You can only order by a "state_field_path_expression | result_variable", and that is none of those. Clearly the message that your JPA provider gives is gibberish, but doesn't hide the fact that it is invalid. – Neil Stockton Aug 09 '17 at 09:34
  • 1
    No comment is possible beyond that since you don't provide your entity class. And please ... PUT THEM IN THE QUESTION NOT IN THE COMMENTS – Neil Stockton Aug 09 '17 at 09:39

1 Answers1

-2

If you take a look at this; https://dzone.com/articles/the-nasty-jpa-unknown-abstract

Also refer to this, it is more for case sensitivity i.e. user mistakes: Error on compiling query: The abstract schema type 'entity' is unknown

You may have a lower case somewhere where uppercase is needed, or your annotation is wrong etc. But refer to the first link above first.

Aleksandar Zoric
  • 1,343
  • 3
  • 18
  • 45