[hibernate-dev] Usage of static fields throughout Hibernate Core
Vlad Mihalcea
mihalcea.vlad at gmail.com
Thu Apr 28 04:58:28 EDT 2016
Hi,
While reviewing this PR:
https://github.com/hibernate/hibernate-orm/pull/1198/files
I realized that we have some static fields which might cause some problems
when we deploy two or more SessionFactories in the same container (e.g.
Spring).
The fix suggests that we should use synchronised, as indicated by Sonar,
but I think we should avoid the static fields altogether.
Every instance variable must be confined to an object that's confined to
the same SessionFactory root object.
Without static fields, we can make sure that nothing escapes a given
SessionFactory.
Let me know what you think.
Vlad
More information about the hibernate-dev
mailing list