Oracle repository dependency for javers - oracle

I wanted to persist audit changes to oracle db. The micro-service is a spring boot application with hibernate. I found many dependencies in this link mvn repository link for javers
Which dependency should I be using for oracle db?

I added the following dependency and it worked.
<dependency>
<groupId>org.javers</groupId>
<artifactId>javers-spring-boot-starter-sql</artifactId>
<version>5.8.13</version>
</dependency>
referred this link, javers repository configuration link

Related

Why is my H2 database Spring config not working?

I am always getting java.lang.NoSuchMethodError: org.springframework.orm.jpa.JpaTransactionManager$JpaTransactionObject.setReadOnly(Z)V
I do not know why.
I use H2 database in memory. According to spring there is no configuration necessary. I just include the dependency in my maven POM . But when I call the database it gives me this error.
public interface ClientRepository extends CrudRepository<Client, Long> {
I know a lot had this error before but I cannot see any mistake on my side. According to spring it should work out of the box. Just add maven dependency. Nothing more. So where is my error.
It seems that if you mix Spring boot dependencies and Spring framework dependencies maybe this could cause a problem. I really do not know. I removed this dependency
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.1.3.RELEASE</version>
</dependency>
It was not Spring boot . So I would not need it anyway. I think Spring boot will never ever need any Spring framework dependency I guess.
Also versions could maybe be an issue. I did not include any version. Because Spring boot should then just take the latest one. Right ? But now I have versions. Maybe this was also an issue.

Why does H2 database use Hibernate Core in Springboot application

I have a simple springboot application which uses H2 in memory db. I have used following dependency in my POM
spring-boot-starter-data-jpa
com.h2database.h2
When I start application, It automatically create Entity tables using Hibernate Dialect. I have no where mentioned about Hibernate in my POM. So why does this happening. Why Spring is using Hibernate Dialect. Do we have any option to change this dialect to some other dialect. please help.
Starter poms in the SpringBoot ecosystem bring a bag of dependencies, which have been tested and are proven to work together. It also saves you the hustle of managing the right dependencies versions.
You're using spring-boot-starter-data-jpa - which is a starter pom for JPA - the opinionated choice here is the usage of Hiberante as JPA provider.
If you look at the source of the pom file, you will see this definition:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
This is what brings hibernate to your project, although you have not explicitly declared it in your pom. The hibernate is downloaded as implicit dependency because of your spring-boot-starter-data-jpa starter pom.
Well you using "spring-boot-starter-data-jpa" and "starter" notion means that it has everythingfor it to work. If you would look to https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa/2.1.3.RELEASE , this dependency also includes hibernate-core.

Flyway update does not migrate schema_version table when updating from version 3 to 4

I updated from Spring Boot 1.5 to 2. As some other, I also faced the issue that by doing the update also Flyway was updated from 3 to 5. The problem with the Flyway update is that the flyway schema table does not get migrated automatically so that the database migrations do not work.
The Spring Boot migration guide suggests to update first to Flyway 4 and then do the update to Spring Boot 2. I did as suggested and included
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>4.0</version>
</dependency>
into my POM. Flyway stated that you just need to run the application to apply the migration from version 3 to 4. When I start the application everything works (no error) BUT the schema table of Flyway was NOT migrated. I still see the columns in there which should be removed by the migration (version_rank).
My question now: What do I need to do to trigger the Flyway migration?
Update:
Thanks to #M. Deinum! His comment gave me the hint to fix the issue. If you face a similar problem: search through your workspace if you do something with flyway that would bypass Spring Boot auto config.
Problem solved as proposed by #M.Deinum:
Upgrade to the latest 1.5.x version of Spring Boot, next to that make
sure you aren't actually initializing or using Flyway yourself as that
would bypass Spring Boot auto config and execution of flyway.

JpaStateMachineRepository not available in Spring StateMachine 2.0.0

After creating project via spring Initializr https://start.spring.io/
with option Statemachine checked.
If I try to autowaire JpaStateMachineRepository then I get
JpaStateMachineRepository cannot be resolved to a type.
There is no import option. I have spring-statemachine-bom in my pom and I beleive it has spring-data-jpa already dependancy covered already.
I am migrating from 1.2.8 to 2.0.0. Please help.
start.spring.io only adds spring-statemachine-starter which effectively only adds spring-statemachine-autoconfigure. spring-statemachine-bom only adds dependency management, not dependencies itself.
You just need to import below dep manually:
<dependency>
<groupId>org.springframework.statemachine</groupId>
<artifactId>spring-statemachine-data-jpa</artifactId>
</dependency>
We're probably going to add more starters for usual use cases. JPA seem to be one of those which could have its own statemachine related starter.

Spring Boot: Do I have to add a jdbc pool dependency for Oracle connection?

First off I'm new to Spring Boot, so perhaps there is something simple I'm missing.
I have a small Spring Batch process that relies upon Spring Boot.
By default it uses the embedded H2 database.
I want it to use an oracle database.
So I set the url/username/password in the application.properties file
spring.datasource.url=jdbc:oracle:thin:#host:1521:batch
spring.datasource.username=username
spring.datasource.password=reallyCoolPassword
and add the dependecy to my Maven pom
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${oracle.client.version}</version>
</dependency>
I still get the embedded database. The only way I've been able to make it work is to add a dependency to a connection pool (for example tomcat).
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</dependency>
Am I missing something? I was expecting Spring Boot to already have a dependency to tomcat that it would have brought in. Allowing me to override with dbcp or something else if needed.
hopefully someone can tell me what I've done wrong or help me straighten out my thinking.
In addition to providing url, name and password for DB you need to add spring.datasource.driverClassName.
We are using mysql as storage and we are adding this in properties:
spring.datasource.driverClassName: com.mysql.jdbc.Driver
Here is also link to properties for spring batch using oracle db.
Also you need to add your driver to project and oracle due to licence restrictions does not have public maven repository so you need to install driver. Here is useful link with walk through.

Resources