09-25-2013 11:09 AM
@Service
public class AddClientService implements ActivityBehavior {
@Override
public void execute(ActivityExecution execution) throws Exception {
PvmTransition transition = null;
Client client = new Client();
client.setFirstName("John");
client.setLastName("Smith"); // Have unique constraint
execution.setVariable("client", client); // need to be rollbacked in case of error
Engine engine = Engine.getInstance();
SessionFactory sessionFactory = engine.getHibernateSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
try {
session.save(client);
session.getTransaction().commit();
transition = execution.getActivity().findOutgoingTransition("toTaskOneFlow");
} catch (Exception ex) {
transition = execution.getActivity().findOutgoingTransition("toTaskTwoFlow");
} finally {
session.close();
}
execution.take(transition);
}
}
09-26-2013 01:11 PM
09-27-2013 03:21 AM
10-02-2013 05:33 AM
10-03-2013 02:36 AM
10-03-2013 04:09 AM
10-04-2013 07:23 AM
10-09-2013 08:42 AM
There are a lot of topics in the internet that people face the same problemDo you mean specifically using activity and hibernate together? Because in Alfresco 3.4.X, activiti was running with the hibernate transaction manager (as all entities USED to be hibernate in alfresco) without any issues and unit-tests to back that statement up…
03-21-2014 04:09 AM
03-21-2014 12:01 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.