A way to programmatically switch the dialect?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

A way to programmatically switch the dialect?

jmeyer09
This post was updated on .
Hi,

   I am working on a program that I'd like to have the ability to have both
a PostgreSQL and Oracle session and I'd like to know if there is a way to
programmatically switch the dialect when the sessions are created?  (I am
using hibernate spatial 1.0)  It seems that only the default dialect specified in the hibernate-spatial.cfg.xml file continues to be used.

   The session code is below...
 /***********************************************************
*******************

*-- Method: getSessionFactory

*-- Purpose: Gets database session factory

*-- Developer: Jim Meyer

*-- Create Date: 2015-01-13

*-- Last Modified:

*******************************************************************************/

*private* SessionFactory getSessionFactory() *throws* Exception {

*    if* (sessionFactory == *null*) {

         sessionFactory = *new* Configuration().configure(
"hibernate.cfg.xml").buildSessionFactory();

    }

*    return* sessionFactory;

}
// end getSessionFactory()


/******************************************************************************

*-- Method: getOracleSessionFactory

*-- Purpose: Gets the Oracle database session factory

*-- Developer: Jim Meyer

*-- Create Date: 2015-03-03

*-- Last Modified:

*******************************************************************************/

*private* SessionFactory getOracleSessionFactory() *throws* Exception {

*    if* (sessionFactoryOra == *null*) {

        sessionFactoryOra =*new* Configuration().configure(
"orahibernate.cfg.xml").buildSessionFactory();

    }

*    return* sessionFactoryOra;

}
// end getSessionFactory()



Thanks,
Jim Meyer, PMP, ACP
AIM-SAA Program Manager
ConceptSolutions, LLC
We Make Business Intelligent
(703) 889.8434 (desk)

*www.Concept-Solutions.com* <http://www.concept-solutions.com/>

This message contains privileged and/or confidential Information. You may
not share or use this information without the express written consent of
Concept Solutions, LLC. If you are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you
may not use, copy, or deliver this message in any way, shape, or form.
Please destroy this message and kindly notify the sender by reply email.
Please advise immediately if you or your employer does not consent to
Internet email for messages of this kind. Opinions, conclusions, and/or
other information in this message that do not relate to the official
business of Concept Solutions, LLC shall be understood as neither given nor
endorsed by it.

--


www.concept-solutions.com

An Equal Opportunity Employer


CONFIDENTIALITY NOTICE: The information and/or documents contained in this
transmission may contain confidential or proprietary information. The
information is solely for the use of the addressee named above. If you are
not the intended recipient, you are hereby notified that any disclosure,
copying, distribution, any action in reliance or other use of the contents
of this transmission is strictly prohibited

_______________________________________________
hibernatespatial-users mailing list
hibernatespatial-users@lists.hibernatespatial.org
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users