xhtml: <h:form> <rich:dataTable value="#{action.contracts}" var="c"> <h:column> <h:inputText value="#{c.name}" /> </h:column> </rich:dataTable> <h:commandButton action="#{action.save()}" value="save" /> </h:form> Action.java @Name("action") @Scope(ScopeType.CONVERSATION) public class Action { @In private EntityManager em; @DataModel private List<contract> contracts; @Create @Begin public void create(){ this.contracts = findAllConracts(); } public void findAllContracts() { em.createQuery("from Contract ").getResultList(); } @End public void save() { ;//I don't do anything here } } I edit the name and press save button, the new names were saved to the database. But I didn't do anything like "em.merge(..)", how can it save it? Does seam save datamodel automatically ?
When you submit the form with the h:commandButton the updated values are applied to the model. If you don't want them saved you can look into setting the flushMode to manual.
Cheers,
Damian.