title: can Use Hibernate and Tomcat Connection pool at same time?
body: <p>I am developing a java web Application and I use Tomcat connection pooling, here is my setting:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context path="" docBase="" debug="5" reloadable="true" crossContext="true"&gt;
  &lt;Resource name="jdbc/jdbcPool"
              auth="Container"
              type="javax.sql.DataSource"
              maxActive="100"
              maxIdle="30"
              maxWait="10000"
              username="root"
              password="*******"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://localhost:3306/dbname?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=UTF-8"/&gt;            
  &lt;/Context&gt;
  </code></pre>
  
  <p>and my DAO:</p>
  
  <pre><code> public static Connection dbConnection() throws NamingException {
          Context initContext;
          DataSource ds = null;
          Connection conn = null;
          try {
              initContext = new InitialContext();
              Context envContext = (Context) initContext.lookup("java:/comp/env");
              ds = (DataSource) envContext.lookup("jdbc/jdbcPool");
              conn = ds.getConnection();        
          }catch (SQLException ex){
              logger.error("SQLException Occurred in DAO.dbConnection() Method, Exception Message is: " + ex.getMessage(), ex);
          }
          catch (RuntimeException er){
              logger.fatal("SQLException Occurred in DAO.dbConnection() Method, Exception Message is: " + er.getMessage(), er);
          }catch(Exception rt){
             logger.fatal("Exception Occurred in DAO.dbConnection() Method, Exception Message is: " + er.getMessage(), er);
          }
          return conn;
      }
  </code></pre>
  
  <p>I want to use hibernate so I refactor some part of my code, now I want to know is it possible for me us use both of them in my application (I mean some part of my code use hibernate and some part use my DAO connection?)
  If yes, what's gonna happen to those tables that not mapped with hibernate but some mapped tables have relation with them?</p>