1

I am trying to check if an entry to the DB has occurred today. My Query works when I run it with MySqlWorkbench, but when I use hibernate the query does not seem to work correctly I am always returned true even though the DB does have dates today.

The query is: @Query("SELECT CASE WHEN (count(ent) < 1) then true else false end FROM Entity ent WHERE ent.createdAt >= (?1)") boolean checkIfEnteredToday(Date date);

The date is from the java.sql.Date library.

1 Answer 1

1

I solved it by changing the DataType of The entity's datetype for 'created_at' to java.sql.Date, whereas previously it was java.sqlTimestamp.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.