KEYCLOAK-536 Fix Sybase - role can't be used as column name as it's keyword in sybase
This commit is contained in:
parent
5d8c803da6
commit
19a545049b
5 changed files with 9 additions and 3 deletions
|
@ -142,7 +142,7 @@ public class ApplicationAdapter extends ClientAdapter implements ApplicationMode
|
||||||
|
|
||||||
applicationEntity.getRoles().remove(role);
|
applicationEntity.getRoles().remove(role);
|
||||||
applicationEntity.getDefaultRoles().remove(role);
|
applicationEntity.getDefaultRoles().remove(role);
|
||||||
em.createNativeQuery("delete from CompositeRole where role = :role").setParameter("role", role).executeUpdate();
|
em.createNativeQuery("delete from CompositeRole where childRole = :role").setParameter("role", role).executeUpdate();
|
||||||
em.createQuery("delete from " + ScopeMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", role).executeUpdate();
|
em.createQuery("delete from " + ScopeMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", role).executeUpdate();
|
||||||
em.createQuery("delete from " + UserRoleMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", role).executeUpdate();
|
em.createQuery("delete from " + UserRoleMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", role).executeUpdate();
|
||||||
role.setApplication(null);
|
role.setApplication(null);
|
||||||
|
|
|
@ -928,7 +928,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
realm.getRoles().remove(role);
|
realm.getRoles().remove(role);
|
||||||
realm.getDefaultRoles().remove(role);
|
realm.getDefaultRoles().remove(role);
|
||||||
|
|
||||||
em.createNativeQuery("delete from CompositeRole where role = :role").setParameter("role", roleEntity).executeUpdate();
|
em.createNativeQuery("delete from CompositeRole where childRole = :role").setParameter("role", roleEntity).executeUpdate();
|
||||||
em.createQuery("delete from " + UserRoleMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", roleEntity).executeUpdate();
|
em.createQuery("delete from " + UserRoleMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", roleEntity).executeUpdate();
|
||||||
em.createQuery("delete from " + ScopeMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", roleEntity).executeUpdate();
|
em.createQuery("delete from " + ScopeMappingEntity.class.getSimpleName() + " where role = :role").setParameter("role", roleEntity).executeUpdate();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.keycloak.models.jpa.entities;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
|
|
||||||
|
@ -20,7 +21,9 @@ public class AbstractRoleMappingEntity {
|
||||||
protected String id;
|
protected String id;
|
||||||
@ManyToOne(fetch= FetchType.LAZY)
|
@ManyToOne(fetch= FetchType.LAZY)
|
||||||
protected UserEntity user;
|
protected UserEntity user;
|
||||||
|
|
||||||
@ManyToOne(fetch= FetchType.LAZY)
|
@ManyToOne(fetch= FetchType.LAZY)
|
||||||
|
@JoinColumn(name="roleId")
|
||||||
protected RoleEntity role;
|
protected RoleEntity role;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class RoleEntity {
|
||||||
private String appRealmConstraint;
|
private String appRealmConstraint;
|
||||||
|
|
||||||
@ManyToMany(fetch = FetchType.LAZY, cascade = {})
|
@ManyToMany(fetch = FetchType.LAZY, cascade = {})
|
||||||
@JoinTable(name = "CompositeRole", joinColumns = @JoinColumn(name = "composite"), inverseJoinColumns = @JoinColumn(name = "role"))
|
@JoinTable(name = "CompositeRole", joinColumns = @JoinColumn(name = "composite"), inverseJoinColumns = @JoinColumn(name = "childRole"))
|
||||||
private Collection<RoleEntity> compositeRoles = new ArrayList<RoleEntity>();
|
private Collection<RoleEntity> compositeRoles = new ArrayList<RoleEntity>();
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
@ -27,7 +28,9 @@ public class ScopeMappingEntity {
|
||||||
protected String id;
|
protected String id;
|
||||||
@ManyToOne(fetch= FetchType.LAZY)
|
@ManyToOne(fetch= FetchType.LAZY)
|
||||||
protected ClientEntity client;
|
protected ClientEntity client;
|
||||||
|
|
||||||
@ManyToOne(fetch= FetchType.LAZY)
|
@ManyToOne(fetch= FetchType.LAZY)
|
||||||
|
@JoinColumn(name="roleId")
|
||||||
protected RoleEntity role;
|
protected RoleEntity role;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
Loading…
Reference in a new issue