Interface JpaRootEntity
- All Superinterfaces:
AbstractEntity,Serializable
- All Known Subinterfaces:
JpaRootVersionedEntity
- All Known Implementing Classes:
JpaAdminEventEntity,JpaAuthenticationSessionEntity,JpaAuthEventEntity,JpaClientEntity,JpaClientScopeEntity,JpaClientSessionEntity,JpaComponentEntity,JpaGroupEntity,JpaLockEntity,JpaPermissionEntity,JpaPolicyEntity,JpaRealmEntity,JpaResourceEntity,JpaResourceServerEntity,JpaRoleEntity,JpaRootAuthenticationSessionEntity,JpaScopeEntity,JpaSingleUseObjectEntity,JpaUserConsentEntity,JpaUserEntity,JpaUserFederatedIdentityEntity,JpaUserLoginFailureEntity,JpaUserSessionEntity
Interface for all root entities in the JPA storage.
-
Method Summary
Modifier and TypeMethodDescriptionvoidsetEntityVersion(Integer entityVersion) default booleanIn case of any update on entity, we want to update the entityVersion to current one.Methods inherited from interface org.keycloak.models.map.common.AbstractEntity
getId, setId
-
Method Details
-
getEntityVersion
Integer getEntityVersion()- Returns:
- current supported version of the JPA entity used for schema versioning.
-
setEntityVersion
- Parameters:
entityVersion- sets current supported version to JPA entity.
-
updateEntityVersion
default boolean updateEntityVersion()In case of any update on entity, we want to update the entityVersion to current one. This includes downgrading from a future version of Keycloak, as the entityVersion must match the JSON and the additional tables this version writes. The listenerJpaEntityVersionListenercalls this method whenever the root entity or one of its children changes. Future versions of this method might restrict downgrading to downgrade only from the next version.- Returns:
trueif the entityVersion was effectively changed,falseotherwise.
-
getCurrentSchemaVersion
Integer getCurrentSchemaVersion()
-