Category "spring-data-jpa"

How to iterate through all instances of an entity in Spring data JPA

I have an entity called packet, I want to update an attribute in all instances of that entity. The attribute I want to update is the price of the packet by a gi

Is it reasonable to have properties file while having Javaconfig classes in spring projects?

I encountered handful of guides to creating spring data jpa projects and people configured persistence layer using properties file and javaconfig both. If we on

Is it reasonable to have properties file while having Javaconfig classes in spring projects?

I encountered handful of guides to creating spring data jpa projects and people configured persistence layer using properties file and javaconfig both. If we on

No converter found capable of converting from type [java.math.BigInteger] to Entity

I'm trying to get a list of transactions from database and this is the error I'm facing. "trace": "org.springframework.core.convert.ConversionFailedException:

How to query a column which value is null and use keyword `in` in JPA?

When I passing parameters a1 as "a1", a2 as ["a21","a22"] @Query(value = "select * from a where if(:a1 !='', a1=:a1,1=1)" + "and if(:a2 !='',a2 in (

How can I delete the product and corresponding logs?

I want to delete all the product logs of a specific product depending on its product_id(FK). I created product logs to monitor when the product it's created and

How to implement a search table with many to many relationship in Hibernate with a 3rd class entity

I am trying to learn Hibernate to create on startup the Db from entities, but I have only found articles suggesting how to implement many to many relationship w

How use projections in spring-data-jpa?

I need to get all the information about the ticket in one request, also the name, author, and year of the book. I have implemented this : I create interface Tic

Only allow updating JPA entity when @version attribute matches

I have two classes, a file and an attachment. There is a version attribute on the file and it has a onetomany relationship. I have written code to upload/add at

Building a select query using Spring Data Specification

I'm trying to build a select query with Spring Data Specification. The query in question is the following: SELECT * FROM product WHERE id IN (SELECT product_id

How to make inherited fields of non-audited base entity being audited for audited child entity in JPA?

I have a base entity not intended to be audited: @Data @MappedSuperclass @EqualsAndHashCode(of = {"id"}) public abstract class BaseEntity implements Serializabl

when i add opcion forEach method get java.util.ConcurrentModificationException: null

I have a problem, I have a question entity and an option entity, the relationship is one to many. but when I want to add the options in the question, it shows m

Spring Data REST - do not allow to return entities but only views (projections)

My objective is to make sure that a client can't access (retrieve) directly an entity through the Spring Data REST auto-exposed APIs, but rather only to the vie

Spring boot AbstractDataSourceBasedMultiTenantConnectionProviderImpl as well as a shared database

I currently have multi tennancy database working by implmenting AbstractDataSourceBasedMultiTenantConnectionProviderImpl. This is working great thankfully. Now

Sequence number, incorrect number

In a spring boot application, I have this entity @Data @NoArgsConstructor @AllArgsConstructor @Entity public class User { @Id @GeneratedValue(generator="user_id

MariaDB Connector gives datetime with precision 3 instead of 6 after update to version 3.0.3

I have a spring boot application with mariaDB, after updating the connector ("org.mariadb.jdbc:mariadb-java-client") from version 2.7.5 to 3.0.3 the datetimes (

Spring Boot and H2 Table Population Error: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL

I am having trouble getting an H2 In Memory database to populate. The idea here to have the BuildingCode which is unique as a primary key and id. I get the foll

What is the relation between a thread and transaction in JPA?

I am aware that JPA works with the default isolation level set for the database , if no isolation level is explicitly specified using the @Transactional annotat

Select only a set to improve perfomance

I search to know if a user have an active subscription @Query("select case when count(u) > 0 then true else false end from User u where u.id=:userId and cur

EntityManager closed when executing queries on different threads

I am trying to execute a couple of queries on different threads. There are 2 top level queries each executing on different tables at runtime. For executing the