You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2015/06/01 14:27:18 UTC

[jira] [Commented] (METAMODEL-147) API, Maven CodeGenerator

    [ https://issues.apache.org/jira/browse/METAMODEL-147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14567241#comment-14567241 ] 

Kasper Sørensen commented on METAMODEL-147:
-------------------------------------------

Please keep the topic to one point at a time, or else we cannot manage this JIRA issue at all. I take it from the subject that this issue is _just_ about the maven generation thing - so your last paragraph only?

Btw. I replied on the mailing list to your questions. But I am not sure if you are subscribed to the list.

> API, Maven CodeGenerator
> ------------------------
>
>                 Key: METAMODEL-147
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-147
>             Project: Apache MetaModel
>          Issue Type: Wish
>    Affects Versions: 4.4.0
>            Reporter: xialvjun
>
> I sended an email to dev@metamodel.apache.org last night.  But now I found jira site of metamodel, so paste the email here.
> I've searched http://wiki.apache.org/metamodel/ with keyword "subquery", but there is no result.
> I used to think if org.apache.metamodel.query.Query implements org.apache.metamodel.schema.Table  so I can do it like dataContext.query().from(query), but it doesn't. 
> So I ask you how to do SubQuery in MetaModel.
> In fact, I think the api of MetaModel can do a big change, like this:
> {code}
> TableLike = dataContext.query().from(TableLike... tables)
> TableLike = dataContext.query().from(TableLike... tables).select(ColumnLike... columns)
> Filter = ColumnLike.operator(value)
> dataContext.query().from(TableLike... tables).select(ColumnLike... columns).where(Filter... filters).groupBy(ColumnLike... columns)
> DataSet ds = TableLike.execute();
> {code}
> There are 3 main interfaces: TableLike , ColumnLike , Filter.
> query, table, view are all TableLike;
> column in a query, column in a table are all ColumnLike;
> filter is generated by ColumnLike...
> And if the Column Type can be represent by the class of Column, things may be better.
> Maybe we can't make Column a generic class like Column<Integer>, because we can't use it like Column<Person>(wait, wait, wait, maybe we can if Person is just a java bean.... WOW, so it seems that TableLike is in fact a subclass of ColumnLike, ehh, it's a little complex, leave it).... So we can have some simple column class like IntegerColumn, StringColumn, DateColumn.....
> By the way, I think a code generator maven plugin is needed.  I usually manually create a DB class which has static members of all the Tables and Columns, then I can use them without string literals to represent table or column which has a using expirence like jooq or empire-db. I believe a maven code generation plugin will do better. It can also create pojo class from database schema using underline naming method to camel naming method... So when we get a Dataset dataSet object, we can just like dataSet.extract(List<Person>.class) to get the data.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)