Skip to content

Commit 43019af

Browse files
committed
more consistent format for logging in boot.model package
1 parent 9398e1f commit 43019af

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,7 +2804,7 @@ private void setLocalGenerators(Map<String, IdentifierGeneratorDefinition> local
28042804

28052805
private void logOneToManySecondPass() {
28062806
if ( LOG.isTraceEnabled() ) {
2807-
LOG.trace( "Binding @OneToMany through foreign key: " + safeCollectionRole() );
2807+
LOG.trace( "Binding one-to-many association through foreign key: " + safeCollectionRole() );
28082808
}
28092809
}
28102810

@@ -2814,16 +2814,16 @@ private void logManyToManySecondPass(
28142814
boolean isManyToAny) {
28152815
if ( LOG.isTraceEnabled() ) {
28162816
if ( isCollectionOfEntities && isOneToMany ) {
2817-
LOG.trace( "Binding @OneToMany through association table: " + safeCollectionRole() );
2817+
LOG.trace( "Binding one-to-many association through association table: " + safeCollectionRole() );
28182818
}
28192819
else if ( isCollectionOfEntities ) {
2820-
LOG.trace( "Binding @ManyToMany through association table: " + safeCollectionRole() );
2820+
LOG.trace( "Binding many-to-many association through association table: " + safeCollectionRole() );
28212821
}
28222822
else if ( isManyToAny ) {
2823-
LOG.trace( "Binding @ManyToAny: " + safeCollectionRole() );
2823+
LOG.trace( "Binding many-to-any: " + safeCollectionRole() );
28242824
}
28252825
else {
2826-
LOG.trace( "Binding @ElementCollection to collection table: " + safeCollectionRole() );
2826+
LOG.trace( "Binding element collection to collection table: " + safeCollectionRole() );
28272827
}
28282828
}
28292829
}

hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static Component fillEmbeddable(
453453

454454
final String subpath = getPath( propertyHolder, inferredData );
455455
if ( LOG.isTraceEnabled() ) {
456-
LOG.trace( "Binding component with path: " + subpath );
456+
LOG.trace( "Binding embeddable with path: " + subpath );
457457
}
458458
final PropertyHolder subholder = buildPropertyHolder(
459459
component,

hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public static void bindEntityClass(
180180
Map<ClassDetails, InheritanceState> inheritanceStates,
181181
MetadataBuildingContext context) {
182182
if ( LOG.isTraceEnabled() ) {
183-
LOG.trace( "Binding entity from annotated class: " + clazzToProcess.getName() );
183+
LOG.trace( "Binding entity with annotated class: " + clazzToProcess.getName() );
184184
}
185185

186186
final InFlightMetadataCollector collector = context.getMetadataCollector();

hibernate-core/src/main/java/org/hibernate/boot/model/internal/QueryBinder.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public static void bindQuery(
8181
}
8282

8383
if ( LOG.isTraceEnabled() ) {
84-
LOG.tracef( "Binding named query: %s => %s", queryName, queryString );
84+
LOG.tracef( "Binding named query '%s' to [%s]", queryName,
85+
queryString.replace( '\n', ' ' ) );
8586
}
8687

8788
final QueryHintDefinition hints = new QueryHintDefinition( queryName, namedQuery.hints() );
@@ -141,9 +142,9 @@ public static void bindNativeQuery(
141142
createNamedQueryDefinition( registrationName, queryString, resultClass, resultSetMappingName, hints, location );
142143

143144
if ( LOG.isTraceEnabled() ) {
144-
LOG.tracef( "Binding named native query: %s => %s",
145+
LOG.tracef( "Binding named native query '%s' to [%s]",
145146
queryDefinition.getRegistrationName(),
146-
queryDefinition.getSqlQueryString() );
147+
queryDefinition.getSqlQueryString().replace( '\n', ' ' ) );
147148
}
148149

149150
if ( isDefault ) {
@@ -234,9 +235,9 @@ public static void bindNativeQuery(
234235
final NamedNativeQueryDefinition<?> queryDefinition = builder.build();
235236
if ( LOG.isTraceEnabled() ) {
236237
LOG.tracef(
237-
"Binding named native query: %s => %s",
238+
"Binding named native query '%' to [%s]",
238239
queryDefinition.getRegistrationName(),
239-
queryDefinition.getSqlQueryString()
240+
queryDefinition.getSqlQueryString().replace( '\n', ' ' )
240241
);
241242
}
242243
context.getMetadataCollector().addNamedNativeQuery( queryDefinition );
@@ -390,9 +391,9 @@ public static void bindQuery(
390391
final NamedHqlQueryDefinitionImpl<?> hqlQueryDefinition = builder.build();
391392

392393
if ( LOG.isTraceEnabled() ) {
393-
LOG.tracef( "Binding named query: %s => %s",
394+
LOG.tracef( "Binding named query '%s' to [%s]",
394395
hqlQueryDefinition.getRegistrationName(),
395-
hqlQueryDefinition.getHqlString() );
396+
hqlQueryDefinition.getHqlString().replace( '\n', ' ' ) );
396397
}
397398

398399
context.getMetadataCollector().addNamedQuery( hqlQueryDefinition );

hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,7 @@ private void bindComponent(
24542454
// todo : better define the conditions in this if/else
24552455
if ( isDynamic ) {
24562456
// dynamic is represented as a Map
2457-
log.tracef( "Binding dynamic-component [%s]", role );
2457+
log.tracef( "Binding dynamic component [%s]", role );
24582458
componentBinding.setDynamic( true );
24592459
}
24602460
else if ( isVirtual ) {
@@ -2983,7 +2983,7 @@ public void doSecondPass(Map<String, PersistentClass> persistentClasses) throws
29832983
collectionBinding.createAllKeys();
29842984

29852985
if ( log.isTraceEnabled() ) {
2986-
log.tracef( "Mapped collection : %s", getPluralAttributeSource().getAttributeRole().getFullPath() );
2986+
log.tracef( "Mapped collection: %s", getPluralAttributeSource().getAttributeRole().getFullPath() );
29872987
log.tracef( " + table -> %s", getCollectionBinding().getTable().getName() );
29882988
log.tracef( " + key -> %s", columns( getCollectionBinding().getKey() ) );
29892989
if ( getCollectionBinding().isIndexed() ) {

0 commit comments

Comments
 (0)