Skip to content

bvincent/spring-cqrs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Example of cqrs application module

Process of changing table/model structure:

  • Create sql script that do what you want
  • Update entities
  • Update database with Flyway mechanism
  • Update meta models (Query Meta Model, Write Meta Model) by QueryDSL maven plugin

Dependencies:

  • Flyway - is used as database migration tool.
  • Hibernate - is used as ORM in write stack.
  • QueryDSL - is used as a tool for type safe SQL-like queries.

Write stack

Uses Hibernate and jpa-querydsl.

Read stack

Uses sql-querydsl with spring-jdbc-extension.

Database - MetaModel synchronization

In brief, to synchroznize database with flyway sql scripts and meta models with database, just run:

mvn -Pdb-tools compile

Database migration with Flyway

  • After project is deployed on server, database is automatically initialized and upgreaded. There is no need to use command tool.

  • If you want to manually upgread the database. Use command tool:

    mvn -Pdb-tools initialize flyway:init mvn -Pdb-tools initialize flyway:migrate

Generating Query Meta Model

Query meta model is generated from tables from database. It is is generated to src/main/java location, so there is no need to generate automatically by IDE or to generate it during integration tests on hudson.

mvn -Pdb-tools initialize com.mysema.querydsl:querydsl-maven-plugin:export

Generating Command Meta Model

Command Meta Model is generated from JPA entities. It is automatically generated during compile phase to target/generated-sources/querydsljpa directory.

mvn compile

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%