Skip to content

Conversation

@alexzam
Copy link

@alexzam alexzam commented Mar 24, 2015

Use like this:

@Table(name = "myView", view = true)
public class MyView extends View {
    @Column
    public String field1;

    @Column
    public int field2;

    @Override
    public String getQuery() {
        return "select t1.field1, count(t2.Id) as field2 from t1 " +
                "LEFT JOIN t2 ON t2.group_id = t1.Id " +
                "group by t1.Id";
    }
}

@alexzam
Copy link
Author

alexzam commented Mar 24, 2015

And to use a view:

List<MyView> rows = View.getRows(MyView.class, params);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant