hi, i am using hibernate but i want to add an application that is using hibernate. the problem that i am facing is when i want to perform global transaction on that combined application. i am using weblogic as container, now the problem is that hibernate created its own connection, i want that toplink should use that connection only... can any one tell me how can i achieve that?????
Are you concerned about multiple connections or combining transactions? If you want your toplink code and your hibernate code to share transactions you're probably going to have to look at JTA to combine them into a distributed transaction. Otherwise, I'm unclear on what it is you're trying to accomplish
I'd suggest keeping the Hibernate and TopLink worlds separate and use one EJB Session bean for the Hibernate side of things and another EJB Session bean for the TopLink side of things.
Use container managed transactions and let the WebLogic server take care of the commit across both session bean calls. You may need one data source + connection pool for the TopLink work and a different data source + connection pool for the Hibernate work as well.
This way you have proper architectural separation between the two ORM technologies. I suspect that trying to use the same connection from the TopLink work and passing it to Hibernate (or vice versa) won't work because once one tool has called commit then the other tool can't call rollback :-)
Is you do things at the EJB layer it will be easier than mucking about with JTA directly. The container should take care of the JTA stuff for you.