Hi,
Say you have a Client Buying Card object and a product object. When the client chooses the buy opition you create the object and then add a product. It should be transactional but it's not on the same entity group as the product and the card already been persisted, isn't it? Is there any way to overcome this simple scenario safely and easily?
here's a code sample:
Transaction tx = pm.currentTransaction();
tx.begin();
Product prod = pm.getObjectById(Product.class, "TV");
prod.setReserved(true);
pm.makePersistent(prod);
Card card = pm.getObjectById(Card.class, "user123"); /// <--- will thorw an exception as card and prod aren't on the same entity group
card.setProd(prod);
pm.makePersistent(card);
try {
tx.commit();
break;
}