Reputation: 35
At the moment I only know that you can do this in JPA
SELECT art_bezeichnung FROM table WHERE art_nr = :parameter
.setParameter("parameter", "H03")
But can you also add a whole where clause via a parameter
SELECT art_bezeichnung FROM table :parameter
.setParameter("parameter", "WHERE art_nr = H03")
I searched the Internet for it, but couldn´t find a clear answer.
Upvotes: 0
Views: 216
Reputation: 356
That's not possible because of possible SQL-Injection.
Use a if statement instead:
if (Parameter is set) add where to SQL Statement and Parameter.
Upvotes: 1