Public feed
#887348
// initialize hibernate session
SessionFactory sf =
(SessionFactory) getApplicationContext().getBean("hibernateFactory");
// open the session in case we need lazy loading
Session session = sf.openSession();
session.setFlushMode(FlushMode.AUTO);
SessionHolder holder = new SessionHolder(session);
TransactionSynchronizationManager.bindResource(sf, holder);
injectAuthentication(userId.toString());
// do the actual work
executeWorkflowAction(articleWorkflow, redaxService, context);
// flush and close hibernate session
if (session != null) {
if (session.isDirty()) {
session.flush();
}
TransactionSynchronizationManager.unbindResource(sf);
SessionFactoryUtils.releaseSession(session, sf);
}