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 can I run Spring with MongoDB disabled, but still installed?

I was reading through this Git issue: https://github.com/spring-projects/spring-boot/issues/7589 with regards to Java Spring boot and am trying to figure out a way to bypass the crash upon startup. The short version is that If you include the code…
PGMacDesign
  • 6,092
  • 8
  • 41
  • 78
4
votes
1 answer

How can I define index on inherited fields in MongoDB with Spring Data?

I have a persistent class that extends a parent where some of its fields are defined. With Spring Data Mongo, I can use the @Indexed annotation on persistent fields to create index on the corresponding Collection. However, in the case of inherited…
Psycho Punch
  • 6,418
  • 9
  • 53
  • 86
4
votes
0 answers

Replace old data source with new one in the Spring Boot

There is Spring Boot application connected to two databases: db_1 - contains all business logic; db_2 - contains application configurations. Issue User should be able to change configurations : db_host, db_user, db_password, db_type. And…
Maksym
  • 2,650
  • 3
  • 32
  • 50
4
votes
1 answer

Spring Reactive kafka Receiver always overrides bootstrap server to localhost

I am trying to write Spring boot applications for a Reactive Kafka consumer using @EnableKafka and @KafkaListener annotations. i have configured my kafka brokers are on different machine. when i give bootstrap-server to advertised host of kafka…
4
votes
2 answers

spring data save does only create cascaded children if parent did not exist

I have the following Entities: Question has OneToOne Config. And Config has many Options. All are configured to CASCADE.ALL (s. appendix) Based on a RequestDTO (requestConfig) I create new Option entities with id=null for either a NEW question or an…
Stuck
  • 11,225
  • 11
  • 59
  • 104
4
votes
5 answers

Spring data: DeleteAll and Insert in same transaction

I am trying to achieve below native query logic using hibernate (Spring JPA). But save(Iterable) throws exception and rollback the entire transaction if one of the record fails to persist. Is there any way to do to catch the record error and proceed…
Shameer
  • 51
  • 1
  • 1
  • 2
4
votes
2 answers

PostgreSQL: column "BOOLEAN_VALUE" is of type numeric but expression is of type boolean Hint: You will need to rewrite or cast the expression

I was trying to insert a new data into both database server. This one works in Oracle 11g but does not work in PostgreSQL 9+. I cannot trace the issue as the error says: column "BOOLEAN_VALUE" is of type numeric but expression is of type boolean …
Yejin
  • 541
  • 2
  • 15
  • 32
4
votes
1 answer

How to use loadgraph and fetchgraph from JPA 2.1 on Query DSL 4

Environment: org.hibernate:hibernate-core:5.2.14.Final org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final org.hibernate.common:hibernate-commons-annotations:5.0.1.Final org.hibernate.validator:hibernate-validator:6.0.7.Final org.sprin…
Leonel
  • 2,796
  • 5
  • 25
  • 36
4
votes
2 answers

Does Spring Data Elasticsearch support Multi Search API?

I'm using Spring Data Elasticsearch, and am interested in utilizing Elasticsearch 6.2's Multi Search API in order to execute more than one search in a single API…
4
votes
1 answer

Spring boot multiple data source , H2 tables not found

Spring boot with muiltiple datasources H2 and Mysql , not creating H2 tables in the console. while accessing the h2 table getting error saying table not found  . while checking the console i could confirm that the tables are notg ettting created . I…
Ansar Samad
  • 729
  • 2
  • 8
  • 15
4
votes
4 answers

Cassandra Spring Data doesn't let me query data by composite primary key directly

I am trying to use Spring Data Cassandra using Composite primary key class. But when I try to query data I get an exception: org.springframework.data.repository.query.QueryCreationException: **Could not create query for public abstract…
4
votes
3 answers

Custom method for update query with spring data MongoRepository

I am using org.springframework.data.mongodb.repository.MongoRepository. I have written some custom method like below, public interface DocRepository extends MongoRepository { Doc findByDocIdAndAssignmentId(final String docId,…
Harshana
  • 7,297
  • 25
  • 99
  • 173
4
votes
1 answer

How to implement DDD using Spring Crud/Jpa Repository

I want to create an app by implementing DDD using Spring. Let's say I have a business entity Customer and an interface CustomerRepository. Since spring provides CrudRepository and JpaRepository to perform basic CRUD operations and other operations…
4
votes
1 answer

Database agnostic way to filter entities?

I use Spring Data, Hibernate and Microsoft SQL Server. I have 2 entities: Role and Privilege. One role has many privileges. Privileges have VALID_TO column. I want every role to have only privileges that are still valid (i.e., VALID_TO <=…
yaskovdev
  • 1,213
  • 1
  • 12
  • 22
4
votes
1 answer

Spring Data - Projection and @Query nested property

Assume I have those DTO: public interface ForumDTO extends ForumBaseDTO{ Integer getId(); ThreadDTO getLastThread(); } public interface ThreadDTO { Integer getId(); Integer getCommentCount() } In my Repository I have this query…
user2477
  • 896
  • 2
  • 10
  • 23
1 2 3
99
100