Home » Support » Issue Tracking » UPDATE query cannot set a new field after schema change

UPDATE query cannot set a new field after schema change

Type: BugVersion: 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?

#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
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login