Question

I am using a @ConversationScoped CDI to manage my form. Now, when loading a page, the entity is searched using JPA. I bind this entity directly onto my bean and accessing is like:

<h:inputText value=#{myForm.myEntity.name}/>

The problem is that it seems to be managed all the time, even if I do a

em.detach(myEntity);
myForm.myEntity = myEntity;

when binding the entity to my bean. Without a merge, the entity is updated in the underlying database.

What's going on there? Do I really need a deep copy of my object?

Is this probably an erroneous way to use CDI beans?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top