Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7638155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:06:18+00:00 2026-05-31T08:06:18+00:00

While inside a not trasient conversation, I need to start a new conversation for

  • 0

While inside a not trasient conversation, I need to start a new conversation for the bean.

The case is the following: I have a jsf page with a cdi bean to handle creation and altering of an order. On the menu of the page there is an item which is “new Order”. So, when altering an Order, I need to click on “new Order” and the page must be refreshed with the new CID, and a new conversation scope. But if I try to do this, the conversation.getConverstaionId() always return the same value, even if I call conversation.end() and conversation.begin() first.

EDIT:

I have a page to edit an order. When clicking on a new button (of the menu), I want it to refresh and start a new conversation, to add a new order. So this button calls the method redirectToNewOrderPage(). But it has the problem described on the code and before.

@Named
@ConversationScoped
public class OrderEditBean implements Serializable {
    private static final long serialVersionUID = 1L;

    @Inject
    private Conversation conversation;

    [...]


    public void redirectToNewOrderPage() {
        String cid = createNewConversationId();
        setOrder(null);
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("/OrdersManager/restricted/orders/edit.xhtml?cid=" + cid);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private String createNewConversationId() {
        String oldConversationId = null;
        String newConversationId = null;
        oldConversationId = conversation.getId();

        if (!conversation.isTransient() && conversation.getId() != null) {
            conversation.end();
        }

        conversation.begin();
        newConversationId = conversation.getId();

        // **************
        // at this point newConversationId is equal to 
        // oldConversationId if the conversation was NOT transient.
        // **************

        return newConversationId;
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:06:20+00:00Added an answer on May 31, 2026 at 8:06 am

    What you are trying to do, does not work. The conversation scope in CDI is not as power as the one from Seam 2 (if that’s where you’re coming from).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two while loops running one after the other (not inside of each
In the following C# code snippet I have a ' while ' loop inside
I have some problems with controlling a while loop inside an event structure. Say
I have a nested while loop inside a foreach loop where I would like
I am wondering why the table variables inside while loop does not behave like
If a thread is interrupted while inside Object.wait() or Thread.join() , it throws an
I made a while loop inside a program and the program reaches the while
inside of while loop, i've used <asp:Button ID=<%=objReader.Item(0)%> OnClick=btn_Click runat=server CssClass=submit_button Text=Delete /> Sub
i am getting a problem while populating data inside the dropdown... I guess since
Is it possible to wait for user touch inside a while loop? I mean,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.