Fri Aug 06, 2010 9:40 am
...
@Entity
@Table(name="identity")
@SecondaryTable(name = "identity_history", pkJoinColumns = @PrimaryKeyJoinColumn(name = "dbId"))
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
public class Identity
{
// Identity and Version Fields
@Id
@GeneratedValue
@XmlTransient
private int dbId;
@XmlElement(name = "identity-id")
@Transient
private String xmlId;
@Version
@XmlTransient
private int version;
// Data Fields
@Embedded
@AttributeOverrides({
@AttributeOverride(name="attribute", column=@Column(name="username_attribute")),
@AttributeOverride(name="versionNumber",column=@Column(name="username_versionNumber"))
})
private VersionedAttribute<String> username;
@Embedded
@AttributeOverrides({
@AttributeOverride(name="attribute", column=@Column(name="password_attribute")),
@AttributeOverride(name="versionNumber",column=@Column(name="password_versionNumber"))
})
private VersionedAttribute<String> password;
@Embedded
@AttributeOverrides({
@AttributeOverride(name="attribute", column=@Column(name="isRevoked_attribute")),
@AttributeOverride(name="versionNumber",column=@Column(name="isRevoked_versionNumber"))
})
private VersionedAttribute<Boolean> isRevoked;
@Embedded
@AttributeOverrides({
@AttributeOverride(name="attribute", column=@Column(name="revocationReason_attribute")),
@AttributeOverride(name="versionNumber",column=@Column(name="revocationReason_versionNumber"))
})
private VersionedAttribute<String> revocationReason;
...
}
@Embeddable
public class VersionedAttribute<T>
{
private String versionNumber;
private T attribute;
public VersionedAttribute()
{
}
public VersionedAttribute(String versionNumber, T attribute)
{
super();
this.versionNumber = versionNumber;
this.attribute = attribute;
}
...
}
Sat Aug 07, 2010 12:33 am
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.