As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
@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); } }
There are a lot of topics in the internet that people face the same problem