Category "spring-data-jpa"

Set of String is not acting normal in Spring JPA Projection Interface

I am using Projection Interface to return a partial view of an Entity, and the partial view contains a Set of String. I expect the Set works as normal but its n

Is it possible to use data.sql without schema.sql

I want to initialise schema using spring.jpa.generate-ddl=true and then populate using data.sql. I tried it but it doesn't seem to work without schema.sql. Any

Meaning of Long in JPARepository?

What is Long here and what on basis do we configure this in JpaRepository? public interface FirstRepository extends JpaRepository<First, Long> { }

405 Method not allowed despite exposing all methods when using RepositoryRestConfiguration.disableDefaultExposure()

I don't want to expose my repositories by default and it looks like RepositoryRestConfiguration.disableDefaultExposure() does exactly what I want; however I get

org.springframework.beans.factory.UnsatisfiedDependencyException Spring JPA

i need help to solve this error here, for my college project. I created an online database and from there I tried to develop a service to be consumed later, the

Which is a better approach to persist the spring state machine context or restore the state machine using the state enum on entity object?

I am new to spring state machine and trying to understand which is a better approach whether to persist the state context in a database or to restore the state

Spring data: DeleteAll and Insert in same transaction

I am trying to achieve below native query logic using hibernate (Spring JPA). But save(Iterable) throws exception and rollback the entire transaction if one of

Is it a good or bad convention to update entity / row without calling save() in hibernate / spring-jpa?

Recently I found it not necessary to call repository.save() if within a @Transactional block. Hibernate / Spring-JPA will update row automatically when exiting

Spring Data: can I create a method in the @Repository with a name what return list of object if String equals to constant?

Guess easier if I show you my example: @Entity class User { Long id; Status status; } enum Status { NEW("N"), DELETED("D") } I have an AttributeCon

Hibernate / Spring Data - get executed sql queries count

I'm working on presentation in which I would like to show difference in number of executed sql queries between deleteByPost() method with and without custom que

pgp_sym_decrypt not working with JPA nativeQuery. Always throw error

Hi I'm working on a Spring Boot Project using PSQL. I have a model that is implemented pgcrypto like this, @ColumnTransformer( read = "pgp_sym_decrypt( ms

AssertionFailure: null identifier when try to save identifying one-to-one relation

I'm trying to make identifying relation with Spring Data JPA. And following is my (simplified) entities. @Entity class AuthorizationCodeEntity( @MapsId

Spring Boot - Hibernate - Table does not exists

I have a 3rd party jar that holds all the entities and mapping. I am currently using this jar successfully in a classic Spring-MVC application, but now I am t

Named parameter not bound : DATE_FORMAT Native Query in Spring Boot

I am trying to get table data as list using select query between dateFrom and current date using MySQL Native Query in Spring Boot. and MySQL database field dat

How to write a unit test for spring specification?

I created a builder class which construct Specifications object. It is used for creating queries for JpaSpecificationExecutor. The builder is used, because I ha

unable to test UUID

I have a spring boot 2.6.7 app, using Liquibase, Gradle and Spock. I have a class that uses a guid format string as the ID: @Entity @Table(name = "devices") pu

How to call repository method in entity listener

I'm trying to make call to repository inside my Entity Listener, when I call repository.findById() method inside my @prePersist method the same method is callin

How can I test the Remember Me checkbox

I am currently setting up a service allowing user login on a web portal, for comfort I have added the "Remember Me" function using Spring Security by using a pe

Document QueryDSL endpoint with Swagger

I'm using Spring Boot Data, QueryDSL and Swagger. I've define endpoint like this: @GetMapping public ResponseEntity<?> listOfThings( @PageableDef

Northwind - creating orders (MySQL + Spring boot)

I have DB with schema like below: I would like to create an Order. I created DAO of Order with all columns like below and added there relations like this: O