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.
This was originally filed as bug 178970, re-filing as a clean issue. 1. Create a Java SE project (Ant or Maven - the problem is reproducible with both). 2. Set the source level to JDK 6. 3. Create Entity Classes from database, using the bundled JavaDB database, choose e.g. the Customer table. Create Persistence Unit as suggested etc. 4. Create JPA controller classes for the entity classes you just generated 5. In the main class, put the following in the main method: System.out.println("cust" + new CustomerJpaController().getCustomerCount()); 6. Run the application The running of application will fail, because the JBDC driver is missing. We should improve the out of box experience for the database drivers and add them to the project's libraries/dependencies, if the driver class is not on the runtime classpath yet.
after fix need to be verified with maven as it may take a lot of time to add some dependencies and time may depend on internet connection.
*** Bug 76756 has been marked as a duplicate of this bug. ***
A few notes on this: - The driver should be added to the runtime-only classpath, which was introduced recently. This type of classpath is not implemented for Ant JavaSE project (in that case it's always runtime+compiletime), but it can be used for Maven SE project. - Where can we get the Maven coordinates for the driver? Do we have this information? We should at least have it for the drivers that are well-known to us: MySQL, OracleDB, Derby. - There is also a new utility method for creating a temporary in-memory LibraryImplementation based on jar location and Maven coordinates, but I am not sure if that will be needed in this case.
in my opinion it's ok to add to compile+runtime if it's the same as manual addition by users. can't say about maven, it will work properly if all maven artifacts are specified in a registered jdbc library.
If connection is registered we have driver registered also, but it doesn't mean we know any maven artifact and addition of corresponding jar to a project may trigger full maven index download and may be quite long for first time.
with new db api to get library from a connection, we may have proper maven artifacts in some cases.
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.