Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @XmlRootElement
- @XmlAccessorType(XmlAccessType.FIELD)
- public class Person implements Serializable {
- @Id
- private Long id;
- private String name;
- @OneToOne(mappedBy="marriedTo")
- @XmlIDREF
- private Person marriedTo;
- @ManyToOne
- @XmlIDREF
- // For the sake of simplicity, Persons only have one parent
- private Person parent;
- @OneToMany(mappedBy="parent")
- @XmlElement
- @XmlIDREF
- private List<Person> children;
- public Person() {
- }
- public Person(Long id, String name) {
- this.id = id;
- this.name = name;
- }
- @XmlID
- private String getStringId() {
- return Long.toString(id);
- }
- // OTHER GETTERS AND SETTERS
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement