public interface Session extends AutoCloseable
A Session can be created either by invoking the default
DatabasePipelineFactory through create(Configuration)
or by initializeing it through a Pipeline.
In any case it may require you to provide you a Configuration, it is
recommended to use the Configuration provided with the Database-Module you
wish to use (usually prefixed with the Database-Name).
| Modifier and Type | Method and Description |
|---|---|
static Session |
create(Configuration cnf)
Creates a simple
Session for direct interaction with a database. |
void |
delete(Object entity)
Deletes the provided Object.
|
void |
deleteAll(Collection<? extends Object> entities)
Deletes all provided values of Collection entities.
|
QueryBuilder |
getQueryBuilder()
Provides the configured
QueryBuilder for the use in custom queries |
boolean |
isConnected()
Provides information of the connection-status.
|
<T,ID extends Serializable> |
load(Class<T> type,
ID id)
Loads the Object of Class matching the provided id.
|
<T,ID extends Serializable> |
load(Class<T> type,
ID id,
Integer depth)
Loads the Object of Class matching the provided id.
|
<T> T |
load(IFilter filter)
Deprecated.
may not return the Object of the correct Class
|
<T> Collection<T> |
loadAll(Class<T> type)
Deprecated.
discouraged from using - needlessly fills up RAM
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
ID id)
Loads all Objects of Class matching the provided id.
|
<T,ID extends Serializable> |
loadAll(Class<T> type,
ID id,
Integer depth)
Loads all Objects of Class matching the provided id.
|
<T> Collection<T> |
loadAll(Class<T> type,
Integer depth)
Deprecated.
discouraged from using - needlessly fills up RAM
|
<T> Collection<T> |
loadAll(IFilter filter)
Deprecated.
may not return the Object of the correct Class
|
<T> Collection<T> |
loadAllLazy(Class<T> type)
Deprecated.
discouraged from using - needlessly fills up RAM
|
<T,ID extends Serializable> |
loadAllLazy(Class<T> type,
ID id)
Lazy-Loads all Objects of Class matching the provided id.
|
<T,ID extends Serializable> |
loadLazy(Class<T> type,
ID id)
Lazy-Loads the Object of Class matching the provided id.
|
void |
reload(Object entity)
Reloads the Values and Relations of entity.
|
void |
reload(Object entity,
Integer depth)
Reloads the Values and Relations of entity.
|
void |
reloadAll(Collection<? extends Object> entities)
Reloads the Values and Relations of Collection entities.
|
void |
reloadAll(Collection<? extends Object> entities,
Integer depth)
Reloads the Values and Relations of Collection entities.
|
void |
resolveAllLazyLoaded(Collection<? extends Object> entities)
Loads all Relations provided by values of Collection entities.
|
void |
resolveAllLazyLoaded(Collection<? extends Object> entities,
Integer depth)
Loads all Relations provided by values of Collection entities.
|
void |
resolveLazyLoaded(Object entity)
Loads all Relations provided by entity.
|
void |
resolveLazyLoaded(Object entity,
Integer depth)
Loads all Relations provided by entity.
|
void |
save(Object entity)
Saves the provided Object.
|
void |
save(Object entity,
Integer depth)
Saves the provided Object.
|
void |
saveAll(Collection<? extends Object> entities)
Saves all provided values of Collection entities.
|
void |
saveAll(Collection<? extends Object> entities,
Integer depth)
Saves the provided values of Collection entities.
|
void |
saveAllLazy(Collection<? extends Object> entities)
Saves the provided values of Collection entities without saving any
Relations.
|
void |
saveLazy(Object entity)
Saves the provided Object without any Relations.
|
void |
unload(Object entity)
Unloades the provided Object.
|
void |
unloadAll(Collection<? extends Object> entities)
Unloades all provided values of Collection entities.
|
closeboolean isConnected()
<T,ID extends Serializable> T load(Class<T> type, ID id)
null in
case no Object could be loaded.T - Model-Class provided through the ConfigID - Serializable Objecttype - requested Typeid - requested entity-id<T,ID extends Serializable> T load(Class<T> type, ID id, Integer depth)
null in
case no Object could be loaded.
Depth defines how often the requested Objects Relations will be loaded
recursively. 0 will load the Object without any Relations
(LAZY).
T - Model-Class provided through the ConfigID - Serializable Objecttype - requested Typeid - requested entity-iddepth - requested load depth<T,ID extends Serializable> T loadLazy(Class<T> type, ID id)
null in case no Object could be loaded.T - Model-Class provided through the ConfigID - Serializable Objecttype - requested Typeid - requested entity-idload(Class, Serializable, Integer)<T> T load(IFilter filter)
IFilter Object. Returns
null in case the Filter had no loadedable results.
In case of use it is recommended to build the Filter with the
QueryBuilder acquirable through getQueryBuilder().
T - Model-Class provided through the Configfilter - Custom-FilterIFilter
Object<T,ID extends Serializable> Collection<T> loadAll(Class<T> type, ID id)
T - Model-Class provided through the ConfigID - Serializable Objecttype - requested Typeid - requested entity-id<T,ID extends Serializable> Collection<T> loadAll(Class<T> type, ID id, Integer depth)
Depth defines how often the requested Objects Relations will be loaded
recursively. 0 will load the Object without any Relations
(LAZY).
T - Model-Class provided through the ConfigID - Serializable Objecttype - requested Typeid - requested entity-iddepth - requested load depth<T,ID extends Serializable> Collection<T> loadAllLazy(Class<T> type, ID id)
T - Model-Class provided through the ConfigID - Serializable Objecttype - requested Typeid - requested entity-idloadAll(Class, Serializable, Integer)<T> Collection<T> loadAll(Class<T> type)
T - Model-Class provided through the Configtype - requested Type<T> Collection<T> loadAll(Class<T> type, Integer depth)
Depth defines how often the requested Objects Relations will be loaded
recursively. 0 will load the Object without any Relations
(LAZY).
T - Model-Class provided through the Configtype - requested Typedepth - requested load depth<T> Collection<T> loadAllLazy(Class<T> type)
T - Model-Class provided through the Configtype - requested TypeloadAll(Class, Integer)<T> Collection<T> loadAll(IFilter filter)
IFilter Object. Returns an
empty Collection in case no Objects could be loaded.
In case of use it is recommended to build the Filter with the
QueryBuilder acquirable through getQueryBuilder().
T - Model-Class provided through the Configfilter - Custom-FilterIFilter Objectvoid resolveLazyLoaded(Object entity)
entity - Object of Model-Class provided through the Configvoid resolveLazyLoaded(Object entity, Integer depth)
Depth defines how often the requested Objects Relations will be loaded
recursively. 0 will load the Object without any Relations
(LAZY).
entity - Object of Model-Class provided through the Configdepth - requested load depthvoid resolveAllLazyLoaded(Collection<? extends Object> entities)
entities - Collection with Objects of Model-Classes provided through the
Configvoid resolveAllLazyLoaded(Collection<? extends Object> entities, Integer depth)
Depth defines how often the requested Objects Relations will be loaded
recursively. 0 will load the Object without any Relations
(LAZY).
entities - Collection with Objects of Model-Classes provided through the
Configdepth - requested load depthvoid reload(Object entity)
entity - entity Object of Model-Class provided through the Configvoid reload(Object entity, Integer depth)
Depth defines how often the requested Objects Relations will be loaded
recursively. 0 will only reload the Values and skip reloading
any Relations.
entity - entity Object of Model-Class provided through the Configdepth - requested reload depthvoid reloadAll(Collection<? extends Object> entities)
entities - Collection of Model-Classes provided through the Configvoid reloadAll(Collection<? extends Object> entities, Integer depth)
Depth defines how often the requested Objects Relations will be loaded
recursively. 0 will only reload the Values and skip reloading
any Relations.
entities - Collection with Collection of Model-Classes provided through
the Configdepth - requested reload depthvoid save(Object entity)
entity - Object of Model-Class provided through the Configvoid save(Object entity, Integer depth)
Depth defines how many of the Object's Relations will be saved recursively.
0 will save the Object without saving any Relations.
entity - Object of Model-Class provided through the Configdepth - requested load depthvoid saveLazy(Object entity)
entity - Object of Model-Class provided through the Configsave(Object, Integer)void saveAll(Collection<? extends Object> entities)
entities - Collection of Objects of Model-Classes provided through the
Configvoid saveAll(Collection<? extends Object> entities, Integer depth)
Depth defines how many of the Object's Relations will be saved recursively.
0 will save the Object without saving any Relations.
entities - Collection of Objects of Model-Classes provided through the
Configdepth - requested load depthvoid saveAllLazy(Collection<? extends Object> entities)
entities - Collection of Objects of Model-Classes provided through the
ConfigsaveAll(Collection, Integer)void delete(Object entity)
entity - Object of Model-Class provided through the Configvoid deleteAll(Collection<? extends Object> entities)
entities - Collection of Objects of Model-Classes provided through the
Configvoid unload(Object entity)
(Removes the provided Object and all Relations from the Buffer)
entity - Object of Model-Class provided through the Configvoid unloadAll(Collection<? extends Object> entities)
(Removes all provided values of Collection entities and all fo their Relations from the Buffer)
entities - Collection of Objects of Model-Classes provided through the
ConfigQueryBuilder getQueryBuilder()
QueryBuilder for the use in custom queriesQueryBuilder instancestatic Session create(Configuration cnf) throws Exception
Session for direct interaction with a database.
The Configuration cnf should be use the Configuration provided with
the Database-Module you wish to use (usually prefixed with the
Database-Name).
cnf - Configuration of the databaseSession for direct interaction with a databaseException - re-throws any Exception that might accure during
Pipeline creation.Copyright © 2020–2022 RunedUniverse. All rights reserved.