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
10 changes: 8 additions & 2 deletions hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public interface BootLogging extends BasicLogger {
@Message(id = 160101, value = "Duplicate generator name: '%s'")
void duplicateGeneratorName(String name);


@LogMessage(level = DEBUG)
@Message(id = 160111, value = "Package not found or no package-info.java: %s")
void packageNotFound(String packageName);
Expand Down Expand Up @@ -84,7 +83,6 @@ public interface BootLogging extends BasicLogger {
@ManyToOne and @OneToOne associations mapped with @NotFound are forced to EAGER fetching""")
void ignoreNotFoundWithFetchTypeLazy(String entity, String association);

// --- New typed TRACE/DEBUG messages for boot internals ---
@LogMessage(level = TRACE)
@Message(id = 160140, value = "Binding formula: %s")
void bindingFormula(String formula);
Expand Down Expand Up @@ -449,4 +447,12 @@ public interface BootLogging extends BasicLogger {
@LogMessage(level = DEBUG)
@Message(id = 160244, value = "Skipping HBM processing of entity hierarchy [%s], as at least one entity [%s] has been processed")
void skippingHbmProcessingOfEntityHierarchy(String rootEntityName, String processedEntity);

@LogMessage(level = WARN)
@Message(id = 160245, value = "Association '%s' is 'mappedBy' another entity and should not specify a '@MapKeyColumn' (use '@MapKey' instead)")
void mappedByShouldNotSpecifyMapKeyColumn(String associationPath);

@LogMessage(level = WARN)
@Message(id = 160246, value = "Association '%s' is 'mappedBy' another entity and should not specify an '@OrderColumn' (use '@OrderBy' instead)")
void mappedByShouldNotSpecifyOrderColumn(String associationPath);
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ public MetadataSources(ServiceRegistry serviceRegistry, XmlMappingBinderAccess x
// service registry really should be either BootstrapServiceRegistry or StandardServiceRegistry type...
if ( !isExpectedServiceRegistryType( serviceRegistry ) ) {
if ( BOOT_LOGGER.isDebugEnabled() ) {
BOOT_LOGGER.unexpectedServiceRegistryType(
serviceRegistry.getClass().getName()
);
BOOT_LOGGER.unexpectedServiceRegistryType( serviceRegistry.getClass().getName() );
}
}
this.serviceRegistry = serviceRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import org.hibernate.boot.archive.spi.ArchiveException;

import static org.hibernate.boot.BootLogging.BOOT_LOGGER;


/**
* Helper for dealing with archives
Expand Down Expand Up @@ -89,7 +91,7 @@ else if ( "zip".equals( protocol )
"Unable to determine JAR Url from " + url + ". Cause: " + e.getMessage()
);
}
org.hibernate.boot.BootLogging.BOOT_LOGGER.jarUrlFromUrlEntry( String.valueOf(url), String.valueOf(jarUrl) );
BOOT_LOGGER.jarUrlFromUrlEntry( String.valueOf(url), String.valueOf(jarUrl) );
return jarUrl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,11 @@ public static LoadedConfig consume(JaxbCfgHibernateConfiguration jaxbCfg) {
final String eventTypeName = listenerGroup.getType().value();
final var eventType = EventType.resolveEventTypeByName( eventTypeName );
for ( var listener : listenerGroup.getListener() ) {
if ( listener.getType() != null ) {
BOOT_LOGGER.listenerDefinedAlsoDefinedEventType(
listener.getClazz()
);
}
cfg.addEventListener( eventType, listener.getClazz() );
final String listenerClassName = listener.getClazz();
if ( listener.getType() != null ) {
BOOT_LOGGER.listenerDefinedAlsoDefinedEventType( listenerClassName );
}
cfg.addEventListener( eventType, listenerClassName );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void injectJpaTempClassLoader(ClassLoader classLoader) {

void injectScanOptions(ScanOptions scanOptions) {
if ( scanOptions != this.scanOptions ) {
BOOT_LOGGER.injectingScanOptions(scanOptions, this.scanOptions);
BOOT_LOGGER.injectingScanOptions( scanOptions, this.scanOptions );
}
this.scanOptions = scanOptions;
}
Expand All @@ -332,7 +332,7 @@ void injectScanEnvironment(ScanEnvironment scanEnvironment) {

void injectScanner(Scanner scanner) {
if ( scanner != this.scannerSetting ) {
BOOT_LOGGER.injectingScanner( scanner, scannerSetting );
BOOT_LOGGER.injectingScanner( scanner, this.scannerSetting );
}
this.scannerSetting = scanner;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ public AnnotatedColumn() {

public void bind() {
if ( isNotEmpty( formulaString ) ) {
if ( BOOT_LOGGER.isTraceEnabled() ) {
BOOT_LOGGER.bindingFormula( formulaString );
}
BOOT_LOGGER.bindingFormula( formulaString );
formula = new Formula();
formula.setFormula( formulaString );
}
Expand Down Expand Up @@ -269,7 +267,7 @@ public void bind() {
if ( generatedAs != null ) {
mappingColumn.setGeneratedAs( generatedAs );
}
if ( BOOT_LOGGER.isDebugEnabled() && logicalColumnName != null ) {
if ( logicalColumnName != null ) {
BOOT_LOGGER.bindingColumn( logicalColumnName );
}
}
Expand Down Expand Up @@ -770,7 +768,7 @@ private static jakarta.persistence.Column[] overrideColumns(
+ " columns (every column must have exactly one '@AttributeOverride')" );
}
if ( BOOT_LOGGER.isTraceEnabled() ) {
BOOT_LOGGER.columnMappingOverridden( inferredData.getPropertyName() );
BOOT_LOGGER.columnMappingOverridden( inferredData.getPropertyName() );
}
return isEmpty( overriddenCols ) ? null : overriddenCols;
}
Expand Down Expand Up @@ -930,7 +928,7 @@ void applyColumnDefault(PropertyData inferredData, int length) {
}
}
else {
BOOT_LOGGER.couldNotPerformColumnDefaultLookup();
BOOT_LOGGER.couldNotPerformColumnDefaultLookup();
}
}

Expand All @@ -951,7 +949,7 @@ void applyGeneratedAs(PropertyData inferredData, int length) {
}
}
else {
BOOT_LOGGER.couldNotPerformGeneratedColumnLookup();
BOOT_LOGGER.couldNotPerformGeneratedColumnLookup();
}
}

Expand Down Expand Up @@ -994,9 +992,9 @@ void applyCheckConstraint(PropertyData inferredData, int length) {
}
}
else {
BOOT_LOGGER.couldNotPerformCheckLookup();
BOOT_LOGGER.couldNotPerformCheckLookup();
}
}
}

//must only be called after all setters are defined and before binding
private void extractDataFromPropertyData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,7 @@ private void bind() {
}
collection = createCollection( propertyHolder.getPersistentClass() );
final String role = qualify( propertyHolder.getPath(), propertyName );
if ( BOOT_LOGGER.isTraceEnabled() ) {
BOOT_LOGGER.bindingCollectionRole( role );
}
BOOT_LOGGER.bindingCollectionRole( role );
collection.setRole( role );
collection.setMappedByProperty( mappedBy );

Expand Down Expand Up @@ -1145,16 +1143,14 @@ private void detectMappedByProblem(boolean isMappedBy) {
}
if ( oneToMany ) {
if ( property.hasDirectAnnotationUsage( MapKeyColumn.class ) ) {
BOOT_LOGGER.warn( "Association '"
+ qualify( propertyHolder.getPath(), propertyName )
+ "' is 'mappedBy' another entity and should not specify a '@MapKeyColumn'"
+ " (use '@MapKey' instead)" );
BOOT_LOGGER.mappedByShouldNotSpecifyMapKeyColumn(
qualify( propertyHolder.getPath(), propertyName )
);
}
if ( property.hasDirectAnnotationUsage( OrderColumn.class ) ) {
BOOT_LOGGER.warn( "Association '"
+ qualify( propertyHolder.getPath(), propertyName )
+ "' is 'mappedBy' another entity and should not specify an '@OrderColumn'"
+ " (use '@OrderBy' instead)" );
BOOT_LOGGER.mappedByShouldNotSpecifyOrderColumn(
qualify( propertyHolder.getPath(), propertyName )
);
}
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public void registerTable(Identifier logicalName, Table table) {
final Table previous = tables.put( logicalName, table );
if ( previous != null ) {
BOOT_LOGGER.replacingTableRegistration(
String.valueOf(logicalName),
String.valueOf(previous),
String.valueOf(table)
String.valueOf( logicalName ),
String.valueOf( previous ),
String.valueOf( table )
);
}
}
Expand Down