Examples of SQLGenerator


Examples of org.hibernate.hql.internal.ast.SqlGenerator

      final DeleteStatement deleteStatement = ( DeleteStatement ) walker.getAST();
     
      final String idSubselectWhere;
      if (deleteStatement.hasWhereClause()) {
        final AST whereClause = deleteStatement.getWhereClause();
        final SqlGenerator gen = new SqlGenerator( factory );
        gen.whereClause( whereClause );
        parameterSpecifications = gen.getCollectedParameters();
        idSubselectWhere = gen.getSQL().length() > 7 ? gen.getSQL() : "";
      }
      else {
        parameterSpecifications = new ArrayList<ParameterSpecification>();
        idSubselectWhere = "";
      }
View Full Code Here

Examples of org.hibernate.hql.internal.ast.SqlGenerator

   
    final DeleteStatement deleteStatement = ( DeleteStatement ) walker.getAST();
    final AST whereClause = deleteStatement.getWhereClause();
   
    try {
      final SqlGenerator gen = new SqlGenerator( factory );
      gen.whereClause( whereClause );
      parameterSpecifications = gen.getCollectedParameters();
     
      // If many-to-many, delete the FK row in the collection table.
      for ( Type type : persister.getPropertyTypes() ) {
        if ( type.isCollectionType() ) {
          final CollectionType cType = (CollectionType) type;
          final AbstractCollectionPersister cPersister = (AbstractCollectionPersister) factory
              .getCollectionPersister( cType.getRole() );
          if ( cPersister.isManyToMany() ) {
            if (persister.getIdentifierColumnNames().length > 1
                && !dialect.supportsTuplesInSubqueries()) {
              LOG.warn( "This dialect is unable to cascade the delete into the many-to-many join table" +
                  " when the entity has multiple primary keys.  Either properly setup cascading on" +
                  " the constraints or manually clear the associations prior to deleting the entities." );
            }
            else {
              final String idSubselectWhere = gen.getSQL().length() > 7 ? gen.getSQL() : "";
              final String idSubselect = "(select "
                  + StringHelper.join( ", ", persister.getIdentifierColumnNames() ) + " from "
                  + persister.getTableName() + idSubselectWhere + ")";
              final String where = "(" + StringHelper.join( ", ", cPersister.getKeyColumnNames() )
                  + ") in " + idSubselect;
View Full Code Here

Examples of org.pentaho.metadata.query.impl.sql.SqlGenerator

  {
    try
    {
      final String sqlGeneratorClass = configuration.getConfigProperty
          ("org.pentaho.reporting.engine.classic.extensions.datasources.pmd.SqlGeneratorClass");
      final SqlGenerator sqlGenerator = (SqlGenerator) ObjectUtilities.loadAndInstantiate
          (sqlGeneratorClass, SimplePmdDataFactory.class, SqlGenerator.class);
      if (sqlGenerator == null)
      {
        logger.error("Default SqlGenerator class " + sqlGeneratorClass + " not found."); //$NON-NLS-1$
        throw new ReportDataFactoryException("Failed to generate SQL. No valid SqlGenerator class found.");//$NON-NLS-1$
      }
      // convert DataRow into Map<String,Object>
      final Map<String, Object> parameterMap = new HashMap<String, Object>();
      final String[] columnNames = parameters.getColumnNames();
      for (int i = 0; i < columnNames.length; i++)
      {
        final String key = columnNames[i];
        final Object value = parameters.get(key);
        parameterMap.put(key, value);
      }

      final IMetadataDomainRepository domainRepository = getDomainRepository();

      Locale locale;
      if (resourceBundleFactory != null)
      {
        locale = resourceBundleFactory.getLocale();
      }
      else
      {
        locale = LocaleHelper.getLocale();
      }
      if (locale == null)
      {
        locale = Locale.getDefault();
      }

      return sqlGenerator.generateSql(queryObject, locale.toString(), domainRepository, databaseMeta, parameterMap, true);
    }
    catch (ReportDataFactoryException e)
    {
      throw e;
    }
View Full Code Here

Examples of org.pentaho.metadata.query.impl.sql.SqlGenerator

  {
    try
    {
      final String sqlGeneratorClass = getConfiguration().getConfigProperty
          ("org.pentaho.reporting.engine.classic.extensions.datasources.pmd.SqlGeneratorClass");
      final SqlGenerator sqlGenerator = ObjectUtilities.loadAndInstantiate
          (sqlGeneratorClass, SimplePmdDataFactory.class, SqlGenerator.class);
      if (sqlGenerator == null)
      {
        logger.error("Default SqlGenerator class " + sqlGeneratorClass + " not found."); //$NON-NLS-1$
        throw new ReportDataFactoryException("Failed to generate SQL. No valid SqlGenerator class found.");//$NON-NLS-1$
      }

      final Map<String, Object> parameterMap = convertDataRowToMap(parameters);
      final IMetadataDomainRepository domainRepository = getDomainRepository();
      Locale locale = computeLocale();
      return sqlGenerator.generateSql(queryObject, locale.toString(), domainRepository, databaseMeta, parameterMap, true);
    }
    catch (final ReportDataFactoryException e)
    {
      throw e;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.