[hibernate-dev] Accessing metadata when SF is build the legacy way
Koen Serneels
ks at error.be
Wed Nov 18 05:20:52 EST 2015
Hi. I'm digging up an older question
(https://www.mail-archive.com/hibernate-dev@lists.jboss.org/msg12872.html)I
asked about modifying mapping metadata in H5. In short; I want to change the
mutability flag of mappings programmatically.
Using H4 there was a method called "getClassMappings" on
org.hibernate.cfg.Configuration. This method no longer exist in H5.
>From the previous answers/docu I understand that when using the new way of
building the SF one can interact with the metadata after building it using
the MetadataBuilder (but before building the SF) this would solve my
problem as I would be able to access the metadata at that point and change
the behavior.
Unfortunately, when using H5 through Spring4, the SF is built as what the
manual describes the "legacy way"; Spring's LocalSessionFactoryBean uses
Spring's LocalSessionFactoryBuilder which on its turn extends
org.hibernate.cfg.Configuration and calls org.hibernate.cfg.Configuration
#buildSessionFactory to build the SF.
Both metadata and sessionfactory are build in that single method leaving no
hook to modify the metadata.
At this point I don't see a normal/clean way in accessing the metadata
before the SF is build using the legacy way. So, am I missing something? Is
there maybe another way to access the metadata?
Thanks
Koen
More information about the hibernate-dev
mailing list