I run the following code:
Code:
String query = String
.format("select ti from com.emi.framework.infrastructure.workflow.EmiTaskInstance as ti, "
+ "org.jbpm.context.exe.variableinstance.StringInstance as vi where vi.name = 'FolderId' and "
+ "vi.value = '%s' and vi.token = ti.token and (ti.isOpen = true or ti.isSuspended = true) and "
+ "ti.end is null and ti.name ", new Object[] {searchValue});
String inString;
if (!notInTaskType) {
inString = String.format("in ( %s )", new Object[] {taskName});
}
else {
// we're looking for tasks which are not of types given
inString = String.format("not in ( %s )", new Object[] {taskName});
}
query += inString;
List<?> result = jbpmContext.getSession().createQuery(query).list();
if (result == null || result.isEmpty()) {
return null;
}
when I run it the result list is empty! I turned on the "show sql". The generated sql is as follows:
Code:
select
emitaskins0_.ID_ as ID1_22_,
emitaskins0_.VERSION_ as VERSION3_22_,
emitaskins0_.NAME_ as NAME4_22_,
emitaskins0_.DESCRIPTION_ as DESCRIPT5_22_,
emitaskins0_.ACTORID_ as ACTORID6_22_,
emitaskins0_.CREATE_ as CREATE7_22_,
emitaskins0_.START_ as START8_22_,
emitaskins0_.END_ as END9_22_,
emitaskins0_.DUEDATE_ as DUEDATE10_22_,
emitaskins0_.PRIORITY_ as PRIORITY11_22_,
emitaskins0_.ISCANCELLED_ as ISCANCE12_22_,
emitaskins0_.ISSUSPENDED_ as ISSUSPE13_22_,
emitaskins0_.ISOPEN_ as ISOPEN14_22_,
emitaskins0_.ISSIGNALLING_ as ISSIGNA15_22_,
emitaskins0_.ISBLOCKING_ as ISBLOCKING16_22_,
emitaskins0_.TASK_ as TASK17_22_,
emitaskins0_.TOKEN_ as TOKEN18_22_,
emitaskins0_.PROCINST_ as PROCINST19_22_,
emitaskins0_.SWIMLANINSTANCE_ as SWIMLAN20_22_,
emitaskins0_.TASKMGMTINSTANCE_ as TASKMGM21_22_,
emitaskins0_1_.EX_INFO1 as EX2_27_,
emitaskins0_1_.EX_INFO2 as EX3_27_,
emitaskins0_1_.EX_INFO3 as EX4_27_,
emitaskins0_1_.EX_INFO4 as EX5_27_,
emitaskins0_1_.PREVIOUS_ACTOR_ID_ as PREVIOUS6_27_,
emitaskins0_1_.HAS_COMMENTS as HAS7_27_
from
JBPM_TASKINSTANCE emitaskins0_
inner join
EMI_JBPM_TASKINSTANCE emitaskins0_1_
on emitaskins0_.ID_=emitaskins0_1_.TASK_ID_,
JBPM_VARIABLEINSTANCE stringinst1_
where
emitaskins0_.CLASS_='E'
and stringinst1_.CLASS_='S'
and stringinst1_.NAME_='FolderId'
and stringinst1_.STRINGVALUE_='124'
and stringinst1_.TOKEN_=emitaskins0_.TOKEN_
and (
emitaskins0_.ISOPEN_=1
or emitaskins0_.ISSUSPENDED_=1
)
and (
emitaskins0_.END_ is null
)
and (
emitaskins0_.NAME_ in ('inNewClaim' , 'documentsForCredit' , 'creditCheck' , 'documentsForCalculation' , 'claimCalculation' , 'claimSammery' , 'notApproveClaim' , 'reserveBoard' , 'approveClaim' , 'parentCompanyApproval' , 'createClaimFinObj' , 'createClaimOrdedPayment' , 'anotherClaimInFolder')
)
when I run this sql in the DB I get a result (A single result). What could be the reason I don't get a result when I run the query from code?
I use Hibernate 3.0
Oracle 10
Java 5
thanks.