0

As the title says, I'm trying to use Hibernate's @Where annotation with Spring Data JPA but without success, is it actually supposed to work together ?

Anthony Richir
  • 619
  • 2
  • 7
  • 29
  • Possible duplicate https://stackoverflow.com/questions/41453231/how-to-replicate-the-hibernates-where-functionality-in-spring-jparepository or https://stackoverflow.com/questions/45952919/how-to-add-global-where-clause-for-all-find-methods-of-spring-data-jpa-with-hibe?rq=1 – Martin Čuka Aug 14 '18 at 19:33
  • Spring Data JPA does nothing that would not make where not work. Can you post an example where you think it doesn't work? – Simon Martinelli Aug 15 '18 at 06:20
  • @MartinČuka I checked your links and my question isn't a duplicate, it's a completely different problem, please see my own answer to the question. – Anthony Richir Aug 16 '18 at 07:18

1 Answers1

2

While working on the example to demonstrate my problem, I realized what was wrong.

My problem is that the @Where annotation was set on an abstract parent class that we wanted to have for all our entities to extend and be able to soft deleted everything.

Unfortunately, it seems that, when set on a parent class, the @Where is not used (maybe on purpose and I'm not aware of it).

Here is my example which demonstrate that, when used on the entity directly, it's working, and when used on a parent class, it doesn't.

Example @Where Annotation

Anthony Richir
  • 619
  • 2
  • 7
  • 29