Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using enum property value in query annotation

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

i use spring boot 2.3.2 with spring data and hibernate.

I have a Enum



I have an enitty


In my repository i tried theses solutions without success



If I do like that that working



I see some thread like this one: https://stackoverflow.com/questions/63060484/enum-in-query-get-invalid-expression who have similar issue.


thanks
 
Saloon Keeper
Posts: 27929
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing to do with Spring Boot, and if you're using Hibernate JPA with Spring Data, even the "Hibernate" part doesn't really matter, because it's a JPA thing.

Look here: https://tomee.apache.org/examples-trunk/jpa-enumerated/

The big problem with enumerations is that most databases don't support enumerations as a basic field type. So the JPA layer has to bridge the difference, and that's what the above mechanism is for.
 
Because those who mind don't matter and those who matter don't mind - Seuss. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic