List of usage examples for org.hibernate HibernateException HibernateException
public HibernateException(Throwable cause)
From source file:net.commerce.zocalo.hibernate.HibernateUtil.java
License:Open Source License
static public CashBank getOrMakePersistentRootBank(String rootCashBankName) throws HibernateException { CashBank result;/* ww w . ja v a 2s .c o m*/ Session session = currentSession(); Criteria tokenCriterion = session.createCriteria(CurrencyToken.class); tokenCriterion.add(Expression.eq("name", rootCashBankName)); List tokens = tokenCriterion.list(); if (tokens.size() > 1) { throw new HibernateException("too many root banks"); } else if (tokens.size() == 1) { CurrencyToken t = (CurrencyToken) tokens.get(0); result = t.lookupCashBank(session); } else { result = new CashBank(rootCashBankName); session.save(result); } return result; }
From source file:net.mlw.vlh.adapter.hibernate3.HibernateAdapter.java
License:Open Source License
/** * @param info/*from ww w.j av a 2s . co m*/ * @param session * @return @throws * HibernateException */ private Query getQuery(ValueListInfo info, Session session) throws HibernateException, ParseException { if (getHql() != null) { return getStatementBuilder().generate(session, new StringBuffer(getHql()), info.getFilters(), _isRemoveEmptyStrings); } else { if (namedQuery != null) { return session.getNamedQuery(getNamedQuery()); } else { throw new HibernateException("Please define any QUERY in value list retrieve adpater!"); } } }
From source file:net.mlw.vlh.adapter.hibernate3.HibernateAdapter.java
License:Open Source License
/** * /*from w w w. j av a2 s .c o m*/ * @param info * @param session * @return query that select only focus property. * @throws HibernateException * @throws ParseException */ private Query getOptimizedQuery(ValueListInfo info, Session session) throws HibernateException, ParseException { if (getHql() != null) { return getStatementBuilder().generateForFocus(session, new StringBuffer(getHql()), info.getFilters(), _isRemoveEmptyStrings, defaultFocusPropertyObjectAlias, info.getFocusProperty()); } else { throw new HibernateException( "Please define any HQL QUERY in value list retrieve adpater, function is not implemented for NamedQuery!"); } }
From source file:net.servicefixture.sample.util.EnumUserType.java
License:Apache License
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String value = rs.getString(names[0]); if (rs.wasNull()) { return null; }//w w w . ja v a 2 s . com try { return fromStringMethod.invoke(null, new Object[] { value }); } catch (Exception e) { throw new HibernateException("Unable to invoke method fromString(String) method."); } }
From source file:net.sf.jasperreports.data.hibernate.HibernateConnectionProvider.java
License:Open Source License
@Override public void configure(Properties props) throws HibernateException { String driverClass = props.getProperty(Environment.DRIVER); poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20 log.info("Using Hibernate built-in connection pool (not for production use!)"); log.info("Hibernate connection pool size: " + poolSize); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit); isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); if (isolation != null) log.info("JDBC isolation level: " + Environment.isolationLevelToString(isolation.intValue())); if (driverClass == null) { log.warn("no JDBC Driver class was specified by property " + Environment.DRIVER); } else {/*from ww w.j a v a2 s. c o m*/ try { // trying via forName() first to be as close to DriverManager's semantics // NOTE for JSS: we use the context class loader because it will be able to locate the database drivers // already loaded in our plug-ins or projects driver = (Driver) Class.forName(driverClass, true, Thread.currentThread().getContextClassLoader()) .newInstance(); } catch (Exception e) { try { driver = (Driver) ReflectHelper.classForName(driverClass).newInstance(); } catch (Exception e1) { log.error(e1.getMessage()); throw new HibernateException(e1); } } } url = props.getProperty(Environment.URL); if (url == null) { String msg = "JDBC URL was not specified by property " + Environment.URL; log.error(msg); throw new HibernateException(msg); } connectionProps = ConnectionProviderFactory.getConnectionProperties(props); log.info("using driver: " + driverClass + " at URL: " + url); // if debug level is enabled, then log the password, otherwise mask it if (log.isDebugEnabled()) { log.info("connection properties: " + connectionProps); } else if (log.isInfoEnabled()) { log.info("connection properties: " + PropertiesHelper.maskOut(connectionProps, "password")); } }
From source file:net.wohlfart.framework.search.FullTextSessionImpl.java
License:Open Source License
@Override @SuppressWarnings("rawtypes") public Query createSQLQuery(final String sql, final String returnAlias, final Class returnClass) { throw new HibernateException("unsupported method"); }
From source file:net.wohlfart.framework.search.FullTextSessionImpl.java
License:Open Source License
@Override @SuppressWarnings("rawtypes") public Query createSQLQuery(final String sql, final String[] returnAliases, final Class[] returnClasses) { throw new HibernateException("unsupported method"); }
From source file:net.wohlfart.framework.search.FullTextSessionImpl.java
License:Open Source License
@Override public int delete(final String query) throws HibernateException { throw new HibernateException("unsupported method"); }
From source file:net.wohlfart.framework.search.FullTextSessionImpl.java
License:Open Source License
@Override public int delete(final String query, final Object value, final Type type) throws HibernateException { throw new HibernateException("unsupported method"); }
From source file:net.wohlfart.framework.search.FullTextSessionImpl.java
License:Open Source License
@Override public int delete(final String query, final Object[] values, final Type[] types) throws HibernateException { throw new HibernateException("unsupported method"); }