Skip to content
Advertisement

Tag: spring-data-jpa

Spring Data Jpa: persisting child entities from parent entity does not update child identity

Environment: OS: Ubuntu 20.04 LTS Java: OpenJDK 17.0.3 Spring Boot: 2.6.7 MySQL: 8.0.29 Is it normal for Spring Data Jpa (or Jpa in general) to NOT update child identity attributes when the child is persisted (saved) via the parent entity repository? Consider this: When I call someClassFunction() I get: The database assigned id is NOT available to me immediately. I

Working with multiple parameters in CriteriaBuilder

I have a need to use JpaSpecificationExecutor. Initially, I assumed that one parameter would be given as input and I would process it like this: CarRepository : However, I need to be able to work with: And in response to me came all the options for suitable machines. For example input: At the output, I want to get all the

how do i save a new student that contains entities, but don’t create these entities because they already exist in the database?

I want to save a student and a student has a TargetAudience object as an attribute. These target audiences are allready hardcoded in my database. (targetaudience = campus + major). Now when i post like this: it doesnt work because everythime it creates a new object for the campus and because i use name as a primary key it throws

Combine JPA Query annotation with Oracle sample method

i am trying to pass a parameter into a JPA query Example code But i get an error because of the sample(:percentile). If i just hardcode a number in there it works but not with a param. Is there a way to escape the brackets or something similar? Thx Answer The error is on the following part Unfortunately it does

Advertisement