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.
NetBeans build 201209020001 JDK 7u5 64-bit Background: I have two database connections. The first is the sample Derby DB, and the second is our actual development database. I created a schema containing some tables from our dev database, and then I created entities from that schema. In the "New Entity Classes from Database" wizard, I checked the "Create Persistence Unit" option. But the persistence unit that was created pointed to the first database it found (which is the Derby DB) and not the database that the schema was generated from. So either ensure that the right connection is used somehow or allow the user to choose a connection as well.
Oh, and all of this creation happened in a Maven-based NetBeans Platform application module.
Sergey, please, can you evaluate this issue? I've tried to reproduce it, but persistence unit was created correctly for me.
yes, as there is no connection selection step, pu is created with some default value in this case it's first available connection. not sure what to do as we decide to avoid this extra step in the wizard and it's @by design@.
Maybe as a compromise show the selection step only if there is more than one connection? It makes sense to keep the wizard as simple as possible, but personally I would prefer seeing an extra step to ending up with a persistence unit that doesn't work.
one more possible solution may be persistenmce.xml editor can be opened if pu was created by this wizard, so it will be more visible what connection is used and can be corrected right after creation. Regading steps this step is required only for generation from schema because in case of generation from datasource/connection this connection is used and it should fit most cases proper;y.
(In reply to comment #5) > one more possible solution may be persistenmce.xml editor can be opened if pu > was created by this wizard, so it will be more visible what connection is used > and can be corrected right after creation. That would indeed help. :) > Regading steps this step is required only for generation from schema because in > case of generation from datasource/connection this connection is used and it > should fit most cases proper;y. Agreed.
fix with persistence.xml opening (only in case if it's created and if schema was used) http://hg.netbeans.org/web-main/rev/4f7616e8a332 may not be a complete or perfect fix but it may make functionality here a bit better
Integrated into 'main-golden', will be available in build *201210030002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/4f7616e8a332 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #217853 open persistence.xml
Verified with build 201210040002 that the persistence.xml file is indeed opened.