This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have successfully tested using hibernate in my application.
However now i need to be able to use hibernate in such a way that the Application server takes care of handling database connections from it's connection pool. Which means like in Entity beans programmer should be able to use db connections without having to worry about open/close connections. So he could focus only on business logic of the application
ideally the HQL must be executed by using an availbale connection from application server's pooled connection, by the application server.
thanks Paul. I have created the datasource to use connection pooling. (I am using the Sun Application server Platform Ed. 8.). What i don't understand is how to make Hibernate look it up. Do i have to do some changes in Hibernate.Properties file?
But does that mean still i have to open/close connection when i have to i.e. add a record to the database?
Ehm, you can't do this through Hibernate - it doesn't have a Connection object you can access. With Hibernate you would open a Session, do some DB stuff, then flush and close it. What Hibernate does with connections is entirely up to Hibernate and your connection pool provider.
Joined: Jun 28, 2004
Now i need help with transaction mgt. strategy. How do i achieve declarative transaction demarcation?
I need my app server to take care of transactions. In that case i will have to specify the demarcation in the deployment descriptor of my EJB component and that's fine. Do i have to do any changes in my Hibernate.properties file too?
Ideally i need the HQL queries to be executed without wrapping it in a programmatically specified transaction (session.beginTransaction(),transaction.commit()).
Joined: Jun 28, 2004
I think i figured it out.
I simply removed the begin__ and commit statements and before closing the session i do a flush() on it. And also in my hibernate.properties file i no more use the