简体   繁体   中英

in @Query , I need to query DB to select a row where a column is null. I am using JpaRepository

I have tried using below query

@Query(value = "select E.SRC,E.TRGT,E.EVNT_STTS,E.ADDL_ATTR from EVNT.EVNT_LOG E where E.EVNT_ID=:eventId and E.ADDL_ATTR IS NULL" , nativeQuery = true)
List<AggregationLog> findByEventIdAndTargetAndAdditionalAttributeWithNULL(@Param("eventId") Long eventId);

in above query I am getting invalid column name.

Please guide me to select a row with eventID and addl_attr as null.

Well... invalid column means oracle cannot resolve the column name in the query. That usually means 1 of 2 things:

  1. A Typo
  2. The columns were created with case sensitivity. Whoever created the table surrounded the column names with double quotes and put column names in something other than all caps. Do a "DESCRIBE <table_name>" in sqlplus, sqldeveloper or any other client and check if the column names are all upper case. If they're not, you will need to enclose them in double quotes in your query with the name matching exactly what you see.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM