Closed all-sd closed 8 years ago
This pull request does not look appropriate. The actual bind value depends on how the Enum is mapped and that can be by name, ordinal or a mapped value via @EnumValue. The determination of that bind value happens later (not as part of typequery).
So there will be some other problem but this pull request is not appropriate.
Ok, no problem. Do you have a hint for me, where I have to search for a better solution?
I'll see if there are tests for all 3 forms of enum mapping.
You can try adding: @Enumerated(EnumType.STRING)
Or explicit mapping via @EnumValue ...
public enum Status { @EnumValue("N") NEW, @EnumValue("A") APPROVED, @EnumValue("S") SHIPPED, @EnumValue("C") COMPLETE }
On 30 September 2015 at 09:00, ossd notifications@github.com wrote:
Ok, no problem. Do you have a hint for me, where I have to search for a better solution?
— Reply to this email directly or view it on GitHub https://github.com/ebean-orm/avaje-ebeanorm-typequery/pull/10#issuecomment-144172919 .
Ok, but there is an @Enumerated on my field:
@Enumerated(EnumType.STRING)
private Type type;
Where is the test case? Is there a test case with @Enumerated(EnumType.STRING) and an overridden toString() in the enum?
This was logged as https://github.com/ebean-orm/avaje-ebeanorm/issues/580 ... will be fixed in 7.1.2
So this merge request is not correct in that the problem was never in the querybean but instead in ebean as per https://github.com/ebean-orm/avaje-ebeanorm/issues/580
Closing.
Hi Rob,
using enums in a typequery uses toString() to geht the enum representation. This ist not working if you override the toString() in an enum.
To reproduce:
And the Query:
Will result in a query where the type="Kunde" and not type="CUSTOMER".