【发布时间】:2015-07-09 00:36:11
【问题描述】:
我正在尝试将 Seam 2 应用程序迁移到 CDI 并使用 PicketLink 来确保安全。经过所有的阅读和研究,似乎所有示例在 PicketLink 模型和后端实体之间都有一对一映射。例如帐户到 AccountEntity,分区到 PartitionEntity。由于我已经有了代表身份模型的实体,所以我一直试图将它们映射到 PicketLink。这是我所拥有的:
@MappedSuperClass
public class ModelEntityBase implement Serializable {
@Id @Generated
Long id;
Date creationDate;
}
@Entity
public Account extends ModelEntityBase {
String username;
String passwordHash;
@OneToOne(mappedBy = "account")
Person person;
}
@Entity
public Person extends ModelEntityBase {
String name;
String email;
@OneToOne
@JoinColumn(name = "account_id")
Account account;
}
在 PicketLink 中表示单个身份模型的两个实体(加上一个超类),例如立体类型用户。
基于这个why IdentityType id is String not Long,我尝试在以下位置添加一个新实体:
@Entity
@IdentityManaged(BaseIdentityType.class);
public class IdentityTypeEntity implement Serializble {
@Id @Identifier
private String id;
@OneToOne(optional = false, mappedBy = "identityType")
@OwnerReference
private Account account;
@IdentityClass
private String typeName;
@ManyToOne @OwnerReference
private PartitionEntity partition;
}
我尝试了几种不同的方法来处理注解和模型类。但是当使用 IdentityManager.add(myUserModel) 时,我无法让它填充所有实体。这甚至可能吗?
【问题讨论】:
标签: jpa picketlink