Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Using enum property value in query annotation

 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • 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: 22479
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic