List of usage examples for org.hibernate HibernateException HibernateException
public HibernateException(String message, Throwable cause)
From source file:cr.ac.una.prograiv.aerolinea.utils.HibernateUtil.java
public void manejaExcepcion(HibernateException he) throws HibernateException { transac.rollback();//from www . ja v a 2 s . c o m throw new HibernateException( "Se gener un error con la base de datos, por favor contcte al administrador", he); }
From source file:cr.ac.una.prograiv.moviestar.utils.HibernateUtil.java
public void manejaExcepcion(HibernateException he) throws HibernateException { transac.rollback();/* w ww. j ava 2 s. c om*/ throw new HibernateException("Ocurri un error en la capa de " + "acceso a datos", he); }
From source file:cr.ac.una.prograv.lab.utils.HibernateUtil.java
public void manejarException(HibernateException he) throws HibernateException { transac.rollback();//w w w . j a v a 2 s . c o m throw new HibernateException("Error Hibernate Utils", he); }
From source file:Dao.DaoReportes.java
private void manejaExcepcion(HibernateException he) throws HibernateException { tx.rollback();/*from w w w. ja v a 2 s .com*/ throw new HibernateException("Ocurri un error en la capa de acceso a datos", he); }
From source file:Data.Dao.RepositoryBase.java
protected void manageException(Exception he) throws HibernateException { tx.rollback();// w w w. j ava 2 s.c o m sesion.close(); this.LogSever(he); throw new HibernateException("Ocurri un error en la capa de acceso a datos", he); }
From source file:Data.DAOs.GeneralDAO.java
protected void exceptionManagement(HibernateException hibernateException) throws HibernateException { transaction.rollback();/*from w w w .ja v a 2 s . co m*/ throw new HibernateException("Ocurrio un error en la capa de acceso a datos", hibernateException); }
From source file:de.escidoc.core.common.persistence.EscidocIdGenerator.java
License:Open Source License
/** * See Interface for functional description. *///from ww w . j ava2s. c o m @Override public Serializable generate(final SessionImplementor sessionImplementor, final Object arg1) { try { final EscidocIdProvider idProvider = (EscidocIdProvider) SpringApplicationContextHolder.getContext() .getBean("escidoc.core.business.EscidocIdProvider"); return idProvider.getNextPid(); } catch (final SystemException e) { throw new HibernateException("Failed to generate an id. ", e); } }
From source file:de.innovationgate.webgate.api.jdbc.pool.DBCPReplicationConnectionProvider.java
License:Open Source License
public void configure(Map propsMap) throws HibernateException { try {/*from w w w . j a v a 2s. c o m*/ log.info("Configure DBCPReplicationConnectionProvider"); Properties props = new Properties(); props.putAll(propsMap); String jdbcUrl = props.getProperty(Environment.URL); // split jdbcURL by "|" and configure masterDS for first and slaveDataSources for all other URLs _jdbcUrls = jdbcUrl.split("\\|"); // spec. configuration for dbcp if (!props.containsKey("hibernate.connection.connectTimeout")) { props.setProperty("hibernate.dbcp.poolPreparedStatements", "true"); } if (!props.containsKey("hibernate.connection.connectTimeout")) { props.setProperty("hibernate.connection.connectTimeout", "5000"); } if (!props.containsKey("hibernate.connection.socketTimeout")) { props.setProperty("hibernate.connection.socketTimeout", "20000"); } if (!props.containsKey("hibernate.dbcp.testOnBorrow")) { props.setProperty("hibernate.dbcp.testOnBorrow", "true"); } if (!props.containsKey("hibernate.dbcp.validationQuery")) { props.setProperty("hibernate.dbcp.validationQuery", "select 1"); } // create master DS log.info("configuring master datasource on url: " + _jdbcUrls[0]); Properties masterProps = (Properties) props.clone(); masterProps.setProperty(Environment.URL, _jdbcUrls[0]); DBCPConnectionProvider masterProvider = new DBCPConnectionProvider(); masterProvider.configure(masterProps); _masterDS = masterProvider.getDs(); // create slave datasources for (int i = 1; i < _jdbcUrls.length; i++) { log.info("configuring slave datasource on url: " + _jdbcUrls[i]); Properties slaveProps = (Properties) props.clone(); slaveProps.setProperty(Environment.URL, _jdbcUrls[i]); DBCPConnectionProvider slaveProvider = new DBCPConnectionProvider(); slaveProvider.configure(slaveProps); _slaveDSList.add(slaveProvider.getDs()); } log.info("Configure DBCPReplicationConnectionProvider complete"); } catch (Exception e) { log.fatal("Could not create DBCPReplicationConnectionProvider.", e); throw new HibernateException("Could not create DBCPReplicationConnectionProvider.", e); } }
From source file:de.innovationgate.webgate.api.jdbc.pool.DBCPReplicationConnectionProvider.java
License:Open Source License
public void close() throws HibernateException { log.info("Close DBCPReplicationConnectionProvider"); try {/*from w ww . j av a 2 s . c o m*/ try { if (_masterDS != null) { _masterDS.close(); } } catch (SQLException e) { log.error("Cannot close masterDS", e); } Iterator _slaves = _slaveDSList.iterator(); while (_slaves.hasNext()) { try { BasicDataSource slaveDS = (BasicDataSource) _slaves.next(); if (slaveDS != null) { slaveDS.close(); } } catch (SQLException e) { log.error("Cannot close slaveDS", e); } } _slaveDSList.clear(); } catch (Exception e) { throw new HibernateException("Could not close DBCPReplicationConnectionProvider", e); } log.info("Close DBCPReplicationConnectionProvider complete"); }
From source file:de.iteratec.iteraplan.persistence.util.StringEnumUserType.java
License:Open Source License
@SuppressWarnings("unchecked") public void setParameterValues(Properties parameters) { String enumClassName = parameters.getProperty("enum"); try {/*from w w w .j av a 2 s . com*/ //Validates the class but does not eliminate the cast enumClass = (Class<T>) Class.forName(enumClassName).asSubclass(Enum.class); } catch (ClassNotFoundException ex) { throw new HibernateException("Enum class " + enumClassName + " not found", ex); } setDefaultValue(parameters.getProperty("default")); }