Adding order columns to persistence schema

This commit is contained in:
Martin Stockhammer 2016-09-30 22:38:08 +02:00
parent f3bcedfdf8
commit 30c3441cd4
3 changed files with 14 additions and 2 deletions

View File

@ -425,6 +425,7 @@ public class JpaRbacManager extends AbstractRBACManager {
em.remove(ua);
}
em.getTransaction().commit();
em.clear();
}

View File

@ -21,6 +21,7 @@ package org.apache.archiva.redback.rbac.jpa.model;
import org.apache.archiva.redback.rbac.AbstractRole;
import org.apache.archiva.redback.rbac.Permission;
import org.springframework.core.annotation.Order;
import javax.persistence.*;
import java.io.Serializable;
@ -46,6 +47,7 @@ public class JpaRole extends AbstractRole implements Serializable {
@Column(name="PERMANENT")
private boolean permanent;
@ManyToMany(cascade = CascadeType.PERSIST)
@OrderColumn(name="INTEGER_IDX")
@JoinTable(
name="SECURITY_ROLE_PERMISSION_MAP",
joinColumns={ @JoinColumn(name="NAME_OID", referencedColumnName="NAME") },
@ -56,6 +58,7 @@ public class JpaRole extends AbstractRole implements Serializable {
List<JpaPermission> permissions = new ArrayList<JpaPermission>();
@ElementCollection
@OrderColumn(name="INTEGER_IDX")
@CollectionTable(
name="SECURITY_ROLE_CHILDROLE_MAP",
joinColumns = {

View File

@ -21,7 +21,14 @@ package org.apache.archiva.redback.rbac.jpa.model;
import org.apache.archiva.redback.rbac.AbstractUserAssignment;
import javax.persistence.*;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -39,8 +46,9 @@ public class JpaUserAssignment extends AbstractUserAssignment implements Seriali
private String principal;
@ElementCollection
@Column(name="STRING_ELE")
@OrderColumn(name="INTEGER_IDX")
@CollectionTable(
name="SECURITY_USERASSIGNMENT_MAP",
name="SECURITY_USERASSIGNMENT_ROLENAMES",
joinColumns = {
@JoinColumn(name = "PRINCIPAL_OID", referencedColumnName = "PRINCIPAL")
}