is there any solution for this problem?

On Thu, Dec 31, 2009 at 8:46 PM, Kemal Dogan <[email protected]> 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")
>   �[email protected](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 [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