I decided to post the code. I just saw your comment about the "new entity ..."
and that does explain part of it (purchase not saved ) as you will see. That does not
explain why the changed entity (member) did not get saved. Member was injected in the
calling SLSB using SEAM and passed to this method.
If it is true that a new entity is not saved on exit that needs to be emphasized in
documentation. I started with the trailblazer and use the references. Maybe it is in
there but I never noticed it.
public @Stateless class PurchaseCreditsBean implements PurchaseCredits {
@PersistenceContext
EntityManager em;
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void purchaseCredits(Member member, int purchaseQty)
{
Purchase purchase = new Purchase();
purchase.setPurchasedCredits(purchaseQty);
member.setCredits(purchaseQty + member.getCredits());
purchase.setMember(member);
purchase.setPurchasedCredits(purchaseQty);
em.merge(purchase); // TODO should not have to call merge
em.merge(member);
}
}
Thanks, my assumption is the SEAM injected entity is behaving as if it is not attached to
my em as well. If this is the case I certainly misunderstood this. I bet many others
have been down this same path!
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116598#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...