-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How do I initialize SessionFactory in Websphere 6.1 once?
PostPosted: Mon Feb 11, 2008 4:40 am 
Newbie

Joined: Mon Feb 11, 2008 4:31 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.