This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
1. Create a web project with GF 3.1 target 2. Create entities from database 3. Create REST services from these entities The wizard will generate the following in the REST service: protected EntityManager getEntityManager() { try { utx.begin(); return em; utx.commit(); } catch (Exception e) { ... } } I.e. an unreachable utx.commit() statement. Since this generated class is a @Stateless session bean, is the utx variable needed at all?
First of all : I cannot reproduce it with my dev build. It means that this is recent change. The second : this is not REST bug. The EntityManager accessor is generated via org.netbeans.modules.j2ee.persistence.action.EntityManagerGenerator.generate(). REST generation code modifies only annotations for generated method. The body of this method is not changed . So this is the issue inside persistence module code.
yes, it may be recent change related to 189559, but utx usage should be for non ejb classes only, but if ejb was just created it may not be in model yet, not which part of code should consider this behavior. and I don't remember any code like utx.begin(); return em; utx.commit(); but will look.
here is fast fix, it may be good but also it may be good to move transaction wrapping to GenerationOptions itself. http://hg.netbeans.org/web-main/rev/bcf72c65d958
Integrated into 'main-golden', will be available in build *201012170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/bcf72c65d958 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: fix #193491 - exclude some operations from eligib;le for transactions if non ejb
*** Bug 193611 has been marked as a duplicate of this bug. ***