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.
Product Version: NetBeans IDE Dev (Build 201102240001) Java: 1.6.0_22; Java HotSpot(TM) 64-Bit Server VM 17.1-b03-307 System: Mac OS X version 10.5.8 running on x86_64; MacRoman; en_US (nb) Userdir: /Applications/NetBeans/userdirs/7.0-20110222 The code generated by Use Entity Manager in a session bean is inconsistent between Ant and Maven projects. For more details, see issue 185682. When you use the Use Entity Manager to generate code in an Ant project, the IDE generates the following: @PersistenceContext(unitName = "WebAppJUnitPU") private EntityManager em; public void persist(Object object) { em.persist(object); } When you use the same wizard in a Maven project, the code generated by the IDE is different: @PersistenceContext(name = "persistence/LogicalName", unitName = "com.mycompany_mavenwebapp2_war_1.0-SNAPSHOTPU") public class NewSessionBean { @Resource private javax.transaction.UserTransaction utx; protected void persist(Object object) { try { Context ctx = (Context) new InitialContext().lookup("java:comp/env"); utx.begin(); EntityManager em = (EntityManager) ctx.lookup("persistence/LogicalName"); em.persist(object); utx.commit(); } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", e); throw new RuntimeException(e); } }
Is server set in maven project?
yes, GF 3.1 b43
both kind of code works for me with eclipselink 2.x, so can wait to fix. also may have to test how it works with jpa1.0 and ee5 or lower.
unfortunately missed from 7.2 target, set to TBD to review in 7.3 timeframe
now maven should match to ant but it may need some additional testing http://hg.netbeans.org/web-main/rev/fb8e2f591dd7
Integrated into 'main-golden', will be available in build *201211100001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/fb8e2f591dd7 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #195993 maven use the same generator now as in ant web project