All Questions
Tagged with spring-boot postgresql
2,616
questions
127
votes
7
answers
247k
views
HikariCP - connection is not available
We have Spring-boot/Hibernate/PostgreSQL application in our project and use Hikari as the connection pool.
We keep running into the following problem: after few hours active connections number grows ...
75
votes
21
answers
217k
views
Unable to connect to Postgres DB due to the authentication type 10 is not supported
I have recently tried my hands on Postgres. Installed it on local (PostgreSQL 13.0).
Created a maven project and used Spring Data JPA, works just fine. Whereas when I tried using Gradle project, I am ...
57
votes
6
answers
146k
views
how to properly specify database schema in spring boot?
in my spring boot / hibernate application, I need to connect to a Postgres database "ax2012_1", which belong to the "dbo" schema.
I have the following application.properties:
# Database
db.driver: ...
52
votes
10
answers
34k
views
Spring + Hibernate: Query Plan Cache Memory usage
I'm programming an application with the latest version of Spring Boot. I recently became problems with growing heap, that can not be garbage collected. The analysis of the heap with Eclipse MAT ...
45
votes
5
answers
119k
views
how to store PostgreSQL jsonb using SpringBoot + JPA?
I'm working on a migration software that will consume unknown data from REST services.
I already think about use MongoDB but I decide to not use it and use PostgreSQL.
After read this I'm trying to ...
43
votes
10
answers
35k
views
Very slow Spring Boot application startup
I have a simple Spring Boot application that connects to a PostgreSQL database and serves as a JSON service. Somehow the startup has become very slow, see timings 10:37:10 and 10:38:00:
2015-05-09 10:...
42
votes
5
answers
80k
views
Embedded Postgres for Spring Boot Tests
I'm building a Spring Boot app, backed by Postgres, using Flyway for database migrations. I've been bumping up against issues where I cannot produce a migration that generates the desired outcome in ...
40
votes
8
answers
136k
views
Spring boot fails to load DataSource using PostgreSQL driver
I have successfully developed a prototype using Spring Boot 1.0.2.RELEASE (was 1.0.1.RELEASE until today).
I have searched and searched and tried solutions like:
Spring Boot jdbc datasource ...
38
votes
4
answers
102k
views
ERROR: update or delete on table "tablename" violates foreign key constraint
I'm trying to delete the parent student or parent course and I get this error:
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "student" violates foreign key ...
36
votes
3
answers
71k
views
Postgres Sql `could not determine data type of parameter` by Hibernate
I have JpaRepository:
@Repository
public interface CardReaderRepository extends JpaRepository<CardReaderEntity, Integer > {
}
when i execute query in this repo same as this:
@Query(
...
35
votes
6
answers
91k
views
Postgres connection has been closed error in Spring Boot
I am running a Spring Boot application to create REST apis. Often I get an error saying that the database connection is closed, and after that I cannot make any calls to the application. I'm using ...
33
votes
5
answers
18k
views
Spring Boot "PSQLException: FATAL: sorry, too many clients already" when running tests
I have a Spring Boot application that provides a REST API to front-ends. I am using jOOQ and Postgresql. I am currently getting this error when executing all integration tests locally (around 1000 ...
32
votes
12
answers
147k
views
org.postgresql.util.PSQLException: ERROR: relation "app_user" does not exist
I have an application that I'm using spring boot and postgres. I'm getting this error when I try to create a user.
When I run this query on my database, I get the same error:
select * from APP_USER
...
30
votes
4
answers
92k
views
Disable table recreation in Spring Boot application
I'm trying to build a simple web application using Spring Boot. When I restart the application all database tables are recreated. I tried setting hibernate.hbm2ddl.auto to update or validate but that ...
27
votes
10
answers
56k
views
Spring Boot Application gets stuck on "Hikari-Pool-1 - Starting..."
I'm trying to run Spring Boot application connected to PostgreSQL database. However, when it comes to Hikari connection pool initializing, it just gets stuck and nothing goes on. HikariPool-1 - ...
25
votes
6
answers
24k
views
Map a PostGIS geometry point field with Hibernate on Spring Boot
In my PostgreSQL 9.3 + PostGIS 2.1.5 I have a table PLACE with a column coordinates of type Geometry(Point,26910).
I want to map it to Place entity in my Spring Boot 1.1.9 web application, which uses ...
23
votes
2
answers
38k
views
Failed to validate connection (This connection has been closed.). Possibly consider using a shorter maxLifetime value
I see the following error message:
HikariPool-1 - Failed to validate connection
org.postgresql.jdbc.PgConnection@f162126 (This connection has been
closed.). Possibly consider using a shorter ...
21
votes
7
answers
30k
views
Connecting to Heroku Postgres from Spring Boot
I'm looking for the simplest, cleanest way of connecting to Heroku Postgres in a Spring Boot app using JPA/Hibernate.
I don't see a good, complete example for this combo in either Heroku or Spring ...
21
votes
3
answers
22k
views
Timeouts connecting to a Postgres database on Amazon RDS from Azure
I get the following exception in my application after leaving a database connection idle for some amount of time:
... An I/O error occured while sending to the backend.; nested exception is org....
21
votes
1
answer
27k
views
How do I get Spring Boot to automatically reconnect to PostgreSQL?
I am running Spring Boot connecting to a PostgreSQL database. I have verified that data is written to the database if Spring Boot is started after the database.
spring.datasource.url = jdbc:...
21
votes
2
answers
12k
views
Spring Data / Hibernate save entity with Postgres using Insert on Conflict Update Some fields
I have a domain object in Spring which I am saving using JpaRepository.save method and using Sequence generator from Postgres to generate id automatically.
@SequenceGenerator(initialValue = 1, name = ...
20
votes
3
answers
14k
views
Is there a rule that forbids to name its entity class "User" when working with PostgreSQL and Spring Boot?
guys. I'm having a problem with a Spring boot 2.3.0 and PostgreSQL 12 project. I have an entity class I called User whose code is as follows:
@Entity
@NoArgsConstructor
@Data
@AllArgsConstructor
@...
19
votes
5
answers
39k
views
ERROR: column is of type json but expression is of type character varying in Hibernate
I need to map two columns of entity class as json in postgres using spring data jpa. After reading multiple stackoverflow posts and baeldung post ,
How to map a map JSON column to Java Object with JPA
...
19
votes
3
answers
61k
views
org.postgresql.util.PSQLException: ERROR: value too long for type character varying(255)
When I execute my project, I get this error:
The goal is to save json text into a database using hibernate.
Users.java & UsersBooks.java is likewise,
Books.java:
@Entity
@Table(name="tblbooks")...
16
votes
7
answers
23k
views
Spring Batch / Postgres : ERROR: relation "batch_job_instance" does not exist
I am trying to configure Spring Batch to use PostGres DB. I have included the following dependencies in my build.gradle.kts file:
implementation("org.springframework.boot:spring-boot-starter-...
16
votes
2
answers
32k
views
using spring boot profiles with liquibase changeset context attribute to manage changset scope
I am trying to do a proof of concept application with spring boot and liquibase. I basically want to create a spring boot app that can manage liquibase changesets by utilizing the changeset attribute ...
16
votes
6
answers
141k
views
HikariPool-1 - Exception during pool initialization
I'm deploying Spring-Boot4 project and I have got an error called HikariPool-1 - Exception during pool initialization.
2019-07-05 11:29:43.600 INFO 5084 --- [ main] org.hibernate.Version ...
15
votes
1
answer
10k
views
Transactions in spring boot testing not rolled back
I have an integrations test class for my UserController. The contents of the following class are:
// imports...
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(...
15
votes
1
answer
112k
views
Configure SpringBoot+Hibernate+PostgreSQL
I'm totally noob in PostgreSQL and configuring Spring web applications, plus all info I could found about this is on Maven or for Eclipse, so very hard for me understand cause I'm using IntelliJ + ...
14
votes
3
answers
44k
views
JPA Uppercase table names
I have a table in Postgresql:
CREATE TABLE "UTILISATEUR"(
"IdUtilisateur" serial NOT NULL,
"Nom" character varying(50),
"Prenom" character varying(50),
&...
14
votes
4
answers
21k
views
Spring Boot connection to Postgresql with SSL
I have a Spring Boot application (version 2.1.1) using Postgresql 9.6 as database.
I have to connect to the db via SSL with sslmode=verify-ca.
What I have done till now is to set in the Application....
13
votes
3
answers
14k
views
Is there a way to use Postgres' UUID generation with Hibernate's IDENTITY ID generation strategy?
I'm using Spring Boot 1.4.1, which includes Hibernate 5, with Postgres 9.6, and I'm trying to create an entity with a UUID ID but using Postgres' UUID generation instead of Hibernate's. Many similar ...
13
votes
2
answers
45k
views
HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection@2a84e649 (This connection has been closed.)
I'm using Postgresql and spring boot 2.0.4. The below error is thrown when trying to execute the queries one after the other. I've executed the following query, and the count keeps on increasing.
...
12
votes
2
answers
16k
views
Spring data JPA nativeQuery order by is invalid
The Spring Data Jpa Method like this:
@Query("select pb.id,pp.max_borrow_amt,pp.min_borrow_amt
from product_loan_basic pb left join product_loan_price pp on pb.code=pp.product_code
where pb.code IN(...
12
votes
2
answers
21k
views
@CreationTimestamp and @UpdateTimestamp is not working with LocalDateTime
I am trying to use @CreationTimestamp and @UpdateTimestamp with LocalDateTime type, but it is giving me org.hibernate.HibernateException: Unsupported property type for generator annotation @...
12
votes
1
answer
23k
views
why does spring-boot and postgres connection breaks after certain time?
I run Spring-Boot with gradle using the tomcat-connection-pool. All the standard spring-boot-tools. I run several soap-webservices on that webserver. It all works fine when testing the load of the ...
12
votes
3
answers
8k
views
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.
http://...
12
votes
2
answers
46k
views
Spring Boot JPA Database Choice
How can I start a stand-alone Spring Boot JPA application -- not via cli -- with a choice of databases to get data, e.g., localhost:5432/my_db; or 192.168.1.100:5432/our_db, or example.com:5432/...
11
votes
2
answers
16k
views
org.postgresql.util.PSQLException: No results returned by the query
hey everyone am trying to insert data in a table using @Query annotation in my spring boot app am getting a postgres Exception :
org.postgresql.util.PSQLException: No results returned by the query
...
11
votes
1
answer
10k
views
How can I set the port for Postgresql when using Testcontainers?
Sometimes I need to install a port for Postgresql, which I run for tests in a container. But the Test container the developer command ofTestcontainers removed this feature. But somewhere there is a ...
11
votes
2
answers
12k
views
@Column(unique = true) produces a WARN o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 0, SQLState: 00000
In a project with Spring Boot 2.0.0.RELEASE, when I start the application the first time, when the database tables are being created, I'm getting the following warning message:
Hibernate: alter table ...
11
votes
3
answers
28k
views
How to specify UTC timezone for Spring Boot JPA Timestamp
Environment
Spring Boot Starter Data JPA 1.4.2
Eclipselink 2.5.0
Postgresql 9.4.1211.jre7
Problem
I am building a Spring Boot microservice that shares a Postgresql database with a different ...
10
votes
2
answers
5k
views
REVINFO table is missing the sequence "revinfo_seq"
I am migrating to SpringBoot 3.0.1 and updated "hibernate-envers" version to "6.1.6.Final". My DB is PostgreSQL 13.6.
Hibernate is configured to create the DB schema:
spring.jpa....
10
votes
2
answers
14k
views
Spring Boot Query annotation with nativeQuery doesn't work in Postgresql
Development environment.
OS: windows 8
IDE : Eclipse Luna with JAVA 8
Postgresql : 9.3.4 in OPENBSD 5.5
Other All JPA query like findFirst3ByTextOrderByTextAsc are working fine.
But not in ...
10
votes
2
answers
35k
views
java.lang.IllegalStateException: No supported DataSource type found
Spring boot can't create my Postgres datasource. The error is starting here:
at org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder.getType(DataSourceBuilder.java:138) ~[spring-boot-...
10
votes
5
answers
25k
views
Passing a null parameter to a native query using @Query JPA annotation
In a Spring Boot application, I have a SQL query that is executed on a postgresql server as follows :
@Query(value = "select count(*) from servers where brand= coalesce(?1, brand) " +
"and ...
10
votes
1
answer
5k
views
org.postgresql.util.PGobject not available in org.postgresql
I'm using Spring boot 2.1.5.RELEASE and I have the following dependency in my pom.xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</...
10
votes
3
answers
15k
views
Springboot HikariCP
I using springboot with HikariCP, but after a while my app crash and I got the error:
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for ...
10
votes
2
answers
2k
views
How do you include postgresql.conf on docker container when using org.testcontainers
Is it possible to give postgresql testcontainer a custom postgresql.conf file via config?
I have included maven dependency
<dependency>
<groupId>org.testcontainers</...
10
votes
1
answer
11k
views
HikariCP connection pool - 'active' - how to debug?
I am building an app using Spring-Boot/Hibernate with Postgres as the database. I am using Spring 2.0, so Hikari is the default connection pool provider.
Currently, I am trying to load-test the ...