Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* has no {@link jakarta.persistence.Table @Table} annotation, then
* {@link #determinePrimaryTableName(ImplicitEntityNameSource) determinePrimaryTableName}
* is called with an {@link ImplicitEntityNameSource} providing access to information
* about the Java class and its {@link jakarta.persistence.Entity#name() entity name}.
* about the Java class and its {@linkplain jakarta.persistence.Entity#name entity name}.
* <p>
* On the other hand, when a logical name <em>is</em> explicitly specified, for example,
* using {@link jakarta.persistence.Table#name() @Table} to specify the table name,
Expand All @@ -34,15 +34,15 @@
* implementation of {@code ImplicitNamingStrategy}.
* <p>
* An {@code ImplicitNamingStrategy} may be selected using the configuration property
* {@value org.hibernate.cfg.AvailableSettings#IMPLICIT_NAMING_STRATEGY}.
* {@value org.hibernate.cfg.MappingSettings#IMPLICIT_NAMING_STRATEGY}.
*
* @apiNote The method names here mostly favor the JPA terminology,
* for example, "secondary table" rather than "join".
*
* @see PhysicalNamingStrategy
* @see org.hibernate.cfg.Configuration#setImplicitNamingStrategy(ImplicitNamingStrategy)
* @see org.hibernate.boot.MetadataBuilder#applyImplicitNamingStrategy(ImplicitNamingStrategy)
* @see org.hibernate.cfg.AvailableSettings#IMPLICIT_NAMING_STRATEGY
* @see org.hibernate.cfg.MappingSettings#IMPLICIT_NAMING_STRATEGY
*
* @author Steve Ebersole
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
* names, so the abstraction here is in some sense "incomplete".
* <p>
* A {@code PhysicalNamingStrategy} may be selected using the configuration property
* {@value org.hibernate.cfg.AvailableSettings#PHYSICAL_NAMING_STRATEGY}.
* {@value org.hibernate.cfg.MappingSettings#PHYSICAL_NAMING_STRATEGY}.
*
* @see ImplicitNamingStrategy
* @see org.hibernate.cfg.Configuration#setPhysicalNamingStrategy(PhysicalNamingStrategy)
* @see org.hibernate.boot.MetadataBuilder#applyPhysicalNamingStrategy(PhysicalNamingStrategy)
* @see org.hibernate.cfg.AvailableSettings#PHYSICAL_NAMING_STRATEGY
* @see org.hibernate.cfg.MappingSettings#PHYSICAL_NAMING_STRATEGY
*
* @author Steve Ebersole
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@

/**
* Converts {@code camelCase} or {@code MixedCase} logical names to {@code snake_case}.
* <p>
* This strategy leaves quoted identifiers alone. If quoted identifiers should also be
* processed, then this class may be extended the implement the required behavior. For
* example:
* <pre>
* public class AlwaysSnakeEverythingStrategy extends PhysicalNamingStrategySnakeCaseImpl {
* &#64;Override
* protected Identifier quotedIdentifier(Identifier quotedName) {
* return super.unquotedIdentifier( quotedName ).quoted();
* }
* }
* </pre>
*
* @author Phillip Webb
* @author Madhura Bhave
Expand Down Expand Up @@ -59,7 +71,7 @@ else if ( name.isQuoted() ) {
}

private String camelCaseToSnakeCase(String name) {
final StringBuilder builder = new StringBuilder( name.replace( '.', '_' ) );
final var builder = new StringBuilder( name.replace( '.', '_' ) );
for ( int i = 1; i < builder.length() - 1; i++ ) {
if ( isUnderscoreRequired( builder.charAt( i - 1 ), builder.charAt( i ), builder.charAt( i + 1 ) ) ) {
builder.insert( i++, '_' );
Expand Down
Loading