Class JpaMapStorage<RE extends JpaRootEntity,E extends AbstractEntity,M>  
java.lang.Object
org.keycloak.models.map.storage.jpa.JpaMapStorage<RE,E,M>  
- All Implemented Interfaces:
- MapStorage<E,- M> 
- Direct Known Subclasses:
- JpaAdminEventMapStorage,- JpaAuthEventMapStorage,- JpaClientMapStorage,- JpaClientScopeMapStorage,- JpaGroupMapStorage,- JpaLockMapStorage,- JpaPermissionMapStorage,- JpaPolicyMapStorage,- JpaRealmMapStorage,- JpaResourceMapStorage,- JpaResourceServerMapStorage,- JpaRoleMapStorage,- JpaRootAuthenticationSessionMapStorage,- JpaScopeMapStorage,- JpaSingleUseObjectMapStorage,- JpaUserLoginFailureMapStorage,- JpaUserMapStorage,- JpaUserSessionMapStorage
public abstract class JpaMapStorage<RE extends JpaRootEntity,E extends AbstractEntity,M>  
extends Object
implements MapStorage<E,M> 
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionJpaMapStorage(KeycloakSession session, Class<RE> entityType, Class<M> modelType, jakarta.persistence.EntityManager em) 
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidclearQueryCache(org.hibernate.Session session) Instructs this storage to add a new value into the underlying store on commit in the context of the current transaction.protected abstract JpaModelCriteriaBuilderbooleanInstructs this storage to delete a value associated with the identifierkeyfrom the underlying store upon commit.longdelete(QueryParameters<M> queryParameters) Instructs this transaction to remove values (identified bymcbfilter) from the underlying store upon commit.longgetCount(QueryParameters<M> queryParameters) Returns a number of values present in the underlying storage that fulfill the given criteria with respect to changes done in the current transaction.protected abstract EmapToEntityDelegate(RE original) protected EmapToEntityDelegateUnique(RE original) Use the cache within the session to ensure that there is only one instance per entity within the current session.Provides possibility to lookup for values by akeyin the underlying store with respect to changes done in current transaction.read(QueryParameters<M> queryParameters) Returns a stream of values from underlying storage that are updated based on the current transaction changes; i.e.protected voidremoveFromCache(String key) protected abstract jakarta.persistence.criteria.Selection<? extends RE>selectCbConstruct(jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.Root<RE> root) protected abstract voidsetEntityVersion(JpaRootEntity entity) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.map.storage.MapStorageexists, exists
- 
Field Details- 
emprotected jakarta.persistence.EntityManager em
 
- 
- 
Constructor Details- 
JpaMapStoragepublic JpaMapStorage(KeycloakSession session, Class<RE> entityType, Class<M> modelType, jakarta.persistence.EntityManager em) 
 
- 
- 
Method Details- 
selectCbConstruct
- 
setEntityVersion
- 
createJpaModelCriteriaBuilder
- 
mapToEntityDelegate
- 
mapToEntityDelegateUniqueUse the cache within the session to ensure that there is only one instance per entity within the current session.
- 
createDescription copied from interface:MapStorageInstructs this storage to add a new value into the underlying store on commit in the context of the current transaction.Updates to the returned instances of Vwould be visible in the current transaction and will propagate into the underlying store upon commit. The ID of the entity passed in the parameter might change to a different value in the returned value if the underlying storage decided this was necessary. If the ID of the entity was null before, it will be set on the returned value.- Specified by:
- createin interface- MapStorage<RE extends JpaRootEntity,- E extends AbstractEntity> 
- Parameters:
- mapEntity- the value
- Returns:
- Entity representing the valuein the store. It may or may not be the same instance asvalue.
 
- 
readDescription copied from interface:MapStorageProvides possibility to lookup for values by akeyin the underlying store with respect to changes done in current transaction. Updates to the returned instance would be visible in the current transaction and will propagate into the underlying store upon commit. IfVimplementsExpirableEntitythis method should not return entities that are expired. SeeExpirableEntityJavaDoc for more details.- Specified by:
- readin interface- MapStorage<RE extends JpaRootEntity,- E extends AbstractEntity> 
- Parameters:
- key- identifier of a value
- Returns:
- a value associated with the given key
 
- 
readDescription copied from interface:MapStorageReturns a stream of values from underlying storage that are updated based on the current transaction changes; i.e. the result contains updates and excludes of records that have been created, updated or deleted in this transaction by respective methods of this interface.Updates to the returned instances of Vwould be visible in the current transaction and will propagate into the underlying store upon commit. IfVimplementsExpirableEntitythis method should not return entities that are expired. SeeExpirableEntityJavaDoc for more details.- Specified by:
- readin interface- MapStorage<RE extends JpaRootEntity,- E extends AbstractEntity> 
- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- values that fulfill the given criteria, that are updated based on changes in the current transaction
 
- 
clearQueryCachepublic static void clearQueryCache(org.hibernate.Session session) 
- 
getCountDescription copied from interface:MapStorageReturns a number of values present in the underlying storage that fulfill the given criteria with respect to changes done in the current transaction.- Specified by:
- getCountin interface- MapStorage<RE extends JpaRootEntity,- E extends AbstractEntity> 
- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- number of values present in the storage that fulfill the given criteria
 
- 
deleteDescription copied from interface:MapStorageInstructs this storage to delete a value associated with the identifierkeyfrom the underlying store upon commit.- Specified by:
- deletein interface- MapStorage<RE extends JpaRootEntity,- E extends AbstractEntity> 
- Parameters:
- key- identifier of a value
- Returns:
- Returns trueif the object has been deleted or result cannot be determined,falseotherwise.
 
- 
removeFromCache
- 
deleteDescription copied from interface:MapStorageInstructs this transaction to remove values (identified bymcbfilter) from the underlying store upon commit.- Specified by:
- deletein interface- MapStorage<RE extends JpaRootEntity,- E extends AbstractEntity> 
- Parameters:
- queryParameters- parameters for the query like firstResult, maxResult, requested ordering, etc.
- Returns:
- number of removed objects (might return -1if not supported)
 
 
-