Could you kindly help review my code?
I try to batch update “vehicles” to set ProjectCode to null, but nothing changed.
If set a non-null value, DB will be updated.
So null will be ignored, even if view is specified?
Hi,
I’m sorry but you are using DataManager#getReference() for a wrong purpose.
Javadoc clearly states that:
Returns an entity instance which can be used as a reference to an object which exists in the database.
For example, if you are creating a User, you have to set a Group the user belongs to. If you know the group id, you could load it from the database and set to the user. This method saves you from unneeded database round trip:
user.setGroup(dataManager.getReference(Group.class, groupId));
dataManager.commit(user);
A reference can also be used to delete an existing object by id:
dataManager.remove(dataManager.getReference(Customer.class, customerId));
It should not be used to make changes to entities.
How you think EclipseLink should detect that you’ve changed the value of the field of an empty-state object from null to null?