I need help with this specific scenario, I need to execute sql based on user selection. When user selects multiple conditions I need to build the query by addign multiple and, or conditions to the SQL. How can I do this using ibatis? Should I create sql statements for every possiblity and execute? or can we put this conditions into a variable and pass that to substitute in the SQL ? I hope there should be some better way. If any one point me into the right direction then that would be a great help. Please explain to me in detail..