Transaction issue when using hibernate in Process Application

Hi
Hope you’re doing great.
I am using camunda 7.5.
i have some custom entities in my process app(like Emploee, Employer,Contract, etc)
and also i need to persist Employee in a service task like below:

    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.configure("hibernate.cfg.xml");//populates the data of the configuration file

    //creating seession factory object
    SessionFactory factory = cfg.buildSessionFactory();

    //creating session object
    Session session = factory.openSession();

    //Create new Employee object
    EmployeeEntity emp = new EmployeeEntity();
    emp.setEmployeeId(1);

    //Save employee
    session.save(emp);

but i doesn’t persist to db i think it’s because transaction issue
how can i integrate my shared spring process engine transaction with my own services?!

1 Like