I have a entity Artist
and this artist should have one or many Music
s.
When user click in "New Artist", can fill all fields for an artist (name, address, style and etc). This form is associated a managed bean called ArtistMB
. As I said, Artist
can have one or many Music
s, so inside this form user should click in "New Music" and be redirected to another page new_music.xhtml
, but the user has not saved Artist
in database yet, all content of ArtistMB
should be saved in memory for now, because when user finishes adding new Music
, this Music
will be added to a Set<Music>
inside Artist
bean, and after all this the Artist
bean will be saved in database.
How can I do it? If a use @ViewScoped
, then the state of ArtistMB
will be lost when I redirect to another page new_music.xhtml
.