I have an issue.
I have SQL that I need to append different type of “restrictions” or even do a join. This depends on user’s search criteria.
This SQL will involve different table as it can search one-to-many relationship, therefore hibernate ORM can’t support my requirement.
May I know if there is a design pattern to help construct such SQL statements?
The design pattern that fits to the problem of representing a language statement is the Interpreter pattern. But before you start to code your SQL parser, take a look to ANTLR.
And what is more important, ask yourself two questions: