metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Krause <david.krause...@gmail.com>
Subject More easy joining of tables in MetaModel Query?
Date Sun, 29 Jun 2014 17:25:12 GMT
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?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message