Hibernate - Configure JNDI Connection

I installed the Hibernate Tools Eclipse plug-in for Eclipse Indigo, because I want to use the ability to test my HQL queries and try to run them against my database and analyze the results in real time.

In my file, hibernate.cfg.xmlI defined a JNDI connection as shown below:

<property name="connection.datasource">java:/comp/env/jdbc/acertDB</property>

Since I have a JNDI file, I use a file context.xmlthat defines the connection and exists in my META-INF folder. The contents of this file are below.

    <Context crossContext="true" docBase="acert" path="/acert" reloadable="false" useHttpOnly="true">
    <ResourceLink global="jdbc/acertDB" name="jdbc/acertDB" type="javax.sql.DataSource" />
    </Context>

I am using Tomcat to manage database connections with the following entry.

My web application is working fine. Only connection setup for Hibernate Tools is my problem.

My question is how to establish a connection with Hibernate Tools and not create an additional properties file containing all the information about my connection, or put all the information about my connection in hibernate.cfg.xml?

+3
source share

All Articles