6.6. Using an "explicit" conversation id
Ordinarily, Seam generates a meaningless unique id for each conversation in each session. You can customize the id value when you begin the conversation.
This feature can be used to customize the conversation id generation algorithm like so:
@Begin(id="#{myConversationIdGenerator.nextId}")
public void editHotel() { ... }
Or it can be used to assign a meaningful conversation id:
@Begin(id="hotel#{hotel.id}")
public String editHotel() { ... }
@Begin(id="hotel#{hotelsDataModel.rowData.id}")
public String selectHotel() { ... }
@Begin(id="entry#{params['blogId']}")
public String viewBlogEntry() { ... }
@BeginTask(id="task#{taskInstance.id}")
public String approveDocument() { ... }
Clearly, these example result in the same conversation id every time a particular hotel, blog or task is selected. So what happens if a conversation with the same conversation id already exists when the new conversation begins? Well, Seam detects the existing conversation and redirects to that conversation without running the @Begin
method again. This feature helps control the number of workspaces that are created when using workspace management.