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.

Bug 84454 - Entity Classes from Database Wizard and DB-Schema Wizard come up empty
Summary: Entity Classes from Database Wizard and DB-Schema Wizard come up empty
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
: 77950 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-09-07 16:48 UTC by ulim
Modified: 2007-02-14 16:25 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Dysfunctional Schema file (DB Driver and Version inside) (2.19 KB, application/octet-stream)
2006-09-08 12:50 UTC, ulim
Details
messages.log (15.46 KB, application/octet-stream)
2006-09-12 12:32 UTC, ulim
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ulim 2006-09-07 16:48:05 UTC
The same problem applies to both wizards. Once I've made a connection to the
database, a window appears, where I should select the appropriate database
tables. However, this windows is empty. It did work before, so something must
have changed, but there is no error message.

It does not matter whether I make the database connection via JNDI (Glassfish
appserver) or locally. Both local and remote DB connections work in other
contexts, but not with these wizards.
Comment 1 Andrei Badea 2006-09-08 12:21:22 UTC
I tried to reproduce based on the scarce description, but with no luck. Please:

- use the latest daily build.
- post steps to reproduce starting from a clean userdir. Something like:

  1. Register a database driver and a connection.
  2. Create an EJB project.
  2. Open the Entity Classes from DB wizard... etc.

- start NetBeans by passing -J-Dorg.netbeans.modules.db=0 on the command line
- state the name and version of the database server and driver you are using

Thanks.
Comment 2 ulim 2006-09-08 12:44:20 UTC
Can you explain what you mean by "clean userdir"? Where do I configure that?

I downloaded today's daily build, but the installer didn't work (it never works
on my machine, which is why I always download as tar.gz). So, can I get the
.tar.gz of the daily build somewhere?
Comment 3 ulim 2006-09-08 12:49:26 UTC
New observations: I was successful in generating entity classes from an old
Database Schema file, which I had generated with an earlier version of Netbeans.
However, as soon as I select "recapture Schema from Database", the file becomes
dysfunctional. Looking at the XML, all the DDL is gone, just a shell remains. I
am attaching the file.
Comment 4 ulim 2006-09-08 12:50:18 UTC
Created attachment 33719 [details]
Dysfunctional Schema file (DB Driver and Version inside)
Comment 5 Andrei Badea 2006-09-08 17:55:01 UTC
You can get a clean userdir by running NetBeans with the option

-userdir <some_directory>

This will make NetBeans save settings in <some_directory> instead of the default
~/.netbeans/5.5dev.

Regarding the daily build, can't you use a zipped archive instead of the installer?
Comment 6 ulim 2006-09-11 09:11:55 UTC
Hm, for some reason there were no ZIP archives or I didn't see them. Anyway,
downloaded the newest one now and the following steps reproduce the problem:

./netbeans -userdir /some/empty/directory
Runtime tab / Databases / Drivers / New Driver / jConnect
Runtime tab / Servers / Add Server / Sun Java System Application Server /
Register Remote Domain / Enter connection data for Glassfish Server
File / New Project / Enterprise / EJB Module
Select EJB Module / New File/Folder / Persistence / Database Schema / Enter data
for new Connection to DB

==> The window for selecting tables comes up, but no tables show in the list

Select EJB Module / New Entity Classes from Database / Select Datasource on
Appserver

==> same result, no tables to select

Note: even if I made a mistake while trying to create a db schema, the
datasource on the remote server is guaranteed to work correctly, because my
enterprise application runs off it. I did develop my enterprise app with the
table wizard, so the feature did work before.
Comment 7 Andrei Badea 2006-09-12 10:22:18 UTC
Please attach the <userdir>/var/log/message.log file. Before that be sure to run
NetBeans with 

-J-Dorg.netbeans.modules.db=0 -J-Dnetbeans.debug.exceptions=true

on the command line.

Can you remember which daily build it used to work correctly in? Did it work in
5.5 beta 2?

Another thing: please create a Java Application (New Project - Generic), invoke
the Entity Classes from DB wizard and select the database connection
corresponding to your data source. Can you see any tables?

Anyway, looks like a regression in dbschema. It would be nice if you could
remember which daily build used to work, because there weren't that many changes
and I could track down the one causing this.

Thank you for help!
Comment 8 ulim 2006-09-12 12:31:52 UTC
1. delete contents of userdir

2. ./netbeans -userdir /my/userdir/ -J-Dorg.netbeans.modules.db=0
-J-Dnetbeans.debug.exceptions=true

3. Install JDBC driver and AppServer

4. New J2EE Module

5. New Database Schema using IDE's db connection ==> window comes up empty

6. New Entity Classes from Database using Appserver's JDBC resource ==> window
comes up empty

7. Exit IDE

This is starting from a fresh daily build 0911, I'll attach the
userdir/var/log/messages.log file.
Comment 9 ulim 2006-09-12 12:32:46 UTC
Created attachment 33822 [details]
messages.log
Comment 10 ulim 2006-09-12 12:38:32 UTC
The same problem appears, when I use the wizards from a generic Java
application. The version where it did work was pre 5.5 beta 2, but probably
after 5.5 beta 1. I might remember if I had a list of versions and when they
appeared.
Comment 11 Andrei Badea 2006-09-13 14:05:18 UTC
The message log didn't help unfortunately. I expected some exceptions, but there
aren't any. 

Here is a list of NetBeans 5.5 Q-builds. If you have time, it would be great if
you could find the first one which doesn't work for you. If you don't have time
to test them all please at least test q-build #3.

Alternatively, if there's any chance you could provide a computer to which I
could connect and reproduce the issue, it would be very helpful.
Comment 12 Andrei Badea 2006-09-13 17:54:29 UTC
Ah sorry, I forgot the list:

http://qa.netbeans.org/q-builds/index_55.html
Comment 13 ulim 2006-09-14 09:00:19 UTC
It works with QBuild 2 (20060424), but not with 3 (20060615).
Comment 14 Andrei Badea 2006-09-25 09:05:27 UTC
*** Issue 77950 has been marked as a duplicate of this issue. ***
Comment 15 ulim 2006-10-12 17:25:54 UTC
Anything more you need?
Comment 16 Andrei Badea 2006-10-13 15:03:06 UTC
No, I just didn't have time to look at this. Thank you for the info in desc14, I
hope it will help to track down the cause.
Comment 17 ulim 2006-11-03 16:02:59 UTC
Still not working in 5.5 release.

Maybe this problem is related: when I go to the Runtime tab and open
"Databases", then I can add connections to our database. If I expand a
connection, three folders appear: "Tables", "Views", "Procedures". When I click
on any of these three nodes, nothing happens - I was expecting to see all
existing tables, views and procedures. I can create a table and then I see it,
too - can expand it, view the columns etc. I can also delete it again.

It's not a permissions problem, I tried it with many different users. All of
them can see all the tables in other tools, just not in Netbeans.
Comment 18 Andrei Badea 2006-11-07 12:38:35 UTC
Sorry, still no time to look at this.

Thank you for the new info. It is interesting that you see the newly created
table, but only that one. Are you connecting to the right schema? In the Connect
dialog, after entering your user name and password click Advanced, then press
the Get Schemas button and try if selecting a different schema in the Select
schema combo box helps.

Also please do the following:

1. Connect to the datbase.
2. Right click the connection node, invoke Enable Debug.
3. Create the table -- this will dump the CREATE TABLE statement to the Output
window
4. Attach the statement to the issue.
Comment 19 ulim 2006-11-07 13:18:20 UTC
I tried various users with different schemas. BTW, what is a schema in this
context? When I click "Get Schemas" I get a list of all our users. Anyway, when
I right-click the connection, there is no "enable debug" option. I have
"disconnect", "execute command", "refresh" and "properties".
Comment 20 Andrei Badea 2006-11-07 20:48:05 UTC
Sorry, that should have been the Databases node.

Re. schemas: I'm not exactly familiar with Sybase, but I would try the schema
named as the user who owns the tables, or dbo if the former doesn't help. 

If you can, also try the following:

1. Connect in the usual way (just enter the user name and password, don't use
the Advanced tab).
2. Create a table.
3. Invoke View Data from the table's context menu. This should open an SQL
editor containing:

SELECT * from [something].[table_name]

4. Change table_name to a table of which you are sure it exists in the database.
5. Invoke Run SQL in the SQL editor's toolbar.

Does the execution succeed? In the fortunate case it doesn't, try to find out
what you should replace [something] with in order to make the statement execute
(it should be the table owner). Then try if connecting to the "something" schema
shows any tables.
Comment 21 ulim 2006-11-08 10:38:34 UTC
That was the key, thank you very much. With your test I could find a schema,
which will load all the tables. The issue can be closed.
Comment 22 Andrei Badea 2006-11-08 12:34:10 UTC
Good to hear! I'm still curious why the difference between Q-Build 2 and 3. It
would seem that in Q-Build 2 you didn't have to manually select the right
schema, but not in Q-Build 3 and later releases you have to.

Could you please try to connect in Q-Build 2 without manually selecting a schema
and let me know what the schema chosen by NetBeans was, or actually if the
schema was different from the one that you found in desc21?

Ultimately would also like to know why other tools select the right schema, but
NetBeans doesn't. Was the right schema named "dbo" or was it in any way related
to the user name which you connected as?

Thanks!
Comment 23 ulim 2006-11-08 12:42:46 UTC
The right schema was dbo. The dbo-user himself is called "DBO_DATABASENAME" and
there is a schema of the same name that I always used and that didn't work. Only
by chance did I try dbo and it worked. The selected schema, if I didn't choose
one manually, was always "default". Other tools didn't ask me for a schema, so I
guess they were using the default one as well.
Comment 24 Andrei Badea 2007-02-14 16:25:49 UTC
Closing per desc22.