Package org.hibernate.dialect

Examples of org.hibernate.dialect.Dialect


      processedPositionalParameterTypes = getPositionalParameterTypes();
      processedSQL = sql;
    }
    else {
     
      Dialect dialect = session.getFactory().getDialect();
      String symbols = new StringBuffer().append( ParserHelper.HQL_SEPARATORS )
          .append( dialect.openQuote() )
          .append( dialect.closeQuote() )
          .toString();
      StringTokenizer tokens = new StringTokenizer( sql, symbols, true );
      StringBuffer result = new StringBuffer();
   
      List parameters = new ArrayList();
View Full Code Here


    if ( type == null ) {
      throw new QueryException( QueryTranslator.ERROR_CANNOT_DETERMINE_TYPE + node.getText() );
    }
    try {
      LiteralType literalType = ( LiteralType ) type;
      Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
      node.setText( literalType.objectToSQLString( value, dialect ) );
    }
    catch ( Exception e ) {
      throw new QueryException( QueryTranslator.ERROR_CANNOT_FORMAT_LITERAL + node.getText(), e );
    }
View Full Code Here

    if ( replacement != null ) {
      constant.setText( replacement );
    }
    else {
      boolean bool = "true".equals( constant.getText().toLowerCase() );
      Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
      constant.setText( dialect.toBooleanValueString(bool) );
    }
  }
View Full Code Here

      processedPositionalParameterValues = getPositionalParameterValues();
      processedPositionalParameterTypes = getPositionalParameterTypes();
      processedSQL = sql;
    }
    else {
      final Dialect dialect = factory.getDialect();
      String symbols = new StringBuffer().append( ParserHelper.HQL_SEPARATORS )
          .append( dialect.openQuote() )
          .append( dialect.closeQuote() )
          .toString();
      StringTokenizer tokens = new StringTokenizer( sql, symbols, true );
      StringBuffer result = new StringBuffer();

      List parameters = new ArrayList();
View Full Code Here

      processedPositionalParameterValues = getPositionalParameterValues();
      processedPositionalParameterTypes = getPositionalParameterTypes();
      processedSQL = sql;
    }
    else {
      final Dialect dialect = factory.getDialect();
      String symbols = new StringBuffer().append( ParserHelper.HQL_SEPARATORS )
          .append( dialect.openQuote() )
          .append( dialect.closeQuote() )
          .toString();
      StringTokenizer tokens = new StringTokenizer( sql, symbols, true );
      StringBuffer result = new StringBuffer();

      List parameters = new ArrayList();
View Full Code Here

    this( propertyName, matchMode.toMatchString(value) );
  }

  public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
  throws HibernateException {
    Dialect dialect = criteriaQuery.getFactory().getDialect();
    String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
    if (columns.length!=1) throw new HibernateException("ilike may only be used with single-column properties");
    if ( dialect instanceof PostgreSQLDialect ) {
      return columns[0] + " ilike ?";
    }
    else {
      return dialect.getLowercaseFunction() + '(' + columns[0] + ") like ?";
    }

    //TODO: get SQL rendering out of this package!
  }
View Full Code Here

  private static Dialect determineDialect() {
    try {
      return Dialect.getDialect();
    }
    catch( Exception e ) {
      return new Dialect() {
      };
    }
  }
View Full Code Here

  }

  private String resolveToLiteralString(Type type) {
    try {
      LiteralType literalType = ( LiteralType ) type;
      Dialect dialect = factory.getDialect();
      return literalType.objectToSQLString( constantValue, dialect );
    }
    catch ( Throwable t ) {
      throw new QueryException( QueryTranslator.ERROR_CANNOT_FORMAT_LITERAL + constantExpression, t );
    }
View Full Code Here

    settings.setDataDefinitionImplicitCommit( metaReportsDDLCausesTxnCommit );
    settings.setDataDefinitionInTransactionSupported( metaReportsDDLInTxnSupported );


    //SQL Dialect:
    Dialect dialect = determineDialect( props, databaseName, databaseMajorVersion );
    settings.setDialect(dialect);
   
    //use dialect default properties
    final Properties properties = new Properties();
    properties.putAll( dialect.getDefaultProperties() );
    properties.putAll(props);
   
    // Transaction settings:
   
    TransactionFactory transactionFactory = createTransactionFactory(properties);
View Full Code Here

  }

  public String toSqlString(
      Criteria criteria,
      CriteriaQuery criteriaQuery) throws HibernateException {
    Dialect dialect = criteriaQuery.getFactory().getDialect();
    String[] columns = criteriaQuery.getColumnsUsingProjection( criteria, propertyName );
    if ( columns.length != 1 ) {
      throw new HibernateException( "Like may only be used with single-column properties" );
    }
    String lhs = ignoreCase
        ? dialect.getLowercaseFunction() + '(' + columns[0] + ')'
              : columns[0];
    return lhs + " like ?" + ( escapeChar == null ? "" : " escape \'" + escapeChar + "\'" );

  }
View Full Code Here

TOP

Related Classes of org.hibernate.dialect.Dialect

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.