Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EntityManger and Session in Hibernate  RSS feed

Ganesh Choudhary
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want something to execute on openSession and closeSession event of hibernate. When Hibernate API is used to persist the object i am able to do it . I have put aspects around openSession() and closeSession() methods and there i can execute my own logic but when Java Persistence API is used to persist an object i am not able to do it. when we call the close() method on entityManager's object it goes to aspect i have put on session.close() method but it never goes to the aspect put on openSession() event. so what to do ?? Can you people please help me ?

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!