I am making a mini JSF project by using JPA about book store. There is a relationship with author and book. I mean a book could be written by multiple authors and an author can write books more than one.
I made(or tried to make) this relationship on java classes. But I am so confused about how to add a book with more than one writers. How to add them to database.
There are code parts that I have done so far. book.java :
public class Book {
    ...
@ManyToMany(cascade = CascadeType.ALL)
private List<Author> authorsOfBooks = new ArrayList<>();
    ...
 }
Writer.java:
public class Author {
    ...
    @ManyToMany(mappedBy = "authorsOfBooks")
    private List<Book> booksOfAuthor = new ArrayList<>();
    ...
    }
and books.xhtml:
 <p:panelGrid columns="2">   
 Book Name : <h:inputText value="#{BookBean.book.bookName}" />
 Author Names : <h:inputText value="#{BookBean.book.author}" />
 </p:panelGrid>
I am so confused about what should I do. Because "BookBean.book.author" is actually a list and I can not type and add data as a normal type.