public interface SessionManager
HqlQuery
and SqlQuery
.
Delete methods provided by this interface work only if entity ID property is named id
. Behavior is not
specified if entity uses alternative names.
Modifier and Type | Method and Description |
---|---|
void |
delete(Class<?> type,
Collection<Integer> ids)
Delete collection of objects of requested type, in a single database query.
|
void |
delete(Class<?> type,
Object id)
Delete the object identified by
id , of requested type . |
void |
delete(String entityName,
Collection<Integer> ids)
Delete collection of objects mapped to requested entity, in a single database query.
|
void |
delete(String entityName,
Object id)
Delete the object identified by
id and mapped to requested entity. |
boolean |
exists(String existsClause,
Object... parameters) |
<T> T |
get(Class<T> type,
Serializable id,
String... lazyFields)
Query to retrieve object by ID.
|
org.hibernate.Session |
getSession()
Access to low level ;-) Hibernate session.
|
HqlQuery |
HQL(String hql,
Object... parameters)
Create a HQL query instance wrapping given query string.
|
<T> void |
save(Collection<T> collection)
Convenient way to save or update collection of objects.
|
void |
save(Object object)
Save or update the object.
|
void |
save(String entity,
Object object)
Save or update object instance mapped to requested entity name.
|
SqlQuery |
SQL(String sql,
Object... parameters)
Create a SQL query instance wrapping given query string.
|
void save(Object object)
object
- object to save.void save(String entity, Object object)
entity
- mapped entity name,object
- object instance to persist.<T> void save(Collection<T> collection)
save(Object)
for every object.T
- collection type.collection
- collection of objects to persist.<T> T get(Class<T> type, Serializable id, String... lazyFields)
T
- class type.type
- expected object type,id
- desired object ID,lazyFields
- optional lazy mapped fields to be initialized.void delete(Class<?> type, Object id)
id
, of requested type
. Type is used to infer entity name
that on its turn determine the table on which delete is performed.
This method works only if entity ID property is named id
. This method behavior is not specified if
entity uses alternative names.
type
- object type,id
- object id.void delete(String entityName, Object id)
id
and mapped to requested entity. Entity is used to determine the
table on which delete is performed.
This method works only if entity ID property is named id
. This method behavior is not specified if
entity uses alternative names.
entityName
- entity name,id
- object id.void delete(Class<?> type, Collection<Integer> ids)
delete(Class, Object)
on collection id values; it executes delete in a single database statement using
IN
clause.
This method works only if entity ID property is named id
. This method behavior is not specified if
entity uses alternative names.
type
- object type,ids
- collection of id values.void delete(String entityName, Collection<Integer> ids)
delete(String, Object)
on collection id values; it executes delete in a single database
statement using IN
clause.
This method works only if entity ID property is named id
. This method behavior is not specified if
entity uses alternative names.
entityName
- Hibernate entity name,ids
- collection of id values.HqlQuery HQL(String hql, Object... parameters)
hql
- HQL statement with optional positioned parameters markup, that is question mark sign,parameters
- variable number of parameters mapped by position.SqlQuery SQL(String sql, Object... parameters)
sql
- SQL statement with optional positioned parameters markup, that is question mark sign,parameters
- variable number of parameters mapped by position.org.hibernate.Session getSession()
Copyright © 2019. All rights reserved.