Reputation: 845
@SessionScoped
public SessionClass{
// Buyer is a view scoped class
private List<Buyer> sessionObject = new ArrayList<Buyer>();
}
When updating a input field buyer.fname. The list is also updated. Should I change the Buyer class to session scope also.
Upvotes: 0
Views: 205
Reputation: 1109542
This has nothing to do with JSF scopes, but everything with the object oriented nature of Java. Apparently the view scoped Buyer
instance represents exactly the same reference as the item in the list of the session scoped bean (it's however beyond me how you coded it like that; it would have been explainable if Buyer
is actually a JPA entity).
You should be creating a copy of the Buyer
instance instead or detach the entity if it's indeed a JPA entity.
Upvotes: 1