Background:

I am using app engine 1.5 and GWT 2.3 with requestfactory. I have an
inventory object that has an ArrayList of InventoryItems. I can
update  and add entitites to the ArrayList collection without issue.
Now I am trying to update a single InventoryItem object and it appears
to complete successfully but the data is not updated. There is no
exception being thrown and I see the the updated client values just
before persisting the object. I have verified that the transaction is
successful. Is there something I am missing? I have also tried to add
a function in the Inventory class to update an InventoryItem and after
mark the inventoryItems dirty using JDOHelper.makeDirty(this,
inventoryItems) but this did not solve my issue either.



@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class Inventory {

  /**
   * List of all inventory items in this inventory.
   */
  @Persistent(mappedBy="inventory")
  @Element(dependent="true")
  private List<InventoryItem> inventoryItems;

  ... more
}



----------

@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class InventoryItem {

  public InventoryItem persist() {
    System.out.println("Persisting object with id " + this.getId());
    System.out.println("Price is " + this.getPrice().toString());
    PersistenceManager em = EntityManager.getPersistenceManager();
    InventoryItem attached = null;

    Transaction tx = em.currentTransaction();
    try {
      tx.begin();
      attached = em.makePersistent(this);
      tx.commit();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        if (tx.isActive()) {
          tx.rollback();
        }
      } finally {
        em.close();
      }
    }
    return attached;
  }


  /**
   * Primary key that can be used to reference this expense
   */
  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value
= "true")
  private String id;

  @Persistent Inventory inventory;

  .... more data
}



-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to