| 
5 | 5 | package org.hibernate.boot;  | 
6 | 6 | 
 
  | 
7 | 7 | import org.hibernate.Internal;  | 
 | 8 | +import org.hibernate.boot.model.relational.Namespace;  | 
8 | 9 | import org.hibernate.internal.log.SubSystemLogging;  | 
9 | 10 | 
 
  | 
 | 11 | +import java.io.File;  | 
 | 12 | +import java.io.FileNotFoundException;  | 
 | 13 | +import java.lang.invoke.MethodHandles;  | 
 | 14 | + | 
 | 15 | +import org.hibernate.type.SerializationException;  | 
 | 16 | +import org.jboss.logging.BasicLogger;  | 
10 | 17 | import org.jboss.logging.Logger;  | 
 | 18 | +import org.jboss.logging.annotations.Cause;  | 
 | 19 | +import org.jboss.logging.annotations.LogMessage;  | 
 | 20 | +import org.jboss.logging.annotations.Message;  | 
 | 21 | +import org.jboss.logging.annotations.MessageLogger;  | 
 | 22 | +import org.jboss.logging.annotations.ValidIdRange;  | 
11 | 23 | 
 
  | 
 | 24 | +import static org.jboss.logging.Logger.Level.DEBUG;  | 
 | 25 | +import static org.jboss.logging.Logger.Level.TRACE;  | 
 | 26 | +import static org.jboss.logging.Logger.Level.WARN;  | 
 | 27 | +import static org.jboss.logging.Logger.Level.INFO;  | 
12 | 28 | 
 
  | 
13 | 29 | /**  | 
14 | 30 |  * Logging related to Hibernate bootstrapping  | 
 | 
17 | 33 | 		name = BootLogging.NAME,  | 
18 | 34 | 		description = "Logging related to bootstrapping of a SessionFactory / EntityManagerFactory"  | 
19 | 35 | )  | 
 | 36 | +@MessageLogger(projectCode = "HHH")  | 
 | 37 | +@ValidIdRange(min = 160101, max = 160200)  | 
20 | 38 | @Internal  | 
21 |  | -public interface BootLogging {  | 
 | 39 | +public interface BootLogging extends BasicLogger {  | 
22 | 40 | 	String NAME = SubSystemLogging.BASE + ".boot";  | 
23 |  | -	Logger BOOT_LOGGER = Logger.getLogger( NAME );  | 
 | 41 | +	BootLogging BOOT_LOGGER = Logger.getMessageLogger( MethodHandles.lookup(), BootLogging.class, NAME );  | 
 | 42 | + | 
 | 43 | +	@LogMessage(level = WARN)  | 
 | 44 | +	@Message(id = 160101, value = "Duplicate generator name %s")  | 
 | 45 | +	void duplicateGeneratorName(String name);  | 
 | 46 | + | 
 | 47 | +	@LogMessage(level = INFO)  | 
 | 48 | +	@Message(id = 160102, value = "Reading mappings from file: %s")  | 
 | 49 | +	void readingMappingsFromFile(String path);  | 
 | 50 | + | 
 | 51 | +	@LogMessage(level = INFO)  | 
 | 52 | +	@Message(id = 160103, value = "Reading mappings from cache file: %s")  | 
 | 53 | +	void readingCachedMappings(File cachedFile);  | 
 | 54 | + | 
 | 55 | +	@LogMessage(level = WARN)  | 
 | 56 | +	@Message(id = 160104, value = "Could not deserialize cache file [%s]: %s")  | 
 | 57 | +	void unableToDeserializeCache(String path, SerializationException error);  | 
 | 58 | + | 
 | 59 | +	@LogMessage(level = WARN)  | 
 | 60 | +	@Message(id = 160105, value = "I/O reported error writing cached file: [%s]: %s")  | 
 | 61 | +	void unableToWriteCachedFile(String path, String message);  | 
 | 62 | + | 
 | 63 | +	@LogMessage(level = WARN)  | 
 | 64 | +	@Message(id = 160106, value = "Could not update cached file timestamp: [%s]")  | 
 | 65 | +	@SuppressWarnings("unused")  | 
 | 66 | +	void unableToUpdateCachedFileTimestamp(String path);  | 
 | 67 | + | 
 | 68 | +	@LogMessage(level = WARN)  | 
 | 69 | +	@Message(id = 160107, value = "I/O reported cached file could not be found: [%s]: %s")  | 
 | 70 | +	void cachedFileNotFound(String path, FileNotFoundException error);  | 
 | 71 | + | 
 | 72 | +	@LogMessage(level = INFO)  | 
 | 73 | +	@Message(id = 160108, value = "Omitting cached file [%s] as the mapping file is newer")  | 
 | 74 | +	void cachedFileObsolete(File cachedFile);  | 
 | 75 | + | 
 | 76 | +	@LogMessage(level = DEBUG)  | 
 | 77 | +	@Message(id = 160111, value = "Package not found or no package-info.java: %s")  | 
 | 78 | +	void packageNotFound(String packageName);  | 
 | 79 | + | 
 | 80 | +	@LogMessage(level = WARN)  | 
 | 81 | +	@Message(id = 160112, value = "LinkageError while attempting to load package: %s")  | 
 | 82 | +	void linkageError(String packageName, @Cause LinkageError e);  | 
 | 83 | + | 
 | 84 | +	@LogMessage(level = TRACE)  | 
 | 85 | +	@Message(id = 160121, value = "Trying via [new URL(\"%s\")]")  | 
 | 86 | +	void tryingURL(String name);  | 
 | 87 | + | 
 | 88 | +	@LogMessage(level = TRACE)  | 
 | 89 | +	@Message(id = 160122, value = "Trying via [ClassLoader.getResourceAsStream(\"%s\")]")  | 
 | 90 | +	void tryingClassLoader(String name);  | 
 | 91 | + | 
 | 92 | +	@LogMessage(level = WARN)  | 
 | 93 | +	@Message(id = 160130, value = "Ignoring unique constraints specified on table generator [%s]")  | 
 | 94 | +	void ignoringTableGeneratorConstraints(String name);  | 
 | 95 | + | 
 | 96 | +	@LogMessage(level = WARN)  | 
 | 97 | +	@Message(  | 
 | 98 | +			id = 160131,  | 
 | 99 | +			value = """  | 
 | 100 | +					@Convert annotation applied to Map attribute [%s] did not explicitly specify\  | 
 | 101 | +					'attributeName="key" or 'attributeName="value"' as required by spec;\  | 
 | 102 | +					attempting to infer whether converter applies to key or value"""  | 
 | 103 | +	)  | 
 | 104 | +	void nonCompliantMapConversion(String collectionRole);  | 
 | 105 | + | 
 | 106 | +	@LogMessage(level = WARN)  | 
 | 107 | +	@Message(  | 
 | 108 | +			id = 160133,  | 
 | 109 | +			value = """  | 
 | 110 | +					'%1$s.%2$s' uses both @NotFound and FetchType.LAZY;\  | 
 | 111 | +					@ManyToOne and @OneToOne associations mapped with @NotFound are forced to EAGER fetching""")  | 
 | 112 | +	void ignoreNotFoundWithFetchTypeLazy(String entity, String association);  | 
 | 113 | + | 
 | 114 | +	// --- New typed TRACE/DEBUG messages for boot internals ---  | 
 | 115 | +	@LogMessage(level = TRACE)  | 
 | 116 | +	@Message(id = 160140, value = "Binding formula: %s")  | 
 | 117 | +	void bindingFormula(String formula);  | 
 | 118 | + | 
 | 119 | +	@LogMessage(level = TRACE)  | 
 | 120 | +	@Message(id = 160141, value = "Binding column: %s")  | 
 | 121 | +	void bindingColumn(String column);  | 
 | 122 | + | 
 | 123 | +	@LogMessage(level = TRACE)  | 
 | 124 | +	@Message(id = 160142, value = "Column mapping overridden for property: %s")  | 
 | 125 | +	void columnMappingOverridden(String propertyName);  | 
 | 126 | + | 
 | 127 | +	@LogMessage(level = TRACE)  | 
 | 128 | +	@Message(id = 160143, value = "Could not perform @ColumnDefault lookup as 'PropertyData' did not give access to XProperty")  | 
 | 129 | +	void couldNotPerformColumnDefaultLookup();  | 
 | 130 | + | 
 | 131 | +	@LogMessage(level = TRACE)  | 
 | 132 | +	@Message(id = 160144, value = "Could not perform @GeneratedColumn lookup as 'PropertyData' did not give access to XProperty")  | 
 | 133 | +	void couldNotPerformGeneratedColumnLookup();  | 
 | 134 | + | 
 | 135 | +	@LogMessage(level = TRACE)  | 
 | 136 | +	@Message(id = 160145, value = "Could not perform @Check lookup as 'PropertyData' did not give access to XProperty")  | 
 | 137 | +	void couldNotPerformCheckLookup();  | 
 | 138 | + | 
 | 139 | +	@LogMessage(level = TRACE)  | 
 | 140 | +	@Message(id = 160146, value = "Binding embeddable with path: %s")  | 
 | 141 | +	void bindingEmbeddable(String path);  | 
 | 142 | + | 
 | 143 | +	@LogMessage(level = TRACE)  | 
 | 144 | +	@Message(id = 160147, value = "Binding filter definition: %s")  | 
 | 145 | +	void bindingFilterDefinition(String name);  | 
 | 146 | + | 
 | 147 | +	@LogMessage(level = TRACE)  | 
 | 148 | +	@Message(id = 160148, value = "Second pass for collection: %s")  | 
 | 149 | +	void secondPassForCollection(String role);  | 
 | 150 | + | 
 | 151 | +	@LogMessage(level = TRACE)  | 
 | 152 | +	@Message(id = 160149, value = "Binding collection role: %s")  | 
 | 153 | +	void bindingCollectionRole(String role);  | 
 | 154 | + | 
 | 155 | +	@LogMessage(level = TRACE)  | 
 | 156 | +	@Message(id = 160150, value = "Binding one-to-many association through foreign key: %s")  | 
 | 157 | +	void bindingOneToManyThroughForeignKey(String role);  | 
 | 158 | + | 
 | 159 | +	@LogMessage(level = TRACE)  | 
 | 160 | +	@Message(id = 160151, value = "Binding one-to-many association through association table: %s")  | 
 | 161 | +	void bindingOneToManyThroughAssociationTable(String role);  | 
 | 162 | + | 
 | 163 | +	@LogMessage(level = TRACE)  | 
 | 164 | +	@Message(id = 160152, value = "Binding many-to-many association through association table: %s")  | 
 | 165 | +	void bindingManyToManyThroughAssociationTable(String role);  | 
 | 166 | + | 
 | 167 | +	@LogMessage(level = TRACE)  | 
 | 168 | +	@Message(id = 160153, value = "Binding many-to-any: %s")  | 
 | 169 | +	void bindingManyToAny(String role);  | 
 | 170 | + | 
 | 171 | +	@LogMessage(level = TRACE)  | 
 | 172 | +	@Message(id = 160154, value = "Binding element collection to collection table: %s")  | 
 | 173 | +	void bindingElementCollectionToCollectionTable(String role);  | 
 | 174 | + | 
 | 175 | +	@LogMessage(level = TRACE)  | 
 | 176 | +	@Message(id = 160155, value = "Import: %s -> %s")  | 
 | 177 | +	void importEntry(String importName, String className);  | 
 | 178 | + | 
 | 179 | +	@LogMessage(level = TRACE)  | 
 | 180 | +	@Message(id = 160156, value = "Processing association property references")  | 
 | 181 | +	void processingAssociationPropertyReferences();  | 
 | 182 | + | 
 | 183 | +	@LogMessage(level = TRACE)  | 
 | 184 | +	@Message(id = 160157, value = "Mapping class: %s -> %s")  | 
 | 185 | +	void mappingClassToTable(String entityName, String tableName);  | 
 | 186 | + | 
 | 187 | +	@LogMessage(level = TRACE)  | 
 | 188 | +	@Message(id = 160158, value = "Mapping joined-subclass: %s -> %s")  | 
 | 189 | +	void mappingJoinedSubclassToTable(String entityName, String tableName);  | 
 | 190 | + | 
 | 191 | +	@LogMessage(level = TRACE)  | 
 | 192 | +	@Message(id = 160159, value = "Mapping union-subclass: %s -> %s")  | 
 | 193 | +	void mappingUnionSubclassToTable(String entityName, String tableName);  | 
 | 194 | + | 
 | 195 | +	@LogMessage(level = TRACE)  | 
 | 196 | +	@Message(id = 160160, value = "Mapped property: %s -> [%s]")  | 
 | 197 | +	void mappedProperty(String propertyName, String columns);  | 
 | 198 | + | 
 | 199 | +	@LogMessage(level = TRACE)  | 
 | 200 | +	@Message(id = 160161, value = "Binding dynamic component [%s]")  | 
 | 201 | +	void bindingDynamicComponent(String role);  | 
 | 202 | + | 
 | 203 | +	@LogMessage(level = TRACE)  | 
 | 204 | +	@Message(id = 160162, value = "Binding virtual component [%s] to owner class [%s]")  | 
 | 205 | +	void bindingVirtualComponentToOwner(String role, String ownerClassName);  | 
 | 206 | + | 
 | 207 | +	@LogMessage(level = TRACE)  | 
 | 208 | +	@Message(id = 160163, value = "Binding virtual component [%s] as dynamic")  | 
 | 209 | +	void bindingVirtualComponentAsDynamic(String role);  | 
 | 210 | + | 
 | 211 | +	@LogMessage(level = TRACE)  | 
 | 212 | +	@Message(id = 160164, value = "Binding component [%s]")  | 
 | 213 | +	void bindingComponent(String role);  | 
 | 214 | + | 
 | 215 | +	@LogMessage(level = TRACE)  | 
 | 216 | +	@Message(id = 160165, value = "Attempting to determine component class by reflection %s")  | 
 | 217 | +	void attemptingToDetermineComponentClassByReflection(String role);  | 
 | 218 | + | 
 | 219 | +	@LogMessage(level = TRACE)  | 
 | 220 | +	@Message(id = 160166, value = "Mapped collection: %s")  | 
 | 221 | +	void mappedCollection(String role);  | 
 | 222 | + | 
 | 223 | +	@LogMessage(level = TRACE)  | 
 | 224 | +	@Message(id = 160167, value = "Mapping collection: %s -> %s")  | 
 | 225 | +	void mappingCollectionToTable(String role, String tableName);  | 
 | 226 | + | 
 | 227 | +	@LogMessage(level = TRACE)  | 
 | 228 | +	@Message(id = 160168, value = "Binding natural id UniqueKey for entity: %s")  | 
 | 229 | +	void bindingNaturalIdUniqueKey(String entityName);  | 
 | 230 | + | 
 | 231 | +	@LogMessage(level = TRACE)  | 
 | 232 | +	@Message(id = 160169, value = "Binding named query '%s' to [%s]")  | 
 | 233 | +	void bindingNamedQuery(String queryName, String bindingTarget);  | 
 | 234 | + | 
 | 235 | +	@LogMessage(level = TRACE)  | 
 | 236 | +	@Message(id = 160170, value = "Binding named native query '%s' to [%s]")  | 
 | 237 | +	void bindingNamedNativeQuery(String queryName, String bindingTarget);  | 
 | 238 | + | 
 | 239 | +	@LogMessage(level = TRACE)  | 
 | 240 | +	@Message(id = 160171, value = "Binding SQL result set mapping '%s' to [%s]")  | 
 | 241 | +	void bindingSqlResultSetMapping(String name, String target);  | 
 | 242 | + | 
 | 243 | +	@LogMessage(level = TRACE)  | 
 | 244 | +	@Message(id = 160172, value = "Bound named stored procedure query: %s => %s")  | 
 | 245 | +	void boundStoredProcedureQuery(String name, String procedure);  | 
 | 246 | + | 
 | 247 | +	@LogMessage(level = TRACE)  | 
 | 248 | +	@Message(id = 160173, value = "Adding global sequence generator with name: %s")  | 
 | 249 | +	void addingGlobalSequenceGenerator(String name);  | 
 | 250 | + | 
 | 251 | +	@LogMessage(level = TRACE)  | 
 | 252 | +	@Message(id = 160174, value = "Adding global table generator with name: %s")  | 
 | 253 | +	void addingGlobalTableGenerator(String name);  | 
 | 254 | + | 
 | 255 | +	@LogMessage(level = TRACE)  | 
 | 256 | +	@Message(id = 160175, value = "Binding entity with annotated class: %s")  | 
 | 257 | +	void bindingEntityWithAnnotatedClass(String className);  | 
 | 258 | + | 
 | 259 | +	@LogMessage(level = DEBUG)  | 
 | 260 | +	@Message(id = 160176, value = "Import name [%s] overrode previous [{%s}]")  | 
 | 261 | +	void importOverrodePrevious(String importName, String previous);  | 
 | 262 | + | 
 | 263 | +	@LogMessage(level = TRACE)  | 
 | 264 | +	@Message(id = 160177, value = "%s")  | 
 | 265 | +	void mappedCollectionDetails(String details);  | 
 | 266 | + | 
 | 267 | +	@LogMessage(level = TRACE)  | 
 | 268 | +	@Message(id = 160178, value = "Mapping entity secondary table: %s -> %s")  | 
 | 269 | +	void mappingEntitySecondaryTableToTable(String entityName, String tableName);  | 
 | 270 | + | 
 | 271 | +	@LogMessage(level = TRACE)  | 
 | 272 | +	@Message(id = 160179, value = "Writing cache file for: %s to: %s")  | 
 | 273 | +	void writingCacheFile(String xmlPath, String serPath);  | 
 | 274 | + | 
 | 275 | +	@LogMessage(level = DEBUG)  | 
 | 276 | +	@Message(id = 160180, value = "Unexpected ServiceRegistry type [%s] encountered during building of MetadataSources; may cause problems later attempting to construct MetadataBuilder")  | 
 | 277 | +	void unexpectedServiceRegistryType(String registryType);  | 
 | 278 | + | 
 | 279 | +	@LogMessage(level = TRACE)  | 
 | 280 | +	@Message(id = 160181, value = "Created database namespace [logicalName=%s, physicalName=%s]")  | 
 | 281 | +	void createdDatabaseNamespace(Namespace.Name logicalName, Namespace.Name physicalName);  | 
 | 282 | + | 
 | 283 | +	@LogMessage(level = DEBUG)  | 
 | 284 | +	@Message(id = 160182, value = "Could load component class [%s]")  | 
 | 285 | +	void couldLoadComponentClass(String className, @Cause Throwable ex);  | 
 | 286 | + | 
 | 287 | +	@LogMessage(level = DEBUG)  | 
 | 288 | +	@Message(id = 160183, value = "Unable to load explicit any-discriminator type name as Java Class - %s")  | 
 | 289 | +	void unableToLoadExplicitAnyDiscriminatorType(String typeName);  | 
 | 290 | + | 
 | 291 | +	@LogMessage(level = DEBUG)  | 
 | 292 | +	@Message(id = 160184, value = "Ignoring exception thrown when trying to build IdentifierGenerator as part of Metadata building")  | 
 | 293 | +	void ignoringExceptionBuildingIdentifierGenerator(@Cause Throwable ex);  | 
 | 294 | + | 
 | 295 | +	@LogMessage(level = TRACE)  | 
 | 296 | +	@Message(id = 160185, value = "Binding component [%s] to explicitly specified class [%s]")  | 
 | 297 | +	void bindingComponentToExplicitClass(String role, String className);  | 
 | 298 | + | 
 | 299 | +	@LogMessage(level = DEBUG)  | 
 | 300 | +	@Message(id = 160186, value = "Unable to determine component class name via reflection, and explicit class name not given; role=[%s]")  | 
 | 301 | +	void unableToDetermineComponentClassByReflection(String role);  | 
 | 302 | + | 
 | 303 | +	@LogMessage(level = DEBUG)  | 
 | 304 | +	@Message(id = 160187, value = "Replacing Table registration(%s) : %s -> %s")  | 
 | 305 | +	void replacingTableRegistration(String logicalName, String previous, String table);  | 
 | 306 | + | 
 | 307 | +	@LogMessage(level = DEBUG)  | 
 | 308 | +	@Message(id = 160188, value = "Ignoring %s XML mappings due to '%s'")  | 
 | 309 | +	void ignoringXmlMappings(int count, String setting);  | 
 | 310 | + | 
 | 311 | +	@LogMessage(level = WARN)  | 
 | 312 | +	@Message(id = 160189, value = "Duplicate fetch profile name '%s'")  | 
 | 313 | +	void duplicatedFetchProfile(String name);  | 
 | 314 | + | 
 | 315 | +	// EntityBinder discriminator handling  | 
 | 316 | +	@LogMessage(level = TRACE)  | 
 | 317 | +	@Message(id = 160190, value = "Ignoring explicit @DiscriminatorColumn annotation on: %s")  | 
 | 318 | +	void ignoringExplicitDiscriminatorForJoined(String className);  | 
 | 319 | + | 
 | 320 | +	@LogMessage(level = TRACE)  | 
 | 321 | +	@Message(id = 160191, value = "Inferring implicit @DiscriminatorColumn using defaults for: %s")  | 
 | 322 | +	void inferringImplicitDiscriminatorForJoined(String className);  | 
 | 323 | + | 
 | 324 | +	// GeneratorBinder additions  | 
 | 325 | +	@LogMessage(level = TRACE)  | 
 | 326 | +	@Message(id = 160192, value = "Added generator with name: %s, strategy: %s")  | 
 | 327 | +	void addedGenerator(String name, String strategy);  | 
 | 328 | + | 
 | 329 | +	@LogMessage(level = TRACE)  | 
 | 330 | +	@Message(id = 160193, value = "Added sequence generator with name: %s")  | 
 | 331 | +	void addedSequenceGenerator(String name);  | 
 | 332 | + | 
 | 333 | +	@LogMessage(level = TRACE)  | 
 | 334 | +	@Message(id = 160194, value = "Added table generator with name: %s")  | 
 | 335 | +	void addedTableGenerator(String name);  | 
 | 336 | + | 
 | 337 | +	@LogMessage(level = DEBUG)  | 
 | 338 | +	@Message(id = 160195,  | 
 | 339 | +			value = """  | 
 | 340 | +					ServiceRegistry passed to MetadataBuilder was a BootstrapServiceRegistry; \  | 
 | 341 | +					this likely won't end well if attempt is made to build SessionFactory""")  | 
 | 342 | +	void badServiceRegistry();  | 
24 | 343 | }  | 
0 commit comments