This Repository Contains Implementation for Database Locking with Spring Data JPA
- Java
- Spring Boot
- Spring Data JPA
- Hibernate
- Maven
- H2 Database (for testing)
- JMeter (for performance testing)
- Clone the repository:
git clone https://github.com/your-repo/spring-jpa-database-locking.git
- Navigate to the project directory:
cd spring-jpa-database-locking
- Build the project:
./mvnw clean install
- Run the application:
./mvnw spring-boot:run
- Access the application at
http://localhost:8080
.
// ...existing code...
@Entity
public class ExampleEntity {
// ...existing code...
@Version
private Long version;
// ...existing code...
}
// ...existing code...
@Entity
public class ExampleEntity {
// ...existing code...
@Version
private Long version;
// ...existing code...
}
- Open JMeter.
- Load the provided JMeter test plan located at
Database Locking JPA Test Plan.jmx
. - Start the test plan to simulate concurrent updates and observe the results.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License.