This repository demonstrates the integration of jOOQ's powerful querying capabilities , specifically focusing on implementing optimistic locking strategies. The goal is to showcase how to leverage jOOQ's expressive DSL for building type-safe SQL queries for building enterprise Java applications to implement efficient optimistic locking mechanisms.
- Seamless integration of jOOQ for efficient database operations
- Implementation of optimistic locking strategies to manage concurrent data access
- Detailed examples and best practices for incorporating jOOQ
- Comprehensive documentation and code samples for easy understanding and implementation
- Clone the repository:
git clone https://github.com/amalrajvinoth/jooq-optimistic-locking.git
- DB Migrations
- To first clean the database and then run all the migrations, run the following command:
./mvnw -f pom.xml flyway:clean flyway:migrate \ -Djooq.skip.generation=true \ -DDATASOURCE_HOST=127.0.0.1 \ -DDATASOURCE_PORT=5432 \ -DDATASOURCE_USER=postgres \ -DDATASOURCE_DATABASE_NAME=postgres \ -DDATASOURCE_PASSWORD=password
- Generate jOOq classes
$ ./mvnw -f pom.xml jooq-codegen:generate \ -Djooq.skip.generation=false \ -DDATASOURCE_HOST=127.0.0.1 \ -DDATASOURCE_PORT=5432 \ -DDATASOURCE_USER=postgres \ -DDATASOURCE_DATABASE_NAME=postgres \ -DDATASOURCE_PASSWORD=password
- Run Main
mvn compile exec:java -Dexec.mainClass="io.github.amalrajvinoth.Main" -DDB_PASSWORD=pzS5dRWDUc7bu8Kr -DDB_URL="jdbc:postgresql://127.0.0.1:54320/test" -DDB_USER=postgres
Follow the guidelines in the usage documentation to understand how to use the jOOQ with optimistic locking.