4

I have an application that uses Hibernate. We are moving to JPA 2.1 standard. There are a lot of usage of "org.hibernate.criterion.Example" with its (excludeProperty) feature. Is there any equivalent to "Hibernate Example" in JPA 2.1?

Thanks.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
skywards
  • 79
  • 1
  • 8
  • Unfortunately no - this hasn't changed since JPA 2.0. But you can check the anwers in [here](http://stackoverflow.com/questions/2880209/jpa-findbyexample). I would guess for simple use cases you can build something like _wallenborn_ is creating there. – Tobias Liefke Jul 30 '15 at 21:31

1 Answers1

2

JPA doesn't offer this yet, but you can use Spring Data JPA Query by Example.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
  • I would think that JPA will contain a solution by now - since Hibernate 6 has removed Example. I am looking for a way to replace our usage of Example... – Darkwyng Apr 27 '23 at 09:20