[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - How to dynamically configure different databases and dialect

kathrinRocketman do-not-reply at jboss.com
Fri Sep 26 08:18:00 EDT 2008


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>
  | 

Getting the session factory:


  | 	InitialContext context = new InitialContext();
  | 	sessionFactory = (SessionFactory) context
  | 					.lookup("hibernate/SessionFactory");
  | 

Can anyone provide an example how to configure the MBean before creating the session factory?

Thanks

Katrin

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179053#4179053

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4179053



More information about the jboss-user mailing list