org.openmrs.api.db.hibernate
Class HibernateUtil

java.lang.Object
  extended by org.openmrs.api.db.hibernate.HibernateUtil

public class HibernateUtil
extends java.lang.Object

This class holds common methods and utilities that are used across the hibernate related classes


Constructor Summary
HibernateUtil()
           
 
Method Summary
static java.lang.String escapeSqlWildcards(java.lang.String oldString, java.sql.Connection connection)
          Escapes all sql wildcards in the given string, returns the same string if it doesn't contain any sql wildcards
static java.lang.String escapeSqlWildcards(java.lang.String oldString, org.hibernate.SessionFactory sessionFactory)
           
static org.hibernate.dialect.Dialect getDialect(org.hibernate.SessionFactory sessionFactory)
          Fetch the current Dialect of the given SessionFactory
static boolean isHSQLDialect(org.hibernate.SessionFactory sessionFactory)
          Check and cache whether the currect dialect is HSQL or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtil

public HibernateUtil()
Method Detail

isHSQLDialect

public static boolean isHSQLDialect(org.hibernate.SessionFactory sessionFactory)
Check and cache whether the currect dialect is HSQL or not. This is needed because some queries are different if in the hsql world as opposed to the mysql/postgres world

Parameters:
sessionFactory -
Returns:
true/false whether we're in hsql right now or not

getDialect

public static org.hibernate.dialect.Dialect getDialect(org.hibernate.SessionFactory sessionFactory)
Fetch the current Dialect of the given SessionFactory

Parameters:
sessionFactory - SessionFactory to pull the dialect from
Returns:
Dialect of sql that this connection/session is using

escapeSqlWildcards

public static java.lang.String escapeSqlWildcards(java.lang.String oldString,
                                                  org.hibernate.SessionFactory sessionFactory)
See Also:
escapeSqlWildcards(String, Connection)

escapeSqlWildcards

public static java.lang.String escapeSqlWildcards(java.lang.String oldString,
                                                  java.sql.Connection connection)
Escapes all sql wildcards in the given string, returns the same string if it doesn't contain any sql wildcards

Parameters:
oldString - the string in which to escape the sql wildcards
connection - The underlying database connection
Returns:
the string with sql wildcards escaped if any found otherwise the original string is returned

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change