final String schema = normalizer.toDatabaseIdentifierText( params.getProperty( PersistentIdentifierGenerator.SCHEMA ) ); final String catalog = normalizer.toDatabaseIdentifierText( params.getProperty( PersistentIdentifierGenerator.CATALOG ) ); final String tableName = normalizer.toDatabaseIdentifierText( tables[i] ); if ( tables.length > 1 ) { buf.append( "select max(" ).append( column ).append( ") as mx from " );
sqlType = normalizer.toDatabaseIdentifierText( columnDefinition );
mappingColumn.setName( normalizer.toDatabaseIdentifierText( columnName ) );
/** * Determine the name of the column in which we will store the generator persistent value. * <p> * Called during {@link #configure configuration}. * * @param params The params supplied in the generator config (plus some standard useful extras). * @param dialect The dialect in effect * * @return The name of the value column */ protected String determineValueColumnName(Properties params, Dialect dialect) { ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ); String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN ); return normalizer.toDatabaseIdentifierText( name ); }
/** * Determine the name of the column used to indicate the segment for each * row. This column acts as the primary key. * <p> * Called during {@link #configure configuration}. * * @param params The params supplied in the generator config (plus some standard useful extras). * @param dialect The dialect in effect * * @return The name of the segment column * * @see #getSegmentColumnName() */ protected String determineSegmentColumnName(Properties params, Dialect dialect) { ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ); String name = ConfigurationHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN ); return normalizer.toDatabaseIdentifierText( name ); }
/** * Configure this generator for a specific type. * * @param type The type. * @param params The parameters. * @param serviceRegistry The included service registry. * @throws MappingException Not thrown. */ @Override public void configure(final Type type, final Properties params, final ServiceRegistry serviceRegistry) throws MappingException { this.type = type; // Grab the column and table name. String column = params.getProperty(PersistentIdentifierGenerator.PK); String table = params.getProperty(PersistentIdentifierGenerator.TABLE); // Grab the JDBC environment managers. JdbcEnvironment jdbcEnvironment = serviceRegistry.getService(JdbcEnvironment.class); ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER); // Render the column and table name for the JDBC environment column = normalizer.normalizeIdentifierQuoting(column) .render(jdbcEnvironment.getDialect()); table = normalizer.toDatabaseIdentifierText(table); sql = String.format("select count(%s) from %s where %s=?", column, table, column); }
sqlType = normalizer.toDatabaseIdentifierText( columnDefinition );