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 202742 - Broken datasource status of projects is not refreshed correctly
Summary: Broken datasource status of projects is not refreshed correctly
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-27 15:29 UTC by Petr Jiricka
Modified: 2011-10-11 14:12 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2011-09-27 15:29:13 UTC
1. Create a Java EE 6 Web application 
2. Register some database connection under Services
3. Create entities from this database
4. Remove the connection in Services
=> The project should be badged with the Broken datasource badge, but it's not. Only if you close and reopen the project, it will be correctly badged.

Now when the project is badged as having a broken datasource:
5. Click Resolve Data Source Problem... in the project's popup menu.
6. Resolve the datasource by adding a connection
7. Close the Resolve Data Sources dialog
=> A popup message about a broken datasource will be open again, and the error badge will not be cleared. Again, you need to close and reopen the project to refresh the status.
Comment 1 Jiri Skrivanek 2011-09-29 09:07:26 UTC
I can't even see any broken datasource badge if I delete connection from Services and restart the IDE. I use jdbc:derby://localhost:1527/sample [app on APP], Product Version: NetBeans IDE Dev (Build 201109280601)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows XP version 5.1 running on x86; Cp1250; en_US (nb)
Comment 2 Sergey Petrov 2011-09-30 09:00:57 UTC
it's not required for datasources to be registered as connections in the ide.
Comment 3 Sergey Petrov 2011-09-30 09:07:20 UTC
may be I miss something in use-case.

but there may be no api right now to track changes, also it's not persistence issue in my opinion and it's specific project support issue, like web/ejb etc.
Comment 4 Petr Jiricka 2011-09-30 09:17:59 UTC
> it's not required for datasources to be registered as connections in the ide.

This is true, but when the connection is not registered, some features are not available, so the user should be alerted about this and given the opportunity to fix this - see bug 202741.

> it's specific project support issue, like web/ejb etc.

Possibly, please explain what needs to happen on the project side, and feel free to reassign.
Comment 5 Sergey Petrov 2011-09-30 09:43:28 UTC
Ok,I see if it's warning level.

And I also don't see 'broken datasource' badge neither after close-open nor after restart. In my opinion 202741 doesn't mean project  should be marked as a project with some problems if it's the only side effect from unregistered connection, 202741 itself is good to fix and suggest a solution in completion dialog. But if it's marked sometimes may be there are more problems I don't know yet.
Comment 6 Sergey Petrov 2011-09-30 09:58:49 UTC
Regarding area, I've found 

LBL_Resolve_Missing_Datasources_Title=Resolve Data Sources
..
LBL_Fix_Broken_Datasource_Action=Resolve Data Source Problem...

in j2ee.common. yet it doesn't mean it's not on persistence side, just some point.

regarding I can't see badge, may be because I didn't complete steps 1:1.

What does it mean step 3? Sould I create new datasource in entities from db from connection created on step 2?
Comment 7 Sergey Petrov 2011-09-30 10:24:41 UTC
regarding area also BrokenDatasourceSupport is in j233.common 
and WebProject handle references probem in WebProject$ProjectOpenedHookImpl.projectOpened just nothing from persistence.
It's clear project configuraton issue with broken datasource reference and it's handled by common/project code.

Regarding persistence I don't really see as a good solution to mark a project with warning/error badge if I for example create pu manually and set datsource to some known server side. May be I just a bit conservative and it can be added, i.e. check datasource status for datasources used in persistence units but it will be new features as I see.
Comment 8 Sergey Petrov 2011-09-30 10:43:47 UTC
current badge is shown even if I remove persistence.xml and all entities before close-reopen. and if the issue is about existent functionality and not about missed verification for pu -> move to web.project for evaluation.
Comment 9 David Konecny 2011-10-11 00:16:45 UTC
web-main #a1791772e123

I fixed the problem but have question about purpose of whole this "broken data sources" check. If I follow steps given in this issue:

1. Create a Java EE 6 Web application 
2. Register some database connection under Services
3. Create entities from this database
4. Remove the connection in Services

then nothing is broken. I do not have connection to DB in IDE but that has no impact on my application - glassfish-resources.xml contains all information to recreate this connection on server and that's all what's needed. So why do we report this situation as "datasource is missing? And also we should be able to recreate this connection in IDE automatically based on content of glassfish-resources.xml (whether as a permanent connection under Databases node or some "smart" virtual node under project's logical view). What do you think guys?
Comment 10 Petr Jiricka 2011-10-11 11:44:45 UTC
You are right that this probably does not need to be reported as a warning. Still, having the connection registered somewhere in the IDE would be useful (either in in the db explorer or under the project node), to avoid discoverability problems such as bug 202741.
Comment 11 Quality Engineering 2011-10-11 14:12:56 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a1791772e123
User: David Konecny <dkonecny@netbeans.org>
Log: #202742 - Broken datasource status of projects is not refreshed correctly
(showAlert action was always called even after broken resources were fixed; not sure about purpose of such warning - commented out for now)