Hello,

In a Maven Web application, NetBeans 12.1, Windows 10.

Alt-Insert "Use an Entity Manager..." in an EJB stateless inserts code for a bean managed transaction, even if the transaction is managed by the container.

Code inserted:

  @PersistenceContext(unitName = "customerPU")
  private EntityManager em;
  @Resource
  private javax.transaction.UserTransaction utx;

  public void persist(Object object) {
    try {
      utx.begin();
      em.persist(object);
      utx.commit();
    } catch (Exception e) {
      Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", e);
      throw new RuntimeException(e);
    }
  }

Code that should have been inserted:

@PersistenceContext(unitName = "customerPU")
  private EntityManager em;

public void persist(Object object) {
  em.persist(object);
}

This is a regression. It worked in older versions of NetBeans but I can't remember which ones.

Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to