Search in sources :

Example 1 with Transactional

use of org.mifos.framework.hibernate.helper.Transactional in project head by mifos.

the class LegacyMasterDao method getLookUpEntity.

/**
     * Only two non-test usages, one that may never be called and one for getting labels.
     */
@Transactional
public CustomValueDto getLookUpEntity(final String entityName) throws SystemException {
    Session session = getSession();
    Query queryEntity = session.getNamedQuery("masterdata.entityvalue");
    queryEntity.setString("entityType", entityName);
    CustomValueDto entity = (CustomValueDto) queryEntity.uniqueResult();
    entity.setCustomValueListElements(lookUpValue(entityName, session));
    return entity;
}
Also used : Query(org.hibernate.Query) CustomValueDto(org.mifos.application.master.business.CustomValueDto) Session(org.hibernate.Session) Transactional(org.mifos.framework.hibernate.helper.Transactional)

Example 2 with Transactional

use of org.mifos.framework.hibernate.helper.Transactional in project head by mifos.

the class AspectJApprovalInterceptorTest method testRESTCallExecution.

@Test
@Transactional
public void testRESTCallExecution() throws Exception {
    Assert.assertEquals(0, approvalService.getAllWaiting().size());
    try {
        stubRestController.createCall("HELLO");
        Assert.fail("should throw interrupt exception");
    } catch (RESTCallInterruptException e) {
    }
    Assert.assertEquals(1, approvalService.getAllWaiting().size());
    RESTApprovalEntity entity = approvalService.getAllWaiting().get(0);
    Assert.assertEquals("arg", entity.getApprovalMethod().getArgsHolder().getNames()[0]);
}
Also used : RESTApprovalEntity(org.mifos.rest.approval.domain.RESTApprovalEntity) RESTCallInterruptException(org.mifos.rest.approval.service.RESTCallInterruptException) Test(org.junit.Test) Transactional(org.mifos.framework.hibernate.helper.Transactional)

Aggregations

Transactional (org.mifos.framework.hibernate.helper.Transactional)2 Query (org.hibernate.Query)1 Session (org.hibernate.Session)1 Test (org.junit.Test)1 CustomValueDto (org.mifos.application.master.business.CustomValueDto)1 RESTApprovalEntity (org.mifos.rest.approval.domain.RESTApprovalEntity)1 RESTCallInterruptException (org.mifos.rest.approval.service.RESTCallInterruptException)1