public Object doInTransaction(TransactionStatus status) {
T result = (T) jpaTemplate.execute(new JpaCallback() {
public Object doInJpa(EntityManager em) {
env.set(EnvironmentName.ENTITY_MANAGER, em);
try {
SessionInfo sessionInfoMerged = em.merge(sessionInfo);
sessionInfoMerged.setJPASessionMashallingHelper(sessionInfo.getJPASessionMashallingHelper());
sessionInfo = sessionInfoMerged;
((StatefulKnowledgeSessionImpl) ksession).session.setEndOperationListener( new EndOperationListenerImpl( sessionInfo ) );
T result = command.execute(kContext);
em.flush();