KEYCLOAK-554 Fix for MySQL 5.1. Set length of keys to 36 for uuid's or 200 for others
This commit is contained in:
parent
e4b3007ce2
commit
3451778f48
14 changed files with 34 additions and 11 deletions
|
@ -11,6 +11,7 @@ import javax.persistence.Id;
|
||||||
public class EventEntity {
|
public class EventEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private long time;
|
private long time;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package org.keycloak.models.jpa.entities;
|
package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||||
*/
|
*/
|
||||||
|
@ -13,6 +14,7 @@ import javax.persistence.Id;
|
||||||
public class AuthenticationLinkEntity {
|
public class AuthenticationLinkEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Map;
|
||||||
public class AuthenticationProviderEntity {
|
public class AuthenticationProviderEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Set;
|
||||||
@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"realm", "name"})})
|
@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"realm", "name"})})
|
||||||
public abstract class ClientEntity {
|
public abstract class ClientEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
private String id;
|
private String id;
|
||||||
@Column(name = "name")
|
@Column(name = "name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.keycloak.models.jpa.entities;
|
package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -10,6 +9,8 @@ import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
|
@ -20,6 +21,7 @@ import javax.persistence.NamedQuery;
|
||||||
@Entity
|
@Entity
|
||||||
public class CredentialEntity {
|
public class CredentialEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Set;
|
||||||
})
|
})
|
||||||
public class RealmEntity {
|
public class RealmEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
||||||
@Column(unique = true)
|
@Column(unique = true)
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package org.keycloak.models.jpa.entities;
|
package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
|
@ -13,6 +14,7 @@ import javax.persistence.Id;
|
||||||
@Entity
|
@Entity
|
||||||
public class RequiredCredentialEntity {
|
public class RequiredCredentialEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class RoleEntity {
|
public class RoleEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name="id")
|
@Column(name="id", length = 36)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -51,6 +51,7 @@ public class RoleEntity {
|
||||||
private ApplicationEntity application;
|
private ApplicationEntity application;
|
||||||
|
|
||||||
// Hack to ensure that either name+application or name+realm are unique. Needed due to MS-SQL as it don't allow multiple NULL values in the column, which is part of constraint
|
// Hack to ensure that either name+application or name+realm are unique. Needed due to MS-SQL as it don't allow multiple NULL values in the column, which is part of constraint
|
||||||
|
@Column(length = 36)
|
||||||
private String appRealmConstraint;
|
private String appRealmConstraint;
|
||||||
|
|
||||||
@ManyToMany(fetch = FetchType.LAZY, cascade = {})
|
@ManyToMany(fetch = FetchType.LAZY, cascade = {})
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -23,6 +24,7 @@ import javax.persistence.NamedQuery;
|
||||||
@Entity
|
@Entity
|
||||||
public class ScopeMappingEntity {
|
public class ScopeMappingEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.keycloak.models.jpa.entities;
|
package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -10,6 +9,8 @@ import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
|
@ -22,6 +23,7 @@ import javax.persistence.NamedQuery;
|
||||||
@Entity
|
@Entity
|
||||||
public class SocialLinkEntity {
|
public class SocialLinkEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
|
@ -44,6 +44,7 @@ import java.util.Set;
|
||||||
})
|
})
|
||||||
public class UserEntity {
|
public class UserEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
||||||
protected String username;
|
protected String username;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.keycloak.models.jpa.entities;
|
package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -11,6 +10,8 @@ import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
|
@ -23,6 +24,7 @@ import javax.persistence.NamedQuery;
|
||||||
@Entity
|
@Entity
|
||||||
public class UserRoleMappingEntity {
|
public class UserRoleMappingEntity {
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
protected String id;
|
protected String id;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.keycloak.models.sessions.jpa.entities;
|
package org.keycloak.models.sessions.jpa.entities;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
@ -30,6 +31,7 @@ public class ClientUserSessionAssociationEntity {
|
||||||
protected UserSessionEntity session;
|
protected UserSessionEntity session;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
protected String clientId;
|
protected String clientId;
|
||||||
|
|
||||||
public UserSessionEntity getSession() {
|
public UserSessionEntity getSession() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.keycloak.models.sessions.jpa.entities;
|
package org.keycloak.models.sessions.jpa.entities;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.IdClass;
|
import javax.persistence.IdClass;
|
||||||
|
@ -21,9 +22,11 @@ import java.io.Serializable;
|
||||||
public class UsernameLoginFailureEntity {
|
public class UsernameLoginFailureEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 200)
|
||||||
protected String username;
|
protected String username;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@Column(length = 36)
|
||||||
protected String realmId;
|
protected String realmId;
|
||||||
|
|
||||||
protected int failedLoginNotBefore;
|
protected int failedLoginNotBefore;
|
||||||
|
|
Loading…
Reference in a new issue