QueryRunner explanations with simpler examples

Good day

onAfterUpdate() method is called after a record was updated in the database, but before transaction commit**. This method does not allow modifications of the current persistence context, however, database modifications can be done using QueryRunner.**

I am new to cuba. Looking at the above definition of an AfterUpdateEntityListener it says that one can do database modifications using QueryRunner. I don’t understand. I tried looking at the example of a QueryRunner but was unable to understand. Please do provide me with more insight about a QueryRunner, with simpler examples.

Thank you in advance.


Here it is:

package com.company.sales.listener;

import com.company.sales.entity.Customer;
import com.haulmont.bali.db.QueryRunner;
import com.haulmont.cuba.core.Persistence;
import com.haulmont.cuba.core.listener.AfterUpdateEntityListener;
import org.springframework.stereotype.Component;

import javax.inject.Inject;
import java.sql.Connection;
import java.sql.SQLException;

public class NewEntityListener implements AfterUpdateEntityListener<Customer> {

    private Persistence persistence;

    public void onAfterUpdate(Customer entity, Connection connection) {
        QueryRunner queryRunner = new QueryRunner();
        try {
                    "update sales_customer set foo = ? where id = ?",
                    new Object[] {"some-foo", persistence.getDbTypeConverter().getSqlObject(entity.getId())});
        } catch (SQLException e) {
            throw new RuntimeException(e);