|
28 | 28 | import static org.hibernate.id.PersistentIdentifierGenerator.CATALOG; |
29 | 29 | import static org.hibernate.id.PersistentIdentifierGenerator.PK; |
30 | 30 | import static org.hibernate.id.PersistentIdentifierGenerator.SCHEMA; |
31 | | -import static org.hibernate.internal.util.StringHelper.split; |
| 31 | +import static org.hibernate.internal.util.StringHelper.splitAtCommas; |
32 | 32 | import static org.hibernate.internal.util.config.ConfigurationHelper.getString; |
33 | 33 |
|
34 | 34 | /** |
@@ -85,25 +85,16 @@ public synchronized Object generate(SharedSessionContractImplementor session, Ob |
85 | 85 | public void configure(GeneratorCreationContext creationContext, Properties parameters) throws MappingException { |
86 | 86 | returnClass = creationContext.getType().getReturnedClass(); |
87 | 87 |
|
88 | | - final JdbcEnvironment jdbcEnvironment = creationContext.getServiceRegistry().requireService( JdbcEnvironment.class ); |
| 88 | + final JdbcEnvironment jdbcEnvironment = creationContext.getDatabase().getJdbcEnvironment(); |
89 | 89 | final IdentifierHelper identifierHelper = jdbcEnvironment.getIdentifierHelper(); |
90 | | - |
91 | | - column = parameters.getProperty( COLUMN ); |
92 | | - if ( column == null ) { |
93 | | - column = parameters.getProperty( PK ); |
94 | | - } |
95 | | - column = identifierHelper.normalizeQuoting( identifierHelper.toIdentifier( column ) ) |
| 90 | + column = identifierHelper.normalizeQuoting( identifierHelper.toIdentifier( getString( COLUMN, PK, parameters ) ) ) |
96 | 91 | .render( jdbcEnvironment.getDialect() ); |
97 | 92 |
|
98 | 93 | final Identifier catalog = identifierHelper.toIdentifier( getString( CATALOG, parameters ) ); |
99 | 94 | final Identifier schema = identifierHelper.toIdentifier( getString( SCHEMA, parameters ) ); |
100 | 95 |
|
101 | | - String tableList = parameters.getProperty( TABLES ); |
102 | | - if ( tableList == null ) { |
103 | | - tableList = parameters.getProperty( PersistentIdentifierGenerator.TABLES ); |
104 | | - } |
105 | 96 | physicalTableNames = new ArrayList<>(); |
106 | | - for ( String tableName : split( ", ", tableList ) ) { |
| 97 | + for ( String tableName : splitAtCommas( getString( TABLES, PersistentIdentifierGenerator.TABLES, parameters ) ) ) { |
107 | 98 | physicalTableNames.add( new QualifiedTableName( catalog, schema, identifierHelper.toIdentifier( tableName ) ) ); |
108 | 99 | } |
109 | 100 | } |
@@ -144,9 +135,9 @@ private void initializePreviousValueHolder(SharedSessionContractImplementor sess |
144 | 135 | LOG.debugf( "Fetching initial value: %s", sql ); |
145 | 136 | } |
146 | 137 | try { |
147 | | - PreparedStatement st = session.getJdbcCoordinator().getStatementPreparer().prepareStatement( sql ); |
| 138 | + final PreparedStatement st = session.getJdbcCoordinator().getStatementPreparer().prepareStatement( sql ); |
148 | 139 | try { |
149 | | - ResultSet rs = session.getJdbcCoordinator().getResultSetReturn().extract( st, sql ); |
| 140 | + final ResultSet rs = session.getJdbcCoordinator().getResultSetReturn().extract( st, sql ); |
150 | 141 | try { |
151 | 142 | if ( rs.next() ) { |
152 | 143 | previousValueHolder.initialize( rs, 0L ).increment(); |
|
0 commit comments