Relative Content

Tag Archive for javaspring-boot

How to find file that is parallel to src in Maven project?

I’m trying to access a json file in a Spring boot project and the file is not under src main. Rather it is parallel to src. What is the path to this file if i want to create a Resource or File object to read from it.
I cannot move this file to app/src or app/test. It is directly under app. That is, it is in the same directory as pom.xml

Retry for multiple parallel Api calls

I am doing multiple api calls parallely using completableFuture. I am Using RetryTemplate to invoke the Api when the api calls fail with 500 then it should retry. if multiple api calls fail I want the retry to happen for all the calls which got failed. I can see only one api call is retrying where as others calls are not getting retried

entityManager persist does not persist any data

I am creating a team dashboard with matches from a csv file. I am creating two Entity’s – Match and Team. I am using Spring Batch to load matches into postgre and its loading fine. I am able to verify data load complete by querying postgre database. After batch job completion I would like to run some queries to aggregate data for which I am using EntityManager. When I persist from EntityManager I don’t see any data in database and don’t see any errors. I tried outputing the data stored in hashMap and I see data which I would like to store in database Team table. What could be wrong with the way I am persisting?

spring Boot problem, In the database, when the data is entered, why is it not saved to the linked table , why is the foreign key null?

package com.example.project2.entity; import jakarta.persistence.*; import lombok.*; @Entity @AllArgsConstructor @NoArgsConstructor @Data @Table(name = “LoginUser”) public class LoginUser { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int loginID; private String loginEmail; private int loginContactNumber; private String loginPassword; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = “fk_reUserID”, referencedColumnName = “reUserID”) private RegisteredUser registeredUser; } package com.example.project2.entity; import jakarta.persistence.*; import lombok.*; @Entity @AllArgsConstructor @NoArgsConstructor […]

spring Boot problem, In the database, when the data is entered, why is it not saved to the linked table , why is the foreign key null?

package com.example.project2.entity; import jakarta.persistence.*; import lombok.*; @Entity @AllArgsConstructor @NoArgsConstructor @Data @Table(name = “LoginUser”) public class LoginUser { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int loginID; private String loginEmail; private int loginContactNumber; private String loginPassword; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = “fk_reUserID”, referencedColumnName = “reUserID”) private RegisteredUser registeredUser; } package com.example.project2.entity; import jakarta.persistence.*; import lombok.*; @Entity @AllArgsConstructor @NoArgsConstructor […]