Questions tagged [spring-data]

Spring Data is an umbrella open source project which contains many subprojects that are specific to a given database. The projects are developed by working together with many of the companies and community that are behind these exciting technologies.

The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services as well as provide improved support for relational database technologies.

This is an umbrella project which contains many subprojects that are specific to a given database. The projects are developed by working together with many of the companies and developers that are behind these exciting technologies.

Resources

Spring Data modules and specific tags

Noteworthy Questions and Answers

Are you supposed to have one repository per table in JPA?

11873 questions
4
votes
2 answers

How to handle soft-delete in Spring Data JDBC?

Is there a good way of how to handle soft-delete in Spring Data JDBC? In Spring Data JPA we can either add @Where(clause="is_active=1") annotation or extend CrudRepository or PagingAndSortingRepository. Since Spring Data JDBC doesn't support SPEL in…
Dexter
  • 98
  • 7
4
votes
1 answer

Smart way to use Collation from Spring Data ReactiveMongoRepository

We are developing an Application on Spring 5 Reactive Stack. For persistance we use MongoDb with ReactiveMongoRepository (ReactiveCrudRepository) from Spring Data. Currently for fetching data we are using a Query like @Query("{ 'ownerId': ?0,…
JohnnyJ
  • 43
  • 1
  • 4
4
votes
1 answer

Spring data Elasticsearch change indexName dynamically

I'm trying to use spring data elastisearch save some data. I need to create same index for different client. Ex. If I have index my-index, I need create my-index-A, my-index-B for client A and B. But annotation @Document works only with static…
4
votes
3 answers

Spring Data Redis on Spring Boot 2.1.0 and Java 11 not working

I updated my application to Spring Boot 2.1.0 and Java 11. Since then my Redis is not working anymore. When I call findById() and the result is empty then there are no problems. When I call findById() and there is a result then the application /…
Peter Lustig
  • 1,585
  • 1
  • 18
  • 34
4
votes
1 answer

Handling entities inheritance spring boot

I'm working with this tutorial to handle entities inheritance. I have person and company entities that extends the User entity. @Entity @Inheritance public abstract class User { @Id private long id; @NotNull private String email; // getters and…
Achraf
  • 347
  • 1
  • 5
  • 17
4
votes
3 answers

How to write a custom @Query in Spring Data JDBC?

In Spring Data JDBC examples, how do I write a simple query in @Query annotation? e.g. In LegoSet Repository, how do I add a simple findByName query? When I tried @Query("select * from lego_set where name = :name") List
Kevin Z
  • 41
  • 1
  • 1
  • 2
4
votes
2 answers

Delete not complete

I use spring boot 2, jpa and hibernate. Db is postgres I try to delete an object with child @Entity @IdClass(SamplingsPK.class) @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class Samplings { @Id private int year; //only last…
robert trudel
  • 5,283
  • 17
  • 72
  • 124
4
votes
2 answers

Spring test: Avoid to load configuration class on test

This is a Spring @Configuration annotated class I'm using into my spring boot project: @Configuration @ImportResource({ "classpath:cat/gencat/ctti/canigo/arch/web/rs/config/canigo-web-rs.xml", …
Jordi
  • 20,868
  • 39
  • 149
  • 333
4
votes
1 answer

Neo4j: Don't know how to map graph to Spring Data bean

I'm writing an app to capture configuration properties of other applications. Config is my primary domain object. There are hierarchical relationships between Config objects (one Config [:OVERRIDES] another Config). So, given a bottommost Config, I…
CNDyson
  • 1,687
  • 7
  • 28
  • 63
4
votes
1 answer

Spring JPA Data Repository Generic Implementation Example

Is it possible to create a generic Repository interface to save POJOs in my spring-data project? I have around 50 different objects and I don't want to create 50 corresponding repository interfaces one of each pojo ? For example, public interface…
mayur tanna
  • 241
  • 1
  • 3
  • 14
4
votes
1 answer

What are the advantages of @MatrixVariable over @RequestParam?

I am reading in this article http://www.kscodes.com/spring-mvc/spring-mvc-matrix-variable-example/ that one advantage is that you can use the variable type Map for the matrix variable and you can't use this type when using @RequestParam. But aside…
Maurice
  • 6,698
  • 9
  • 47
  • 104
4
votes
0 answers

How do I use Lettuce Async connection with Spring Cache Abstraction (RedisCacheManager) in Spring Data Redis 2.0.X

We recently upgraded our application to Spring Boot 2 (2.0.3.RELEASE). Along with that Spring Data Redis was upgraded was upgraded to 2.0.8.RELEASE. We switched over from using Jedis to Lettuce as the boot upgrade docs say that is now the…
Chris Savory
  • 2,597
  • 1
  • 17
  • 27
4
votes
0 answers

Subscribe to long running async query

I am trying to fetch a large dataset from Couchbase reactively. I use the ReactiveCouchbaseRepository provided by spring data. public interface ReactiveFooRepository extends ReactiveCouchbaseRepository { …
4
votes
1 answer

NotFoundAction.EXCEPTION not throwing an exception

I have the following relationship: @Entity public class SomeEntity { //... @EmbeddedId private SomeEntityIdentity id; @OneToOne @NotFound(action = NotFoundAction.EXCEPTION) //This is the important bit @JoinColumns({ …
Telmo Marques
  • 5,066
  • 1
  • 24
  • 34
4
votes
0 answers

Spring Data JPA Self Join with Nullable foreign key

I have problem with Spring Data JPA. I want to create a category that have parent category with the same table. Some categories don't need to have parent category, so parent category can be null. but when I do that, and save it, it shown error as…
Leang
  • 150
  • 12
1 2 3
99
100