parent
e19899d496
commit
c058983655
2 changed files with 15 additions and 1 deletions
|
@ -37,6 +37,7 @@ import org.keycloak.models.map.common.DeepCloner;
|
|||
import org.keycloak.models.map.common.UpdatableEntity;
|
||||
import static org.keycloak.models.map.storage.jpa.Constants.CURRENT_SCHEMA_VERSION_AUTH_SESSION;
|
||||
import org.keycloak.models.map.storage.jpa.JpaRootEntity;
|
||||
import org.keycloak.models.map.storage.jpa.JpaRootVersionedEntity;
|
||||
import org.keycloak.models.map.storage.jpa.hibernate.jsonb.JsonbType;
|
||||
import org.keycloak.sessions.CommonClientSessionModel;
|
||||
|
||||
|
@ -52,13 +53,18 @@ import org.keycloak.sessions.CommonClientSessionModel;
|
|||
@Entity
|
||||
@Table(name = "kc_auth_session")
|
||||
@TypeDefs({@TypeDef(name = "jsonb", typeClass = JsonbType.class)})
|
||||
public class JpaAuthenticationSessionEntity extends UpdatableEntity.Impl implements MapAuthenticationSessionEntity, JpaRootEntity {
|
||||
public class JpaAuthenticationSessionEntity extends UpdatableEntity.Impl implements MapAuthenticationSessionEntity, JpaRootVersionedEntity {
|
||||
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue
|
||||
private UUID id;
|
||||
|
||||
//used for implicit optimistic locking
|
||||
@Version
|
||||
@Column
|
||||
private int version;
|
||||
|
||||
@Type(type = "jsonb")
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private final JpaAuthenticationSessionMetadata metadata;
|
||||
|
@ -107,6 +113,11 @@ public class JpaAuthenticationSessionEntity extends UpdatableEntity.Impl impleme
|
|||
return CURRENT_SCHEMA_VERSION_AUTH_SESSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabId() {
|
||||
return metadata.getTabId();
|
||||
|
|
|
@ -51,6 +51,9 @@ limitations under the License.
|
|||
<column name="id" type="UUID">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
||||
</column>
|
||||
<column name="version" type="INTEGER" defaultValueNumeric="0">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="fk_root" type="UUID">
|
||||
<constraints foreignKeyName="auth_session_fk_root_fkey" references="kc_auth_root_session(id)" deleteCascade="true"/>
|
||||
</column>
|
||||
|
|
Loading…
Reference in a new issue