5 Replies Latest reply on Oct 12, 2007 2:37 PM by Pete Muir

    EntityHome and EntityQuery difference/problem

    Dimitar Nikolov Newbie

      Note that this topic isn't about the difference between EntityHome and EntityQuery in general, but about the different behavior I get when I put a certain bit of functionality in classes extending these two.

      So, my setup:

      I followed ch 1 of the seam tutorial and put in a @DataModel and a @DataModelSelection on a data table so I can detect which row is selected.

      I set up the table so that if the current row is selected inputText elements are shown so a user can edit the information in the row. Otherwise outputText elements are rendered.

      On each row I also have an edit commandLink that is wired to a method that does something like this:

      public String edit() {
       if(!this.selectionItem.getSelected()) {
       return null;

      I also have a save button on each row that does something like:
      public String save() {
       EntityObj obj = this.selectionItem.getEntityObj();
       EntityManager em = this.getEntityManager();
       return null;

      This seems to work fine in a class extending EntityHome (provided that in the save function I set the current instance to obj and then do persist on the current instance), but it doesn't work in the class extending entity query.

      Tracing through this shows that after the user edits the input boxes and the save function is called, the EntityObj gotten from this.selectionItem.getEntityObj() has the values that were there before the user edit.

      selectionItem is the @DataItemSelection of course.

      So.. any ideas why this works in one class and not in another? I am using the pages generated by seamgen to test this: I use a ___Edit.xhtml page with the ___Home.java, and a ___List.xhtml with the ___List.java.

      Any feedback is greatly appreciated.