/** * Determine the name of the sequence (or table if this resolves to a physical table) to use. * * <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 sequence name */ protected ObjectName determineSequenceName(Properties params, Dialect dialect) { String sequencePerEntitySuffix = ConfigurationHelper.getString( CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, DEF_SEQUENCE_SUFFIX); // JPA_ENTITY_NAME value honors <class ... entity-name="..."> (HBM) and @Entity#name (JPA) // overrides. String sequenceName = ConfigurationHelper.getBoolean(CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false) ? params.getProperty(JPA_ENTITY_NAME) + sequencePerEntitySuffix : DEF_SEQUENCE_NAME; final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get(IDENTIFIER_NORMALIZER); sequenceName = normalizer.normalizeIdentifierQuoting( ConfigurationHelper.getString(SEQUENCE_PARAM, params, sequenceName)); if (sequenceName.indexOf('.') < 0) { final String schemaName = normalizer.normalizeIdentifierQuoting(params.getProperty(SCHEMA)); final String catalogName = normalizer.normalizeIdentifierQuoting(params.getProperty(CATALOG)); return new ObjectName(catalogName, schemaName, sequenceName); } else { return ObjectName.parse(sequenceName); } }
/** * Determine the name of the column used to store the generator value in the db. * * <p>Called during {@link #configure configuration} <b>when resolving to a physical table</b>. * * @param params The params supplied in the generator config (plus some standard useful extras). * @param dialect The dialect in effect. * @return The value column name */ protected Identifier determineValueColumnName(Properties params, Dialect dialect) { final ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get(IDENTIFIER_NORMALIZER); final String name = ConfigurationHelper.getString(VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN); return Identifier.toIdentifier(normalizer.normalizeIdentifierQuoting(name)); }