When to use modelService.refresh() method?

The OOB Hybris Model Service provides a method, to refresh the model. Usually we use this method to refresh the data, before saving the data in database, using save method.

There might be conditions, where some other thread or operation would be updating the same model instance. Br doing a refresh, we can be sure of not loosing those changes. This is of more importance, if we are going through a time consuming transaction like payment.

refresh model

 

Also transaction like, stock update, may happen simultaneously from multiple users, so we should always refresh the model, before saving it.

One thought on “When to use modelService.refresh() method?

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s