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.
To me, this is a regression compared to the old wizard, especially if I have a dbschema in the project. I know there is a bit more overhead in db connection, but in the case of a dbschema, it really just involves reading the file, not a db sconnection. Also, if I open the wizard twice in a row, it should remember my last selection - in that case, there won't be a connection overhead because the connection should have happened last wizard session.
OK, if there is a dbschema in the project, it can be deserialized and selected in the combo box when the wizard is opened. But if there isn't, according to the UI spec you would have to select the first connection *and* display its connection dialog. When you right-click the project and select the wizard, not only the wizard would pop up, but also the connection dialog on top of the wizard. I don't like this, but will do it if Jano says so. Reassigning to him for comments. Re. remembering the last schema: I would remember the last table source selection for the current IDE session, but I woulnt' serialize this info to disk (looks like too much work for too little gain).
Jano, can you update this with what should be done?
Initially (using the wizard for the first time): - If there's a schema file in project, we should select it in the combo box. - If there's no schema, we should not select schema, nor connection. Next time: - If a schema file was selected previously, we should select it for the user. - If a connection was selected, then it would be good to select it, but only if we remember the password. Otherwise, do not select anything. Okay? It's a pity that it's a lot of work to remember things across IDE sessions. Because if we remember something between different wizard invocation, we should remember it also between IDE sessions.
Okay.
Hopefull fixed. Checking in persistence/nbproject/project.xml; /cvs/j2ee/persistence/nbproject/Attic/project.xml,v <-- project.xml new revision: 1.1.2.16.2.14; previous revision: 1.1.2.16.2.13 done Checking in persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/DatabaseTablesPanel.java; /cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/DatabaseTablesPanel.java,v <-- DatabaseTablesPanel.java new revision: 1.1.2.33; previous revision: 1.1.2.32 done Checking in persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/EntityClassesPanel.java; /cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/EntityClassesPanel.java,v <-- EntityClassesPanel.java new revision: 1.1.2.19; previous revision: 1.1.2.18 done Checking in persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/RelatedCMPHelper.java; /cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/RelatedCMPHelper.java,v <-- RelatedCMPHelper.java new revision: 1.1.2.2.2.8; previous revision: 1.1.2.2.2.7 done Checking in persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/RelatedCMPWizard.java; /cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/RelatedCMPWizard.java,v <-- RelatedCMPWizard.java new revision: 1.1.2.2.2.20; previous revision: 1.1.2.2.2.19 done RCS file: /cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/TableSource.java,v done Checking in persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/TableSource.java; /cvs/j2ee/persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/TableSource.java,v <-- TableSource.java new revision: 1.1.2.1; previous revision: 1.1 done RCS file: /cvs/j2ee/persistence/test/unit/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/TableSourceTest.java,v done Checking in persistence/test/unit/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/TableSourceTest.java; /cvs/j2ee/persistence/test/unit/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/Attic/TableSourceTest.java,v <-- TableSourceTest.java new revision: 1.1.2.1; previous revision: 1.1 done Checking in utilities/manifest.mf; /cvs/j2ee/utilities/manifest.mf,v <-- manifest.mf new revision: 1.6.2.3.2.9; previous revision: 1.6.2.3.2.8 done Checking in utilities/src/org/netbeans/modules/j2ee/common/DatasourceHelper.java; /cvs/j2ee/utilities/src/org/netbeans/modules/j2ee/common/Attic/DatasourceHelper.java,v <-- DatasourceHelper.java new revision: 1.1.2.3; previous revision: 1.1.2.2 done
This is a huge improvement! My only concern is in trying the connection and having the connection automatically selected the next time. This results in 2 identical dbschemas unless there was a change in the database itself. Is that really what we want?
Yeah, good catch. I guess this is a question for Jano.
I don't understand why there are 2 identical schemas in that scenario.
You invoke the wizard for the first time in an EJB project. No data source is selected. You select jdbc/sample, add some but not all tables and finish the wizard -- a dbschema file is generated. You invoke the wizard for the second time. The jdbc/sample data source is selected, since it was used in the previous invocation. You are happy you see the tables already displayed, so you add those you haven't added in the previous invocation and finish the wizard -- a new dbschema file is generated, having the same contents as the first one unless the database changed in the meanwhile.
I see. I think the fact that we silently generate multiple schema files is quite bad. After discussion with Andrei, it looks like maybe we don't have to generate schema file, but we don't know all the reasons why we generate them currently. Maybe because of CMP beans? Pavle, could we get rid of generating the schema file as part of "Entity Classes from DB"?
I do not see why we would need to generate a new schema every time. I think it is a bug, we should just update the existing schema for that DS/connection if it exists.
It's hard to say if it is a bug when there is no specification and we don't know what is the intended behavior. Anyway, if we wanted to do it, the result should be the equivalent of invoking Recapture Schema on the dbschema file before invoking the wizard, right? I slightly don't like the idea of iterating over and loading all dbschema files in the project in order to find one which matches the database connection. Could have performance implications, but probably usually not, since by this we actually keep the number of the dbschema files in the project small.
Yes, I think it should do the same as "recapture schema". If we update the existing schema instead of creating a new one every time you run the wizard then there will only be one schema per connection. Unless the user created one manually which I think is not typical (and if they did we would at least find and update it from the wizard). Using more then one connection is also quite rare case, IMHO. So hopefully there will be almost zero performance impact in a typical case. Generating files that are of no use is IMO a bug. Not a huge deal but at least it looks strange.
Filed issue 81956.
Another unexpected behavior: Say I have a dbschema file in mypackage and right click on that package to invoke this wizard. The first found schema in META-INF is the default, not the one in my package.
Jano, can you comment on my last concern?
Never add "another concern" into an existing issue. One issue, one problem. If you reopen you know what problem you want to revisit, every issue has its own priority, etc. If you have another problem (or a concern) file a new issue. I am not surprised Jano does not pay attention to resolved issues - yet another reason to file a new one. (BTW, IMO your concern is a P5)
I was trying to get Jano's advice on whether to reopen or file a diff issue =). I'll file a separate one, though I think it's p4.
filed as issue 82325
I agree that selection of initial schema file could look into the selected package first. Thank you for filing a new issue.