Class PojoEntityManager
java.lang.Object
ch.tocco.nice2.persist.core.impl.hibernate.pojo.PojoEntityManager
- All Implemented Interfaces:
EntityManager
Hibernate adapter for the
EntityManager interface-
Constructor Summary
ConstructorsConstructorDescriptionPojoEntityManager(TypeManager typeManager, ContextAdapter context, PersistenceService persistService, EntityModel entityModel) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd anEntityFacadeListener.voidAdd anEntityListener.create()Create a new entity (stateEntity.State.CONCEPTION.createEntityList(PrimaryKey... entities) createEntityList(Entity... entities) Creates an EntityList of persistent entities of the same EntityModel.createQuery(Collection<PrimaryKey> keys) Create a query that returns objects with known primary keys.Create aQueryfor all entities of that type.Deletes all entities of the currentEntityModelon which the condition applies to in a single sql statement.get(PrimaryKey key) Get an entity by a known primary key.Get an entity by unique_id field.Get the persistence context of this entity manager.getModel()Get the entity type's model.voidRemove anEntityFacadeListener.voidRemove anEntityListener.@Nullable Entityretrieve(PrimaryKey key) Retrieve an entity by a known primary key.@Nullable EntityRetrieve an entity by unique_id field.toString()
-
Constructor Details
-
PojoEntityManager
public PojoEntityManager(TypeManager typeManager, ContextAdapter context, PersistenceService persistService, EntityModel entityModel)
-
-
Method Details
-
get
Description copied from interface:EntityManagerGet an entity by a known primary key. If the entity with the specified key isn't present, in the database, this method throws aNotFoundException. UseEntityManager.retrieve(PrimaryKey), if you prefer a `null` value, if the entity does not exist.- Specified by:
getin interfaceEntityManager- Parameters:
key- The primary key.- Returns:
- An entity facade for the entity with the specified key
- Throws:
PersistException- See Also:
-
retrieve
Description copied from interface:EntityManagerRetrieve an entity by a known primary key. UnlikeEntityManager.get(PrimaryKey), this method returnsnullif the entity does not exist in the database or the current user has no access to the entity.- Specified by:
retrievein interfaceEntityManager- Parameters:
key- ThePrimaryKeyof the entity.- Returns:
- The entity or
null, if the entity does not exist or is not accessible. - Throws:
PersistException- If an error occurs.- See Also:
-
get
Description copied from interface:EntityManagerGet an entity by unique_id field. Throws if entity cannot be found.- Specified by:
getin interfaceEntityManager- Parameters:
uniqueId- unique id value of entity.- Returns:
- An entity facade for the entity with the specified unique_id
- Throws:
PersistException- See Also:
-
retrieve
Description copied from interface:EntityManagerRetrieve an entity by unique_id field.- Specified by:
retrievein interfaceEntityManager- Parameters:
uniqueId- unique id value of entity.- Returns:
- The entity or
null, if the entity does not exist or is not accessible. - Throws:
PersistException- See Also:
-
createQueryForAll
Description copied from interface:EntityManagerCreate aQueryfor all entities of that type.- Specified by:
createQueryForAllin interfaceEntityManager- Returns:
- A query that queries all entities.
- Throws:
PersistException
-
createQuery
Description copied from interface:EntityManagerCreate a query that returns objects with known primary keys. Note that the results will be returned in random order unless a sorting is applied. They will not be returned in the given keys order. UseEntityLists.orderedList(ch.tocco.nice2.persist.core.api.entity.EntityList, ch.tocco.nice2.model.entity.api.PrimaryKey[]).- Specified by:
createQueryin interfaceEntityManager- Parameters:
keys- A collection of known primary keys.- Returns:
- The executable query.
- Throws:
PersistException
-
createEntityList
Description copied from interface:EntityManagerCreates an EntityList of persistent entities of the same EntityModel.- Specified by:
createEntityListin interfaceEntityManager- Parameters:
entities- Must be of same EntityModel, and persistent (not conception).- Returns:
- new EntityList of given persistent entities.
-
createEntityList
- Specified by:
createEntityListin interfaceEntityManager
-
create
Description copied from interface:EntityManagerCreate a new entity (stateEntity.State.CONCEPTION. The entity won't have any primary key yet and will be written into the storage when the transaction is committed.- Specified by:
createin interfaceEntityManager- Returns:
- The newly created entity.
- Throws:
PersistException
-
delete
Description copied from interface:EntityManagerDeletes all entities of the currentEntityModelon which the condition applies to in a single sql statement. Does not provide cascading delete.- Specified by:
deletein interfaceEntityManager
-
getModel
Description copied from interface:EntityManagerGet the entity type's model.- Specified by:
getModelin interfaceEntityManager- Returns:
- The entity type's model.
-
getContext
Description copied from interface:EntityManagerGet the persistence context of this entity manager.- Specified by:
getContextin interfaceEntityManager- Returns:
- The persistence context of this entity manager.
-
addEntityListener
Description copied from interface:EntityManagerAdd anEntityListener.- Specified by:
addEntityListenerin interfaceEntityManager- Parameters:
l- TheEntityListenerto be added.
-
removeEntityListener
Description copied from interface:EntityManagerRemove anEntityListener.- Specified by:
removeEntityListenerin interfaceEntityManager- Parameters:
l- TheEntityListenerto be removed.
-
getEntityListeners
-
addEntityFacadeListener
Description copied from interface:EntityManagerAdd anEntityFacadeListener.- Specified by:
addEntityFacadeListenerin interfaceEntityManager- Parameters:
l- TheEntityFacadeListenerto be added.
-
removeEntityFacadeListener
Description copied from interface:EntityManagerRemove anEntityFacadeListener.- Specified by:
removeEntityFacadeListenerin interfaceEntityManager- Parameters:
l- TheEntityFacadeListenerto be removed.
-
getEntityFacadeListeners
-
toString
-