| I think you missed my point here. Maybe because English isn't my native lang. I don't say this is bug. No! There was a bug. And now (in 5.0.3) it's fixed and works as intended. I absolutely agree with that. And I don't want you make Hibernate to support enum as integers in JPQL. But my point is (if I remember right, because I created this issue long time ago and now I don't remember all details): before 5.0.3 this didn't work:
SELECT e FROM Entity e WHERE e.type = EntityType.TYPE1
and this didn't work:
SELECT e FROM Entity e WHERE e.type = com.sample.EntityType.TYPE1
And the one and only way it worked is:
SELECT e FROM Entity e WHERE e.type = 1
The AttributeConverter was just silently ignored in JPQL. This is not intended behaviour of course. This is bug. And it is fixed in 5.0.3. I am right?
- If no, then sorry. Then it is just me, who used JPQL wrong way (which is worked by accident).
If
SELECT e FROM Entity e WHERE e.type = com.sample.EntityType.TYPE1
works in 4.x then yes, it is not breaking change at all.
- But if I am right, then... how can we write JPQL query in 4.x which uses Enum with AttributeConverter like in first example.
If
SELECT e FROM Entity e WHERE e.type = 1
is wrong way, then which is right way?
For this:
BTW. It is inaccurate that you have to supply the FQN for the enum literal. You could actually just use the "simple name".
When I tested this with 5.0.3, it didn't work. Maybe because my Enum was inner class. |