Comment 3 for bug 839349

Revision history for this message
Timo Westkämper (timo-westkamper) wrote :

The approach of generating SQL query types this way is not very expressive. There are lots of query expressions you wouldn't be able to generate this way easily such as

* joins
* properties from embeddables
* columns from mixed table inheritance

I don't see good alternatives to using the generated SQL types. You can restrict the tables to be mirrored via the schemaPattern and tableNamePattern properties.

Even if you would manage to generate proper expressions, your queries would become really verbose.

Compare this

from($(user)).innerJoin($(employee)).on($(user.getEmployee().getId()).eq($(employee.getId()));

with

SUser user = SUser.user;
SEmployee employee = SEmployee.employee;
from(user).innerJoin(user.employeeFk, employee);

Try to sketch some queries involving joins with your imagined approach. You will see that it doesn't scale.