diff --git a/default/generated/spring-framework/spring-framework-5.x-to-6.0-jpa-data-access.yaml b/default/generated/spring-framework/spring-framework-5.x-to-6.0-jpa-data-access.yaml
new file mode 100644
index 00000000..2fbbe62e
--- /dev/null
+++ b/default/generated/spring-framework/spring-framework-5.x-to-6.0-jpa-data-access.yaml
@@ -0,0 +1,35 @@
+- ruleID: spring-framework-5.x-to-6.0-data-access-00040
+ category: optional
+ effort: 1
+ labels:
+ - konveyor.io/source=spring5
+ - konveyor.io/target=spring6+
+ tag:
+ - Spring Framework
+ when:
+ java.referenced:
+ pattern: org.springframework.dao.DeadlockLoserDataAccessException
+ location: IMPORT
+ description: DeadlockLoserDataAccessException is deprecated in favor of CannotAcquireLockException
+ message: "DeadlockLoserDataAccessException is deprecated in favor of CannotAcquireLockException"
+ links:
+ - title: 'org.springframework.dao.DeadlockLoserDataAccessException'
+ url: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/dao/DeadlockLoserDataAccessException.html
+
+- ruleID: spring-framework-5.x-to-6.0-data-access-00050
+ category: optional
+ effort: 1
+ labels:
+ - konveyor.io/source=spring5
+ - konveyor.io/target=spring6+
+ tag:
+ - Spring Framework
+ when:
+ java.referenced:
+ pattern: org.springframework.dao.CannotSerializeTransactionException
+ location: IMPORT
+ description: CannotSerializeTransactionException is deprecated in favor of CannotAcquireLockException
+ message: "CannotSerializeTransactionException is deprecated in favor of CannotAcquireLockException"
+ links:
+ - title: 'org.springframework.dao.CannotSerailizeTransactionException Documentation'
+ url: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/dao/CannotSerializeTransactionException.html
\ No newline at end of file
diff --git a/default/generated/spring-framework/tests/data/jpa-data-access/.DS_Store b/default/generated/spring-framework/tests/data/jpa-data-access/.DS_Store
new file mode 100644
index 00000000..f2c573a7
Binary files /dev/null and b/default/generated/spring-framework/tests/data/jpa-data-access/.DS_Store differ
diff --git a/default/generated/spring-framework/tests/data/jpa-data-access/pom.xml b/default/generated/spring-framework/tests/data/jpa-data-access/pom.xml
new file mode 100644
index 00000000..4c12a70b
--- /dev/null
+++ b/default/generated/spring-framework/tests/data/jpa-data-access/pom.xml
@@ -0,0 +1,51 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.7.0
+
+
+ com.example
+ demo
+ 0.0.1-SNAPSHOT
+ accessing-data-jpa-complete
+ Demo project for Spring Boot
+
+ 1.8
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework
+ spring-dao
+ 2.0.8
+
+
+
+ com.h2database
+ h2
+ runtime
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/AccessingDataJpaApplication.java b/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/AccessingDataJpaApplication.java
new file mode 100644
index 00000000..b0b44341
--- /dev/null
+++ b/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/AccessingDataJpaApplication.java
@@ -0,0 +1,74 @@
+package com.accessingdatajpa;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.dao.DeadlockLoserDataAccessException;
+import org.springframework.dao.CannotSerializeTransactionException;
+
+@SpringBootApplication
+public class AccessingDataJpaApplication {
+
+ private static final Logger log = LoggerFactory.getLogger(AccessingDataJpaApplication.class);
+
+ public static void main(String[] args) {
+ SpringApplication.run(AccessingDataJpaApplication.class);
+ }
+
+ @Bean
+ public CommandLineRunner demo(CustomerRepository repository) {
+ return (args) -> {
+ // save a few customers
+ repository.save(new Customer("Jack", "Bauer"));
+ repository.save(new Customer("Chloe", "O'Brian"));
+ repository.save(new Customer("Kim", "Bauer"));
+ repository.save(new Customer("David", "Palmer"));
+ repository.save(new Customer("Michelle", "Dessler"));
+ repository.save(new Customer("CannotSerializeTransaction", "Exception"));
+ repository.save(new Customer("DeadlockLoserDataAccess", "Exception"));
+
+ // fetch all customers
+ log.info("Customers found with findAll():");
+ log.info("-------------------------------");
+ repository.findAll().forEach(customer -> {
+ log.info(customer.toString());
+ try{
+ throwException("CannotSerializeTransaction", customer);
+ }catch(CannotSerializeTransactionException e){
+ log.error("CannotSerializeTransaction Exception thrown and caught");
+ }
+ try{
+ throwException("DeadlockLoserDataAccess", customer);
+ }catch(CannotSerializeTransactionException e){
+ log.error("CannotSerializeTransaction Exception thrown and caught");
+ }
+ });
+ // fetch an individual customer by ID
+ Customer customer = repository.findById(1L);
+ log.info("Customer found with findById(1L):");
+ log.info("--------------------------------");
+ log.info(customer.toString());
+ log.info("");
+
+ // fetch customers by last name
+ log.info("Customer found with findByLastName('Bauer'):");
+ log.info("--------------------------------------------");
+ repository.findByLastName("Bauer").forEach(bauer -> {
+ log.info(bauer.toString());
+ });
+ log.info("");
+ };
+ }
+
+ public void throwException(String exception, Customer customer){
+ if(customer.isException(exception)){
+ throw new CannotSerializeTransactionException("Exception");
+ }
+ else if(customer.isException(exception)){
+ throw new DeadlockLoserDataAccessException("Exception", new Throwable());
+ }
+ }
+}
diff --git a/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/Customer.java b/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/Customer.java
new file mode 100644
index 00000000..ff9cba8c
--- /dev/null
+++ b/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/Customer.java
@@ -0,0 +1,49 @@
+package com.accessingdatajpa;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+@Entity
+public class Customer {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ private Long id;
+ private String firstName;
+ private String lastName;
+
+ protected Customer() {}
+
+ public Customer(String firstName, String lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(
+ "Customer[id=%d, firstName='%s', lastName='%s']",
+ id, firstName, lastName);
+ }
+
+ public boolean isException(String exceptionName){
+ if(lastName.equals("Exception") && firstName.equals(exceptionName)){
+ return true;
+ }
+ return false;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+}
diff --git a/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/CustomerRepository.java b/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/CustomerRepository.java
new file mode 100644
index 00000000..f934b8c2
--- /dev/null
+++ b/default/generated/spring-framework/tests/data/jpa-data-access/src/main/java/com/accessingdatajpa/CustomerRepository.java
@@ -0,0 +1,12 @@
+package com.accessingdatajpa;
+
+import java.util.List;
+
+import org.springframework.data.repository.CrudRepository;
+
+public interface CustomerRepository extends CrudRepository {
+
+ List findByLastName(String lastName);
+
+ Customer findById(long id);
+}
diff --git a/default/generated/spring-framework/tests/data/jpa-data-access/src/test/java/com/accessingdatajpa/CustomerRepositoryTests.java b/default/generated/spring-framework/tests/data/jpa-data-access/src/test/java/com/accessingdatajpa/CustomerRepositoryTests.java
new file mode 100644
index 00000000..e60a9155
--- /dev/null
+++ b/default/generated/spring-framework/tests/data/jpa-data-access/src/test/java/com/accessingdatajpa/CustomerRepositoryTests.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.accessingdatajpa;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
+
+import com.accessingdatajpa.Customer;
+import com.accessingdatajpa.CustomerRepository;
+
+@DataJpaTest
+public class CustomerRepositoryTests {
+ @Autowired
+ private TestEntityManager entityManager;
+
+ @Autowired
+ private CustomerRepository customers;
+
+ @Test
+ public void testFindByLastName() {
+ Customer customer = new Customer("first", "last");
+ entityManager.persist(customer);
+
+ List findByLastName = customers.findByLastName(customer.getLastName());
+
+ assertThat(findByLastName).extracting(Customer::getLastName).containsOnly(customer.getLastName());
+ }
+}
diff --git a/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-jpa-data-access.test.yaml b/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-jpa-data-access.test.yaml
new file mode 100644
index 00000000..37e500fd
--- /dev/null
+++ b/default/generated/spring-framework/tests/spring-framework-5.x-to-6.0-jpa-data-access.test.yaml
@@ -0,0 +1,19 @@
+rulesPath: ../spring-framework-5.x-to-6.0-jpa-data-access.yaml
+providers:
+- name: java
+ dataPath: ./data/jpa-data-access
+tests:
+- ruleID: spring-framework-5.x-to-6.0-data-access-00040
+ testCases:
+ - name: tc-1
+ analysisParams:
+ mode: "source-only"
+ hasIncidents:
+ exactly: 1
+- ruleID: spring-framework-5.x-to-6.0-data-access-00050
+ testCases:
+ - name: tc-1
+ analysisParams:
+ mode: "source-only"
+ hasIncidents:
+ exactly: 1