liferay - How to update custom field expando values for all users? -


i have 1 boolean custom field expando values each user. on events want update field.

currently below code inside hook works fine:

for (user user : users) {     user.getexpandobridge().setattribute("myfield", false); } 

and have tried below code wont work:

expandotable expandotable = expandotablelocalserviceutil.gettable(companyid);  expandocolumn expandocolumn =  expandocolumnlocalserviceutil.getcolumn(companyid, classnameid, expandotable.getname(), "myfield"); expandovaluelocalserviceutil.addvalues(classnameid, expandotable.gettableid(),expandocolumn.getcolumnid(), classnameid, "myfield"); 

the working code (e.g. loop) give solution question. if you're looking single-sql instruction update of fields: note might leave stale caches.

if don't have large number of users loop shouldn't run long.

if, on other hand, have significant amount of users, assumption portal rather busy - , in case i'd not clear caches make sure they're not stale on single value. e.g. it's better accept operation take while. other option, clearing caches after changing values, make sure generate huge performance drop everything needs loaded db.

now if told me loop runs 2 days, might have different opinion, question not sound you're in big pain it's rather preference eliminate loop.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -