How to set up hibernate to use Glassfish connection pool?
I have set up a connection pool in Glassfish with a jndi resource for it also setup. I am stumped on how to configure hibernate to go g开发者_如何学运维et it.
I have come across alot of write ups to configure it to use C3P0 connection pool. Well I am lost. I found that I need to set:
hibernate.connection.datasource
hibernate.jndi.url
hibernate.jndi.class
hibernate.connection.username
hibernate.connection.password
- Would datasource be the same as the
hibernate.connection.datasource
set in the connection pool? - What would hibernate.jndi.class be?
- Are hibernate.connection.username and hibernate.connection.password for the connection to the database or to the appserver? I assume this is to the database, but why do I need them since that is all set in the appserver?
This article about hibernate basics seems to have the info you will want. Search for the string 'Using a JNDI DataSource'. Listing 2 is important. You may want to compare it against listing 1...
It looks like you can skip c3po, so many of your subquestions do not apply.
精彩评论