Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348279 - Entity Gen Wizard: Better to show a default schema when choosing a connection
Summary: Entity Gen Wizard: Better to show a default schema when choosing a connection
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Nan Li CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-03 16:46 EDT by Nan Li CLA
Modified: 2012-05-24 16:16 EDT (History)
1 user (show)

See Also:
neil.hauge: review+


Attachments
Proposed Patch (1.40 KB, patch)
2011-10-20 13:24 EDT, Nan Li CLA
no flags Details | Diff
Proposed Patch (1.84 KB, patch)
2011-12-06 11:55 EST, Nan Li CLA
no flags Details | Diff
Proposed Patch (1.94 KB, patch)
2011-12-06 12:38 EST, Nan Li CLA
neil.hauge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-06-03 16:46:02 EDT
Build Identifier: I20110525-0800

On the first page, Select Tables, of entity gen, it's better to show a default schema, which could be the first one in the list, along with the tables of that schema if choosing an active connection or connecting to a database through that Connect button. Currently, if selecting a connection or connecting to a database on this page, nothing shows up in the schema and the tables lists which gives a fault impression that the selected connection is inactive.

Reproducible: Always
Comment 1 Neil Hauge CLA 2011-07-01 16:25:45 EDT
Moving JPA specific bugs to new JPA component in bugzilla.
Comment 2 Nan Li CLA 2011-10-20 13:24:21 EDT
Created attachment 205666 [details]
Proposed Patch
Comment 3 Neil Hauge CLA 2011-12-02 18:00:52 EST
I think we need to first default to the JPA project's default schema to cover the case where the user is generating from a schema that is not the default schema of the login.  Also, when calling iterator.next(), it is good to know whether or not that next item exists (to avoid an exception).  I don't think it is likely to encounter a database without any schemas, but I suppose it is possible, so probably good to check just in case.
Comment 4 Nan Li CLA 2011-12-06 11:55:25 EST
Created attachment 208005 [details]
Proposed Patch

Regarding the comment of iterator.next(), the returned schema will be null if a database has no schema and null checks already exist at the places where getDefaultSchema() is invoked so I think it's unnecessary to add extra null check for it. Let me know if you have different opinions. Thanks!
Comment 5 Nan Li CLA 2011-12-06 12:07:30 EST
(In reply to comment #4)
> Created attachment 208005 [details]
> Proposed Patch
> 
> Regarding the comment of iterator.next(), the returned schema will be null if a
> database has no schema and null checks already exist at the places where
> getDefaultSchema() is invoked so I think it's unnecessary to add extra null
> check for it. Let me know if you have different opinions. Thanks!

I see what you meant so ignore this comment and I'll update the code and upload a new patch.
Comment 6 Nan Li CLA 2011-12-06 12:28:05 EST
(In reply to comment #5)
> (In reply to comment #4)
> > Created attachment 208005 [details] [details]
> > Proposed Patch
> > 
> > Regarding the comment of iterator.next(), the returned schema will be null if a
> > database has no schema and null checks already exist at the places where
> > getDefaultSchema() is invoked so I think it's unnecessary to add extra null
> > check for it. Let me know if you have different opinions. Thanks!
> 
> I see what you meant so ignore this comment and I'll update the code and upload
> a new patch.

oh, I forgot that I did go through the code of getDatabase().getSchemata(). It seems it would never be null. An empty array iterable will be returned if no schema exists in the database so a null check is probably still unnecessary. Let me what you think. Thanks!
Comment 7 Nan Li CLA 2011-12-06 12:38:28 EST
Created attachment 208009 [details]
Proposed Patch

I should get it right this time. :)
Comment 8 Neil Hauge CLA 2011-12-15 17:43:08 EST
Patch applied to head.