How can I select only objects with null values in GQL. I have a object that for a new version of my software I include a LastUpdate fields, and I want to update only the oldest updated object, but when I made the query using " ORDER BY LastUpdate ASC", this query should always be used!, it always return only the objects with some value in LastUpda开发者_StackOverflow中文版te.
How the best way I can include in a query the objects with null value?
If an entity in the datastore does not have the new attribute set, then it is impossible to query on it.
The entities will not have a null
value for the property, the property simply will not exist, therfore will not be included in any indexes that you would use to query your entities. The only way to find your entities that need updating is to map over ALL entities and find the ones with missing values.
How much control do you have over record creation? You could always create a new record with the LastUpdate field set to the same value as the RecordCreated field. That way the field would never be blank and could always be queried.
Disadvantage: you would also pick up records that were created a long time ago and not updated since.
maybe use an NVL wrapper ... NVL( LastUpdate, sysdate )
精彩评论