I like the approach of spring-data-jdbc very much, but it seems it does not have support for Oracle. https://docs.spring.io/spring-data/jdbc/docs/2.0.1.RELEASE/reference/html/#requirements
Is it possible to manage with Mybatis all what can be done with spring-data-jdbc by using Mybatis support in spring-data-jdbc. Essentially, I like to keep the design approach and domain driven approach of spring-data-jdbc and use Mybatis in spring-data-jdbc. This way, I can start leveraging spring-data-jdbc apis and approach till Orcale is supported. Or it will be better for me to stick with plain Mybatis and not use Mybatis and spring-data-jdbc at this point.
If you are interested in using Spring Data JDBC with Oracle I'd just go ahead and do it by implementing a Dialect.
People have used it with Oracle before a Dialect was required.
You will probably encounter features that don't work yet, but should be able to work around them with annotated queries, some RowMappers and occasionally a custom method implementation.
Can you not use 2.2.6.RELEASE or 2.3.0.RELEASE of Spring Data? It does support Oracle. The following dependencies works well.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.6.0.0</version>
</dependency>
</dependencies>
I just set a simple example with the Oracle DB and Spring Data JDBC and Spring Data JPA and it worked ok (no need for Dialect either). Could you give more information about your case? Or you assume is not supported because is not listed in the link you shared?
Related
Is it possible to reference a library to get only javax.persistence without having to configure hibernate or other ORM?
I have a library that I want to contain my entities, which will be added to other projects as part of a Maven repository reference. The Data Access will actually only happen on the project using this as a dependency.
I don't want to have to configure hibernate or add a reference to it just to gain access to the JPA api.
Any ideas?
Thank you
Maybe (in Maven):
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
If you use a Java EE server :
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<scope>provided</scope>
</dependency>
Jaeger traces to spring-boot application are not able to capture traces for the DB calls made using spring-data. All other calls like RESTTemplate are able to have the traces captured.
Using springboot version 2.2.2.RELEASE and added below jaeger dependencies,
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-jaeger-web-starter</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-jdbc</artifactId>
<version>0.2.11</version>
</dependency>
Any additional dependencies are missing here?
Remove your dependencies and use the following one that will include also the instrumentation you need
<dependency>
<groupid>io.opentracing.contrib</groupid>
<artifactid>opentracing-spring-jaeger-cloud-starter</artifactid>
<version>3.2.0</version>
</dependency>
I'd like to use #Join annotation in a joinFaces project.
If it's possible, what the steps to configure and use it?
I'm using joinFaces 3.2.4 with rewrite-spring-boot-starter.
Actually i found very very beautiful solution on this link By JSF itself
page-redirect
hopefully be useful
https://www.codenotfound.com/jsf-welcome-page-redirect-example-spring-boot.html
I sent alot of time on it with no hope with Spring boot, But if you want
you need to add this dependencies
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>3.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-integration-faces</artifactId>
<version>3.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-config-prettyfaces</artifactId>
<version>3.4.2.Final</version>
</dependency>
By default Spring Sleuth only sends 10% of requests to Zipkin. By setting spring.sleuth.sampler.percentage you can increase the percentage. Unfortunately it is stuck at 10% regardless of what value I set it to. I have tried 1.0, 0.5, 1, 100.
Output from /env
"spring.sleuth.sampler.percentage": {
"value": 1,
"origin": "class path resource [application.yml]:77:19"
}
Regardless of the value, when I make multiple requests, only 10% make it to Zipkin.
We are using version Finchley.M8 of Spring Cloud and 2.0.0.RELEASE of Spring Boot.
Below are relevant POM settings.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.M8</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
Could this be a bug?
Ok we found the problem and also a work around.
It looks like all the documentation out there is wrong, at least for the version of Spring Cloud Sleuth we are using. The correct property is not spring.sleuth.sampler.percentage. The correct property is spring.sleuth.sampler.probability
And here is a workaround we found right before noticing that the property was wrong.
#Bean
public Sampler alwaysSampler() {
return Sampler.ALWAYS_SAMPLE;
}
Here are some official documentation from Spring Cloud that contain the wrong property.
https://cloud.spring.io/spring-cloud-static/spring-cloud-sleuth/2.0.0.M5/single/spring-cloud-sleuth.html
https://cloud.spring.io/spring-cloud-sleuth/single/spring-cloud-sleuth.html
Here is the source code that is being used and it is using probability not percentage.
https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/sampler/SamplerProperties.java
I am new in OrientDB. I have several questions.
1) Where i can find list of current stable version of *.jar libraries to acess OrientDB instance (version 2.0.3).
I use java 8 .
I connect to Orient DB from Java Spring. In pom.xml I write such lines:
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-core</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orient-commons</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-enterprise</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-client</artifactId>
<version>2.0.2</version>
</dependency>
And everything is working, unless I add library to work with instance as with graph db
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-graphdb</artifactId>
<version>2.0.4</version>
</dependency>
If I add "orientdb-graphdb" reference, my code works in wrong way, actually in one my controller where object of "org.codehaus.jackson.node.ObjectNode" is returned, this controller fails. it seems that some error occurs during converting of ObjectNode.
2) I can't sort out how to use both Document and Graph model of OrientDB in one instance. Which *.jar file to use and of which versions.
I think, the course of my troubles is wrong combination of jar files of wrong versions.
You have mixed the versions as you imagined. You should try having everything at 2.0.5 for example
I had the same issue.. I had to figure it out myself based on what was online in the repositories but it was tough with the latest snapshots when I was reading guidelines from outdated documentation.
Here for the stable ones: http://mvnrepository.com/artifact/com.orientechnologies
and here for the snapshot ones: https://oss.sonatype.org/content/repositories/snapshots/com/orientechnologies/
You need to put this one as a dependency:
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-graphdb</artifactId>
<version>2.0.5</version>
</dependency>
and this will fetch orientdb-core and all the others that it needs - so start from that and then add whatever is not in its dependencies that can be found here
In your case for example orientdb-graphdb 2.0.4 was trying to fetch orientdb-core 2.0.4 but you already had the dependency of orientdb-core 2.0.0 in there.
You can have repositories in your pom.xml like that (although I think there are better ways to configure them):
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>mvn-repository-com-artifacts</id>
<name>mvnrepository.com</name>
<url>http://mvnrepository.com/artifact/</url>
</repository>
</repositories>