Table of Contents |
---|
Classes and
...
Exceptions
SOSHibernateFactory
Java package : com.sos.hibernate.classes
...
SOSHibernateConfigurationException
SOSHibernateConnectionException
SOSHibernateConvertException
SOSHibernateFactoryBuildException
SOSHibernateInvalidSessionException
SOSHibernateLockAcquisitionException
SOSHibernateObjectOperationException
SOSHibernateObjectOperationStaleStateException
SOSHibernateOpenSessionException
SOSHibernateQueryException
SOSHibernateQueryNonUniqueResultException
SOSHibernateSessionException
SOSHibernateTransactionException
SOSHibernateSQLExecutorException
Configuration Items
SOSHibernate
uses the standard Hibernate configuration to configure Hibernate and allows to set the configuration properties programmatically at runtime.
...
Configuration methods that can be applied, before Hibernate SessionFactory
is created.
public void addClassMapping(Class<?> c)
Adds the @Entity
annotated single class to the configuration mapping.
public void addClassMapping(ClassList list)
Adds the @Entity
annotated classes to the configuration mapping.
...
Create Hibernate SessionFactory
public void build()
Create a Hibernate SessionFactory
using the properties and mappings in this configuration.
...
Throws: SOSHibernateConfigurationException
- if invalid isolationLevel
public static String toString(Object dbItem)
Returns: dumping a java object's public properties.
Note: starting with JobScheduler 1.11.5
public Optional<Path> getConfigFile()
...
Default - SOSHibernateFactory.getAutoCommit()
Note: starting with JobScheduler 1.11.4
public void setIdentifier(String val)
...
Returns: session autocommit mode.
Note: starting with JobScheduler 1.11.4
public boolean isStatelessSession()
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Execute
public
...
int executeUpdateNativeQuery(String sql)
The method executes statements as UPDATE, INSERT, DELETE..
Implement a wrapper method for the Hibernate executeUpdate
.
Returns: The number of entities updated or deleted.
Throws: SOSHibernateInvalidSessionException
,SOSHibernateLockAcquisitionException
, SOSHibernateQueryException
public
...
int executeUpdate(Query<?> query)
The method executes statements as UPDATE, INSERT, DELETE..
...
To execute the native statements Query
param must be a NativeQuery
.
Returns: The number of entities updated or deleted.
Throws: SOSHibernateInvalidSessionException
,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Select
public <T> String getSingleValueNativeQueryAsString(String sql)
Creates and get the result of the Hibernate NativeQuery
.
...
Note: difference to Query.getSingleResult
- not throw NoResultException
.
public <T> T getSingleValue(
...
Query<T> query)
Get the result of the Hibernate Query
or NativeQuery
.
The method reads a scalar value – usually a field – of the first record from the result set of a Query
or NativeQuery
.
Returns: T Object or null in the event of an empty result set.
...
Note: difference to Query.getSingleResult
- not throw NoResultException
.
public <T> String getSingleValueAsString(
...
Query<T> query)
Get the result of the Hibernate Query
or NativeQuery
.
The method reads a scalar value – usually a field – of the first record from the result set of a Query
or NativeQuery
.
Returns: String or null in the event of an empty result set.
...
public <T> T getSingleResultNativeQuery(String sql)
Creates Creates a NativeQuery
from sql query string and execute <T> T getSingleResult(NativeQuery<T> nativeQueryQuery<T> query)
See <T> T getSingleResult(NativeQuery<T> nativeQuery)
;
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
...
public <T> Map<String, Object> getSingleResultNativeQueryAsMap(String sql)
Creates Creates a NativeQuery
from sql query string and execute <T> Map<String, Object> getSingleResultAsMap(NativeQuery<T> nativeQuery)
See <T> Map<String, Object> getSingleResultAsMap(NativeQuery<T>
; nativeQuery
)
ThrowsThrows: SOSHibernateInvalidSessionException,
SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> Map<String, String> getSingleResultNativeQueryAsStringMap(String sql)
Creates a NativeQuery
from sql query string and execute <T> Map<String, String> getSingleResultAsStringMap(NativeQuery<T>
nativeQuery
, String dateTimeFormat)
See <T> Map<String, String> getSingleResultAsStringMap(NativeQuery<T>
; nativeQuery
, String dateTimeFormat)
ThrowsThrows: SOSHibernateInvalidSessionException,
SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> Map<String, String> getSingleResultNativeQueryAsStringMap(String sql, String dateTimeFormat)
Creates a NativeQuery
from sql query string and execute <T> Map<String, String> getSingleResultAsStringMap(NativeQuery<T>
nativeQuery
, String dateTimeFormat)
See <T> Map<String, String> getSingleResultAsStringMap(NativeQuery<T>
; nativeQuery
, String dateTimeFormat)
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> T getSingleResult(
...
Query<T> query)
The method reads one record from a query .
See <T> T getSingleResult(Query<T> query)
(Query
or NativeQuery)
.
Throws: SOSHibernateInvalidSessionException, SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryException
...
Note: difference to Query.getSingleResult
- not throw NoResultException
.
Note: starting with JobScheduler 1.11.4
public <T> Map<String, String> getSingleResultAsStringMap(NativeQuery<T> nativeQuery, String dateTimeFormat)
...
Note: difference to Query.getSingleResult
- not throw NoResultException
.
Note: starting with JobScheduler 1.11.4
public <T> List<T> getResultListNativeQuery(String sql)
Creates a NativeQuery
from sql query string and execute <T> List<T> getResultList(Query<T> query)
See <T> List<T> getResultList(Query<T> query)
; Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
...
Creates a NativeQuery
from sql query string and execute <T> List<Map<String, Object>> getResultListAsMaps(NativeQuery<T> nativeQuery)
See <T> List<Map<String, Object>> getResultListAsMaps(NativeQuery<T> nativeQuery)
;
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> List<Map<String, String>> getResultListNativeQueryAsStringMaps(String sql)
Creates a NativeQuery
from sql query string and execute <T> List<Map<String, String>> getResultListAsStringMaps(NativeQuery<T> nativeQuery, String dateTimeFormat)
See <T> List<Map<String, String>> getResultListAsStringMaps(NativeQuery<T> nativeQuery, String dateTimeFormat)
;
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> List<Map<String, String>> getResultListNativeQueryAsStringMaps(String sql, String dateTimeFormat)
Creates a NativeQuery
from sql query string and execute <T> List<Map<String, String>> getResultListAsStringMaps(NativeQuery<T> nativeQuery, String dateTimeFormat)
See <T> List<Map<String, String>> getResultListAsStringMaps(NativeQuery<T> nativeQuery, String dateTimeFormat)
;
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> List<T> getResultList(
...
Query<T> query)
The method reads all records from a query (Query
or NativeQuery
).
See <T> List<T> getResultList(Query<T> query)
;
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
public <T> List<Map<String, Object>> getResultListAsMaps(NativeQuery<T> nativeQuery)
...
Returns: A List of the Maps consisting of column names and values – null for empty result sets.
- Map key - column name in lower case.
- Map value - object (null value as NULL)
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> List<Map<String, String>> getResultListAsStringMaps(NativeQuery<T> query)
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> List<Map<String, String>> getResultListAsStringMaps(NativeQuery<T> query, String dateTimeFormat)
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public <T> ScrollableResults scroll(
...
Query<T> query)
The method executes the scroll
method with the ScrollMode.FORWARD_ONLY
See ScrollableResults scroll(Query<T> nativeQueryquery, ScrollMode scrollMode)
;
Note: starting with JobScheduler 1.11.4
public <T> ScrollableResults scroll(Query<T>
...
query, ScrollMode scrollMode)
The method executes a sql query statements and preserves the result set.
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryExceptionSOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
public String getLastSequenceValue(String sequenceName)
...
Throws: SOSHibernateInvalidSessionException, SOSHibernateConnectionException, SOSHibernateSQLExecutorException
public
...
int executeUpdate(String... sqls)
The method executes DML statements as UPDATE
, INSERT
, DELETE
..
Implement a wrapper method for the java.sql.Statement.executeUpdate(String sql)
Returns: The number of entities updated or deleted.
Throws: SOSHibernateInvalidSessionException, SOSHibernateConnectionException, SOSHibernateSQLExecutorException
...
Throws: SOSHibernateInvalidSessionException, SOSHibernateConnectionException, SOSHibernateSQLExecutorException
public Map<String,
...
Object> next(ResultSet rs)
The method reads the next record from the result set returned by a query.
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
Execute
public
...
int executeUpdate(String hql)
The method executes statements as UPDATE, INSERT, DELETE..
Creates a Query
from HQL/JPQL
query string and execute int executeUpdate(Query<?> query).
Returns: See int
Implement a wrapper method for the Hibernate executeUpdate(Query<?> query)
executeUpdate
.
Throws: SOSHibernateInvalidSessionException
,
SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
public
...
int executeUpdate(Query<?> query)
The method executes statements as UPDATE, INSERT, DELETE..
Implement a wrapper method for the Hibernate executeUpdate
.
Returns: The number of entities updated or deleted.
Throws: SOSHibernateInvalidSessionException
,
SOSHibernateLockAcquisitionException
, SOSHibernateQueryException
...
Returns: value as String
or null
in the event of an empty result set.
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
public <T> T getSingleValue(Query<T> query)
The method reads a value of the first record from the result set of a Query
.
...
Note: difference to Query.getSingleResult
- not throw NoResultException
.
public <T> String getSingleValueAsString(Query<T> query)
The method reads a value of the first record from the result set of a Query
.
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
public <T> T getSingleResult(Query<T> query)
The method reads one record from a query.
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryNonUniqueResultException, SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
Note: difference to Query.getSingleResult
- not throw NoResultException
.
public <T> List<T>
...
getResultList(String hql)
Creates a Query
from HQL/JPQL
query string and execute <T> T getResultList(Query<T> query).
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
public <T> List<T>
...
getResultList(Query<T> query)
The method reads all records from a query.
...
Throws: SOSHibernateInvalidSessionException,
SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
public <T> ScrollableResults scroll(Query<T> query)
The method executes the scroll
method with the ScrollMode.FORWARD_ONLY
See ScrollableResults scroll(Query<T> query, ScrollMode scrollMode)
;
Note: starting with JobScheduler 1.11.4
public <T> ScrollableResults scroll(Query<T> query, ScrollMode scrollMode)
The method executes a sql query statements and preserves the result set.
...
Throws: SOSHibernateInvalidSessionException,
, SOSHibernateQueryException
SOSHibernateLockAcquisitionException
,
Note: starting with JobScheduler 1.11.4
SOSHibernateException
Additional public methods:
...
History of SOSHibernate with JobScheduler Releases
Info | ||
---|---|---|
| ||
|
Info | ||
---|---|---|
| ||
|
Info | ||
---|---|---|
| ||
|