org.hibernate.cfg.Environment defines 3 static (and therefore ClassLoader-scoped) settings, meaning that these settings cannot be varied per-SessionFactory if they share the same ClassLoader:
- #useStreamsForBinary
- #useReflectionOptimizer
- #getBytecodeProvider
Ultimately these should all be moved to SessionFactoryOptions / SessionFactoryBuilder. Actually, for #useReflectionOptimizer and #getBytecodeProvider we may have to initially move them to MetadataBuildingOptions as they are used during the building of the Metadata object - that would be a transitory movement though until we can fix the Metadata building process to not require access to them. Note that simple "deprecate now, but implement the proper way" approach will not work here as the Environment methods would potentially return incorrect information. |