eobjects.org MetaModel

MetaModel is a library that encapsulates the differences and enhances the capabilities of different datastores. Rich querying abilities are offered to datastores that do not otherwise support advanced querying and a unified view of the datastore structure is offered through a single model of the schemas, tables, columns and relationships.

Modules in MetaModel

Sounds interesting? Read on for a few quick steps to get you started!

Query with MetaModel

With MetaModel you use a type-safe SQL-like API for querying any datastore:

DataContext dataContext = DataContextFactory.create[Type-of-DataContext](...);
DataSet dataSet = dataContext.query()
    .from("libraries")
    .select("name")
    .where("language").equals("Java")
    .and("enhances_data_access").equals(true)
    .execute();

The MetaModel query API allows you to use the power of SQL, even on data formats such as CSV files, Excel spreadsheets, NoSQL databases and more.

Update with MetaModel

MetaModel lets you do CRUD operations on arbitrary datamodels, also in a type-safe manner. Batch updates and transactions are logically modelled as UpdateScript closures.

dataContext.executeUpdate(new UpdateScript() {
    public void run(UpdateCallback callback) {
        // CREATE a table
        Table table = callback.createTable("foo").withColumn("bar").ofType(INTEGER)
            .withColumn("baz").ofType(VARCHAR).execute();
            
        // INSERT INTO table
        callback.insertInto(table).value("bar", 1).value("baz", "hello").execute();
        callback.insertInto(table).value("bar", 2).value("baz", "world").execute();
        
        // UPDATE table
        callback.update(table).value("baz","universe").where("bar").equals(2).execute();
        
        // DELETE FROM table
        callback.deleteFrom(table).where("bar").equals(1).execute();
    }
});

The rest of the API should reveal itself through using the DataContext (but don't be affraid to check out the examples and the Javadoc API documentation)!

Install MetaModel

Include MetaModel as a dependency in your project (if you're not using Maven, refer to the download page for alternatives):

<dependency>
    <groupId>org.eobjects.metamodel</groupId>
    <artifactId>MetaModel-full</artifactId>
    <version>3.4.1</version>
</dependency>