Skip to content
Advertisement

Tag: jpa

Showing a specific JSON response for my GET endpoint

I have a many-to-many relationship between Department and Employee I have already done a mapping for the GET endpoint which returns a list of departments that contain Employees, this is the request: http://localhost:8080/api/departments/1/employees, and this is the response I get: This is the code that gets the job done: Department Repository Imp Employee Service Impl Department Controller Now what I

NullPointerException on JPA on SpringBoot

I’m new on SpringBoot and I’m making a small CRUD. When I try to make a GET request that show me a list of soccer teams from my BD called “soccer” I’ve have the following error message: My model “Equipo” is: My Repositorie “EquipoRepo” is My service “EquipoServicio” is: And my REST class called “EquipoREST” is: Answer Try to add

testEntityManager.persistFlushFind() giving error “detached entity passed to persist”

I was trying to test h2 Repository with spring-boot-testing .Below is the Testing code is used.: In the above code I am facing this “detached entity passed to persist”. “testEntityManager.persistFlushFind(new Product(1,”A”,”dec”,false))” is giving below error: Please tell how can i resolve the issue.For more info please comment Answer You didn’t show your Product entity. But I assume that the ID

Hibernate how to commit transaction even when exception pops up

i have a method in Service A And another method in Service B My problem is that when “repository.insertRandomValue()” throws ConstraintViolationException for example, then even tho it was caught in catch(), the thread ends with I have tried setting the propagation to REQUIRES_NEW and tried to set up transaction manager and GlobalRollbackOnParticipationFailure to false. I want it to simply ignore

Problem with Foreign Key in @OneToOne annotation

I have spent a couple of days with a weird problem. There is a plethora of similar posts here in StackOverflow and I have check a lot of them but I was unable to find something similar with this. I have a Human Parent class A User child class : and also a CollectionOfContactMethods with composition relationship with the User.

Using the concept of JPA, how to update table using data from another table?

FmoReorgGeo.java FMOReorgGeoServiceImpl.java FMOReorgGeoRepository.java ERROR LOG *I am trying to fetch data from reorgViewX and then updating FmoReorgGeo table. I am being able to fetch data correctly but when running update query I am getting error. The error says: Could not extract result set metadata; nested exception is org.hibernate.HibernateException: Could not extract result set metadata. I am using the concept of

Advertisement