I faced a problem. A have an entity: DDL of the related table: I have such logic: Field dateCreate is set by DB function now() but it is not returned by JPA in created entity. Does anyone know how to solve this problem? Without using Hibernate or Spring specific tools. Just JPA. Answer You need to refresh the data after
Tag: postgresql
setReadOnly not working on PostgreSQL Connection
I have a problem setting a read-only connection with a PostgreSQL database using JDBC. I’m creating an application which loads queries to execute from a file, and I want to execute only SELECT (read-only) queries. Setting permissions on users who will run the application is not an option, so setting permissions at code level through the Connection.setReadOnly(boolean) method was the
Jooq Java CTE wrong render
I have CTE that is been creating from DSL.values: Then i am trying use it to get needed values from DB But i have only the next error I suppose it happens because of (select * from (values(cast(? as varchar)) How to fix it? Other methods without cte work fine. Answer The problem was there: “Id” is needed to be
How to update a JSONB column in PostgreSQL using a Spring Data JPA Query
I have the following Controller If i remove/comment That is i don’t add the fetched result to the new updatedAdditionDetails (of type ArrayList), the DB updates successfully Otherwise i get the below error : ERROR: column “itemsinventory_addtion_details” is of type jsonb but expression is of type recordn Hint: You will need to rewrite or cast the expression.n Position In my
Spring boot cannot connect to postgre database deployed on another kubernetes pod
I deployed my microservice hello-k8s in a pod and another pod as postgre-server, I have successfully connected to localhost using port-forward and try to create a table in the deployed database. But when I deploy hello-k8s it return error due to database connection attempt failed. Disclaimer: kube-dns is working fine, I already try nslookup to the postgre-svc and it works
Using 0 as Primary Key
I use lookup tables commonly and sometimes I have some default record in the Lookup table and I think for this record I can use 0 as Primary Key a as shown below: Project: By doing this I can start from 1 for the actual project values (A, B, C…) and on the other hand I can easily distinguish general/default
spring.jpa.properties.hibernate.jdbc.time_zone applied on writes but not on reads?
I’m using: spring boot 2.0.4.RELEASE spring-data-jpa 2.0.9.RELEASE hibernate-core 5.2.17.Final hibernate-jpa-2.1-api 1.0.0.Final postgres jdbc driver 42.2.9 I have the following entity: and the following property set in application.yaml: Regardless of what the JVM timezone/default timezone is, I want to save and return timestamps in UTC. For testing purposes, I have set the timezone of my application code to US/Hawaii: When I
How to deserialize BigDecimal value received from kafka broker through debezium CDC mechanism?
I have a couple of microservices developed using spring boot and each has its own Postgres database. These microservices exchange data with a CDC mechanism provided by debezium platform through kafka broker and kafka connect. I have a microservice A that stores some entities with a BigDecimal attribute. Another microservice B depends on the data stored by A so it
Create schema if does not exist by using spring Jpa with hibernate
I’m working on spring boot 2 application and trying to establish connection with postgresql database with configuring hikari datasource and spring Jpa. I’m succeed in that and i’m using hibernate.hbm2ddl.auto as update so it is creating table if not exists, but only the problem is it is throwing an exception when schema does not exist Error I configured everything manually
Can I specify *source* IP address for a JDBC connection?
I have a Java application that connects to a database with a JDBC driver. It happens to be a Postgres instance, but I’m looking for a general solution if it exist. The server on which the application runs has multiple IP address, all in the same subnet. The JDBC connection is established using the ‘primary’ IP of the server. I