예제 #1
0
 public Query createQuery(String queryString) throws HibernateException {
   LOG.debug("createQuery");
   if (mSession == null) {
     beginSession();
   }
   return mSession.createQuery(queryString);
 }
 private void logDatabaseInfo() throws ServletException {
   SessionHelper helper = RetsServer.createHelper();
   try {
     Session session = helper.beginSession();
     Connection connection = session.connection();
     DatabaseMetaData metaData = connection.getMetaData();
     LOGGER.info(
         "JDBC Driver info: "
             + metaData.getDriverName()
             + " version "
             + metaData.getDriverVersion());
     LOGGER.info(
         "JDBC DB info: "
             + metaData.getDatabaseProductName()
             + " version "
             + metaData.getDatabaseProductVersion());
   } catch (SQLException e) {
     throw new ServletException("Caught", e);
   } catch (HibernateException e) {
     throw new ServletException("Caught", e);
   } finally {
     try {
       helper.close();
     } catch (HibernateException e) {
       throw new ServletException(e);
     }
   }
 }
예제 #3
0
 public Connection getConnection() throws RetsServerException {
   try {
     beginSession();
     return mSession.connection();
   } catch (HibernateException e) {
     throw new RetsServerException(e);
   }
 }