cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Bug 155965 - Hibernate posts new connection dialog when creating a new web application
: Hibernate posts new connection dialog when creating a new web application
Status: RESOLVED FIXED
: javaee
Hibernate
: 6.7
: All All
: P2 (vote)
: 6.7
Assigned To:
:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-12-22 21:45 by
Modified: 2009-02-19 23:27 (History)
Issue Type: DEFECT
:


Attachments
stack trace in messages.log (62.10 KB, text/plain)
2008-12-22 21:57, John Baker
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-12-22 21:45:41
Using trunk Web build from 12/22

1) After installing, change the userdir in etc/netbeans.conf to a folder other
than dev
2) Start NetBeans and create a new Web Application
3) Wizard says that Java EE is not activated, so I clicked the Activate button
4) Next the new Database Connection dialog opens and I fill in the connection
information for the sample database

Result - error
A connection for the sample database already exists.

Is the v3 plugin trying to register Java DB also?  Because it shouldn't
register Java DB
------- Comment #1 From 2008-12-22 21:51:25 -------
The point should not be the connection already exists, but the new database
connection dialog shouldn't even open
------- Comment #2 From 2008-12-22 21:53:20 -------
Sorry, looking at the stack trace more carefully, it appears that for some
reason Hibernate is posting the new
connection dialog.
------- Comment #3 From 2008-12-22 21:57:05 -------
Created an attachment (id=75255) [details]
stack trace in messages.log
------- Comment #4 From 2008-12-22 22:19:09 -------
Posting new Database connection dialog is new, kind of a regression
------- Comment #5 From 2008-12-22 22:30:58 -------
in the original description, you don't have to change the userdir location,
just make sure you start NetBeans with a new
userdir
------- Comment #6 From 2008-12-23 10:09:39 -------
John,

Can you please explain in detail on the step 3 ? 
1. For me the wizard says 'No Java EE' servers registered and asked me 
to click 'Add Server' button and allowed me to select glashfish server. 
2. When selected to install Glashfish V3, it downloaded and installed the
server. 
3. After that, in the new connection dialog, I do not see JavaDB driver
pre-registered. (I see only JDBC-ODBC, MySQL 
and PostgreSQL) 
4. When I selected the existing MySQL driver then, the new web application is
created without any exceptions.
Please clarify..
(This is on Windows XP with MySQL 5.0 preinstalled)
-Vadiraj.

-Vadiraj.
------- Comment #7 From 2009-01-06 00:36:08 -------
vadirajvd, as shown in the attached messages.log, NetBeans is running JDK 1.6,
so NetBeans uses Java DB from JDK 1.6.
But, all you really need to look at is the stack trace in the attached
messages.log.  

I looked at HibernateConfigurationPanel and it appears and cmbDbConnection
listens for an event fired when selecting an
item which causes the Connection dialog to open.  The connection dialog
shouldn't open, should it?

at
org.netbeans.api.db.explorer.ConnectionManager.showAddConnectionDialog(ConnectionManager.java:229)
    at
org.netbeans.api.db.explorer.support.DatabaseExplorerUIs$ConnectionDataComboBoxModel.newItemActionPerformed(DatabaseExplorerUIs.java:112)
    at
org.netbeans.modules.db.util.DataComboBoxSupport$ItemActionListener.actionPerformed(DataComboBoxSupport.java:245)
    at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1240)
    at javax.swing.JComboBox.setSelectedItem(JComboBox.java:567)
    at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:603)
    at
org.netbeans.modules.hibernateweb.framework.HibernateConfigurationPanel.fillPanel(HibernateConfigurationPanel.java:84)
    at
org.netbeans.modules.hibernateweb.framework.HibernateConfigurationPanel.<init>(HibernateConfigurationPanel.java:72)
    at
org.netbeans.modules.hibernateweb.framework.HibernateWebModuleExtender.<init>(HibernateWebModuleExtender.java:91)
    at
org.netbeans.modules.hibernateweb.framework.HibernateFrameworkProvider.createWebModuleExtender(HibernateFrameworkProvider.java:8
------- Comment #8 From 2009-01-06 22:26:14 -------
I noticed that a db connection dialog opens when I am creating a web app, too.

The db connection dialog appears between the wizard step where I associate the
project with a server and the page where
the frameworks appear.  It looks like the creation of the Hibernate
configuration panel is triggering this dialog that
interrupts the completion of the wizard.
------- Comment #9 From 2009-01-07 12:55:05 -------
This issue creates an annoyance during every new web project creation when
running on J2SE 1.6.*.
The root cause is calling cmbDbConnection.setSelectedIndex(1) after connecting
the drop-down box to db api connection 
manager :  DatabaseExplorerUIs.connect(cmbDbConnection,
ConnectionManager.getDefault());
Looking further...
------- Comment #10 From 2009-01-09 18:45:18 -------
For me, this looks like a db explorer module issue. When there is only one db
connection registered in the IDE and when 
we connect a drop down box to the DatabaseExplorer
(DatabaseExplorerUIs.connect()) and calling drop down 
box.setSelectedIndex(1) results in New Database connection dialog being shown.
Looking further...
------- Comment #11 From 2009-01-12 10:32:52 -------
Its Hibernate module issue... Hibernate wizard is calling
cbDbConnection.setSelectedIndex(1) when there are one or than
one db connections available. When there's only one db connection available,
the drop down box contains the db
connection entry and the 'New Database Connection' entry in that order.. So
setting the selected index to 1 is invoking
the New database connection dialog, which is in fact in-correct. 
Setting the selected index to 0 (zero, first element) would be the right fix..
But Hibernate module does not handle the
case where there are no db connections available in the IDE. In this case, the
'Finish' button is enabled on the wizard
of New Web Project wizard and clicking on it results in NPE..
'hibernate.cfg.xml' is in-complete because, there are no
db connection details to fill in from... Fixing this problem along with this
issue fix..
------- Comment #12 From 2009-01-12 11:07:00 -------
Fixed as per the previous description on this issue report.
http://hg.netbeans.org/main/rev/29e24ab2ab91
------- Comment #13 From 2009-01-14 07:44:32 -------
I think someone from QE should verify this
------- Comment #14 From 2009-01-15 01:02:51 -------
Honza, can u please verify this ?
------- Comment #15 From 2009-01-17 16:34:39 -------
The error of enabling 'Finish' button on the new file wizard when there are no
database connection configured also
applies to Hibernate Configuration wizard. Fixing the same.
http://hg.netbeans.org/main/rev/fecb6bd1a02b