@Override @SuppressWarnings("StatementWithEmptyBody") public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException { DeprecationLogger.DEPRECATION_LOGGER.deprecatedSequenceGenerator( getClass().getName() ); identifierType = type; final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER ); logicalQualifiedSequenceName = QualifiedNameParser.INSTANCE.parse( ConfigurationHelper.getString( SEQUENCE, params, "hibernate_sequence" ), normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ), normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ) ); if ( params.containsKey( PARAMETERS ) ) { LOG.warn( "Use of 'parameters' config setting is no longer supported; " + "to specify initial-value or increment use the " + "org.hibernate.id.enhanced.SequenceStyleGenerator generator instead." ); } }
/** * Normalizes the quoting of identifiers. This form returns a String rather than an Identifier * to better work with the legacy code in {@link org.hibernate.mapping} * * @param identifierText The identifier to be quoting-normalized. * @return The identifier accounting for any quoting that need be applied. */ public String normalizeIdentifierQuotingAsString(String identifierText) { final Identifier identifier = normalizeIdentifierQuoting( identifierText ); if ( identifier == null ) { return null; } return identifier.render( database().getDialect() ); }
column = params.getProperty( PersistentIdentifierGenerator.PK ); column = normalizer.normalizeIdentifierQuoting( column ).render( jdbcEnvironment.getDialect() );
.getImplicitNamingStrategy(); final Identifier implicitName = normalizer.normalizeIdentifierQuoting( implicitNamingStrategy.determineBasicColumnName( new ImplicitBasicColumnNameSource() {
final AttributePath attributePath = AttributePath.parse( propertyName ); Identifier implicitName = normalizer.normalizeIdentifierQuoting( implicitNamingStrategy.determineBasicColumnName( new ImplicitBasicColumnNameSource() {
@Override @SuppressWarnings("StatementWithEmptyBody") public void configure(JavaTypeDescriptor javaTypeDescriptor, Properties params, ServiceRegistry serviceRegistry) throws MappingException { DeprecationLogger.DEPRECATION_LOGGER.deprecatedSequenceGenerator( getClass().getName() ); identifierType = javaTypeDescriptor; final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( IDENTIFIER_NORMALIZER ); logicalQualifiedSequenceName = QualifiedNameParser.INSTANCE.parse( ConfigurationHelper.getString( SEQUENCE, params, "hibernate_sequence" ), normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ), normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ) ); if ( params.containsKey( PARAMETERS ) ) { LOG.warn( "Use of 'parameters' config setting is no longer supported; " + "to specify initial-value or increment use the " + "org.hibernate.id.enhanced.SequenceStyleGenerator generator instead." ); } }
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER ); sequenceName = normalizer.normalizeIdentifierQuoting( PropertiesHelper.getString( SEQUENCE, params, "hibernate_sequence" ) ); parameters = params.getProperty( PARAMETERS ); if ( sequenceName.indexOf( '.' ) < 0 ) { final String schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) ); final String catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) ); sequenceName = Table.qualify( dialect.quote( catalogName ), dialect.quote( schemaName ), dialect.quote( sequenceName ) ); } else { // if already qualified there is not much we can do in a portable manner so we pass it // through and assume the user has set up the name correctly. } this.identifierType = type; sql = dialect.getSequenceNextValString( sequenceName ); }
column = params.getProperty( PersistentIdentifierGenerator.PK ); column = normalizer.normalizeIdentifierQuoting( column ).render( jdbcEnvironment.getDialect() ); final Identifier schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( PersistentIdentifierGenerator.SCHEMA ) ); final Identifier catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( PersistentIdentifierGenerator.CATALOG ) ); final Identifier tableName = normalizer.normalizeIdentifierQuoting( tables[i] ); if ( tables.length > 1 ) { buf.append( "select max(" ).append( column ).append( ") as mx from " );
/** * 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); }
/** * Normalizes the quoting of identifiers. This form returns a String rather than an Identifier * to better work with the legacy code in {@link org.hibernate.mapping} * * @param identifierText The identifier to be quoting-normalized. * @return The identifier accounting for any quoting that need be applied. */ public String normalizeIdentifierQuotingAsString(String identifierText) { final Identifier identifier = normalizeIdentifierQuoting( identifierText ); if ( identifier == null ) { return null; } return identifier.render( database().getDialect() ); }
final AttributePath attributePath = AttributePath.parse( propertyName ); Identifier implicitName = normalizer.normalizeIdentifierQuoting( implicitNamingStrategy.determineBasicColumnName( new ImplicitBasicColumnNameSource() { return normalizer.normalizeIdentifierQuoting( columnName );