Category "spring-data-jpa"

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

Why JpaRepository doesn't commit to database when called from @SpringBootTest?

When repository.save(t) is called from my service, which is in turn called from my controller, all works just fine, and the object is inserted into the database

DB default column value null while saving with Spring Data JPA

I have a JPA entity with the following fields: @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "modified_by_user_id") private User modifiedByUser; @Conve

How to throw exception when there is extra parameters in request body spring boot

In my last project, there was a requirement for throwing exceptions when the request body contains extra parameters. If the request will be like { "test":"bo

JPA relationship for existing table and parent table

I have a table which has a foreign key relationship with an existing table and its child table. The parent table exists before the child table as is populated

JPA/Hibernate @GenericGenerator throws StackOverFlow on persisting entity

I have implemented two entities (Department and Employee) with custom ID generator for Employee, and has a unidirectional one-to-many relationship as shown belo

Is there a way to return collection instead of entity in @Repository's @Query

I have a query: @Query( value = "select name, age, now() from received.scheme ;", nativeQuery = true ) public {???} selectData() I cannot create or r

file from one node to another node?

I would like to add a database to it so that the information is stored.

Cassandra Spring No Converter Found Capable of Converting from Type Instant to type Long

Am getting a No converter found capable of converting from type Instant to type Long while using Spring and Cassandra. I have 2 Instant fields writtenDate (in t

Spring QuerydslPredicate - exception handling for bad types

I didn't find any proper solution for this so maybe you can assist. Basically issue is ultra simple I want to do some kind of "better looking" error handling wh

Spring Batch - RepositoryItemReaderBuilder with RepositoryMethodReference throws Cannot subclass final class

I'm trying to use Spring Batch RepositoryItemReaderBuilder with RepositoryMethodReference as parameter to provide type-safe way to call repository methods. unfo

How to get Count of OneToMany field in JPA Enity?

How can we get the count of OneToMany field of JPA entity as querying count for each parent entity while fetching as a list is costly and there is no way in JPA

JPA cascading delete fails with custom delete method

I ran into an error with custom delete method in spring data jpa. Basically there's a bag which contains items, and when deleting the bag, all the items in it s

How to get Grails Gorm autocomplete in regular Spring Data JPA

Grails GORM is able to autogenerate ORM findBy[fieldName] and related methods for each of the fields in the entity, I'm not sure what magic it uses to do this I