Questions tagged [spring-projections]

28 questions
0
votes
0 answers

Spring Data JPA + Native Query Interface based Projection + returns UnsupportedOperationException : No matching converter found

I recently upgraded spring boot to version 3.0.4. After that I started to get "[java.lang.UnsupportedOperationException: Cannot project java.lang.Boolean to java.lang.Number; Target type is not an interface and no matching Converter found]" when I…
Karul
  • 1
  • 1
0
votes
5 answers

Cannot instantiate DTO Projection in Spring Data

I am trying to return a custom object RecordData from my repository class, but it tries to instantiate my main Record class. I've tried using Interface Projections, but the result is the same. import…
0
votes
0 answers

Spring data projection

My project has entity PostEntity with couple of many-to-many relationships, the goal is to retrieve simple projection with names of PostEntity associated entities: @Query(" select template.name as templates, resource.name as resources from…
tarmogoyf
  • 298
  • 3
  • 17
0
votes
0 answers

Returning a Collection with Generic Projections so multiple Projections can be selected in Spring Data JPA

I am trying to be able to select from multiple projections as return type in a collection when accessing a method in a jpa repository I have come across this thread, however its information is not really sufficient: Spring Data Jpa generic…
0
votes
1 answer

Record projection with another record projection

I get problem with nessted projection. (inside projection) Root entity: @Entity(name = "AAA") @NoArgsConstructor @AllArgsConstructor @Data public class AAA{ @Id private Long id; @OneToOne private BBB bbb; } where BBB looks like…
0
votes
1 answer

spring data neo4j rest projection returns null when using SpEL expression on nested object

Consider the following output is produced: Case 1: while retrieving the nested object from neo4j using spring data neo4j interface (projection) { "name": "Dhoni", "currentLocation": { "city": { "name": "qwerqwer", …
0
votes
1 answer

return type for Interface-Based Projections

I'm learning how to use projection in spring-data-jpa. And i have a problem with projections using interfaces. I saw a lot of tutorial where they just write an interface with the getter they need and finally they just use it as return type for their…
Danyls
  • 1
  • 2
0
votes
2 answers

Spring Data JPA DistinctBy projections

Good day fellow hibernators! I have a question on how the DistinctBy clause works in conjunction with Spring Data's projection Assume I have 3 classes: public class Task { Long id; @ManyToOne(fetch = LAZY) @JoinColumn(name = "project_id") …
0
votes
0 answers

Spring JPA Pagination on Sub-Entities using Dynamic Projection

How to Paginate on the ChildEntity from a ParentEntity (unidirectional oneToMany) via Dynamic Projection. Heres my code sample which works while paginating on Parent . Repository - I tried this, looking this response , but it throws Caused by:…
Alferd Nobel
  • 3,185
  • 2
  • 30
  • 35
0
votes
1 answer

Use service inside SDR projection

I have an entity class Person with uuid column. I have an external rest service(ExternalRestService) where I could fetch information by mentioned uuid column. I want to create projection like interface PersonWithExternalDataProjection { val uuid:…
Sahka
  • 210
  • 3
  • 12
0
votes
0 answers

Dynamic JPA Projections with extended interface and generics

I am looking to use Spring JPA Dynamic Projections to limit the number of fields returned from queries. The table I'm using is wide, but the projection still contains around 10 fields. Therefore I am trying to use Dynamic Projections. The problem…
GothsterC
  • 13
  • 1
  • 5
0
votes
2 answers

How can I Return a JSON Object without Nested Objects From Other Classes?

I want to return a JSON Object with information from two different Classes. Like I want the username from the class User and the rolename from the Class Role together in one JSON Object. My current code: @Entity @DynamicUpdate public class User { …
m3kkasi
  • 5
  • 2
0
votes
1 answer

Spring projections select collection

I am attempting to have a station projection include a list of associated logos. Below is my domain: @Table(name = "Station") public class Station implements Serializable { @Id @Column(name = "Id") private int id; @OneToMany(cascade =…
Sixthpoint
  • 1,161
  • 3
  • 11
  • 34
1
2