Questions tagged [spring-boot-jpa]

96 questions
1
vote
1 answer

How to give external .yml file in Spring Boot Eureka Config?

I have multi-module Spring Boot Application. For the UserManager module I have userman.yml, userman-development.yml and also I have bootsrap.yml in resources part. However, I could not reach the userman-dev.yml. I set up the database url in…
ozer
  • 241
  • 2
  • 12
1
vote
2 answers

How log springboot commit transaction

I create 2 methods with annotation @Trasactional so now how can I log the begin and commit in my transactions? I wanna to see everthing inside one transactions, when Start another insede a existing something like this: Begin1 //sqls Begin…
Fabio Ebner
  • 2,613
  • 16
  • 50
  • 77
1
vote
1 answer

org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Referential integrity constraint violation

Spring boot 2.5 @Entity public class Orders { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @NotNull @DateTimeFormat(pattern = "dd.MM.yyyy HH:mm:ss") private Date created; private String…
Alexei
  • 14,350
  • 37
  • 121
  • 240
1
vote
1 answer

Exclude certain DataSource(s) from HibernateJpaAutoConfiguration

I have a project with 2 DataSources. One is for PostgreSQL and other is for ClickHouse. No problem so far. I intend to use ClickHouse with native SQL via JDBC only. But I would like to use JPA based repositories with PostgreSQL datasource. And if I…
user1918305
  • 2,130
  • 1
  • 13
  • 14
1
vote
1 answer

JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column

Spring Boot 2.2 I has many CartItem in one Cart. One CartItem has one Product with quantity = n So here models: @Entity public class Cart { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @NotNull private…
Alexei
  • 14,350
  • 37
  • 121
  • 240
1
vote
0 answers

How to filter empty string from MongoDB using Spring Boot JPA query method keywords

I am trying to find all appointments that ID is not empty string and not null but can't figure out what the methods are. Here's my repository method: findByAppointmentIdNotNullAndAppointmentIdNot(String condition); Internal Server…
Haifeng Zhang
  • 30,077
  • 19
  • 81
  • 125
1
vote
0 answers

Spring JPA repository use @IdClass

With an entity like this: public class AccountId implements Serializable { private int a; private int b; // getters, setters, etc. } @Entity @IdClass(AccountId.class) public class Account implements Serializable { @Id private int a; …
levant pied
  • 3,886
  • 5
  • 37
  • 56
1
vote
2 answers

Transaction is not committed when spring boot application is run from java -jar

We developed an application using maven spring-boot. When we run project with NetDeans IDE, everything works fine. But when we build it and run it from java -jar command, it seems that working and do not do database updates. On the other hand, it…
ridvandev
  • 51
  • 1
  • 1
  • 6
1
vote
4 answers

Cannot get username in spring boot

The problem is: When I use JpaRepository and use a method to get the user by username like the code below: public interface UserRepository extends JpaRepository { @Query(value = "select * from users where username = :name",…
Higanbana
  • 489
  • 10
  • 26
1
vote
3 answers

@GetMapping doesn't serialize Ids

I have a problem with @GetMapping in Spring boot. It's about my @GetMapping function that doesn't serialize my id on this model while getting all data from database: //User.java @Entity @Table(name = "users") public class User { @Id …
Higanbana
  • 489
  • 10
  • 26
1
vote
1 answer

spring-boot-starter-data-jpa@ManyToMany collection not populating

I'm getting a problem with the @ManyToMany collections not populating on data load. I've tried FetchType.LAZY and FetchType.EAGER with no changes in the result. When I am printing the User Object the collection Object of Roles is empty. User…
Santosh_17
  • 23
  • 5
0
votes
1 answer

Case..When in Where Condition Spring boot data jpa

Is there any way can we make case with where condition?? I need to search users based on first name,last name, role....etc but in search params all params are not mandatory, User may enter only firstname or with combination of multiple…
Narendar Reddy M
  • 1,499
  • 1
  • 11
  • 18
0
votes
1 answer

Two bidirectional association at the same entity - Column cannot be null

I have a scenario where I have a relationship between two tables. One being the step and the other being to know who is the next step. select * from cpo_workflow_step_control; Step entity: @Entity @Table(name = "cpo_workflow_step") public class…
0
votes
2 answers

Accessing Multiple Entity Values in a Join Query Spring-Boot

I have an application that essentially has Post/Comment-like functionality. I need the application to render a Post index page from the Post entity with the latest comment and author being displayed from the Comment entity. My database/table…
Stephen
  • 1
  • 2
0
votes
1 answer

How to define an attribute of a class as key for a map?

This is the first time that I have used Maps to do persistence with JPA. I also lose myself a bit at the conceptual level. I have an object (poi) which has none, one or more description in different language. I want the poi object to have a map…
Camel4488
  • 323
  • 1
  • 3
  • 9