Package ch.inftec.ju.db

Examples of ch.inftec.ju.db.JuDbException


    case ORACLE:
      this.setSchema(this.emUtil.getMetaDataUserName());
      dataTypeFactory = new Oracle10DataTypeFactory();
      break;
    default:
      throw new JuDbException("Unsupported DB: " + this.emUtil.getDbType());
    }
   
    this.setConfigProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory);
    this.setConfigProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, metadataHandler);
  }
View Full Code Here


    Connection unwrappedConn = null;
    if (this.emUtil != null && this.emUtil.getDbType() == DbType.ORACLE && connection instanceof Proxy) {
      try {
        unwrappedConn = connection.unwrap(Connection.class);
      } catch (Exception ex) {
        throw new JuDbException("Couldn't unwrap Connection", ex);
      }
    }
    final Connection realConn = unwrappedConn != null
        ? unwrappedConn
        : connection;
   
    try {
      IDatabaseConnection conn = new DatabaseConnection(realConn, this.schemaName);
      for (String key : this.configProperties.keySet()) {
        conn.getConfig().setProperty(key, this.configProperties.get(key));
      }
      work.execute(conn);
    } catch (DatabaseUnitException ex) {
      throw new JuDbException("Couldn't execute DbUnitWork", ex);
    }
  }
View Full Code Here

    public ExportBuilder setTableNamesCasingByDataSet(String resourcePath) {
      try {
        this.exportItems.setCasedTableNames(new XPathGetter(XmlUtils.loadXml(
            JuUrl.resource().relativeTo(DbDataUtil.class).get(resourcePath))).getNodeNames("dataset/*"));
      } catch (Exception ex) {
        throw new JuDbException("Couldn't load table names data set " + resourcePath, ex);
      }
      return this;
    }
View Full Code Here

          }
        }
       
        return this;
      } catch (Exception ex) {
        throw new JuDbException("Couldn't add tables by dataset " + resourceUrl, ex);
      }
    }
View Full Code Here

          try {
            XmlOutputConverter xmlConv = new XmlOutputConverter();
            ExportBuilder.writeToXml(dataSet, xmlConv.getOutputStream());
            doc.setValue(xmlConv.getDocument());
          } catch (Exception ex) {
            throw new JuDbException("Couldn't write DB data to XML document", ex);
          }
        }
      });
     
      return doc.getValue();
View Full Code Here

           @Override
          public void execute(IDataSet dataSet) {
            try {
              ExportBuilder.writeToXml(dataSet, stream);
            } catch (Exception ex) {
              throw new JuDbException("Couldn't write DB data to byte stream", ex);
            }
          }
        });
      } catch (Exception ex) {
        throw new JuDbException("Couldn't write DB data to byte stream", ex);
      }
     
      try {
        return bos.toString("utf-8");
      } catch (Exception ex) {
View Full Code Here

           @Override
          public void execute(IDataSet dataSet) {
            try {
              ExportBuilder.writeToXml(dataSet, stream);
            } catch (Exception ex) {
              throw new JuDbException("Couldn't write DB data to file " + fileName, ex);
            }
          }
        });
      } catch (Exception ex) {
        throw new JuDbException("Couldn't write DB data to file " + fileName, ex);
      }
    }
View Full Code Here

          .setCaseSensitiveTableNames(false)
          .build(xmlUrl);
        this.dataSetUrl = xmlUrl;
        return this;
      } catch (Exception ex) {
        throw new JuDbException("Couldn't import data from XML: " + xmlUrl, ex);
      }
    }
View Full Code Here

        public void execute(IDatabaseConnection conn) {
          try {
            logger.debug("Executing Clean-Insert from: " + dataSetUrl);
            DatabaseOperation.CLEAN_INSERT.execute(conn, flatXmlDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldn't clean and insert data into DB", ex);
          }
        }
      });
    }
View Full Code Here

        public void execute(IDatabaseConnection conn) {
          try {
            logger.debug("Executing Delete-All from: " + dataSetUrl);
            DatabaseOperation.DELETE_ALL.execute(conn, flatXmlDataSet);
          } catch (Exception ex) {
            throw new JuDbException("Couldnt truncate data in DB", ex);
          }
        };
      });
    }
View Full Code Here

TOP

Related Classes of ch.inftec.ju.db.JuDbException

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.