HibernateConnector
@Deprecated public class HibernateConnector extends SQLConnector implements HibernateConnectable
Konfiguracja konektora hibernate'a.
Są dwa sposoby konfiguracji konektora Hibernate:
<connector name="hibernate" url="jdbc:postgresql://localhost:5432/dbname" class="HibernateConnector"> <mappingMethod>annotation</mappingMethod> <configFile>/opt/jpalio/instances/lechpol_hibernate.cfg.xml</configFile> <user>db_user</user> <password>db_password</password> <driver>org.postgresql.Driver</driver> <hibernateLoggerLevel>ERROR</hibernateLoggerLevel> <mapClasses> lechpol.model.Address; lechpol.model.BankAccount; lechpol.model.Client; lechpol.model.Config; lechpol.model.Department; lechpol.model.Employee; lechpol.model.Material; lechpol.model.MaterialGroup; lechpol.model.MaterialStorage; lechpol.model.Model </mapClasses> </connector>
<?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> <!-- Database connection settings --> <property name="connection.driver_class">org.postgresql.Driver</property> <property name="connection.url">jdbc:postgresql://localhost:5432/dbname</property> <property name="connection.username">db_user</property> <property name="connection.password">db_password</property> <!-- Use the C3P0 connection pool. --> <property name="c3p0.min_size">3</property> <property name="c3p0.max_size">10</property> <property name="c3p0.timeout">1800</property> <!-- Disable second-level cache. --> <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <property name="cache.use_query_cache">false</property> <property name="cache.use_minimal_puts">false</property> <property name="max_fetch_depth">3</property> <!-- JDBC connection pool (use the built-in) --> <!-- <property name="connection.pool_size">1</property> --> <!-- SQL dialect --> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> <!-- Enable Hibernate's automatic session context management --> <!-- Bind the getCurrentSession() method to the thread. --> <property name="current_session_context_class">thread</property> <!-- <property name="hibernate.show_sql">true</property> --> <property name="hibernate.hbm2ddl.auto">update</property> </session-factory> </hibernate-configuration>
SQLConnector.Chars
SQLConnectable.QueryReader
Modifier and Type | Field and Description |
---|---|
static java.util.Map<Instance,org.apache.log4j.Logger> |
loggers
Deprecated.
Mapa instancji logera Hibernate.
|
actionStart, columnLabelingOverride, driver, enableScroll, initSQL, localResultSet, localResultSetMetaData, preparedStatementCacheSize, refreshSQL, unscaledAsLong
allConnections, askingBusy, askingDedicated, debug, freeList, maxConnections, maxInactivity, maxLifeTime, maxUseCount
cluster, connectorClass, instance, name, properties, refreshInterval, scheduler, sharedConfiguration, url
Constructor and Description |
---|
HibernateConnector(java.lang.String url,
java.util.Properties properties)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static org.hibernate.Session |
getCurrentSession()
Deprecated.
Zwraca aktualną sesję połączenia, jeżeli jest skonfigurowane.
|
java.lang.Long |
getSequence(java.lang.String sequenceName)
Deprecated.
|
org.hibernate.Session |
getSession()
Deprecated.
Zwraca sesję połączenia z bazą danych.
|
org.hibernate.Session |
getSession(org.hibernate.EntityMode entityMode)
Deprecated.
|
org.hibernate.SessionFactory |
getSessionFactory()
Deprecated.
|
int |
getType()
Deprecated.
|
void |
init()
Deprecated.
|
static org.hibernate.Session |
openSession()
Deprecated.
|
void |
putSession(org.hibernate.Session session)
Deprecated.
|
protected void |
refreshConnection()
Deprecated.
Nawiązuje połączenie, jeżeli jest ono zamknięte.
|
commit, debugInit, debugSave, dedicatedCommit, dedicatedRollback, dedicatedStart, dedicatedStop, executeFunction, executePL_SQL, executeProcedure, executeSql, fastRead, getConnectorTypes, getInfo, getMetaData, getOutTypeParamForClass, getResultSet, getResultSetMetaData, info, info, isNoTransaction, isTransaction, needWriteLob, newConnection, newConnectionInit, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, readAsMaps, readAsMaps, readAsMaps, readAsMaps, readAsMaps, readAsMaps, readAsMaps, readLine, readLine, readLine, readLine, readLineAsMap, readLineAsMap, readLineAsMap, refreshConnection, resolveDataValue, resolveJavaType, rollback, setFetchSize, transactionStart, transactionStop, write, write, write, write, writeBlob, writeBlob, writeClob, writeLob, writeLob
BusyChecker, clearThreadResources, close, connect, DedicateChecker, FreeChecker, getConnection, getDedicatedConnection, getFreeConnection, getIntParam, putConnection, reconnect, refresh, setDedicated, unsetDedicated
delete, getAsPalioConnector, getConnector, getConnector, getInstance, getLogConfiguration, getName, getUrl, init, log, logDebug, logError, logError, logWarning, save, scheduler, setDedicatedLogConfiguration, setInstance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getUrl, setInstance
public static java.util.Map<Instance,org.apache.log4j.Logger> loggers
public HibernateConnector(java.lang.String url, java.util.Properties properties)
public static org.hibernate.Session getCurrentSession() throws PalioException
null
, jeżeli wowłano metodę spoza działania instancji -
Current.getInstance()
zwróci null.PalioException
- Konektor nie został skonfigurowany.public void init() throws PalioException
init
in interface SQLConnectable
init
in class SQLConnector
PalioException
public org.hibernate.SessionFactory getSessionFactory()
getSessionFactory
in interface HibernateConnectable
public java.lang.Long getSequence(java.lang.String sequenceName) throws PalioException
getSequence
in interface SQLConnectable
getSequence
in class SQLConnector
PalioException
public static org.hibernate.Session openSession()
public org.hibernate.Session getSession() throws PalioException
HibernateConnectable
getSession
in interface HibernateConnectable
PalioException
- Wystąpił problem z połączenie do bazy, lub nie można otworzyć
sesji.public org.hibernate.Session getSession(org.hibernate.EntityMode entityMode) throws PalioException
getSession
in interface HibernateConnectable
PalioException
public void putSession(org.hibernate.Session session)
putSession
in interface HibernateConnectable
session
- Sesja połączenia z DB.public int getType()
getType
in interface SQLConnectable
protected void refreshConnection() throws PalioException
PalioException
- Wystąpiły problemy z nawiązaniem połączenia.