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:
Stian Thorgersen 2014-07-15 15:47:10 +01:00
parent e4b3007ce2
commit 3451778f48
14 changed files with 34 additions and 11 deletions

View file

@ -11,6 +11,7 @@ import javax.persistence.Id;
public class EventEntity {
@Id
@Column(length = 36)
private String id;
private long time;

View file

@ -1,11 +1,12 @@
package org.keycloak.models.jpa.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.annotations.GenericGenerator;
/**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
@ -13,6 +14,7 @@ import javax.persistence.Id;
public class AuthenticationLinkEntity {
@Id
@Column(length = 36)
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
@GeneratedValue(generator = "keycloak_generator")
private String id;

View file

@ -21,6 +21,7 @@ import java.util.Map;
public class AuthenticationProviderEntity {
@Id
@Column(length = 36)
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
@GeneratedValue(generator = "keycloak_generator")
protected String id;

View file

@ -24,6 +24,7 @@ import java.util.Set;
@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"realm", "name"})})
public abstract class ClientEntity {
@Id
@Column(length = 36)
private String id;
@Column(name = "name")
private String name;

View file

@ -1,7 +1,6 @@
package org.keycloak.models.jpa.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
@ -10,6 +9,8 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import org.hibernate.annotations.GenericGenerator;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
@ -20,6 +21,7 @@ import javax.persistence.NamedQuery;
@Entity
public class CredentialEntity {
@Id
@Column(length = 36)
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
@GeneratedValue(generator = "keycloak_generator")
protected String id;

View file

@ -33,6 +33,7 @@ import java.util.Set;
})
public class RealmEntity {
@Id
@Column(length = 36)
protected String id;
@Column(unique = true)

View file

@ -1,11 +1,12 @@
package org.keycloak.models.jpa.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.annotations.GenericGenerator;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
@ -13,6 +14,7 @@ import javax.persistence.Id;
@Entity
public class RequiredCredentialEntity {
@Id
@Column(length = 36)
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
@GeneratedValue(generator = "keycloak_generator")
protected String id;

View file

@ -30,7 +30,7 @@ import java.util.Collection;
public class RoleEntity {
@Id
@Column(name="id")
@Column(name="id", length = 36)
private String id;
private String name;
@ -51,6 +51,7 @@ public class RoleEntity {
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
@Column(length = 36)
private String appRealmConstraint;
@ManyToMany(fetch = FetchType.LAZY, cascade = {})

View file

@ -2,6 +2,7 @@ package org.keycloak.models.jpa.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
@ -23,6 +24,7 @@ import javax.persistence.NamedQuery;
@Entity
public class ScopeMappingEntity {
@Id
@Column(length = 36)
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
@GeneratedValue(generator = "keycloak_generator")
protected String id;

View file

@ -1,7 +1,6 @@
package org.keycloak.models.jpa.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
@ -10,6 +9,8 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import org.hibernate.annotations.GenericGenerator;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
@ -22,6 +23,7 @@ import javax.persistence.NamedQuery;
@Entity
public class SocialLinkEntity {
@Id
@Column(length = 36)
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
@GeneratedValue(generator = "keycloak_generator")
private String id;

View file

@ -44,6 +44,7 @@ import java.util.Set;
})
public class UserEntity {
@Id
@Column(length = 36)
protected String id;
protected String username;

View file

@ -1,7 +1,6 @@
package org.keycloak.models.jpa.entities;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
@ -11,6 +10,8 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import org.hibernate.annotations.GenericGenerator;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
@ -23,6 +24,7 @@ import javax.persistence.NamedQuery;
@Entity
public class UserRoleMappingEntity {
@Id
@Column(length = 36)
@GenericGenerator(name="keycloak_generator", strategy="org.keycloak.models.jpa.utils.JpaIdGenerator")
@GeneratedValue(generator = "keycloak_generator")
protected String id;

View file

@ -1,5 +1,6 @@
package org.keycloak.models.sessions.jpa.entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
@ -30,6 +31,7 @@ public class ClientUserSessionAssociationEntity {
protected UserSessionEntity session;
@Id
@Column(length = 36)
protected String clientId;
public UserSessionEntity getSession() {

View file

@ -1,5 +1,6 @@
package org.keycloak.models.sessions.jpa.entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
@ -21,9 +22,11 @@ import java.io.Serializable;
public class UsernameLoginFailureEntity {
@Id
@Column(length = 200)
protected String username;
@Id
@Column(length = 36)
protected String realmId;
protected int failedLoginNotBefore;