Skip to content
Advertisement

Tag: hibernate

Execute query with MySQL GET_LOCK function in Hibernate

My application uses Hibernate as ORM. I am trying to execute few mysql locking function within my application like GET_LOCK, IS_FREE_LOCK, RELEASE_LOCK (https://dev.mysql.com/doc/refman/5.6/en/locking-functions.html). However I am running into following issue: Here is my Dao code: I am not sure how to execute locking functions using Hibernate. Any help/pointer is appreciated. Thanks in advance. Answer I found the problem. It was

JPA cascade actions on one-to-one relationship

I have the following question regarding one to one relationships (and I guess one to many also): Let’s suppose I have the following tables: As you can see the two tables share the same primary key. Now the entities I created are the following: When I try to persist a new user I have a user object with all the

Stack overflow error for hibernate one-to-one mapping with Spring Data JPA

My problem is similar to this one https://discourse.hibernate.org/t/hibernate-throws-org-hibernate-id-identifiergenerationexception-attempted-to-assign-id-from-null-one-to-one-property/1777 but I am getting a different exception after applying the answer from this thread. My entities: Controller with corresponding Spring Data Repository: With this payload: I am getting an endless nested response with proper fields(distributor -> location -> distributor -> location ..), which ends with SO Error: I can’t fathom why does

SpringBoot DTO Validation

I am new to spring-boot I’m trying to add validation to my DTO class like below. Below is my REST endpoint to save employee. I create a Validation class like below to validate the DTO fields. expected output is { “firstName”:”Employee first name is required”, “employeeNum”:”EmployeeNUM is required” } But I’m getting only the 400 bad request when hit the

how do i fetch derived/calculated column from database view or Procedure in Spring Boot using JPA/Hibernate and use it along with predefined columns?

I am working on a project as am learning Spring Boot with JPA,Hibernate with Mustache as for templates. i managed to create a view with one calculated column which calculates an remaining days from issueDate and expiryDate. the view works fine and i am able to display all columns except the calculated column. I need help figuring out how to

Advertisement