• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

criteriaFind() question

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I'm fairly new (only registered yesterday) to this group, and have had the assignment for the last three days. I have a couple of questions, please. First of all, is there any 'grouping' (for a lack of the better word) of relevant issues on this site? I.e., all the posts relevant to the 'lock/unlock' issue?
I have a question regarding criteriaFind() method. Wasn't able to find any relevant posts (I suspect it could be because it's a 'newby' question), if one already exists please point me to it (and I apologies to all for the bandwidth waste ).
My question is about the argument sent to the criteriaFind() method. After reading the instructions, I think it should be written to accept any number of field/value comma separated parameters. Is that correct? Now, the example of the String argument given to me was "Carrier='SpeedyAir',Origin='SFO'" . This 'Origin' part of the argument is confusing to me. The GUI section specifies the selection of the 'origin' and 'destination' fields. I had a look at the database, including the field names. The two required fields have names 'Destination Airport' and 'Origin Airport'. It would be much easier to select the records which satisfy the search criteria if I could send the EXACT field names as a parameters, ie. "Destination Airport='LAX',Origin Airport = 'SFO'". Should I expect the field names passed to be correct (full), or do I need to cater for the parameters like "Destination='LAX',Origin='SFO'" also? There are three fields which start with the letter 'D', so if I have to accept the partial field names, I'll need at least two characters. It seems ... wrong.
I know I can format the argument any way I want it (I will put values for both fields into JComboBox-es for user to select before I call criteriaFind()), but I want to make sure my criteriaFind() method is written properly.
TIA, Branko.
[ April 18, 2002: Message edited by: Branko Paskutini ]
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Branko. From the sounds of it I think you have a really good handle on it, and question the parts that should be questioned. A search on criteriaFind will get lots of returns.
But no need to do that.
Yes they keep it open ended to include any and all fields that you wish for them to search on. When I read that part there was confusion on my part too. So this is what I did. I saw the two fields in their criteria String, plus the GUI requirement of origin and destination, and combined it to include three JComboboxes.
1. Origin Airport
2. Destination Airport
3. Carrier
I made sure that the string incldued the entire field name, as in

Hope that helps.
Mark
 
Branko Paskutini
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,
Thank you for your reply. What was the reason you included 'Carrier' combo for the user selection? Was that the requirement in your assignment? If user selects 'Any' for the 'Carrier' it would bring all results as if 'Carrier' combo didn't exist, so this sounds like an additional feature. How do examiners react to having additional features? I just don't want to be marked down for the added extras if they weren't in the specs.
Sorry, I just re-read your answer, it was the String example that made you add 'Carrier' to the GUI. Have you submitted your assignment yet? If so, what was their response to having 'Carrier' as one of selection fields.
Regards, Branko.
[ April 18, 2002: Message edited by: Branko Paskutini ]
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Have you submitted your assignment yet? If so, what was their response to having 'Carrier' as one of selection fields.


In the entire assignment I only lost 4 points, and it was in the server, which unfortunate for our discussion also includes the search algorithm. However, I don't think that is where I lost 4 points.
I lost the 4 points in not breaking the server and the db into two seperate packages. Mine was all in the db package. Doh!.
Also I didn't use a LockManager class to handle lock, I used the Data class to keep all the locks, and My DataAccessremote class to handle the client's individual records locked.
Those two areas are probably were I lost the points.
So to make a long story short. (Too late!) they were fine with my three comboboxes. )
Mark
 
Branko Paskutini
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again for your response Mark. Sorry to be a pain, but I did my last post at 3AM local time, and I forgot to clarify my original question: if there are two records whose Carrier is 'SpeedyAir' and Original Airport is 'SFO', and the String argument for criteriaFind() contains incomplete field names (like the example in Instructions), would your criteriaFind() return two records, or zero? Please say zero - I'm running JUnit tests and my code at the moment only returns the correct number of records if the String argument contains complete field names.
Regards, Branko.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please realise that the requirements you got are not necessarily complete and may even be contradictory (doesn't it say this somewhere in the instructions? I seem to remember that two years ago, it did).
I would be confident that requiring that the field names in a criteriaFind match the database field names exactly is reasonable and not something you would be penalised for. After all, that's how every real world database behaves.
- Peter
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your search algorith requires the entire field name, and the string passed has an incomplete one, then no records should be returned.
However, because you are using drop downs the criteria string will be created by you in code, so I hope you won't get incomplete field names.
Mark
 
Branko Paskutini
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's great news. Thank you Mark and Peter for your help.
Branko.
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic