Hi, I am learning and observed the transaction are not getting committed in oracle database. I am using Apace Camel 2.16.0 with Spring Boot
I have following code. It doesnt camit and doesnt throw any error. It shows in logs it has executed end to end successfully. But when i see in database nothing is committed. What i observed is if i change to below transaction works when it calls function saveDepartment(String jobType). Please help need your assistance and any sample or example will help to resolve .to("bean:exportJob?method=saveDepartment(${header.jobType})"); or .bean(exportJob, "saveDepartment"); @Configuration @Profile("camel") public class MyCamelConfiguration extends CamelConfiguration { @Value(value = "${route.jms.myschedule}") private String myschedule; @Bean public RouteBuilder route() { return new RouteBuilder() { @Override public void configure() throws Exception { from(myschedule).routeId("myschedule id").log("------------------------------------ job Header ${in.header.job} -----------------------------") .bean(exportJob.saveDepartment("SOMEID")).id("myscheduleID"); } } } } @Service @Slf4j public class ExportJob { @Autowired private DepartmentRepository deptRepo; @Transactional public Processor saveDepartment(String jobType) throws Exception { try { Department dept = new Department(); dept.setId((new Date()).getTime()); dept.setName("Hello"); deptRepo.save(dept); return e -> saveDepartment(e, jobType); } catch (Throwable e) { e.printStackTrace(); } return null; } @Transactional public void saveDepartment(Exchange exchange, String jobType) throws Exception { try { Department dept = new Department(); dept.setId((new Date()).getTime()); dept.setName("Hello"); deptRepo.save(dept); } catch (Throwable e) { e.printStackTrace(); } } } @Repository public interface DepartmentRepository extends CrudRepository<Department, Long>{ } @Entity @Data @AllArgsConstructor @DynamicUpdate @Table(name = "department") public class Department { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; public Department() { super(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "Department [id=" + id + ", Name=" + name +"]"; } } @Configuration @EnableTransactionManagement @EnableJpaRepositories(basePackages = { "com.spring", "com.mypackage" }, entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "entityTransactionManager") public class MainDBConfiguration { @Bean @Primary @ConfigurationProperties(prefix = "spring.datasource") public DataSource MainDataSource() { return DataSourceBuilder.create().build(); } @Bean(name = "entityManagerFactory") @Primary @PersistenceContext(unitName = "primary") public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) { return builder.dataSource(primaryDataSource()).packages("com.mypackage").persistenceUnit("primary").build(); } @Primary @Bean(name = "entityTransactionManager") public PlatformTransactionManager entityTransactionManager(@Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) { return new JpaTransactionManager(entityManagerFactory); } }