Hi,
My classess are

@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class Type implements Serializable {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;

        @Persistent
        private String name;

        @Persistent(mappedBy = "type")
        @Element(dependent = "true")
        private List<Product> products = new ArrayList<Product>();
        //getter-setter
}
and
@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
public class Product implements Serializable {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;

        @Persistent
        private String name;

        @Persistent(defaultFetchGroup = "true")
        private Type type;
        //getter-setter
}

when adding a product to type, ı am using
                                PersistenceManager pm =
PMF.get().getPersistenceManager();
                                try {
                                        Product product = new
Product("Sample product");
                                        Type type = 
pm.getObjectById(Type.class, selected.getKey());
                                        type.getProducts().add(product);
                                        pm.makePersistent(type);
                                } finally {
                                        pm.close();
                                }
is working and adding a product to type
I am using this code when i want to change type of product

                                PersistenceManager pm =
PMF.get().getPersistenceManager();
                                try {
                                        Product product =
pm.getObjectById(Product.class, currentProduct.getKey());
                                        Type type = 
pm.getObjectById(Type.class, selectedType.getKey());
                                        product.setType(type);
                                        pm.makePersistent(product);
                                } finally {
                                        pm.close();
                                }

But it's not working and no throws any error. How can i update Type of
Product

Thanks
Ertan


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

Reply via email to