Announcement Announcement Module
Collapse
No announcement yet.
Specifying the hibernate.properties file in applicationConte Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Specifying the hibernate.properties file in applicationConte

    Hi,

    We have an ant task that generates a number of hibernate.properties file. How do I tell the Spring application context which file to use? I know I can do it manually in the "hibernateProperties" property section but I would rather tell Spring to use my generated file.

    Is this possible?

    Thanks,

    L

  • #2
    You can use a PropertiesFactoryBean to read-in the properties from your file and configure your LocalSessionFactoryBean:
    Code:
      <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
        <property name="hibernateProperties">
          <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
            <property name="location">path-to-properties-file</property>
          </bean>
        </property>
        ...
      </bean>
    HTH

    Comment

    Working...
    X