359 words

Schema migration - long to String

#1
2013-01-02 18:39

Hi,

I need to change field type in our model from long to String. After changing filed type in our model and repairing database with doctor, most of our entities is gone. Doctor puts some errors on console:

[51030] Page #466190 entry 5 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613575
[51031] Page #466191 entry 0 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613577
[51032] Page #466191 entry 1 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613579
[51033] Page #466191 entry 2 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613581
[51034] Page #466191 entry 3 has unexpected value for field affiID
  pl.hplxtool.model.AffiliateProduct(92):6613583

Is this a bug or there is some other way to change field type that I missed in ODB documentation?

lwalkowski
lwalkowski's picture
Joined on 2010-08-25
User Post #106
#2
2013-01-02 18:49

Changing a field from long to String should not require any specific action.

Actually such schema changes are not related to the Doctor, and usually you don't have to run the Doctor after the schema change (you may need to run the Doctor if the field is indexed). Every old object should be adjusted automatically when it is loaded using the new scheme.

Following your report, I checked and it seems that the Doctor may produce false alarms after such schema change.

As a workaround you can read and write (after making them dirty) all the instances of that modified type immediately after the change (and before running the Doctor).

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,384
#3
2013-01-02 21:15

The checks in the Doctor that caused identifying objects after field type change as invalid were removed in build 2.4.5_05.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,385
#4
2013-01-02 21:48

OK, I should mention one thing. This field has an index on it. After migrating schema, explorer was throwing an error about some Map (didn't get screenshot) and there was no schema in the left panel. After repairing from this state with doctor, almost 53k records was gone from database - only about 3k left.

My assumption is, that database schema was migrated, but index left for old values and when trying to rebuild this index, there was something wrong with filed types.

I will try to reproduce this one more time and I will try to migrate schema with removing index from this field first.

lwalkowski
lwalkowski's picture
Joined on 2010-08-25
User Post #107
#5
2013-01-02 21:52

You may also try fixing the index with the Doctor of build 2.4.5_05.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,386
#6
2013-01-03 11:04

Build 2.4.5_05 works correctly. Thanks.

lwalkowski
lwalkowski's picture
Joined on 2010-08-25
User Post #108

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