ObjectDB ObjectDB

Issue #1420: UPDATE query cannot set a new field after schema change

Type: Bug ReoprtVersion: 2.5.5Priority: NormalStatus: ActiveReplies: 1
#1

I've added a new property/field to one of my objects and want to set the value of this (boolean) property to false for all existing entities in the DB.

I tried to execute an update statement with the Explorer tool.

The statement ends and tells me that 1000 entities have been updated. I then save the changes to the DB via file->save. But when I execute a select on the DB I see that the field is still "null" for all instances.

How do I initialize the field?

edit
delete
#2

You are right. Currently UPDATE queries can only update existing fields, and old objects that do not have the fields are not updated. This should be fixed in future versions.

The workaround is to write some code (even in a simple console application) that updates the objects in a loop within an active transaction, without using an UPDATE query.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.