Hi Kemal, thanks for the report.  I can reproduce the exception and I can
make the exception go away by removing the column = "F_PK" attributes from
the @Persistent annotations.  I don't yet know why this is causing a problem
but overriding the name of a primary key column doesn't do anything (the
primary key is always mapped to the Entity key, not a named property on the
Entity), so removing them shouldn't hurt.

Max

On Thu, Jan 7, 2010 at 10:20 AM, Kemal Dogan <kemal.m...@gmail.com> wrote:

> is there any solution for this problem?
>
> On Thu, Dec 31, 2009 at 8:46 PM, Kemal Dogan <kemal.m...@gmail.com> wrote:
> > hi,
> > I have two entity with owned relation. Order is master entity and
> > OrderItem is child entity.
> > When I have to persist Order without OrderItem, but
> > it gives an exception (javax.jdo.JDOException: Unexpected error during
> > precommit) at commit line.
> >
> > But if I add an OrderItem instance to orderItemChilds, then it works.
> >
> > My sample code is at below, how can I solve this problem.
> > Please help.
> >
> > Kemal Dogan.
> >
> >
> > -----------------------------------------------
> > My Codes:
> >
> > Master Entity:
> > @PersistenceCapable(identityType = IdentityType.APPLICATION, table =
> > "T_Order", detachable = "true")
> > @Inheritance(customStrategy = "complete-table")
> > public class Order extends MasterEntityImpl {
> >
> >    @Persistent(mappedBy = "order")
> >    @Element(dependent = "true")
> >    @javax.jdo.annotations.Order(extensions = @Extension(vendorName =
> > "datanucleus", key = "list-ordering", value = "pk asc"))
> >    private List<OrderItem> orderItemChilds = new ArrayList();
> > ...
> > Child Entity:
> > @PersistenceCapable(identityType = IdentityType.APPLICATION, table =
> > "T_OrderItem", detachable = "true")
> > public class OrderItem extends ChildEntityImpl<Order> {
> >    @Persistent
> >    private Order order;
> > ...
> > DAO code:
> >    public void test_With_ERROR() {
> >        OrderDAO orderDAO = DAOFactory.getInstance().getOrderDAO();
> >        Order order= new Order();
> >        orderDAO.persist(order);
> >    }
> >    public void test_With_NO_ERROR() {
> >        OrderDAO orderDAO = DAOFactory.getInstance().getOrderDAO();
> >        Order order= new Order();
> >        List<OrderItem> orderItems= (List<OrderItem>)
> > order.getOrderItemChilds();
> >        OrderItem item= new OrderItem();
> >        orderItems.add(item);
> >        orderDAO.persist(order);
> >    }
> > .....
> >
> > Other abtract classes.
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable = "true")
> > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
> > public abstract class MasterEntityImpl implements MasterEntity<Key> {
> >    @PrimaryKey
> >    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY, column =
> "F_PK")
> >    private Key pk;
> > ...
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable = "true")
> > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
> > public abstract class ChildEntityImpl<T extends MasterEntity>
> > implements ChildEntity<T,Key> {
> >    @PrimaryKey
> >    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY, column =
> "F_PK")
> >    private Key pk;
> > ...
> >
>
> --
> 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
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>
>
--
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to