BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News New Open Source project provides Object Oriented data access

New Open Source project provides Object Oriented data access

This item in japanese

Kasper Sørensen has created a new open source project at eobjects.dk called MetaModel. The project is a common domain model, query engine, and optimizer for different types of datastores, such as relational databases and flat files. MetaModel is a Java library that provides a fluent, object-oriented interface for SQL compliant queries.

MetaModel offers a common domain model for the "datastore" domain. For example, the library provides domain objects such as Table, Column, Query, and DataSet that can be used to query the datasource or even build or alter the structure of the datastore. This model allows you to create and manipulate SQL queries via JDBC against relational databases. It also provides the same query capabilities against CSV and Excel files.

MetaModel's query engine is entirely object oriented. This allows the specification of queries using Java objects instead of arbitrary or potentially error-prone literals. It also provides a level of type-safety in creating the queries.

In discussing the usefulness of the MetaModel library, Sørensen said
[I]t enforces a better way of interacting with your data, based on accepted standards and type-safe query-writing. The framework is small and simple, yet powerful, making it easy to use and easy to learn.
The project site claimed that the overall goal for MetaModel is to provide a Java API that allows:
  • Traversing and building the structure of datastores.
  • Executing datastore-neutral queries in a SQL-like manner.
  • Provide datastores that do not support queries with a query engine.
  • Implement this system for JDBC databases, CSV files and Excel spreadsheets.
  • Split single queries into multiple ones that yield the same collective result, enabling powerful performance optimization and grid execution for heavy work loads.
eobjects.dk also provided a Programming with MetaModel webcast showing the basics of using the domain model to work with different data sources (CSV and MySQL DB). The first half of the webcast detailed the use of the core DataContext class for interacting with the datastores. The second half of the webcast explained the generation of queries with the library classes.

MetaModel is not equivalent or a replacement for an O/R mapping tool. It may provide a simpler way to implement database interactions than using straight JDBC.

Rate this Article

Adoption
Style

BT