Hi dear friends.
I have tried to implement QueryDSLAbstractDAO for QueryDSL library.
It is quite easy task but…
QueryDSL does not provide out of the box stuff to implement method findById for the case if primary or secondary key is composite key.
For the composite key your SQL query should look like: “SELECT * FROM table t WHERE (t.a, t.b) in (100, 200)”.
This task requires to create an implementation of special programming interface “Tuple”.
To create flexible design we should use Java Generics – because Java Generics is the basis of any AbstractDAO pathern.
I think makes sense to use dedicated POJOs for work with composite keys.
In specific case the signature of finder function may have a look as “findbyId(ProductDescriptionKey productDescriptionKey)”.