Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Do I make the same application look at Different Queries in different Modes?

 
Sege Stephen
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have an Application . Basically, what I need to do is to make the application Use different queries to access data from the database.

Eg, Application in A mode uses a DAO to get the name and address of the users.

Application in B mode uses the same DAO to get the name and address, also telephone detail, email address of the Users. There are two queries in the DAO, when app is in Mode a, it looks at DAO and execute the first query, when in mode B, it looks at the same DAO and execute the second query.


Right, I thought about doing this by having two links on the home page, when you Select App Mode A link, it always execute Query one, when you Select link two which is APP in B mode, it executes Query Two.

HOw do I pass Parameters so that App knows it is in A mode, or B mode. Or better still, what is the best way of doing this, please tell me. I just want Ideas and I would really appreciate it.

Thanks
Sege
 
Arthur Buliva
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about overloading methods?

something like, for instance,

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic