Questions tagged [spring-boot-jpa]
96 questions
12
votes
3 answers
Stream rows from PostgreSQL (with fetch size)
I would like to stream results from PostgreSQL 11.2 and not read all results to memory at once. I use the newest stable SpringBoot 2.1.4.RELEASE.
I read the article how to do it in MySQL.…

Hollow.Quincy
- 547
- 1
- 7
- 14
12
votes
2 answers
How can I combine @DataJpaTest @SpringBootTest in one MVC application for testing every layer?
Here https://stackoverflow.com/a/52968130/10894456 is well explained why @DataJpaTest @SpringBootTest shouldn't be mixed in one application.
But barely explained the case when anyway need to test every layer of MVC SpringBoot application (from my…

J.J. Beam
- 2,612
- 2
- 26
- 55
6
votes
2 answers
Why doesn't Hibernate batch inserts of fields annotated with @ElementCollection?
I have an @Entity containing a few @OneToMany relationships, but since they consist of collections of Enums, I'm using @ElementCollection. The entity has an id that gets generated at the database level (MySQL).
Here is a small example I just made up…

Michele Palmia
- 2,402
- 2
- 25
- 28
6
votes
0 answers
Custom return type (dynamic projection) for Spring CrudRepository save method
I'm wondering if it is possible to define a custom return type for Spring's CrudRepository save method like in the following example for a find query method:
Optional findById(Long id, Class type);
In the documentation I only found an…

times29
- 2,782
- 2
- 21
- 40
5
votes
0 answers
How to call simple select Procedure that using Multiple tables from MySQL using JPA
I have a stored procedure that is returning results from multiple tables
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetProjectAndClientOverview`()
BEGIN
SELECT ( SELECT count(*) FROM projects_info) as "projects_done",
(SELECT COUNT(*) FROM…

VJain
- 1,027
- 7
- 17
- 37
4
votes
1 answer
@JmsListener and persisting to database
I'm working on a service where I listen to the queue, deserialize received messages, and persist them to a database (Oracle). Roughly:
@JmsListener(destination="some-destination")
public void onMessage(Message message) throws Exception {
String…

S. Lokis
- 43
- 1
- 3
4
votes
1 answer
org.springframework.dao.DataIntegrityViolationException after update spring-boot from 2.1.x to 2.2.x using hibernate and spring-boot-data-jpa
When trying to update spring-boot from version 2.1.12 to 2.2.4 got stuck on DataIntegrityViolationException when try to insert multiple objects into MySQL using JPA.
Example object:…

Anton
- 43
- 1
- 4
4
votes
1 answer
Parameter value [....] did not match expected type [java.util.Collection (n/a)]
I am using spring-boot, spring-data-JPA and Hibernate and I've a Form Entity and a Group Entity and they have a @ManyToMany relationship between them.
@ManyToMany(fetch=FetchType.LAZY)
@JoinTable(name = "form_group",
joinColumns =…

jalil
- 476
- 1
- 7
- 16
3
votes
0 answers
Mapping many-to-many relationship to DTO object
Hi like in subject I would like to map entity class to DTO object.
Order Class:
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "ORDERS")
public class Order extends BaseEntity {
@Column(name = "ORDER_DATE")
private…

Oskar
- 379
- 4
- 21
3
votes
1 answer
SCD (slowly changing dimension) Type 4/6 - how to implement in spring boot app, hibernate envers
I am trying to solve the problem how should I create "logs" for my app and store them to database.
Let's assume I have this database structure:
FIRST TABLE:
weatherstation_id | weatherstation_name | weatherstation_ip_address
SECOND TABLE:
sensor_id…

Jakub Znamenáček
- 766
- 1
- 4
- 18
3
votes
3 answers
Prevent @Entity from re creating a database table - Spring Boot
I'm kinda new to spring boot data jpa, as far as I know @Entity is used to represent a database table in the application, for this project im using spring-boot 2.2.5.RELEASE and H2 as in memory database.
So far I've got this.
inside of…

Kevin Valdez
- 359
- 4
- 17
3
votes
1 answer
Spring data jpa with java FX
I'm using Spring JPA with OpenJFX. It's this project JavaFX-weaver, simply adding spring-boot-start-data-jpa inside pom.
However my starting time of Spring JPA is 15-20s and the UI will not show until spring is initalized. When users will start the…

user182410
- 151
- 2
- 8
2
votes
0 answers
How to handle static foreign key related tables Spring Data Jpa
have gotten into the field after time away and working on getting up to speed with my java skills using the spring framework using spring boot and spring data jpa.
Here is my issue....I have a project management application that I am developing, the…

user14880866
- 21
- 1
2
votes
1 answer
where does jpa picks up the method userbyusername as i have not given any implementation and i have checked the inner classes too
In my spring boot project, I am using this starter jpa . i have done all the db related thing in appliction.properties. Project is working fine . I fail to undestand where is this methods defination. We have just defined a abstract method how is…

ayushgupta
- 112
- 11
2
votes
3 answers
Lombok SuperBuilder Inheritance
I've a class BaseEntity:
and an extended class:
I'm trying to build a seeder using the builder:
I want Lombok to create a constructor in the BreedEntity with the base class baseEntity.
I read the documentation and it works just fine when I delete…

Rik Peeters
- 31
- 1
- 6