Package org.nuiton.topia.persistence
Interface TopiaPersistenceContext
- All Superinterfaces:
AutoCloseable,Closeable,TopiaDaoSupplier,TopiaReplicationDestination,TopiaReplicationSupport,TopiaTransaction
- All Known Implementing Classes:
AbstractTopiaPersistenceContext
public interface TopiaPersistenceContext
extends TopiaReplicationSupport, TopiaReplicationDestination, TopiaDaoSupplier, TopiaTransaction, Closeable
This contract represents a persistence context, which lifecycle is linked to the transaction lifecycle.
It extends contracts such as :
TopiaTransaction- to deal with transaction lifecycleTopiaDaoSupplier- to let user get any Dao instanceTopiaReplicationSupport- to use context to context replication facilityTopiaReplicationDestination- can receive replicated entities
In addition to these contracts, there is some other methods :
- Generic entity find
- DAO factory
- Schema management
- Since:
- 3.0
- Author:
- Arnaud Thimel (Code Lutin)
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the PersistenceContext.voiddelete(TopiaEntity entity) Delete into this TopiaContext an entity created by another TopiaContext<E extends TopiaEntity>
voidDelete into this TopiaContext an entities created by another TopiaContext<E extends TopiaEntity>
EfindByTopiaId(String topiaId) RetrieveTopiaEntityusing its uniquetopiaId.Get the currently configuredTopiaFiresSupport.Get the currently configuredTopiaIdFactory.booleanisClosed()Tells if the context is closedvoidupdate(TopiaEntity entity) Add into this TopiaContext an entity created by another TopiaContextMethods inherited from interface org.nuiton.topia.persistence.TopiaDaoSupplier
getDao, getDaoMethods inherited from interface org.nuiton.topia.persistence.TopiaReplicationDestination
replicateMethods inherited from interface org.nuiton.topia.persistence.support.TopiaReplicationSupport
replicate, replicateEntities, replicateEntityMethods inherited from interface org.nuiton.topia.persistence.TopiaTransaction
commit, rollback
-
Method Details
-
findByTopiaId
RetrieveTopiaEntityusing its uniquetopiaId.- Type Parameters:
E- type of entity- Parameters:
topiaId- unique identifier of the entity in all the application.- Returns:
- the entity found or null
-
update
Add into this TopiaContext an entity created by another TopiaContext- Parameters:
entity- the entity to add
-
delete
Delete into this TopiaContext an entity created by another TopiaContext- Parameters:
entity- the entity to delete
-
deleteAll
Delete into this TopiaContext an entities created by another TopiaContext- Type Parameters:
E- type of entity- Parameters:
entities- the entities to delete
-
getTopiaIdFactory
TopiaIdFactory getTopiaIdFactory()Get the currently configuredTopiaIdFactory.- Returns:
- the
TopiaIdFactoryin use - Since:
- 3.0
- See Also:
-
isClosed
boolean isClosed()Tells if the context is closed- Returns:
trueif the context is closed,falseotherwise
-
close
void close()Closes the PersistenceContext. After calling close, it's impossible to make any operation on the database.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getTopiaFiresSupport
TopiaFiresSupport getTopiaFiresSupport()Get the currently configuredTopiaFiresSupport.- Returns:
- the
TopiaFiresSupportin use - Since:
- 3.0
- See Also:
-