2 Replies Latest reply on Mar 11, 2009 12:10 PM by Marco Santos

    javax.persistence.TransactionRequiredException - no transaction is in progress

    Marco Santos Newbie

      Hello There.


      I'm having problems persiting an entity. From an action wich is a Seam component, everything runs fine. but from the following component i get the following execption:



      javax.persistence.TransactionRequiredException: no transaction is in progress

      The Seam component that raise the exception:


      @Name(value="pontonAdapter")
      @Scope(ScopeType.APPLICATION)
      @Startup
      public class PontonAdapter
      .....
          public void partnerAdded(String partnerId, String displayName, boolean isLocalPartner) {
              System.out.print("PARTNER ADDED");
                      
              Partner newPartner = (Partner) Component.getInstance(Partner.class, true);
      
              newPartner.setPartnerId(partnerId);
              newPartner.setDisplayName(displayName);
              newPartner.setLocalPartner(isLocalPartner);
                      
              partnerHandler.save(newPartner);//--> call that raise exception
          }
      .....
      




      Name(value="partnerHandler")
      public class PartnerHandlerBean extends CommonHandlerBean implements PartnerHandler {
              @In
              private EntityManager entityManager;
              public void save(Partner partner) {
                      partner.setUuid(this.generateUUID());
                      
                      entityManager.persist(partner);
                      entityManager.flush(); //--> raise the exception
              }
      .......
      



      Thanks a lot for the help


      Best Regards / Os meus melhores cumprimentos


      Marco Santos