I’m working on an EclipseLink project in which one user can “follow” another as can be done on social media sites. I have this set up with a User entity (referencing a table called users) which has a list of “followers” (users who follow that user) and another list of “foll…
Tag: postgresql
Use a list of strings in IN clause with JDBI
I’m using JDBI / Dropwizard for a project and would like to run some simple queries. I have a query like so: private static final String GET_STUFF = “SELECT * FROM myTable WHERE state IN (:desiredState)” I bind the variable in my method like so: However, I get the following error when runnin…
Exception : org.postgresql.util.PSQLException: ERROR: syntax error at or near “call”
I am working on a application in which hibernate and postgresql and giving the following error org.postgresql.util.PSQLException: ERROR: syntax error at or near “call” Can someone tell me where I am going wrong. I am using Postgres 9.4. EmployeeController Employee.java Class Answer I was using a w…
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 service. The database gets initialized externally (out of our control) and the datetime column type used by the other se…
How to use Postgres JSONB datatype with JPA?
Im not finding a way to map the JSON and JSONB datatypes from PostgreSQL using JPA (EclipseLink). Is some one using this datatypes with JPA and can give me some working examples? Answer All the answers helped me to reach the final solution that is ready for JPA and not EclipseLink or Hibernate specifically.
DBUnit PostgresqlDataTypeFactory does not recognizes enum list
I’m using DBUnit for an integration test, and before executing the test code I’m running into this error: the column that is ignored is a list of enums. In the dataset it’s written like this : I looked in the DBUnit FAQ and saw this issue , that says that I have to override the isEnumType() …
org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [/HibernateTest/src/hibernate.cfg.xml]
I am trying to connect to Postgresql9.1 in ubuntu with pgadmin3. My Pgadmin3 GUI tool does not give any option to create tables by right clicking the database, but it is available in some videos I saw. Therefore, I used terminal to create the database and it showed up in pgadmin3. my file structure My Userdet…
How do I configure PostgreSQL with Grails 3.0?
I am using IntelliJ IDEA 15.0.2 as an IDE. I have created a Grails 3.0 application and changed it a bit to configure PostgreSQL. Here is my dataSource: And in my build.gradle I added runtime “postgresql:postgresql:9.4-1207.jdbc4”. But that gives errors when I run: What have I missed? Answer Data s…
Mapping java.lang.String type to Postgres JSON Type
My question is related to the following question Mapping postgreSQL JSON column to Hibernate value type and although the answer works when I test passing a string to psql in postgres it doesn’t work when passing a string from my Java code. I am using MyBatis to map sql to the postgres database via Sprin…
How to call a PostgreSQL stored procedure with Hibernate
I want to create a Stored Procedure in PostgreSQL to make some calculation and return it to My java call. I have tried Most of the option from Java-Hibernate but not able to succeed. Below is my SP. In Java How to call this procedure to get the values. NOTE: I’m not using hibernate XML files to call qui…