spring-data-jpa Questions

4

Solved

How do I do a distinct counting with Spring Data JPA? I do not want to use the @Query annotation. The equivalent sql query would be: SELECT COUNT(DISTINCT rack) FROM store WHERE id = 10001; I t...

5

Solved

I'm trying to add automated testing using the TestContainers library to my Spring Boot project Here is my test class to test my jpa repository: package com.ubm.mfi.repo; import com.ubm.mfi.domain....
Amaleta asked 6/5, 2020 at 0:24

4

Solved

I am looking for a solution to dynamically build queries using Spring Data JPA. I have a GameController which has a RESTful service endpoint /games which takes 4 optional parameters: genre, platfor...
Turgor asked 28/11, 2014 at 17:13

3

Solved

I try to configure OneToMany and ManyToOne mapping in Spring Data project but have some issues. So I have two entities: Employer and Project. One Employer could have many projects. Entity classes...
Aoudad asked 1/7, 2015 at 21:29

3

I have a small Spring Boot application with spring-boot-starter-web, spring-boot-starter-data-jpa, and postgresql as dependencies. I'm able to use the @Transactional annotation and use JPA to fetc...
Cusick asked 23/2, 2018 at 15:30

3

I wanted to know when we should use @Transactional in Spring Boot Services. Since JpaRepository's save() method is annotated with @Tranasactional is it required for me to add that annotation in my ...
Gnarly asked 9/3 at 13:15

2

In my audited entity I have last modified fields: @LastModifiedBy private String lastModifiedBy; @LastModifiedDate private OffsetDateTime lastModifiedDate; But they doesn't change when enti...
Platinumblond asked 27/11, 2019 at 13:51

0

I need to get 20 users from the postgres database (without sorting), do some actions with them, and then delete them as part of the transaction. If I were using a native sql query, I would write li...

1

When migrating from Spring Boot 2.4.3 to Spring Boot 3.2.2 (by using Java 17.0.2) I ran into the follwing issue with Spring Data JPA and Hibernate: org.springframework.beans.factory.BeanCreationExc...
Dormer asked 28/2 at 10:3

8

Solved

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 trying to use it in a Spring-Boot applic...
Grounder asked 7/10, 2017 at 23:13

2

Solved

All code in this post can be found here: https://github.com/cuipengfei/gs-accessing-data-jpa/tree/master/complete You can run this test to reproduce the problem: https://github.com/cuipengfei/gs-a...
Agincourt asked 20/3, 2017 at 9:58

10

Solved

I'm developing application using spring data jpa,hibernate,mysql,tomcat7,maven and it's create error.I'm trying to figure it out but i failed. error are Cannot resolve reference to bean 'entityMa...
Timtima asked 1/7, 2014 at 23:16

9

Hi I am doing JPA and Hibernate configuration using Java configuration in spring boot and I am stuck it at this error for hours. Even though I have declared the UserRepository as bean still it is n...
Beniamino asked 30/8, 2018 at 16:42

2

Solved

I have a table casemessage and has following columns. And I am trying to search/query JSON column using Spring Framework JPA.. id created_by created_utc from_id message status case_id Here the ...
Evergreen asked 11/5, 2017 at 13:38

1

Solved

I have one Postgres SQL query that will perform search operation inside array of values of the defined key inside jsonb type column. SELECT o.id FROM customer c INNER JOIN order o on c.id = o.c_id ...

1

I am running a unit test set up as a DataJpaTest with an H2 database. It worked well, until I introduced a new Immutable Entity set using a Subselect. It does not break, but it does not find data t...
Toile asked 20/9, 2020 at 21:18

7

I want to use spring data repository interface to execute native queries - I think this way is the simplest because of low complexity. But when extending interface ex. CrudRepository<T, ID> ...
Sideway asked 4/4, 2019 at 10:35

2

Solved

For quite a while now I am trying to get following to work in my resource / controller: Have a stream of data and then map the stream of data to a Page response Page<SomeType> controllerMet...
Mule asked 22/10, 2018 at 13:14

3

Solved

I'm using Spring + Spring Data JPA with Hibernate and I need to perform some large and expensive database operations. How I can use a StatelessSession to perform these kind of operations?
Fluorescein asked 17/3, 2013 at 12:15

3

Solved

I'm new to Spring Boot. I have a mysql database, I use a query to count row in my table. But it's not work, it still return my original table data. Can you help me check my code. Here is my Entity...
Signify asked 9/1, 2019 at 3:13

6

I keep getting org.hibernate.AssertionFailure: null identifier when trying to create an object. My classes are as follows: public class User { @Id @Column(name = "user_id", nullable = false) p...
Peyote asked 13/2, 2015 at 20:40

3

By default, my Spring Boot project had JPA mapping entity properties to table columns by transforming the names from camelCase to snake_case (e.g. from fooBar to foo_bar). I'm working on an existi...
Rhiamon asked 14/6, 2018 at 13:29

2

We are using spring data jpa, and at one place we have injected entity manager. For all other functionalities we are using jpa-repository but for one functionality we are using injected entity mana...
Heinrick asked 20/11, 2017 at 11:2

3

My Environment mysql 8.0.25 hibernate-core:5.4.32 hibernate-spatial:5.4.32 spring-boot2.5.4 java 8 What I did application.yml spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver ur...
Cabochon asked 12/9, 2021 at 5:51

4

Solved

I am trying to create a user model with a CrudRepository: @Entity public class User { @Id @GeneratedValue private String username; private String password; public String getPassword() { r...
Creosote asked 10/5, 2015 at 15:2

© 2022 - 2024 — McMap. All rights reserved.