如何在Spring Data Neo4j中保存一个角色

时间:2015-10-09 06:37:47

标签: spring-security neo4j char spring-data spring-data-neo4j

我有NodeEntityAutorizationPermission

public class AutorizationPermission extends BasePermission {
    public static final Permission READ = new AutorizationPermission(1 << 0,'R'); // 1
    public static final Permission WRITE = new AutorizationPermission(1 << 1, 'W'); // 2
    public static final Permission CREATE = new AutorizationPermission(1 << 2, 'C'); // 4
    public static final Permission DELETE = new AutorizationPermission(1 << 3, 'D'); // 8
    public static final Permission ADMINISTRATION = new AutorizationPermission(1 << 4, 'A'); // 16

protected AutorizationPermission(int mask) {
    super(mask);
}


protected AutorizationPermission(int mask, char code) {
    super(mask, code);
}


public AutorizationPermission() {
    super(0);
}

}

但是持久保存与另一个NodeEntity相关的实体 出现以下错误

java.lang.RuntimeException: Unsupported value type class java.lang.Character. Supported value types are all java primitives (byte, char, short, int, long, float
, double) and String, as well as arrays of all those types.....

Associated @NodeEntity类是

@NodeEntity
@JsonSerialize(using=DesignationSerializer.class)
@JsonDeserialize(using=DesignationDeserializer.class)
public class Role{

    @GraphId
    private Long id;


@RelatedTo(type="ROLE_PERMISSIONS", direction=Direction.OUTGOING)
    @Fetch
    private Set<AutorizationPermission> authPermissions=new HashSet<AutorizationPermission>();

    public Set<AutorizationPermission> getAuthPermissions() {
        return this.authPermissions;
    }

    public void setAuthPermissions(Set<AutorizationPermission> authPermissions) {
        this.authPermissions=authPermissions;
    }




}

0 个答案:

没有答案