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

  • Hibernate Properties as JMX

    Hello,

    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">
    <list>
    <value>at/sozvers/seucc/book/bo/BookBO.hbm.xml</value>
    <value>at/sozvers/seucc/book/bo/AuthorBO.hbm.xml</value>
    <value>at/sozvers/seucc/book/bo/BookAuthorBO.hbm.xml</value>
    </list>
    </property>
    </bean>

    <!-- The Hibernate Properties -->
    <bean id="sessionFactory" parent="abstractSessionFactory">
    <property name="hibernateProperties">
    <props>
    <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>
    </props>
    </property>
    </bean>

    <!-- exposed as JMX -->
    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <entry key="at.sozvers.seucc.book:Name=hibernatePropertie s">
    <ref bean="sessionFactory"/>
    </entry>
    </map>
    </property>
    <property name="autodetect">
    <value>true</value>
    </property>
    </bean>

    Thx
    Rene

  • #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.

    Comment

    Working...
    X