netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Entity classes from database wizard broken

Open AdolfGalland opened this issue 2 years ago • 5 comments

Apache NetBeans version

Apache NetBeans 16

What happened

The "Entity classes from database wizard" is poorly documented and when it fails there are useless error messages. My setup is the following: My setup:

Netbeans 16 on windows 11 Mysql server 8 mysql-connector-java-8.0.30.jar OpenJDK 64-Bit Server VM Microsoft-40354 (build 17.0.4.1+1-LTS, mixed mode, sharing) Payara server 5.2 configured in Netbeans

Entity classes from database wizard fails with useless error.

How to reproduce

When Payara server is added in Netbeans the Datasource select box of the wizard is populated reading jdbc resources from domain.xml . 1- choosing "New datasource..." option is broken, it lets you enter some data but at the end of the process nothing change and data are lost. 2- choosing an existing jdbc resource the following error was reported:

Unable to find driver com.mysql.cj.jdbc.MysqlDataSource. Register this driver in databases tab

I could restore correct functioning only after adding Url and driverClass properties to the connection pool linked to the selected jdbc resource. I didn't have these problems with previous versions of Netbeans (12) and Mysql (5.x)

When Payara server is removed from Netbeans the wizard works correctly with both "New datasource..." option and one of database connection created inside Netbeans.

Did this work correctly in an earlier version?

Apache NetBeans 12.6 or earlier

Operating System

windows 11

JDK

OpenJDK 64-Bit Server VM Microsoft-40354

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

AdolfGalland avatar Jan 26 '23 15:01 AdolfGalland

It works better in NetBeans 17 RC1 with a Jakarta EE10 project (with Payara 2023.1), but you still have to change javax to jakarta in the entities. UPDATE: I am using NetBeans 19 and I can't get this wizard to work at all. I have solved the error message about the driver class by adding the property driverClass to the connexion but the tables are never displayed, so I can't choose any table.

richard-grin avatar Jan 27 '23 21:01 richard-grin

I am getting same error message in NetBeans 17.0.

My setup: Windows 10, java-11-openjdk-11.0.17.8-2.windows.redhat.x86_64 Using Java 11 version of the MSSQL driver. WildFly 27.0.1

image

This last worked for me in NetBeans 14.0

jirahawwad avatar Feb 23 '23 18:02 jirahawwad

For fun I downloaded the sources for version 17.0 and built with java-11-openjdk-11.0.17.8-2.windows.redhat.x86_64 (a version we currently use here at work). Retried and I'm not seeing that error anymore. As mentioned previously you do still need to change javax to jakarta in the entities created.

jirahawwad avatar Feb 24 '23 07:02 jirahawwad

In NetBeans 19 (Windows 11), it is not possible to use this wizard with a connection that already exists, when you define the data source. Indeed, the wizard try to create a new connection every time. If you specify the JDBC URL of an existing connection, at the end you will receive a message "Unable to add connection. Connection already exists". And even if I add a new connection, the tables are never displayed. I use MySQL 8.0.32 and Payara 6.2023.8.

richard-grin avatar Sep 13 '23 16:09 richard-grin

I have just tested NetBeans 21. The wizard works well with a local data source but I have still the same problem with the server data source: the wizard try to create a new connection every time. If you specify the JDBC URL of an existing connection, at the end you will receive a message "Unable to add connection. Connection already exists". Thanks to the developpers of NetBeans: a lot of the problems introduced in the last releases of NetBeans are now solved (for example the problems with the javax package instead of jakarta or the problem with the wizard "JSF form from entity".. There's just this problem left on this wizard for a server data source.

rgrin08 avatar Feb 26 '24 04:02 rgrin08