Thank you Demian.
But after replacing the line
JPAWorkingMemoryDbLogger jpaLogger = new JPAWorkingMemoryDbLogger(ksession);
with
JPAProcessInstanceDbLog jpaLogger = new JPAProcessInstanceDbLog (ksession.getEnvironment());
Could not see any significant logging records added in PROCESSINSTANCEINFO and PROCESSINSTANCELOG.
Could you please let me know the relevant API call to retrive the history details for perticular workflow executed.