Search in sources :

Example 1 with ArrayHandler

use of com.haulmont.bali.db.ArrayHandler in project cuba by cuba-platform.

the class SoftDeleteDataManagerTest method testHardDelete.

@Test
public void testHardDelete() throws Exception {
    DataManager dataManager = AppBeans.get(DataManager.class);
    User loadedUser = dataManager.load(LoadContext.create(User.class).setId(user.getId()));
    CommitContext commitContext = new CommitContext().addInstanceToRemove(loadedUser);
    commitContext.setSoftDeletion(false);
    dataManager.commit(commitContext);
    QueryRunner runner = new QueryRunner(persistence.getDataSource());
    Object[] row = runner.query("select count(*) from sec_user where id = ?", user.getId().toString(), new ArrayHandler());
    assertEquals(0, ((Number) row[0]).intValue());
}
Also used : User(com.haulmont.cuba.security.entity.User) ArrayHandler(com.haulmont.bali.db.ArrayHandler) QueryRunner(com.haulmont.bali.db.QueryRunner) Test(org.junit.Test)

Aggregations

ArrayHandler (com.haulmont.bali.db.ArrayHandler)1 QueryRunner (com.haulmont.bali.db.QueryRunner)1 User (com.haulmont.cuba.security.entity.User)1 Test (org.junit.Test)1