diff --git a/Makefile b/Makefile index 1cacc8af..dfbf2fd7 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ all: build +up: + @docker-compose up -d + build: @./gradlew build --warning-mode all diff --git a/README.md b/README.md index 37cf445c..a272e05b 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,11 @@ This is a repository intended to serve as a starting point if you want to bootst 1. Install Java 8: `brew cask install corretto8` 2. Set it as your default JVM: `export JAVA_HOME='/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home'` 3. Clone this repository: `git clone https://github.com/CodelyTV/java-ddd-skeleton`. -4. Execute some [Gradle lifecycle tasks](https://docs.gradle.org/current/userguide/java_plugin.html#lifecycle_tasks) in order to check everything is OK: +4. Bring up the Docker environment: `make up`. +5. Execute some [Gradle lifecycle tasks](https://docs.gradle.org/current/userguide/java_plugin.html#lifecycle_tasks) in order to check everything is OK: 1. Create [the project JAR](https://docs.gradle.org/current/userguide/java_plugin.html#sec:jar): `make build` 2. Run the tests and plugins verification tasks: `make test` -5. Start developing! +6. Start developing! ## ☝️ How to update dependencies diff --git a/src/shared/main/tv/codely/shared/infrastructure/hibernate/HibernateRepository.java b/src/shared/main/tv/codely/shared/infrastructure/hibernate/HibernateRepository.java index ca4924ea..434a0d42 100644 --- a/src/shared/main/tv/codely/shared/infrastructure/hibernate/HibernateRepository.java +++ b/src/shared/main/tv/codely/shared/infrastructure/hibernate/HibernateRepository.java @@ -21,6 +21,8 @@ public HibernateRepository(SessionFactory sessionFactory, Class aggregateClas protected void persist(T entity) { sessionFactory.getCurrentSession().saveOrUpdate(entity); + sessionFactory.getCurrentSession().flush(); + sessionFactory.getCurrentSession().clear(); } protected Optional byId(Identifier id) {