spring-data

Spring-Data-Elastic Search and Spring-Data-Cassandra Having Issues with MapId

谁说胖子不能爱 提交于 2020-03-03 07:45:06
问题 I am trying to have Spring-Data-Cassandra and Spring-Data-Elasticsearch work together. Below is the problem which I am facing. org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Invocation of init method failed; nested

How are fields set on an entity by Spring Data MongoDB?

巧了我就是萌 提交于 2020-03-02 06:05:10
问题 I have a MongoRepository class public interface UserRepository extends MongoRepository<User, Long> { User findById(Long id); } and my Entity pojo looks like this @Document(collection = "user") class User { Long id; String name; Department department; … } When I call the findBy method, a User object is returned. I want to know how does Spring Data MongoDB converts DBObject to Java object. I was under the impression that Spring Data MongoDB uses some sort of mapper (Jackson?) under the hood

How are fields set on an entity by Spring Data MongoDB?

橙三吉。 提交于 2020-03-02 06:03:09
问题 I have a MongoRepository class public interface UserRepository extends MongoRepository<User, Long> { User findById(Long id); } and my Entity pojo looks like this @Document(collection = "user") class User { Long id; String name; Department department; … } When I call the findBy method, a User object is returned. I want to know how does Spring Data MongoDB converts DBObject to Java object. I was under the impression that Spring Data MongoDB uses some sort of mapper (Jackson?) under the hood

Page<> vs Slice<> when to use which?

我的未来我决定 提交于 2020-02-27 14:36:50
问题 I've read in Spring Jpa Data documentation about two different types of objects when you 'page' your dynamic queries made out of repositories. Page and Slice Page<User> findByLastname(String lastname, Pageable pageable); Slice<User> findByLastname(String lastname, Pageable pageable); So, I've tried to find some articles or anything talking about main difference and different usages of both, how performance changes and how sorting affercts both type of queries. Does anyone has this type of

How to save entities with manually assigned identifiers using Spring Data JPA?

时光毁灭记忆、已成空白 提交于 2020-02-27 08:06:26
问题 I'm updating an existing code that handles the copy or raw data from one table into multiple objects within the same database. Previously, every kind of object had a generated PK using a sequence for each table. Something like that : @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; In order to reuse existing IDs from the import table, we removed GeneratedValue for some entities, like that : @Id @Column(name = "id") private Integer id; For this

How to control depth on custom Spring Data Neo4j repository methods?

℡╲_俬逩灬. 提交于 2020-02-27 06:40:18
问题 For example, if I want to get list of users by name: class UserRepository extands GraphRepository<User> { List<User> findByName(String name); } then how to set loading depth to 2? I tried to find answer in the SDN 4.0.0.RC2 docs, but it isn't contains anything about this issue. 回答1: Derived finders do not yet support a depth. You'll have to write a custom query or use the loadAllByProperty method on the Neo4jTemplate if applicable. This should have been mentioned in the docs, we'll add it.

How to log Spring-data queries to a Couchbase Database

最后都变了- 提交于 2020-02-25 08:08:26
问题 In my Spring-Boot app we have a Spring-Data repository connection to the Couchbase server. I know that when connecting to SQL server, one can see the actual queries sent to the DB by adding to the property file line such as this one (As mentioned here): logging.level.org.hibernate.SQL=DEBUG What should be the way to do it when using Couchbase? 回答1: Add logback as your dependency <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.2.3</version> <

Spring Data “TimeoutException” when calling delete documents (with pagination) in Couchbase

旧巷老猫 提交于 2020-02-25 04:30:31
问题 Our Spring Boot app is using a Couchbase DB and accessing it using Spring-Data To delete records from the bucket we created the following method in the repository: Slice<Dog> deleteAllByOwnerIdAndName(String ownerId, String name, Pageable pageable); We also have relevant index on the bucket: CREATE INDEX `dogs_by_ownerId_and_name_idx` ON `dogs`(`ownerId`,`name`) WHERE (`_class` = "com.example.Dog") Our code is using the pagination when trying to delete the elements: Slice<Dog> dogsSlice =

Spring Data “TimeoutException” when calling delete documents (with pagination) in Couchbase

北城以北 提交于 2020-02-25 04:26:18
问题 Our Spring Boot app is using a Couchbase DB and accessing it using Spring-Data To delete records from the bucket we created the following method in the repository: Slice<Dog> deleteAllByOwnerIdAndName(String ownerId, String name, Pageable pageable); We also have relevant index on the bucket: CREATE INDEX `dogs_by_ownerId_and_name_idx` ON `dogs`(`ownerId`,`name`) WHERE (`_class` = "com.example.Dog") Our code is using the pagination when trying to delete the elements: Slice<Dog> dogsSlice =

Spring data and mongoDB - inheritance and @DBRef

前提是你 提交于 2020-02-24 11:34:37
问题 I have this two documents, User: @Document(collection = "User") public class User { // fields } and Contact: @Document(collection = "Contact") public class Contact extends User{ // fields } and then I have a document which referes either to User oder Contact: @Document(collection = "DocumentFile") public class DocumentFile { @DBRef private User user; } So I am able to add User oder Contact in DocumentFile#user but if I set a Contact to DocumentFile#user than I lost the reference because in