Closed ozzioma closed 11 months ago
The additional annotation exists, as OData enumerations not exactly matches JAVA enumerations. Mainly the option mark an OData enumeration with "isFlag", which means it is a bit sting (see 10 Enumeration Type). That is the annotation is needed. Nevertheless you are right it should be possible that one only needs to use EdmEnumeration in case he wants to state that the enum is of type flag.
I'll take that as an enhancement request. To be honest it may take some time, as you can solve your needs with the existing functionality.
Due to clean-up action. All issues created before 2022 get closed.
Hi, Thanks for the awesome work! I'm having mapping errors with enums.
My JPA models do not use
@EdmEnumeration
, since I have them imported as a dependency.Is it possible to skip the use of yet another annotation and use Reflections to build the schema for enum fields? Like so
You don't really need a new annotation to support enums, as you can use the Reflections library to get the fields that are enum types. This is because, you can expect that at a mininum JPA entity model classes will have the
@Column
annotation. I don't know if that does not suffice.Is it possible to use
@Column
and the.isEnum()
class method to filter out enum fields? With this approach, you can 2 sensible defaults for enum fields, like this: One for fields with@Enumerated(value = EnumType.STRING)
and another for fields with@Enumerated(value = EnumType.ORDINAL).
This way if the @Enumerated annotation is not found, the default becomes
@Enumerated(value = EnumType.ORDINAL).
I think this should be the default approach for supporting enum properties.
Any thoughts?
Thanks.