Skip to content
Advertisement

Tag: hibernate

Spring JPA relationships

I have some troubles with Spring JPA relationships. I have two entities: Gift and Candy. And I want user to be able to select available candy and add it to gift. How can I do that using spring jpa? I’ve already tried ‘one to many’ relationship with gift as owning side, and I got “null value in column ‘gift_id violates

Mapping one to one relationships in Spring Boot

I am trying to map a User with a certain Table in a one to one relationship. This here is my code, id appreciate if u take a look at it: User class: The Table class: Answer You don’t mapped parent entity with child entity properly.In parent table object of CTable is currenTable and you mapped by with table. Change:

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

Getting error : org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: javax/validation/ValidatorFactory

I have a project Webservice with Hibernate in Eclipse (Tomcat v10.0 et java JDK 8). When I run, I got this error: ” Servlet.service() for servlet [Jersey Web Application] in context with path [/musichall] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: javax/validation/ValidatorFactory] with root cause java.lang.ClassNotFoundException: javax.validation.ValidatorFactory” Below is my pom.xml Here is my file “persistence.xml” Here is the “MusicienService” class Here is

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

Advertisement