Skip to content
Advertisement

Tag: spring-data

Spring Data Elasticsearch (4.x) – Using @Id forces id field in _source

Summary Recently we upgraded to Spring Data Elasticsearch 4.x. Part of this major release meant that Jackson is no longer used to convert our domain objects to json (using MappingElasticsearchConverter instead) [1]. This means we are now forced to add a new id field to all our documents. Previously we had domain objects like this: Which resulted in documents like

How to get the value from system property in spring boot

I am using following command to run my spring boot application Currently, I am able to access it via following command like below However I need to access it via any annotation in Spring something like @value(${library.system.property}) I tried to use But the value of the property is null. Do I need to use conditional bean or something? Answer Thanks

Page vs Slice when to use which?

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 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

Spring boot JPA save manytomany relationship

I am trying to store a manytomany relationship but it not stores the relationship. The following code has generated 3 tables. Soldier, medal and soldier_medals. The service just make a call to a CRUD Interface with save(soldier). It stores correctly the soldier, but it not fill any row at the soldier_medals table. This is the JSON I send to the

Query id return type

I use spring data. I want to get some contracts from DB. So I create two queries. In first I get contracts id that I need, in second I get contract by this id. First query in Repository.class ServiceJPA.class But in last line above I have an error. java.lang.IllegalArgumentException: Parameter value element [2] did not match expected type [java.lang.Long (n/a)]

@PreUpdate doesn’t save parent object when it’s updated

I have two entities with relation one to many. Parent can have several Child entity instances. I added a field to the parent that stores the date of children modifications(childrenLastModifiedDate). To maintain that, I added method: Here is the problem. It’s not always invoke when the child is saved. Locally(mac os), it works as expected, all three types of changes

Advertisement