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

Does it make sense to mix JdbcTemplate with CrudRepository?

I am quite familiar with the JdbcTemplate object of Spring (and with spring-jdbc in general), and I really like writing the SQL and dealing with the object mapping myself. However recently I was playing with the CrudRepository interface and I really…
Juan Antonio Gomez Moriano
  • 13,103
  • 10
  • 47
  • 65
4
votes
4 answers

Parameter value [1] did not match expected type [java.lang.Integer (n/a)]

I have entity and rest controller, when I make a request to my controller it throws this exception: java.lang.IllegalArgumentException: Parameter value [1] did not match expected type [java.lang.Integer (n/a)] My controller:…
gg ff
  • 489
  • 1
  • 10
  • 20
4
votes
2 answers

Why is my custom json serializer for Spring data's Page object not being called

Here's my object mapper configuration. I provide my own object mapper so that Spring boot's 2.0's included object mapper is overridden. Despite that I also included the JsonComponentModule() so that I could use the @JsonComponent annotation to…
Jazzepi
  • 5,259
  • 11
  • 55
  • 81
4
votes
3 answers

Pass List into postgres' function as parameter

I have spring data repository interface like this: public interface MyEntityRepository extends JpaRepository { @Query(nativeQuery = true, value = "select * from my_func(:myList)") Page findBy( …
Denis Stephanov
  • 4,563
  • 24
  • 78
  • 174
4
votes
1 answer

How to get @TypeAlias working when reading document after upgrading to Spring Boot 2.1.3 when it was working in 1.4.5

I am currently using spring data mongodb and the Configuration file extends AbstractMongoConfiguration: @Configuration @EnableMongoRepositories(basePackages = "com.mycompany") @EnableMongoAuditing public class MongoConfig extends…
testing123
  • 11,367
  • 10
  • 47
  • 61
4
votes
1 answer

Exclude nested fields in Spring Data MongoDB

is it possible to exclude fields of nested Documents in Spring Data MongoDB?. If tried it with query.fields().exclude("user.password"); but that ends with the hole user document be excluded.
Fip
  • 503
  • 1
  • 5
  • 11
4
votes
3 answers

Couldn't find type java.sql.Date. Are you missing a dependency on your classpath?

I'm trying to run my application in Spring Boot using MongoDB with spring-data but I can't because IntelliJ shows me this error during build: Error:java: Couldn't find type java.sql.Date. Are you missing a dependency on your classpath? I'm using…
Carath
  • 245
  • 4
  • 15
4
votes
4 answers

How to handle all enum value in JPA Query method for empty parameter

I have a JPA method that finds list of Students by their graduation status. List findAllByStatus(Status status); But if the request is made with null Status, I want to retrieve entities with null status. How can I handle this with…
Anil
  • 543
  • 3
  • 16
4
votes
0 answers

Spring trying to set audit fields on null object

Spring-data-mongodb is trying to add createdDate to a null object and fails to do so. How do I configure spring audit to ignore null objects so it does not try to add audit fields to it? I have an abstract class with all the audit info. Two classes…
4
votes
0 answers

Spring-data & Redis: sort the results

From a Spring boot application, I want to use Redis and retrieve paged and sorted results. Maven config: org.springframework.data spring-data-redis
Rolintocour
  • 2,934
  • 4
  • 32
  • 63
4
votes
1 answer

Does @PreUpdate always run when @PrePersist runs?

I have an Entity like below: @Entity public class Order { @Id private String orderId; @Temporal(TemporalType.TIMESTAMP) @Column(name = "created_at", nullable = false) private Date created; @Temporal(TemporalType.TIMESTAMP) …
Aditya Narayan Dixit
  • 2,105
  • 11
  • 23
4
votes
3 answers

Java Spring / MongoDb only works when using URI field

I have a very weird situation. I'm running a Java spring-boot app that connects to a MongoDb instance. When I use the spring.data.mongodb.uri=mongodb://{username}:{password}@{host} field, I connect fine. But when I…
Sedky A
  • 184
  • 2
  • 15
4
votes
1 answer

How spring data clean persited entities in transactional method?

I need to receive and save huge amount of data using spring data over hibernate. Our server allocated not enough RAM for persisting all entities at the same time. We will definitely get OutOfMemory error. So we need to save data by batches it's…
Artyom Karnov
  • 557
  • 9
  • 24
4
votes
2 answers

Walk all results using a Spring Data and pagination

I'm calling a paginate service I can walk all the paginated collection using code like this: Pageable pageable = PageRequest.of(0,100); Page events = eventsService.getEventsPage(pageable); while(!events.isLast()) { doStuff(events) …
drizzt.dourden
  • 683
  • 8
  • 20
4
votes
0 answers

querydsl Can't find a codec for class java.time.ZonedDateTime

On my jhipster project v5.7.1, i have added querydsl support in my pom …
Andrea
  • 77
  • 3
  • 13