Hi all,
I am new to Hibernate and was wondering what best practice would be to create the Sessionfactory inside a J2EE project. After some reading and research on the net I saw that it is expensive to create the SessionFactory (makes sense to me).
The question is, how to create it only once and then look it up by the other J2EE modules?
What I read all the time is to use an MBean. I cannot find any docs on how to create one on WAS 6.1? Is that the right way to do it?
Hibernate version: 3.2.5
my hibernate.cfg.xml so far:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="session_factory_name"> java:hibernate/MySessionFactory </property>
<property name="transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>
<property name="connection.datasource"> jdbc/MyJavaDatasource </property>
<property name="dialect"> org.hibernate.dialect.Oracle9Dialect </property>
<property name="show_sql">true</property>
<mapping resource="....hbm.xml" />
</session-factory>
</hibernate-configuration>
How can I create an MBean and access my hibernate SessionFactory from other modules (JNDI)?
Thanks a lot in advance,
Titan3025