Hi,
Quote:
...it seems Configuration knows about these mappings
Yes, you are absolutely right.
Quote:
...Configuration does not seem to be accessible for me.
This is the case if you are using Spring, since Spring internally creates the
Configuration object and then calls the
buildSessionFactory() method on it to create the SessionFactory.
Quote:
Configuration is intended as a configuration-time object, to be discarded once a SessionFactory is built." -- that means I shouln't access it anyway?
No, it is perfectly valid to use it. What the doc means to say is that the
Configuration object is consulted once *and only once* by Hibernate, viz. while building the SessionFactory. In fact, it is not even referenced by any of the Hibernate classes. This is also the problem, as far as your requirement is concerned. You can't get a handle to the configuration through
SessionFactory or any other Hibernate class, for that sake.
However, assuming that you are using Spring, there is a way out - the
org.springframework.orm.hibernate3.LocalSessionFactoryBean class that you use for configuring Hibernate thru Spring, actually exposes a getter method for the
Configuration object.