rawsqlapache-metamodel

Execute select query in Apache metamodel


I am using Apache meta model with postgres database. I want to execute a simple SQL select query. Can some one please help me how to achieve this functionality ??


Solution

  • Simply instantiate a JdbcDataContext and query like e.g. the MetaModel website’s example:

    DataContext dataContext = new JdbcDataContext(..)(
    DataSet dataSet = dataContext.query()
    .from("libraries")
    .select("name")
    .where("language").eq("Java")
    .and("enhances_data_access").eq(true)
    .execute();