Yes the Query Builder looks good. But I just tried to join 3 tables using the query builder API, and I get a new problem... After the first join, the API no longer exposes the innerJoin method, so in fact I currently need to use the Query class and not the query builder.
OK, here is a JIRA for these subjects: https://issues.apache.org/jira/browse/METAMODEL-64 2014-06-29 21:00 GMT+02:00 Henry Saputra <[email protected]>: > David, > > Please do open Jira ticket for improvement. This seems like good idea. > > - Henry > > On Sunday, June 29, 2014, David Krause <[email protected]> wrote: > > > Hi MetaModel users and developers, > > > > I am looking for a tip, or maybe want to make a proposal... I have three > > tables that I do some joining on... For example purpose, let's say they > are > > called: > > > > product (id, product_line_id, name) > > product_line (id, name) > > product_configuration(id, product_id, name, ...) > > > > Often I want to join like this: > > > > product p > > INNER JOIN product_line ON p.id = product_line.product_id > > INNER JOIN product_configuration ON p.id = > > product_configuration.product_id > > > > So in short, just 3 tables with a relationship "on a line" in a E/R > > diagram. > > > > I have been using MetaModel for a small webapp on this database, and it > > works well. But I find that the table-joining code here is very bulky. I > > need use a lot more lines of Java code than what is there in plain SQL. > > Maybe there is a shortcut I don't know of? Or maybe it can be improved. > An > > idea for improvement would be to have a syntax where the Tables are not > > supplied directly, but rather just grabbed if you supply two Columns. For > > instance: > > > > Column productIdPK = [some code omitted]; > > Column productLineProductIdFK = [some code omitted]; > > > > Query q = [some code omitted]; > > q.fromJoined(productIdPK, productLineProductIdFK); > > > > What do you think? > > >
