'IntelliJ cannot resolve symbol 'NULL' in JPA @Query

In any @Query in a Spring Repository, IntelliJ inspection is highlighting NULL with a red underline, saying "Cannot resolve symbol 'NULL'". Note that changing the case to all lowercase doesn't to fix it. After checking similar posts I did ensure I have the JPA & Spring facets configured properly.

Note this isn't actually an issue at runtime or compile time; everything actually works fine. It's just annoying/distracting seeing the highlights in IntelliJ. Does anyone know how to resolve this, or why it is happening?

Below is a minimal example showing the issue.

example

I am using

  • IntelliJ Ultimate 2021.3.2
  • spring-data-jpa 2.3.4.RELEASE
  • openjdk 11


Solution 1:[1]

Set the nativeQuery attribute to true, something like:

@Query(nativeQuery=true,value="")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tyler2P