-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Frank Pavageau opened SPR-7742 and commented
In AnnotationSessionFactoryBean.scanPackages(), the classes seem to be added to the AnnotationConfiguration in no particular order. This is bad because of https://forum.hibernate.org/viewtopic.php?f=1&t=982072&start=0 : the columns' aliases generated in the SQL queries depend on the order of creation of the org.hibernate.mapping.Tables (through the uniqueIndex field initialized in sequence from a static int), which itself depends on the order of insertion of the classes.
Multiple JVMs running the same application and accessing the same database can then produce equivalent SQL queries using different columns' aliases, preventing the DBMS from properly caching (more hard parsing in Oracle, for example) or a distributed query cache from being shared.
I'd suggest storing the scanned classes in a temporary list and sorting it using the FQCN before adding its content to the AnnotationConfiguration, for consistent, reproducible results.
Affects: 3.0.5
Referenced from: commits 9281649
1 votes, 3 watchers