134 words

mismatch after Enum changes

#1
2016-01-28 11:07

Hi,

I have an entity, an attribute is a enum type:

public enum MyEnum {
  AA, BB, CC, DD;
}

I populated the database, than I changed the enum types deleting some unused types (es. AA) without reset database:  

public enum MyEnum {
  BB, CC, DD;
}

Now there are mismatches with enums in database. It looks as if objectdb keeps the "position" of enum. For example: attributes of entity set to ENUM.BB (second position before the change) now are set to ENUM.CC (second position after the change).

It is a correct behaviour?

Thanks in advance!

luca.camerini@welld.ch
luca.camerini@welld.ch's picture
Joined on 2015-06-26
User Post #2
#2
2016-01-28 14:55

Yes, this is the default behavior. Enum values are stored as ordinal number by default, and then you must preserve the position of every existing value.

Alternatively you can opt for storing enum values as strings. See the documentation for more details.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,398

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel