BSLA - Basic Spring Layer Architecture - is an implementation springframework oriented of DB_API.
The presistence layer is based on JPA2.

Big Picture

bsla-jpa2-big-picture.jpg

Layers

Domain Object

The domain is not dependent on the persistence layer. But the persistence layer (being data-centric) depends on it. That is why the Domain Object artifact is presented here. The domain object is the class representation of a table. It has the following characteristics:
  • Attributes:
    • Standard : All the fields of the DB corresponding table are mapped to attributes of the class. Those fields are type according to the DB 2 Java type conversion. The fields name are DB name converted into java name.
    • Parents : attribute of type of the class of the table of the parent entity
    • Children : list of class of type of the class of the children table.
  • Getter, setter, adder (for list).
  • Constructors:
    • Default
    • one with all the standard attributes
  • Constraints:
    • Length of the field as constant
    • Field mandatory status as constant
  • Methods : toString, equals, mask, hashcode
Remark: The implementation of the Domain Object is not using persistence annotation.

Implementation with JPA2

see JPA2

Instrumentation

  • Caching with ehcache
  • Typesafe Criteria API with
    • QueryDSL (via annotation processing)
    • MetaModel (via generation)
  • Business Logic integrity with Automated Business Logic

DAO

Set of entity related DAOs integrated with spring.
Technical DAO, generic or generated based on the mask pattern: what mask, where (positive/negative) mask, sort and ordering mask.
The mask is the domain object whose attribute and relationships (parent/child) are partially filled.
Mask API are typesafe by essence.
It is use to simplify the query building process in a type safe way.
Operates on top of JPA2 layer.


Services

Entity Service

Handles transactional aspects with spring.
Provides presentation essential service for display purpose.
Operates on top of DAO layer.

Model Service

Cross entity services, centralise common aspects:
  • limited list to be used as drop down list.
  • associated list
  • matrix

Build

The build is based on maven pom.
Each layer has a pom as well as the parent directory.

Extension

It can also be used and extended by your own need.
The extension can take place at the 3 layers of BSLA stack.
  • Domain Object can be altered to provide extra attributes, methods.
  • DAO can
    • be created on top of JPA2 Domain object layer
    • extends already existing DAOs
  • Service can
    • reference other service or DAOs
    • extends existing

Associated tracks

BSLA is an implementation of DB API. It is the ground upon which multiple tracks for retrieving and processing this information operate.

  • REST
  • JSF with Primefaces/spring
  • Vaadin
  • ADF-FACES