Reputation: 41
I have a client who has an existing Hibernate JPA application. For some of the optimization it would be beneficial to utilize stateless sessions. I believe I should be able to use both the existing JPA EntityManager and also create a Hibernate Session Manager based StatelessSession. The JPA would be used for the CRUD functionality, and the StatelessSession would implement bulk insert/updates.
I have not tried to use the two paradigms simultaneously before (always used either EntityManager or Hibernate sessions).
I think it should be possible to do fairly easily, but hopefully someone has done this and can warn me of any pitfalls.
Thanks.
Upvotes: 1
Views: 566
Reputation: 3484
I think you are talking about this:
Session session = (Session) entityManager.getDelegate();
//session.persist(myEntity); Now you can use this session object for operations on entity
Entity manager exposes getDelegate method to access underlying object which in hibernate case it is hibernate Session
Upvotes: 1