Hi!
I have in an entity called User with the following field: @ElementCollection(fetch = FetchType.EAGER) private Set<UserPermission> permissions;
package x.x.x.x public enum UserPermission { BASIC, COACH, ADMIN }
Use case: there are users which contain the first 2 permissions (BASIC and COACH, so the first 2 entries).
Bug: If UserPermission enum is modified by adding, for example, BASIC231 between BASIC and COACH values, data in ObjectDB will be altered in a way that the users that previously had BASIC and COACH as permissions, now they would have BASIC and BASIC231.
Conclusion: @ElementCollection(fetch = FetchType.EAGER) private Set<UserPermission> permissions; saves enum values as ordinal, not String, therefore any modification of the order alters all entities in the DB.
Mention: I have seen this bug by checking the values in DB explorer, but also by printing logs directly in the code.
Desired case: @ElementCollection(fetch = FetchType.EAGER) containing enums should be order independent.
Thanks.