Class LazyEntityList
java.lang.Object
ch.tocco.nice2.persist.core.api.entity.AbstractEntityList
ch.tocco.nice2.persist.core.api.hibernate.AbstractLazyEntityList
ch.tocco.nice2.persist.core.api.hibernate.LazyEntityList
- All Implemented Interfaces:
EntityList
,Iterable<Entity>
An implementation of
EntityList
that delays initialization until the entities are actually accessed.
The entities are loaded in pages of size 50 (per default).-
Nested Class Summary
Nested classes/interfaces inherited from class ch.tocco.nice2.persist.core.api.entity.AbstractEntityList
AbstractEntityList.SimpleIterator
Nested classes/interfaces inherited from interface ch.tocco.nice2.persist.core.api.entity.EntityList
EntityList.Filter
-
Field Summary
Fields inherited from class ch.tocco.nice2.persist.core.api.hibernate.AbstractLazyEntityList
keys, pageSize
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget
(int index, boolean eager) Get the entity at the specified index.Get the entity manager.Methods inherited from class ch.tocco.nice2.persist.core.api.hibernate.AbstractLazyEntityList
getKey, getKeys, getModel, getPageCount, getPageForIndex, getPageSize, indexOf, setPageSize, size, unwrap
Methods inherited from class ch.tocco.nice2.persist.core.api.entity.AbstractEntityList
contains, expect, expectAtLeast, expectAtMost, get, get, get, isEmpty, iterator, toList, toList
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.persist.core.api.entity.EntityList
doWithSingleResult, doWithSingleResultOr, expectAtMostOrThrow, expectOr, expectOrThrow, getOnlyResult, getOptionalOnlyResult, getOptionalOnlyResult, requireFirstEntity, spliterator, stream
-
Constructor Details
-
LazyEntityList
-
-
Method Details
-
get
Description copied from interface:EntityList
Get the entity at the specified index.- Parameters:
index
- The index.eager
-true
, if a page should be eagerly loaded, if the entity's state ishollow
, false otherwise.- Returns:
- The entity at the specified index potentially in
unusable state
, ornull
. - Throws:
PersistException
-
getManager
Description copied from interface:EntityList
Get the entity manager.- Returns:
- The entity manager.
-
getFirstEntity
- Returns:
- the first entity or null
-