Skip to content
Advertisement

Tag: hibernate

hibernate validator throws exception ValidationException: HV000028 for @Past annotation

I am validating an entity with a hibernate validator in a spring boot project. I got an exception for the Date validator @Past . I faced javax.validation.ValidationException: HV000028: Unexpected exception during isValid call This is the dependency I have in my gradle.build file implementation ‘org.springframework.boot:spring-boot-starter-validation’ The following my a similar entity I have This is a log trace Answer This

Spring Boot – Jackson EntityNotFoundException returns 200 instead of 500 response

Exception handler is returning 200 response even though I have specified it to return 500 in the handler (HttpStatus.INTERNAL_SERVER_ERROR) when encountering this exception. I am using Spring Boot v1.5.4.RELEASE. I am calling a Spring Boot service returning a JSON object. I am using a custom exception handler. When an EntityNotFoundException occurs during deserialization, instead of returning 500 response, it returns

Groovy createCriteria issue with joined table

I have a domain class Coach which has a has many relationship to another domain class CoachProperty. Hibernate/Grails is creating a third joined table in the database. In the example below I am trying to fetch the coaches which both have foo AND bar for their text value. I have tried different solutions with ‘or’ and ‘and’ in Grails which

Jpa Enum error with Smallint type in postgres

I want to put enum in my entity. But I have an error with validation which JPA wonts smallint set as enum. How I can solve this issue. “Schema-validation: wrong column type encountered in column [status] in table [order]; found [int2 (Types#SMALLINT)], but expecting [int4 (Types#INTEGER)]”[enter image description here] Answer Add columnDefinition=”int2” at OrderStatus in your entity. Tested on spring

Batch fetching into @ElementCollection

I have following entity with its persistent collection After loading 10k rows A entities, I want to load its collection as well And select statement generated quite a lot (~10k). Very poor performance here! Any idea to work with batch select here? Answer I have solved this! IDEA Hibernate will take care of the sql statement and mapping to entity

Advertisement