skip to Main Content

i think the title sums it up, i tried to run same query on both pgadmin and java springboot.
here is my query annotation on springboot

@Query(value = "SELECT column1, column FROM public.v_example where start_date = ?1 and end_date = ?2", nativeQuery = true)
public List<Object[]> getExample();

i was calling from database views but it had no problem when i run the query directly on the database using pgadmin, when i tried it on java, it called nothing.
i was putting it inside a List<Object[]>.

Before, i was using a different query that works on both platform, the query was without where condition. Putting it on the same List<Object[]>.

3

Answers


  1. Chosen as BEST ANSWER

    Turns out, I have mistaken the day with the month when I was inputting data. For example it should've been, the 5th of January instead of the 1st of May. A silly mistake.


  2. I’m surprised the repository method doesn’t cause an exception.
    In the query you are referencing 2 parameters, but in the repository you are providing none, by having a method without arguments.

    Login or Signup to reply.
  3. @Query(value = "SELECT column1, column FROM public.v_example where start_date = ?1 and end_date = ?2", nativeQuery = true)
    public List<Object[]> getExample(param1, param2);
    

    In the repo call you missed the arguments.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search