-->
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.  [ 3 posts ] 
Author Message
 Post subject: Need help creating session factory
PostPosted: Tue Jul 24, 2007 5:24 am 
Newbie

Joined: Thu Jul 12, 2007 1:13 am
Posts: 17
Please help me in creating and using session factory so that I can use it to link to all the mapping resource file . any helpful link or suggestion will be appreciated.

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 5:11 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
It is unclear what you mean by "use it to link to all the mapping resource files," but I'm assuming that what you want is to be able to get at the mapping metadata that is stored in said files. In which case, you should use the Configuration object. For projects where I need this, I keep a singleton reference to the Configuration alongside the one to the SessionFactory.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 11:41 pm 
Newbie

Joined: Thu Jul 12, 2007 1:13 am
Posts: 17
Yaa I need to know how to implement this singleton pattern.See I have to migrate From Hibernate to NHibernate so in Hbernate project they are using a session factory just like shown below.
Code:
<hibernate-configuration>

    <session-factory>
      <!--
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@171.186.252.121:1527:SBCD</property>
        <property name="hibernate.connection.username">appl_sbcs</property>
        <property name="hibernate.connection.password">sbcsg2</property>
        -->
     
     

   <property name="connection.datasource">sbcsdatasource</property>
   
   <!-- <property name="connection.datasource">sbcsr2datasource</property> -->
   
   <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
   <property name="jta.UserTransaction">java:comp/UserTransaction</property>
   <property name="hibernate.jndi.class">weblogic.jndi.WLInitialContextFactory</property>

   
   
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
        <property name="hibernate.show_sql">false</property>
        <property name="use_outer_join">true</property>
        <property name="transaction.factory_class">
               org.hibernate.transaction.JDBCTransactionFactory
        </property>

       <!-- mapping file for customerinfo view-->
       <mapping resource="customerInfo.hbm.xml"/>
       <!--mapping file for affiliate associated with customers-->
       <mapping resource="Affiliate.hbm.xml"/>
       <!--mapping file for guarantor sassociated with customers-->
       <mapping resource="Guarantor.hbm.xml"/>
       <!--mapping file for loaninfo view -->
       <mapping resource="LoanInfoView.hbm.xml"/>


so Need to implement session factory in NHibernate so that I just have to Load this hbm.xml file and not hte other files...


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

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.