What is grepo?

The Generic Repository (grepo) is an open source (ASLv2) framework for Java which allows you to access (database) repositories in a generic and consistent manner. Using grepo, it is generally no longer required to provide all the boilerplate code which is necessary in order to access (database) repositories from Java. All you have to do is write appropriate database code (queries, procedures, functions etc.), an appropriately annotated Java interface, and very little Spring configuration. Using the framework has the following advantages:

  • Improves development time because no implementations are required for data access objects (DAOs).
  • Simplifies development and increases code quality - you won't hear your colleague say "Hey look, what I've found - I guess this is not the way we do this normally?!" anymore.
  • Makes your data access layer consistent - similar/equal data access operations are "implemented" (and thus work) in the same way which in turn makes software more stable and in general better maintainable.

Goals

The main goals of the framework are:

  • Simplicity - The framework should be easy to use and understand - grepo was designed around the convention over configuration paradigm.
  • Flexibility - The framework should be flexible enough, so it can be used for most database access specific tasks - grepo is easily configurable and extensible in order to fit custom/special needs.
  • Consistency - The framework should assist in building consistent data access layers - grepo allows to define and configure rules and guidelines (coding conventions etc...) for the data access objects. Those rules are then applied and enforced by the framework - grepo has a predefined (default) set of rules which may be customized for custom/special needs.

Features

The main features of the framework are:

  • generic support for Hibernate based DAOs
  • generic support for Jpa based DAOs
  • generic support for executing database stored-procedures and functions
  • highly customizable

Components

The framework consists of the following main components:

Generic Query (gquery)

The "Generic Query" component allows to access databases using SQL queries. Currently the following ORM (Object Relational Mapping) tools/APIs are supported:

  • Native Hibernate API
  • Java Persistence API

The gquery component defines a set of (default) rules for repositories which may be customized/extended for custom/special needs. The framework provides default implementations for both "read-only" and "read-write" repositories which may be used for basic CRUD operations. However its up to you to provide your own implementation(s) if desired. Furthermore gquery offers the possibility to define and execute various queries (SQL, HQL, JPQL) and DAO methods without requiring custom implementations.

Generic Procedure (gprocedure)

The "Generic Procedure" component allows to access databases using PLSQL (that is calling stored procedures and/or functions) without requiring custom implementations - gprocedure is build on top of the Spring (JDBC) framework.