Hi,
I'm using JBoss 4.0.5 and hibernate 3.1 and integrate Hibernate with the Hibernate MBean and deployed it with a har file. So far everything works fine, but I have to support different timebases with different Dialects, all using the same database scheme. I've searched the forum but I haven't found an example how to configure the Hibernate MBean at runtime. Here is my code:
the hibernate-service.xml:
<server> <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate"> <attribute name="DatasourceName">java:/db1</attribute> <attribute name="Dialect">org.hibernate.dialect.SQLServerDialect</attribute> <attribute name="SessionFactoryName">hibernate/SessionFactory</attribute> <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute> <attribute name="ShowSqlEnabled">true</attribute> </mbean> </server>
InitialContext context = new InitialContext(); sessionFactory = (SessionFactory) context .lookup("hibernate/SessionFactory");