use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class AfterCompleteTransactionListenerTest method tearDown.
@After
public void tearDown() throws Exception {
QueryRunner runner = new QueryRunner(persistence.getDataSource());
runner.update("delete from SEC_USER where LOGIN_LC like 'txlstnrtst-%'");
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class BeforeCommitTransactionListenerTest method tearDown.
@After
public void tearDown() throws Exception {
QueryRunner runner = new QueryRunner(persistence.getDataSource());
runner.update("delete from SEC_USER where LOGIN_LC like 'txlstnrtst-%'");
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class TestAfterCompleteTxListener method testCommit.
private void testCommit(boolean committed, Collection<Entity> detachedEntities) {
assertTrue(committed);
User user = null;
for (Entity entity : detachedEntities) {
assertTrue(PersistenceHelper.isDetached(entity));
if (entity instanceof User && ((User) entity).getLogin().startsWith("TxLstnrTst-1-"))
user = (User) entity;
}
if (user != null) {
try {
QueryRunner runner = new QueryRunner(persistence.getDataSource());
runner.update("update SEC_USER set NAME = 'updated by TestAfterCompleteTxListener' where ID = ?", user.getId().toString());
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class PersistenceHelperTest method tearDown.
@After
public void tearDown() throws Exception {
QueryRunner runner = new QueryRunner(cont.persistence().getDataSource());
runner.update("delete from SYS_SERVER");
}
use of com.haulmont.bali.db.QueryRunner in project cuba by cuba-platform.
the class PersistenceTest method setUp.
@Before
public void setUp() throws Exception {
QueryRunner runner = new QueryRunner(cont.persistence().getDataSource());
runner.update("delete from SYS_SERVER");
Transaction tx = cont.persistence().createTransaction();
try {
EntityManager em = cont.persistence().getEntityManager();
User user = new User();
userId = user.getId();
user.setName("testUser");
user.setLogin("testLogin");
user.setGroup(em.find(Group.class, UUID.fromString("0fa2b1a5-1d68-4d69-9fbd-dff348347f93")));
em.persist(user);
tx.commit();
} finally {
tx.end();
}
}
Aggregations