• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I convert my existing Maven JEE project to a EJB one and transaction in Hibernate ?

 
Ranch Hand
Posts: 1021
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi expert,

I am now at a stage where I need to handle transaction management in my JEE JPA maven hibernate project.

However,  I just read that using hibernate sessionFactory is not so 'easy' as compare to EJB EntityManager.

Correct me if I am wrong.

Another way is to use Spring but I have no experience in Spring and if EJB can do the job I hope I can use EJB...hopefully it's alot easier.

The problem I am facing is that I am trying to use sessionFactory on the insertion methods etc etc and seems to be repeating the code throughout.  

The other problem is that it is a 'long conversation' with 'chaining' of 1 method to another and I am abit lost how to get this part correct cos I am receiving the error below :


java.lang.IllegalStateException: Transaction already active
at org.hibernate.engine.transaction.internal.TransactionImpl.begin(TransactionImpl.java:52)
at Business.RegisterService.isTutorExists(RegisterService.java:111)
at Business.RegisterService.register(RegisterService.java:30)
at controller.tutorController.doPost(tutorController.java:90)



Thus, I hope someone can tell me how to...

I am using Tomcat 8 and MySQL.

Tks.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic