NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

ExplorerManager working as database query

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
spaulo



Joined: 06 Oct 2010
Posts: 3

PostPosted: Wed Oct 06, 2010 2:48 pm    Post subject: ExplorerManager working as database query Reply with quote

How can we make ExplorerManager working as database query that can CRUD. With nodes, subnodes and leaf nodes?
Back to top
Charles Bedon
Posted via mailing list.





PostPosted: Thu Oct 07, 2010 3:47 am    Post subject: [platform-dev] Re: ExplorerManager working as dinamic database query Reply with quote

Hello

What exactly so you mean "working as database query that can CRUD"? ExplorerManager is a class that belongs to the "view"

2010/10/6 spaulo <address-removed ([email]address-removed[/email])>
Quote:
How can we make ExplorerManager working as database query that can CRUD. With nodes, subnodes and leaf nodes?[/u]







--
Charles Edward Bed
Back to top
spaulo



Joined: 06 Oct 2010
Posts: 3

PostPosted: Thu Oct 07, 2010 12:01 pm    Post subject: Example Reply with quote

Code:


Table: CITIES
+----------------+---------------+---------+------------+------------------+
| CITY_NAME      | COUNTRY       | AIRPORT | LANGUAGE   | COUNTRY_ISO_CODE |
+----------------+---------------+---------+------------+------------------+
| Melbourne      | Australia     | MEL     | English    | AU               |
| Sydney         | Australia     | SYD     | English    | AU               |
| Rio de Janeiro | Brazil        | GIG     | Portuguese | BR               |
| Sao Paulo      | Brazil        | GRU     | Portuguese | BR               |
| Montreal       | Canada        | YUL     | French     | CA               |
| Toronto        | Canada        | YYZ     | English    | CA               |
| San Jose       | United States | SJC     | English    | US               |
| Albany         | United States | ALB     | English    | US               |
| Albuquerque    | United States | ABQ     | English    | US               |
| Atlanta        | United States | ATL     | English    | US               |
| Boise          | United States | BOI     | English    | US               |
+----------------+---------------+---------+------------+------------------+



Table: FLIGHTS
+-----------+----------------+--------------+-------------+--------------+-------------+------+-------------+-------+----------+
| FLIGHT_ID | SEGMENT_NUMBER | ORIG_AIRPORT | DEPART_TIME | DEST_AIRPORT | ARRIVE_TIME | MEAL | FLYING_TIME | MILES | AIRCRAFT |
+-----------+----------------+--------------+-------------+--------------+-------------+------+-------------+-------+----------+
| AA1123    | 1              | ALB          | 09:00:00    | JFK          | 09:16:00    | S    | 0.27        | 135   | DC10     |
| AA1125    | 1              | ALB          | 07:00:00    | BOS          | 07:16:00    | S    | 0.278       | 139   | B747     |
| AA1127    | 1              | ALB          | 09:00:00    | IAD          | 09:32:00    | S    | 0.548       | 274   | B747     |
| AA1147    | 1              | ATL          | 09:00:00    | LAX          | 09:52:00    | B    | 3.87        | 1935  | B747     |
| AA1149    | 1              | ATL          | 09:00:00    | DFW          | 09:26:00    | B    | 1.442       | 721   | B747     |
| AA1151    | 1              | ATL          | 09:00:00    | SEA          | 10:21:00    | B    | 4.36        | 2180  | B747     |
| AA1226    | 1              | ATL          | 09:00:00    | CHS          | 09:31:00    | S    | 0.532       | 266   | B747     |
| AA1258    | 2              | ATL          | 11:05:00    | DFW          | 11:31:00    | L    | 1.442       | 721   | B747     |
| US1384    | 1              | ATL          | 11:30:00    | MDW          | 11:40:00    | L    | 1.174       | 587   | B747     |
| US1430    | 1              | ATL          | 09:00:00    | MSY          | 08:50:00    | L    | 0.848       | 424   | B747     |
| AA1257    | 2              | ATL          | 12:10:00    | PHL          | 13:29:00    | L    | 1.33        | 665   | B747     |
| US1494    | 1              | ATL          | 09:00:00    | SAT          | 09:45:00    | L    | 1.766       | 883   | B747     |
| AA1164    | 1              | GIG          | 09:00:00    | BNA          | 15:57:00    | L    | 9.964       | 4982  | B747     |
| AA1170    | 1              | GIG          | 09:00:00    | BOG          | 12:38:00    | L    | 5.648       | 2824  | B747     |
+-----------+----------------+--------------+-------------+--------------+-------------+------+-------------+-------+----------+


+ COUNTRY
  + CITY_NAME
    + DEPART_TIME
      + FLIGHT_ID

+ Australia
|
+ Brazil
|
- Canada
| |
| + Montreal
| |
| + Toronto
- United States
| |
| - Albany
| | |
| | - 07:00:00
| | | |
| | | - AA1125
| | |
| | - 09:00:00
| |   |
| |   - AA1123
| |   |
| |   - AA1127
| |
| + Albuquerque
| |
| + Atlanta
| |
| + Boise
| |
| + ...
Back to top
Christian August Michelse
Posted via mailing list.





PostPosted: Thu Oct 07, 2010 5:56 pm    Post subject: [platform-dev] Re: ExplorerManager working as dinamic database query Reply with quote

Den 06.10.2010 16:48, skrev spaulo:
Quote:
How can we make ExplorerManager working as database query that can CRUD. With nodes, subnodes and leaf nodes?[/u]

I can't see why it would matter what kind of a node your talking about,
your <insert here whatever creates your nodes> decides what kind of node
it is based on whatever business logic you have for that kind of thing.
As far as I got before I switched to a more DAO-ish thing was just use
the entitymanager wherever I needed (horrible mess, but it was a prototype).
Though most of the EM-stuff was in various topcomponents.

Though you'd have to ask yourself if you really want your entities
strongly linked to your nodes. It's "easier" and faster I guess. Though
you'd have to write some of the same code over and over again
(transaction, merges, persist etc). Depending on your situation, scope
of project, developers etc. you might just stick with entitymanagers
littered across your UI code if that makes sense for your scenario.


I just use created a DAO layer between my EM and my nodes and my
entities implement various interfaces so it's nice and decoupled. But
then again I have the "unfortunate" task of creating an application that
should work with different databases (radically different schemas, with
enough commonalities of course) and/or mapping tools (or lack thereof).
But I can't really complain since I'm the bastard who decided on that
criterion.

I'm hopefully going to get the time in the not so distant future to
write up something about my approach.

--
Kind regards
Christian Michelsen
Back to top
Charles Bedon
Posted via mailing list.





PostPosted: Fri Oct 08, 2010 12:13 am    Post subject: [platform-dev] Re: ExplorerManager working as database query Reply with quote

Hello

The model behind the views (BeanTreeview, ListView, etc) is up to you. You have to define nodes representing your business objects (Country, City, etc). Maybe you've already followed this, but if not,
Back to top
spaulo



Joined: 06 Oct 2010
Posts: 3

PostPosted: Fri Oct 08, 2010 12:20 pm    Post subject: I like the approach made by Geertjan Wielenga Reply with quote

The approach presented by Geertjan Wielenga in the tutorial http://platform.netbeans.org/tutorials/nbm-crud.html is path I would like take.
I would appreciate that the answers to this question would give code examples.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo