RSS Feed for This PostCurrent Article

MetaModel: SQL 99 Compliant Domain Model

MetaModel is a project created for maximum reuse of a SQL 99 compliant domain model of the database domain. The MetaModel is a model that contains classes that represent the structure of a database (schemas, tables, column, relationships) and interaction with the database (queries). In short a model for modelling (hence the word “metamodel”) data in databases and other datastores.

E.g. look at the following code snippet

DataContext dataContext;
//We can handle different types of datastores transparently of their type.
if (useJdbc()) {
  java.sql.Connection connection = ... //Obtain a JDBC connection
  dataContext = new DataContext(connection);
} else if (useCsv()) {
  dataContext = new DataContext(new File("my_csv_file.csv"));
} else if (useExcel()) {
  dataContext = new DataContext(new File("my_spreadsheet.xls"));
} else if (useOpenOffice()) {
  dataContext = new DataContext(new File("my_database.odb"));
} else {
  dataContext = new DataContext(new MyCustomDataContextStrategy());
}
 
//All datastores has schemas, which in turn consist of tables and columns.
Schema[] schemas = dataContext.getSchemas();
Table customerTable = schemas[0].getTableByName("customer");
Column idColumn = customerTable.getColumnByName("id");
Column nameColumn = customerTable.getColumnByName("name");

Popularity: 1% [?]


Trackback URL


RSS Feed for This PostPost a Comment