Announcement Announcement Module
Collapse
No announcement yet.
LocalSessionFactoryBean's setConfigurationClass() method Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LocalSessionFactoryBean's setConfigurationClass() method

    I typically got bean definitions of my domain objects in my application contexts. Hence I use Hibernate3 in a Tiger environment I utilized a BeanPostProcessor for the registration of Entity annotated beans (= my persistent domain objects) at the AnnotationConfiguration singleton.

    Being forced to subclass the LocalSessionFactoryBean (which is sadly unable to BeanPostProcess the domain objects by itself due to the BeanFactory != BeanPostProcessor restriction) to use my AnnotationConfiguration I was wondering: why exactly is there no setter for a Hibernate Configuration object in the LocalSessionFactoryBean?

  • #2
    I wasn't the designer of the class , but I assume since the Configuration is created based on the various properties of the Bean and the sessionFactory
    is imutable once it's created - the configuration it's also imutable.
    However, if you look through the javadoc and the sources you'll see that you have a hook for post-processing the configuration object:
    postProcessConfiguration(config);

    Comment


    • #3
      Originally posted by costin
      I assume since the Configuration is created based on the various properties of the Bean and the sessionFactory is imutable once it's created - the configuration it's also imutable.
      This might very well be the case. I think an explicit initializer method would have been a good alternative.

      Originally posted by costin
      However, if you look through the javadoc and the sources you'll see that you have a hook for post-processing the configuration object:
      postProcessConfiguration(config);
      Yes, I'm aware of that. That's what I'm currently doing (subclassing the darn thing) - I was merely wondering why the design decision was made.

      Comment

      Working...
      X