cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between setProperties and addProperties in nodeService?

lista
Star Contributor
Star Contributor
Is there any? From what I see (with regards to performance) there is none.

Basically, I see no difference in number of inserts into the DB, when I use one or the other. I'd expect addProperties to only insert properties that I've actually set, and all the other properties to be left out. On the other hand, setProperties would insert all the properties, with null values if not set.

At the moment, it appears all the properties are always inserted, and there's no way around it.
Any experiences worth mentioning?
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
Add properties allows you to leave some properties alone and untouched.    For a situation, for example add aspect, it is better fit since you don't need to worry about the other stuff on the node. 

I'd not expect much difference in performance, under the covers its pretty much identical.

lista
Star Contributor
Star Contributor
I get that - the problem is - I call addProperties with a map that contains say 10 values; and I see 20 inserts into alf_node_properties table, 10 of which are with null values. That's the part that's bugging me. I'd like to avoid those inserts if possible.

I'll take another look if I'm doing something stupid.

mrogers
Star Contributor
Star Contributor
No you arn't doing anything stupid.    I don't think there's the ability to set a single property.