Package org.hibernate

Examples of org.hibernate.HibernateException


      public IntegralDataTypeHolder execute(Connection connection) throws SQLException {
        try {
          return doWorkInCurrentTransactionIfAny( localSession );
        }
        catch ( RuntimeException sqle ) {
          throw new HibernateException( "Could not get or update next value", sqle );
        }
      }
View Full Code Here


    else if ( sqlDefinition.getResultSetRef() != null ) {
      SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) factory.getSessionFactory();
      ResultSetMappingDefinition resultSetMapping = sessionFactory.getResultSetMapping( sqlDefinition.getResultSetRef() );

      if ( resultSetMapping == null ) {
        throw new HibernateException( "Result set mapping '" + sqlDefinition.getResultSetRef() + "' referenced by query '" + sqlDefinition.getName() + "' does not exist." );
      }

      for (NativeSQLQueryReturn queryReturn : resultSetMapping.getQueryReturns() ) {
        if ( queryReturn instanceof NativeSQLQueryScalarReturn ) {
          noSqlQuery.addScalar( ( (NativeSQLQueryScalarReturn) queryReturn ).getColumnAlias() );
View Full Code Here

  public <T> T unwrap(Class<T> cls) {
    final T session = hibernateEm.unwrap( cls );
    if ( Session.class.isAssignableFrom( cls ) || SessionImplementor.class.isAssignableFrom( cls ) ) {
      return (T) buildOgmSession( (EventSource) session );
    }
    throw new HibernateException( "Cannot unwrap the following type: " + cls );
  }
View Full Code Here

   */
  public UpdateLockingStrategy(Lockable lockable, LockMode lockMode) {
    this.lockable = lockable;
    this.lockMode = lockMode;
    if ( lockMode.lessThan( LockMode.UPGRADE ) ) {
      throw new HibernateException( "[" + lockMode + "] not valid for update statement" );
    }
    if ( !lockable.isVersioned() ) {
      log.warn( "write locks via update not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
      this.sql = null;
    }
View Full Code Here

      Serializable id,
          Object version,
          Object object,
          SessionImplementor session) throws StaleObjectStateException, JDBCException {
    if ( !lockable.isVersioned() ) {
      throw new HibernateException( "write locks via update not supported for non-versioned entities [" + lockable.getEntityName() + "]" );
    }
    // todo : should we additionally check the current isolation mode explicitly?
    SessionFactoryImplementor factory = session.getFactory();
    try {
      PreparedStatement st = session.getBatcher().prepareSelectStatement( sql );
View Full Code Here

    }

    int ordinalParamCount = parameterTranslations.getOrdinalParameterCount();
    int[] locations = ArrayHelper.toIntArray( recognizer.getOrdinalParameterLocationList() );
    if ( parameterTranslations.supportsOrdinalParameterMetadata() && locations.length != ordinalParamCount ) {
      throw new HibernateException( "ordinal parameter mismatch" );
    }
    ordinalParamCount = locations.length;
    OrdinalParameterDescriptor[] ordinalParamDescriptors = new OrdinalParameterDescriptor[ordinalParamCount];
    for ( int i = 1; i <= ordinalParamCount; i++ ) {
      ordinalParamDescriptors[ i - 1 ] = new OrdinalParameterDescriptor(
View Full Code Here

   * @throws SQLException Can be thrown while accessing the result set
   * @throws HibernateException Indicates a problem reading back a generated identity value.
   */
  public static Serializable getGeneratedIdentity(ResultSet rs, Type type) throws SQLException, HibernateException {
    if ( !rs.next() ) {
      throw new HibernateException( "The database returned no natively generated identity value" );
    }
    final Serializable id = IdentifierGeneratorFactory.get( rs, type );

    if ( log.isDebugEnabled() ) {
      log.debug( "Natively generated identity: " + id );
View Full Code Here

        classfile.write( out );
        return byteStream.toByteArray();
      }
      catch (Exception e) {
        log.error( "Unable to transform class", e );
        throw new HibernateException( "Unable to transform class: " + e.getMessage() );
      }
      finally {
        try {
          if ( out != null ) out.close();
        }
View Full Code Here

   * {@inheritDoc}
   */
  public Session currentSession() {
    Session current = existingSession( factory );
    if ( current == null ) {
      throw new HibernateException( "No session currently bound to execution context" );
    }
    return current;
  }
View Full Code Here

    if(oracletypes_cursor_value==0) {
      try {
        Class types = ReflectHelper.classForName("oracle.jdbc.driver.OracleTypes");
        oracletypes_cursor_value = types.getField("CURSOR").getInt(types.newInstance());
      } catch (Exception se) {
        throw new HibernateException("Problem while trying to load or access OracleTypes.CURSOR value",se);
      }
    }
    //  register the type of the out param - an Oracle specific type
    statement.registerOutParameter(col, oracletypes_cursor_value);
    col++;
View Full Code Here

TOP

Related Classes of org.hibernate.HibernateException

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.