I have written a basic simple API of students data and added few validations using Hibernate validator but everytime its returning 0 errors. Here’s the code: pom.xml student.java Controller.java I am testing it using postman,My request body: In every request,even if name is empty Its returning 0 errors.…
Tag: spring-boot
Spring boot aggregation with group Trim
Consider collection with whitespace in field, in DB if there is white space if we group them “Ravi”, ” Ravi ” , consider as total 2 values. but it should consider as single value. So I have trim in Group. I had performed in DB. But I don’t know how can I trim and group value in S…
Failed to create topics”,”exception”:”norg.apache.kafka.common.errors.UnsupportedVersionException
Please suggest what changes are required as i am getting this error. Answer I see you are new here. You should always include version information and full stack trace for questions like this. Upgrade your broker to >= 2.4 or set the binder replication factor property. See https://github.com/spring-cloud/sp…
Spring Data Elasticsearch Class Cast exception on Named Query
I’m getting the following exception when trying to use a named query with Spring Data Elasticsearch. The query I’m trying to make is: If I do not use the @Query annotation and instead let Spring derive the query from the method name like so: It works as expected. However, the PlayerNumber field is…
org.hibernate.hql.internal.ast.QuerySyntaxException: Apartment is not mapped [from Apartment]
I have springboot rest appplication with Hibernate and MySQL. I have this error: nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.hql.internal.ast.QuerySyntaxException: Apartment is not mapped [from Apartment] But I dont know where I have a mistake. I have two tabl…
Spring Boot controller test loading entire application context
Spring Boot here. I currently have the following REST controller: I would like to write an integration test for it that: Mocks or stubs an HTTP request to the URL; and Allows me to inject the FizzbuzzController (under test) with a mocked FizzbuzzService or the real thing; and Allows me to inspect the HTTP res…
Failed to convert from type [java.lang.Object[]] to type [@org.springframework.data.jpa.repository.Query com.data.models.Users]
I am trying to limit my query to only select specific columns from a table which am going to use, but when I write a simple select query I end up with an error Resolved [org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object[]] to type [@org.springframework.d…
One to One relationship mapping JPA SpringBoot implementation error: ids for this class must be manually assigned before calling save()
I am trying to understand the JPA Spring Boot implementation for One-to-One mapping classes and was hoping if anyone could provide me a clear picture. One to One mapping Scenario: Table foo and Table childfoo Foo has the columns foo_id,foo_name, foo_place childfoo has the columnd foo_id(foreignkey of foo tabl…
what is the use of the property spring.cloud.stream.bindings..consumer.partitioned
What will happen If partitionCount (spring.cloud.stream.bindings..producer.partitionCount) is greater than 1 and consumer.partitioned (spring.cloud.stream.bindings..consumer.partitioned) is false (Using Kafka) Answer In the case of Kafa binder, the property spring.cloud.stream.bindings..consumer.partitioned i…
Name or Service not Known when calling service via spring boot in Openshift Container Platform (a cloud-based Kubernetes container platform)
I have an application which consists of a backend (spring boot) and a search engine (elasticsearch). After I deployed it into OCP, Initially I tested the connection between the two using the command “curl” to elasticsearch service (https://service-name.namespace.svc.cluster.local:9200) from backen…