I'm new to spring-boot and have been steadily making progress building up my project but I've come to a point where I need to execute a specific query instead of the ones built by spring.
Here is what my @Query looks like:
@Query("select top 1 * from 'table name' where 'column' like 'value' and message like 'value' order by 'column' desc")
Due to it being work-related I had to replace our database specific information but I think you guys should still be able to get the idea of what I'm trying to do. My boss wants this query because, without it formatted like this, we are returned many results and we only want the most recent - thus the top 1 and the order by.
The error I'm seeing is "< operator> or AS expected, got '1'" and, so far, I have yet to find anything on Google.
What am I doing wrong here?
I think problem is that you wrote native query in @Query, but didn't set @Query("...", nativeQuery=true)
, because this annotation accepts by default queries in JPQL. Read about @Query usage there
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With