Package com.ibatis.dao.client

Examples of com.ibatis.dao.client.DaoException


  }

  public Dao getDao(Class iface) {
    DaoImpl impl = (DaoImpl) typeDaoImplMap.get(iface);
    if (impl == null) {
      throw new DaoException("There is no DAO implementation found for " + iface + " in this context.");
    }
    return impl.getProxy();
  }
View Full Code Here


      userTransaction = (UserTransaction) initCtx.lookup(utxName);
      dsName = (String) properties.get("DBJndiContext");
      contextMessage = "Error looking up data source '" + dsName + "'.";
      dataSource = (DataSource) initCtx.lookup(dsName);
    } catch (Exception e) {
      throw new DaoException(contextMessage + "  Cause: " + e);
    }
  }
View Full Code Here

  public JtaDaoTransaction(UserTransaction utx, DataSource ds) {
    // Check parameters
    userTransaction = utx;
    dataSource = ds;
    if (userTransaction == null) {
      throw new DaoException("JtaTransaction initialization failed.  UserTransaction was null.");
    }
    if (dataSource == null) {
      throw new DaoException("JtaTransaction initialization failed.  DataSource was null.");
    }

    // Start JTA Transaction
    try {
      newTransaction = userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION;
      if (newTransaction) {
        userTransaction.begin();
      }
    } catch (Exception e) {
      throw new DaoException("JtaTransaction could not start transaction.  Cause: ", e);
    }

    try {
      // Open JDBC Connection
      connection = dataSource.getConnection();
      if (connection == null) {
        throw new DaoException("Could not start transaction.  Cause: The DataSource returned a null connection.");
      }
      if (connection.getAutoCommit()) {
        connection.setAutoCommit(false);
      }
      if (connectionLog.isDebugEnabled()) {
        connection = ConnectionLogProxy.newInstance(connection);
      }
    } catch (SQLException e) {
      throw new DaoException("Error opening JDBC connection.  Cause: " + e, e);
    }
  }
View Full Code Here

    }
  }

  public void commit() {
    if (commmitted) {
      throw new DaoException("JtaTransaction could not commit because this transaction has already been committed.");
    }
    try {
      try {
        if (newTransaction) {
          userTransaction.commit();
        }
      } finally {
        close();
      }
    } catch (Exception e) {
      throw new DaoException("JtaTransaction could not commit.  Cause: ", e);
    }
    commmitted = true;
  }
View Full Code Here

          }
        } finally {
          close();
        }
      } catch (Exception e) {
        throw new DaoException("JTA transaction could not rollback.  Cause: ", e);
      }
    }

  }
View Full Code Here

            }
          }
        }
      }
    } catch (Exception e) {
      throw new DaoException("Error while configuring DaoManager.  Cause: " + e.toString(), e);
    }
    return daoManager;
  }
View Full Code Here


    try {
      txMgr = (DaoTransactionManager) Resources.classForName(implementation).newInstance();
    } catch (Exception e) {
      throw new DaoException("Error while configuring DaoManager.  Cause: " + e.toString(), e);
    }

    Properties props = properties;

    if (props == null) {
      props = parsePropertyElements(transPoolElement);
    } else {
      props.putAll(parsePropertyElements(transPoolElement));
    }

    txMgr.configure(props);

    if (txMgr == null) {
      throw new DaoException("Error while configuring DaoManager.  Some unknown condition caused the " +
          "DAO Transaction Manager to be null after configuration.");
    }

    return txMgr;
  }
View Full Code Here

          }

          daoImpl.setDaoInstance(dao);
          daoImpl.initProxy();
        } catch (Exception e) {
          throw new DaoException("Error configuring DAO.  Cause: " + e, e);
        }
      }
    }
    return daoImpl;
  }
View Full Code Here

   * @return A JDBC Connection instance.
   */
  protected Connection getConnection() {
    DaoTransaction trans = daoManager.getTransaction(this);
    if (!(trans instanceof ConnectionDaoTransaction)) {
      throw new DaoException("The DAO manager of type " + daoManager.getClass().getName() +
          " cannot supply a JDBC Connection for this template, and is therefore not" +
          "supported by JdbcDaoTemplate.");
    }
    return ((ConnectionDaoTransaction) trans).getConnection();
  }
View Full Code Here

        .getTransaction(this);
    UnitOfWork uow = trans.getUnitOfWork();

    if ((uow == null) || !uow.isActive()) {

      throw new DaoException("No active unit of work.");

    }

    return uow;
View Full Code Here

TOP

Related Classes of com.ibatis.dao.client.DaoException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.