Questions tagged [jparepository]

64 questions
2
votes
5 answers

Is it possible to override Spring's JpaSpecification "findAll" method to add an extra field to my entity?

I'm using Java 11 and Spring Boot 2.5. I have a JPA entity with a @Transient field @Entity public class MyEntity { ... private String name; ... @Transient private String group; } and a JPA repository public interface…
Dave
  • 15,639
  • 133
  • 442
  • 830
2
votes
1 answer

Consider defining a bean of type in your configuration in spring boot when using Spring JpaRepository

Good day, I am doing a Spring Boot Application in my Eclipse IDE. When I right click on my SpringBoot Application file and run as Java application, I hitting error as follow: APPLICATION FAILED TO START Description: Field tutorialRepository in…
Panadol Chong
  • 1,793
  • 13
  • 54
  • 119
1
vote
0 answers

jpa derived query with hardcoded field value

I have an entity defined as this: public class Alert extends { @Column(name = "STATUS_CDE", nullable = false, length = 1) @Convert(converter = AlertStatusCodeTypeConverter.class) private AlertStatusCodeType statusCde; } statusCde is an…
rhbc73
  • 739
  • 9
  • 24
1
vote
0 answers

JpaRepository. methods findBy

I have a sql questions table. The table accordingly contains Questions objects. Each object contains the question and answer strings. package com.example.kr2db.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import…
Stasis2
  • 11
  • 1
1
vote
1 answer

Azure Databricks JpaRepository - [Databricks][JDBC](10220) Driver does not support this optional feature

In my java 17 spring boot application I am trying to connect to an azure databrick and use a JpaRepository. I get the following error message when using the repository: CannotCreateTransactionException: Could not open JPA EntityManager for…
LDK
  • 197
  • 1
  • 10
1
vote
1 answer

JPA: How to get an entity by the id of another object?

Client Entity: @Entity @Table(name = "CLIENT") public class Client { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column(name = "name") private String name; @ManyToOne(fetch = FetchType.LAZY) …
java12399900
  • 1,485
  • 7
  • 26
  • 56
1
vote
2 answers

Error "org.hibernate.query.sqm.ParsingException: line 1:21 mismatched input 'rtn' expecting {, ',', FROM, GROUP, ORDER, WHERE}"

I'm stuck with this error when i try to limit result to n rows. The query is defined in the query atribute. Here the method public interface PaymentRepositoryJpa extends JpaRepository { @Query("SELECT top(:top) new…
MiguelSlv
  • 14,067
  • 15
  • 102
  • 169
1
vote
0 answers

can we implement Resilience4j @Retry on JPA repository methods like findAll, findbyId etc?

@Repository interface Test extends JpaRepository { @Retry(name="database") Optional findById(Id id); } can we implement @Retry on JpaRepository methods ? if some issue occur with findById() method it will retry 2 times and circuit…
1
vote
0 answers

Failed parsing for a LocalDate value while using Spring Data Rest

I am still a newbie with Spring Data Rest and I'm having some issues with it while I have to parse a LocalDate value to an endpoint. I have searched info's in other topics too but I'm still stucked, this is the problem: I have one Entity with this…
1
vote
3 answers

How to implements entity with 2 entity as primary key with jpa annotation and repository

i want to implement a many to many association with quantity information in it . like this : @Entity @Table(name = "reserves") @Getter @Setter @NoArgsConstructor public class Reserve { @Id @ManyToOne(cascade = CascadeType.ALL,fetch =…
1
vote
2 answers

Mapstruct: Ambiguous mapping methods found for mapping property

I am getting this strange error (Using IntelliJ IDEA 2022.2.2 Ultimate): Ambiguous mapping methods found for mapping property "java.lang.Short TypeA" to TypeB: TypeB TypeBRepo.getOne(java.lang.Short id), TypeB TypeBRepo.getById(java.lang.Short id),…
1
vote
0 answers

JSON parse error, unable to deserialize value of type `java.time.LocalDate` in STS 4.15.3 windows version

I'm new to this tool and I'm having trouble with this specific issue. I looked for an example But could not find something similar, better, I found a possible solution, but in my case It doesn't work. I have this narrow project that resembles our…
0
votes
0 answers

Problem with JpaRepository - getting static, non static error while using CRUDrepsosity of JpaRepository

Line 29 and Line 35 showing errors as seen in photo I have tried making every function static still this is not solving the issue To use the predefined function to save the data, I am trying to save the the data using CRUDrespsitory predefined…
0
votes
0 answers

Search using Jpa Repository in both the main object, and a nested list

I have an object called Community that looks like this: package FamilyFusion.rnr.domain.community; import FamilyFusion.rnr.domain.familyTree.Tree; import FamilyFusion.rnr.domain.users.User; import jakarta.persistence.*; import…
namer
  • 33
  • 6
0
votes
1 answer

Can I pass Java Object in JpaRepository Class?

import org.springframework.stereotype.Repository; @Repository public interface CustomRepository extends JpaRepository { @Query(value = "SELECT name FROM student", nativeQuery = true) List
1
2 3 4 5