Huge DB query ideas needed

I

iksrazal

Hi all,

I'm recieving a Bean from a web page that has something like 50
parameters, only one is mandatory. The idea is to use all these
parameters for a big select, filtering out data and returning what is
seached for. Any idea for something better than lots of 'if'
statements? For example...

private void createSelect(StringBuffer query, TrackerFilter param)
{
query.append("select distinct act from Activity act ");
if (param.getClientName() != null)
{
query.append("join act.clientInfo client");
}
// much more of the same
}

private void setParameters(Query
query, TrackerFilter param)
{
if (param.getClientName() != null)
{
query.setParameter("clientName", param.getClientName() + "%");
}
// much more of the same
}

Any ideas?
iksrazal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top