Skip to content
Advertisement

Tag: postgresql

Hibernate Native SQL returns some nulls instead of partially filled objects

I have the following (postgress) SQL Query: And what it does is it creates a series of 6 hours per day and takes averages from it. A result may look like this: variable_id date_time sample_count sample_period_ms min_value max_value value 15 2021-06-06 06:00:00 120 59577 -1.4960686 1.1995025 0.30439844254136744 15 2021-06-06 12:00:00 120 59577 -1.4887594 1.1997863 0.30570657099738263 15 2021-06-06 18:00:00 120 59577

Error parsing SQL Mapper Configuration in mybatis

I am using mybatis framework in a servlet and the mybatis-config.xml file is unable to find the Student_mapper class.I applied all the paths including the package name and excluding it and also used the element in my mybatis-config.xml but it doesn’t work.I am still getting the same error. Here’s my mybatis-config.xml file Here’s my Student_mapper interface Answer The mapper class

org.postgresql.util.PSQLException: ERROR: relation “users” does not exist – SpringBoot, Hibernate, Postgresql

I am using Spring Boot with Hibernate, JPA and Postgresql database. I am trying to create new user and save it. I have the following code: UserEntity.java UserController.java UserServiceImpl.java UserRepository.java Application.yaml My error in Intelij looks like this: I am testing it with Postman and sending JSON in body like this: But in Postman I am receiving 500 Internal Error.

Why am I getting SQL State: 28000 FATAL: Ident authentication failed for user error message when running a simple Java program?

I have a Postgres 11 database installed on a VirtualBox virtual machine running Centos7 (guest machine), and my host machine is a Mac OS Catalina. Both the guest (Centos) and host (Catalina) have JDK 8 installed. I have the following simple Java code that uses a single dependency postgresql-42.2.5: I compile and run this on my host (Catalina) : and

JPA query to filter before, after and between optional start and end dates

I’d like to write a JPA Repository query that can findBy with two optional query parameters, startDate and endDate: startDate endDate Return null null All null endDate Before End startDate null After Start startDate endDate Between Start and End How can this be implemented concisely? For example, using a single JPA @Query method with a SQL statement that can handle

Advertisement