How to check if cache is being used or not?

Are you hoping to use the query cache?

I had the problem and I used the query hint org.hibernate.cacheable from Hibernate.

query.setHint("org.hibernate.cacheable", true);

JPA tells the provider (e.g. Hibernate) that you want to use this query property or hint.