Details
diff --git a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.6.0.xml b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.6.0.xml
index 5b0a0da..b50a4f4 100644
--- a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.6.0.xml
+++ b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.6.0.xml
@@ -31,7 +31,7 @@
<constraints nullable="false"/>
</column>
<column name="LAST_SESSION_REFRESH" type="INT"/>
- <column name="OFFLINE" type="BOOLEAN" defaultValueBoolean="false">
+ <column name="OFFLINE_FLAG" type="VARCHAR(4)">
<constraints nullable="false"/>
</column>
<column name="DATA" type="CLOB"/>
@@ -47,14 +47,14 @@
<column name="CLIENT_ID" type="VARCHAR(36)">
<constraints nullable="false"/>
</column>
- <column name="OFFLINE" type="BOOLEAN" defaultValueBoolean="false">
+ <column name="OFFLINE_FLAG" type="VARCHAR(4)">
<constraints nullable="false"/>
</column>
<column name="TIMESTAMP" type="INT"/>
<column name="DATA" type="CLOB"/>
</createTable>
- <addPrimaryKey columnNames="USER_SESSION_ID, OFFLINE" constraintName="CONSTRAINT_OFFLINE_US_SES_PK" tableName="OFFLINE_USER_SESSION"/>
- <addPrimaryKey columnNames="CLIENT_SESSION_ID, OFFLINE" constraintName="CONSTRAINT_OFFLINE_CL_SES_PK" tableName="OFFLINE_CLIENT_SESSION"/>
+ <addPrimaryKey columnNames="USER_SESSION_ID, OFFLINE_FLAG" constraintName="CONSTRAINT_OFFLINE_US_SES_PK" tableName="OFFLINE_USER_SESSION"/>
+ <addPrimaryKey columnNames="CLIENT_SESSION_ID, OFFLINE_FLAG" constraintName="CONSTRAINT_OFFLINE_CL_SES_PK" tableName="OFFLINE_CLIENT_SESSION"/>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentClientSessionEntity.java b/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentClientSessionEntity.java
index 51a5239..cad8ce8 100644
--- a/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentClientSessionEntity.java
+++ b/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentClientSessionEntity.java
@@ -17,14 +17,14 @@ import javax.persistence.Table;
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@NamedQueries({
- @NamedQuery(name="deleteClientSessionsByRealm", query="delete from PersistentClientSessionEntity sess where sess.userSessionId IN (select u.userSessionId from PersistentUserSessionEntity u where u.realmId=:realmId)"),
- @NamedQuery(name="deleteClientSessionsByClient", query="delete from PersistentClientSessionEntity sess where sess.clientId=:clientId"),
- @NamedQuery(name="deleteClientSessionsByUser", query="delete from PersistentClientSessionEntity sess where sess.userSessionId IN (select u.userSessionId from PersistentUserSessionEntity u where u.userId=:userId)"),
- @NamedQuery(name="deleteClientSessionsByUserSession", query="delete from PersistentClientSessionEntity sess where sess.userSessionId=:userSessionId and sess.offline=:offline"),
+ @NamedQuery(name="deleteClientSessionsByRealm", query="delete from PersistentClientSessionEntity sess where sess.userSessionId IN (select u.userSessionId from PersistentUserSessionEntity u where u.realmId = :realmId)"),
+ @NamedQuery(name="deleteClientSessionsByClient", query="delete from PersistentClientSessionEntity sess where sess.clientId = :clientId"),
+ @NamedQuery(name="deleteClientSessionsByUser", query="delete from PersistentClientSessionEntity sess where sess.userSessionId IN (select u.userSessionId from PersistentUserSessionEntity u where u.userId = :userId)"),
+ @NamedQuery(name="deleteClientSessionsByUserSession", query="delete from PersistentClientSessionEntity sess where sess.userSessionId = :userSessionId and sess.offline = :offline"),
@NamedQuery(name="deleteDetachedClientSessions", query="delete from PersistentClientSessionEntity sess where sess.userSessionId NOT IN (select u.userSessionId from PersistentUserSessionEntity u)"),
- @NamedQuery(name="findClientSessionsByUserSession", query="select sess from PersistentClientSessionEntity sess where sess.userSessionId=:userSessionId and sess.offline=:offline"),
- @NamedQuery(name="findClientSessionsByUserSessions", query="select sess from PersistentClientSessionEntity sess where sess.offline=:offline and sess.userSessionId IN (:userSessionIds) order by sess.userSessionId"),
- @NamedQuery(name="updateClientSessionsTimestamps", query="update PersistentClientSessionEntity c set timestamp=:timestamp"),
+ @NamedQuery(name="findClientSessionsByUserSession", query="select sess from PersistentClientSessionEntity sess where sess.userSessionId=:userSessionId and sess.offline = :offline"),
+ @NamedQuery(name="findClientSessionsByUserSessions", query="select sess from PersistentClientSessionEntity sess where sess.offline = :offline and sess.userSessionId IN (:userSessionIds) order by sess.userSessionId"),
+ @NamedQuery(name="updateClientSessionsTimestamps", query="update PersistentClientSessionEntity c set timestamp = :timestamp"),
})
@Table(name="OFFLINE_CLIENT_SESSION")
@Entity
@@ -45,8 +45,8 @@ public class PersistentClientSessionEntity {
protected int timestamp;
@Id
- @Column(name = "OFFLINE")
- protected boolean offline;
+ @Column(name = "OFFLINE_FLAG")
+ protected String offline;
@Column(name="DATA")
protected String data;
@@ -83,11 +83,11 @@ public class PersistentClientSessionEntity {
this.timestamp = timestamp;
}
- public boolean isOffline() {
+ public String getOffline() {
return offline;
}
- public void setOffline(boolean offline) {
+ public void setOffline(String offline) {
this.offline = offline;
}
@@ -103,12 +103,12 @@ public class PersistentClientSessionEntity {
protected String clientSessionId;
- protected boolean offline;
+ protected String offline;
public Key() {
}
- public Key(String clientSessionId, boolean offline) {
+ public Key(String clientSessionId, String offline) {
this.clientSessionId = clientSessionId;
this.offline = offline;
}
@@ -117,7 +117,7 @@ public class PersistentClientSessionEntity {
return clientSessionId;
}
- public boolean isOffline() {
+ public String getOffline() {
return offline;
}
@@ -129,7 +129,7 @@ public class PersistentClientSessionEntity {
Key key = (Key) o;
if (this.clientSessionId != null ? !this.clientSessionId.equals(key.clientSessionId) : key.clientSessionId != null) return false;
- if (offline != key.offline) return false;
+ if (this.offline != null ? !this.offline.equals(key.offline) : key.offline != null) return false;
return true;
}
@@ -137,7 +137,7 @@ public class PersistentClientSessionEntity {
@Override
public int hashCode() {
int result = this.clientSessionId != null ? this.clientSessionId.hashCode() : 0;
- result = 31 * result + (offline ? 1 : 0);
+ result = 31 * result + (this.offline != null ? this.offline.hashCode() : 0);
return result;
}
}
diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentUserSessionEntity.java b/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentUserSessionEntity.java
index f56284c..abc581b 100644
--- a/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentUserSessionEntity.java
+++ b/model/jpa/src/main/java/org/keycloak/models/jpa/session/PersistentUserSessionEntity.java
@@ -22,12 +22,12 @@ import org.keycloak.models.jpa.entities.UserEntity;
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@NamedQueries({
- @NamedQuery(name="deleteUserSessionsByRealm", query="delete from PersistentUserSessionEntity sess where sess.realmId=:realmId"),
- @NamedQuery(name="deleteUserSessionsByUser", query="delete from PersistentUserSessionEntity sess where sess.userId=:userId"),
+ @NamedQuery(name="deleteUserSessionsByRealm", query="delete from PersistentUserSessionEntity sess where sess.realmId = :realmId"),
+ @NamedQuery(name="deleteUserSessionsByUser", query="delete from PersistentUserSessionEntity sess where sess.userId = :userId"),
@NamedQuery(name="deleteDetachedUserSessions", query="delete from PersistentUserSessionEntity sess where sess.userSessionId NOT IN (select c.userSessionId from PersistentClientSessionEntity c)"),
- @NamedQuery(name="findUserSessionsCount", query="select count(sess) from PersistentUserSessionEntity sess where sess.offline=:offline"),
- @NamedQuery(name="findUserSessions", query="select sess from PersistentUserSessionEntity sess where sess.offline=:offline order by sess.userSessionId"),
- @NamedQuery(name="updateUserSessionsTimestamps", query="update PersistentUserSessionEntity c set lastSessionRefresh=:lastSessionRefresh"),
+ @NamedQuery(name="findUserSessionsCount", query="select count(sess) from PersistentUserSessionEntity sess where sess.offline = :offline"),
+ @NamedQuery(name="findUserSessions", query="select sess from PersistentUserSessionEntity sess where sess.offline = :offline order by sess.userSessionId"),
+ @NamedQuery(name="updateUserSessionsTimestamps", query="update PersistentUserSessionEntity c set lastSessionRefresh = :lastSessionRefresh"),
})
@Table(name="OFFLINE_USER_SESSION")
@@ -49,8 +49,8 @@ public class PersistentUserSessionEntity {
protected int lastSessionRefresh;
@Id
- @Column(name = "OFFLINE")
- protected boolean offline;
+ @Column(name = "OFFLINE_FLAG")
+ protected String offline;
@Column(name="DATA")
protected String data;
@@ -87,11 +87,11 @@ public class PersistentUserSessionEntity {
this.lastSessionRefresh = lastSessionRefresh;
}
- public boolean isOffline() {
+ public String getOffline() {
return offline;
}
- public void setOffline(boolean offline) {
+ public void setOffline(String offline) {
this.offline = offline;
}
@@ -107,12 +107,12 @@ public class PersistentUserSessionEntity {
protected String userSessionId;
- protected boolean offline;
+ protected String offline;
public Key() {
}
- public Key(String userSessionId, boolean offline) {
+ public Key(String userSessionId, String offline) {
this.userSessionId = userSessionId;
this.offline = offline;
}
@@ -121,7 +121,7 @@ public class PersistentUserSessionEntity {
return userSessionId;
}
- public boolean isOffline() {
+ public String getOffline() {
return offline;
}
@@ -133,7 +133,7 @@ public class PersistentUserSessionEntity {
Key key = (Key) o;
if (this.userSessionId != null ? !this.userSessionId.equals(key.userSessionId) : key.userSessionId != null) return false;
- if (offline != key.offline) return false;
+ if (this.offline != null ? !this.offline.equals(key.offline) : key.offline != null) return false;
return true;
}
@@ -141,7 +141,7 @@ public class PersistentUserSessionEntity {
@Override
public int hashCode() {
int result = this.userSessionId != null ? this.userSessionId.hashCode() : 0;
- result = 31 * result + (offline ? 1 : 0);
+ result = 31 * result + (this.offline != null ? this.offline.hashCode() : 0);
return result;
}
}