Announcement Announcement Module
No announcement yet.
Hibernate Properties as JMX Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate Properties as JMX


    I'm trying to expose the Hibernate Properties as an JMX Bean. The idea is, that I can manage the Properties after deployment (e.g. enable/disable hibernate.show_sql for problem analysis on the integration/production machine).

    I did not find out how to configure the bean propertly to see the Properties. I tried the following. How can I configure the context to be able to change the Properties in JMX?

    My try:
    <bean id="abstractSessionFactory" abstract="true" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource"><ref local="dataSource"/></property>
    <property name="mappingResources">

    <!-- The Hibernate Properties -->
    <bean id="sessionFactory" parent="abstractSessionFactory">
    <property name="hibernateProperties">
    <prop key="hibernate.dialect">org.hibernate.dialect.Post greSQLDialect</prop>
    <prop key="hibernate.jdbc.batch_size">0</prop>
    <prop key="hibernate.jdbc.use_streams_for_binary">true</prop>
    <prop key="hibernate.show_sql">true</prop>

    <!-- exposed as JMX -->
    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <entry key=" s">
    <ref bean="sessionFactory"/>
    <property name="autodetect">


  • #2
    I haven't investigated (yet) the problem but there are several aspects of which you have to be aware:
    1. the sessionFactories are immutable. While I assume that you can change some small details, most of the properties will be ignored afterwards.
    2. JBoss has some nice integration with Hibernate - in case you fail to succesed in configuring the configuration you can take a look at their software (especially the jmx console) and see what they offer. AFAIK most of the properties were read-only.
    3. Hibernate can expose JMX properties - see what that offers. It's a lot statistical information but nevertheless can provide some lead.