Как с помощью JaxB сделать ссылку от одного объекта на другой из другого .xml файла?

Имеется два .xml файла. Как сделать так, чтобы объекты ссылались друг на друга?

public class Author {

    private String name;
    private Publication publication;
    private static Books books = new Books();

    public Author() {
        super();
    }

    @XmlElement
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlElement
    @XmlIDREF
    public Publication getPublication() {
        return publication;
    }

    public void setPublication(Publication publication) {
        this.publication = publication;
    }
}
public class Publication {

    private String id;
    private String title;

    @XmlID
    @XmlElement
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @XmlElement
    public String getTitle() {
        return title;
    }
}
@XmlRootElement(name = "library")
public class Library {
    private List<Author> authors = new ArrayList<>();
    private List<Publication> publications = new ArrayList<>();

    public void setAuthors(List<Author> authors) {
        this.authors = authors;
    }

    @XmlElementWrapper
    @XmlElement(name = "authors")
    public List<Author> getAuthors() {
        if (authors == null) {
            authors = new ArrayList<>();
           }
        return authors;
    }
}
@XmlRootElement(name = "books")
public class Books {

    private List<Publication> publications = new ArrayList<>();

    public void setPublications(List<Publication> publications) {
    this.publications = publications;
}

    @XmlElementWrapper
    @XmlElement(name = "publications")
    public List<Publication> getPublications() {
        if (publications == null) {
            publications = new ArrayList<>();
         }
        return publications;
    }
}
<library>
    <authors>
        <authors>
            <name>Natasha</name>
            <publication>12</publication>
        </authors>
        <authors>
            <name>Mark</name>
            <publication>24</publication>
        </authors>
    </authors>
</library>
<books>
    <publications>
        <publications>
            <id>12</id>
            <title>Death on the Nile</title>
        </publications>
        <publications>
            <id>24</id>
            <title>The murder of Roger Ackroyd</title>
        </publications>
    </publications>
</books>

Ответы (0 шт):