Using QueryDSL I would create a query like the following:
select * from cats as C join owners as O on ...
For readability reasons I would apply the alias "O" in the join clause, but the DSL doesn't seem to support this:
query.from(cats.as("C")).join(owners.as("O")).on(...)
The type of owners.as("O")
isn't compatible with types expected by join clause.
Have you any idea?
Ok, instead of using the autogenerated static instance of a table, you can simply create it with an alias:
Cat cat = new Cat("C");
Owner owner = new Owner("O");
query.from(cats).join(owners).on(...)
You can use Alias in Querydsl like
QCat cat = new QCat("C");
Querydsl Alias usage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With