I have a h:commandButton with a rendered method that is getting executed twice. In the debugger, the method executes once then again - the conversation-scoped backing bean is the exact same instance both times, but the weird thing is that some changes I made the first time around are getting 'undone'.
What I do in the rendered method is first entityManager.merge(sessionScopedEntity) to bring the session-scoeped entity into conversation scope. After that statement is run, everything looks great in the debugger - for example, all collections for that entity now have a Session (rather than null) in the session.
When I resume execution in the debugger, the method gets executed again, though it's not referenced anywhere again! Except this time the session-scoped entity is back to being unmanaged! I was thinking maybe I should be outjecting any changes I made, but then I realized this is all happening within one conversation because its within one request, so there's no way these changes should be getting lost.
If I add a second h:commandButton tag with a rendered attribute pointing to the same method, that method now gets executed 4 times - twice per time its referenced in my xhtml file.