Can we prepare an sql dynamically in springs framework.
select emp.lastname, dept.depno from emp, dept where e.empno = dept.empno and dept.deptno =123;
select emp.lastname, dept.depno from emp, dept where e.empno = dept.empno and dept.deptno =123 and emp.firstname = 'emp1';
My scenario is, i may get only deptno = 123 or emp.firstname = 'emp1' or both from a client trying to fetch data.
so is there any way to prepare these sqls dynamically, using a properties file in springs?
sometimes even tables names are also different. suppose instead of dept, salary table has to be referred. please suggest if we can dynamically include table name also.
Thanks in advance,