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?

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top