0
votes
1answer
29 views

How to solve bad sql grammar error with Spring JDBC?

I'm using PostgreSQL with Spring JDBC. Everythig building with Gradle: dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework:spring-jdbc") ...
0
votes
1answer
30 views

How to store a secretKey in database postgresql and retrieve it

I tried convert it to byte[] and store it on a bytea but it didn't work, i don't receive the same secretkey that i stored. Using type String didn't work as well if you're interested in more details, ...
0
votes
1answer
14 views

How to insert a java ArrayList in postgresql Array (integer[] ) type column using @InsertProvider

I Have a mapper method which is defined as following @InsertProvider(type = ActivityMapperSQLBuilder.class, method = "insertIntoActivityComment") public int ...
1
vote
2answers
27 views

How to access the procedure that return setof refcursor from PostgreSQL in Java?

Need to access a procedure that return setof refcursor from PostgreSQL. I am able to access the first object but not rest of object not rest of objects. con.setAutoCommit(false); try ...
-3
votes
0answers
22 views

Postgres aggregate values with Scala and Java [on hold]

To rebuild an application cache (I use Redis), I have to retrieve multiple rows at once with aggregate content in one column then cast these content. Because I work with thousands of rows, it is more ...
2
votes
1answer
29 views

Is it possible to write a data type Converter to handle postgres JSON columns?

Ideally using Jackson on the Java side of things. I have tried the obvious solution: public class JsonObjectConverter implements Converter<Object, ObjectNode> { private final ObjectMapper ...
0
votes
1answer
19 views

Get LD_LIBRARY_PATH value from the postgresql-9.1 service

Can anyone please suggest me that how can I get the value of LD_LIBRARY_PATH from the postgresql-9.1 service, which is registered as part of PostgreSQL9.1 installaion using shell script. I need to ...
0
votes
1answer
42 views

how to pass an array parameter using jpa to a postgresql function?

could someone tell me how to pass an array parameter to a postgresql function using EclipseLink (jpa 2.1)? I tried the below but get error: Exception org.postgresql.util.PSQLException: Can't ...
0
votes
2answers
61 views
+50

Join tables in Hibernate

I have two tables in my PostgreSQL database: CREATE TABLE tableOne (id int, name varchar(10), address varchar(20)) CREATE TABLE tableTwo (id int, info text, addresses varchar(20)[]) now I want to ...
0
votes
0answers
27 views

Performing range filters on aggregated field (e.g. Avg of score) in Elastic Search

I am using latest Elastic Search Version 1.3.2. I just want to perform range filter on an aggregated field (e.g. Average of students score). I am using the following query .. { "query": ...
1
vote
1answer
21 views

Function result AS class field value

I have PostgreSQL database, in which there is a function month_traffic() CREATE FUNCTION month_traffic(hostcode int) RETURNS numeric(14,2) AS $$ DECLARE start_date date := CAST((EXTRACT(year FROM ...
0
votes
1answer
30 views

Hibernate UUID as UUID type

Trying to use a UUID as my id for PostgreSQL and H2, the current exceptions are for H2 java.lang.IllegalArgumentException: Can not set java.util.UUID field com.lm.model.Task.id to java.lang.String at ...
0
votes
1answer
53 views

Hibernate specific configuration in JPA XML mapping file

I'm using JPA with Hibernate. For the entities defined in my app, I use annotations, but some of the entities come as third-party code without any mappings. Therefore I have to map them via XML (at ...
0
votes
0answers
27 views

PostgreSQL & JDBC: INSERT INTO with RETURNING returns empty result set

I have an insert statement with a returning value. The problem is, only the INSERT INTO part works, but returns nothing. I tried with table attributes and constant values too. I am using ...
0
votes
3answers
37 views

CountMatches() equivalent Postgres query

We know the stringutils function CountMatches() - CountMatches - counts the number of occurrences of one String in another. I need an equivalent query in postgresql to count the number of occurence of ...
0
votes
0answers
13 views

Dangling open transaction with JPA

I've got a ws app running with a postgresql (9.3) db using JPA with Hibernate as persistence provider. When I terminate the app I get a 'unexpected EOF on client connection with an open transaction' ...
2
votes
1answer
21 views

How can I intercept JTA transactions events and get a reference to the current EntityManager associated with the transaction

Long story short: We develop and maintain a library that can be used in other projects using JavaEE7/CDI/JPA. Applications will run under Glassfish-4.0 and use Hibernate's JPA implementation for an ...
0
votes
1answer
38 views

Hibernate using multiple joins on same table

I have two postgreSQL tables preference and date_etl and preference_date_etl stores their mappings. preference_date_etl's hibernate mapping: <hibernate-mapping> <class ...
0
votes
0answers
37 views

Concurrent struts action calls on the same method

I'm using struts2 and spring integrated framework, hibernate and Postgres SQL in my project. During performance testing there is an issue when more than 2 users are trying to insert the same ...
1
vote
1answer
73 views

Spring JDBC + Postgres SQL + Java 8 - conversion from/to LocalDate

I am using Postgres SQL 9.2, Spring JDBC with version 4.0.5, and Java 8. Java 8 introduced new date/time API and I would like to use it, but I encountered some difficulties. I have created table ...
2
votes
2answers
42 views

Should I use Postgres' bigserial for records in a new application?

I'm working on a new application which stores it's data in a PostgreSQL database. The kind of data amongst other stuff is meter records from some measuring devices. There can be hundreds and thousands ...
0
votes
1answer
25 views

hibernate order by nested entity field with possible null values

I've stumbled upon a problem with Hibernate. I've 2 entities - let's say A and B like so (Entity/Table annotations ommited): class A { @ManyToOne @JoinColumn(name = "b_id") private B b; } ...
0
votes
0answers
13 views

How to map org.postgresql.geometric.PGpoint to Hibernate Type

I'm migrating my application from spring jdbc to JPA + Hibernate and the DB used is postgres. One of my table in the DB has point data type which translates to org.postgresql.geometric.PGpoint if i ...
1
vote
1answer
66 views

Can't connect to PostgreSQL with JDBC driver

I have my Spring MVC app. dispatcher-servlet.xml <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" ...
0
votes
2answers
34 views

ClassCastException: org.postgresql.jdbc4.Jdbc4Connection cannot be cast to org.postgresql.jdbc4.Jdbc4Connection

I want to get PGConnection from PosgreSQL connection in JBOSS AS7 (Data source postgresql-9.0-801.jdbc4.jar) I've got cast exception when used (WrappedConnection)connection. So now I use reflection ...
-3
votes
4answers
40 views

Getting the following error - No suitable driver found for jdbc:postgresql://localhost: 5432/testDBMS

I get back an error indicating java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost: 5432/testDBMS import java.sql.*; import java.util.*; public class ...
0
votes
1answer
31 views

Java CSV to SQL file size issue

I am monitoring a CSV file and I am importing to Postgres with the following procedure: Load the file into an ArrayList (DATE_TIME,MEASUREMENT) Get the latest DATE_TIME from the database Iterate ...
1
vote
3answers
52 views

StringUtil indexOf() equivalent postgreSQL query

I need to implement stringUtils Class indexOf() method in postgresql. Lets say I have a table in which url is one of the column. url : ...
3
votes
1answer
28 views

How to generate SQL statement with LIMIT clause but without OFFSET clause in jOOQ?

I'm trying to use jOOQ to generate the following SQL statement: SELECT id, name FROM students ORDER BY id DESC LIMIT 50; To generate the above statement with jOOQ: String sql = ...
0
votes
3answers
48 views

Case insensitive in Postgres

I am urgently need help one this topic. I am currently doing a java project which develop it since few months ago. The project is almost complete, and now I realized that Postgres is a case ...
0
votes
1answer
36 views

How to bind an hstore[] value in Java

I'm trying to store people's telephone numbers and addresses in a database table. I would like to support multiple phone numbers and addresses and expect the format to be different in different ...
0
votes
3answers
83 views

What is proper way to persist time or date -type of information into database?

What is the proper way to save date or time based data in the database? What are the proper "field mappings" for java to postgresql(or to some other database)? That data should be stored in utc ...
0
votes
1answer
15 views

Spring Beans: DriverManagerDataSource converting to sun.jdbc.odbc.ee.DataSource

I have a Spring MVC project that I am using NamedParameterJdbcTemplate to connect to a postgres database. When I try to launch my application, I get an exception: Cannot convert value of type ...
0
votes
0answers
23 views

No working postgresql connection in OpenShift jBoss web app

I've been having this problem for over a week now and I cannot find any leads to solving it. I have a Java EE web application, initially built using jBoss Tools Forge, following the guide on ...
1
vote
1answer
81 views

Inserting a New UpdatableRecord and Receiving Error on Duplicate Primary Keys

I'm trying to insert a new record using UpdatableRecords in jOOQ 3.4.2. The pattern is extremely concise and pleasant to use, except that the INSERT reads null values as no value and ignores default ...
1
vote
1answer
34 views

batchStore does not load generated keys

I have a record like below (the first parameter is an id serial PRIMARY KEY in a postgresql DB). SymbologyRecord symbology = new SymbologyRecord(null, "a", "b"); symbology.changed(SYMBOLOGY.ID, ...
0
votes
1answer
14 views

Hibernate SQL - Can't get an interval from table

I'm trying to get an interval through an operation with Timestamps from a table but I'm getting a "No Dialect mapping for JDBC type: 1111" The code is like this: SELECT TS_FINISH - TS_START FROM ...
0
votes
3answers
48 views

how to insert/update multiple rows into database without firing insert/ update query multiple times?

if (!knowledge.isEmpty()) { Iterator<Entry<String, String>> classnmValsItrKW = knowledge .entrySet().iterator(); while ...
0
votes
1answer
27 views

Postgres - Column out of range in PreparedStatement - java

got a problem with a preparedstatement using Java 1.7.0.67 on Windows 8.1... Basically I get an error as follows (from the test): 2014-08-17 16:56:37 org.help SEVERE: Strt Testing 2014-08-17 ...
2
votes
1answer
55 views

Hibernate issue : must appear in the GROUP BY clause or be used in an aggregate function

Query I want to run: SELECT date_trunc('month',UA.activity_date),SUM(UA.points) FROM user_activity UA WHERE UA.activity_date > '01/01/2014' AND UA.activity_date < '12/31/2014' GROUP BY ...
0
votes
1answer
22 views

Hibernate ManyToMany doesn't update

Here's an example: @ManyToMany(targetEntity = Book.class,fetch = FetchType.EAGER, cascade = CascadeType.ALL) public List<Book> getBooks() { return books; } And in the other class : ...
0
votes
1answer
29 views

How to set work_mem in hibernate configuration file

I want to set work_mem (set work_mem='100MB';) for a single query in my hibernate mapping file. where do I need to set work_mem for the following query <query name="queryname"> ...
-4
votes
0answers
20 views

How can I display all entries from a table in Java Spring Framework(postgresql database) [closed]

Does anyone know where can I get a good tutorial about this? I have a huge task and I'm new to spring framework.
-1
votes
0answers
25 views

error in accessing datasource in java

unable to access database of postgresql, getting error in executeQuery.Please help me to sort out the problem. My code is given below: public class getdropdwn extends HttpServlet { protected void ...
0
votes
0answers
13 views

how to retrieve attachments from postgres in the original format?

The attachments in my postgres are stored in bytea column. I am retrieving their names in jquery grid. And on click of the name the attachment starts downloading. The problem here is the attachment is ...
0
votes
1answer
110 views

Spring + Hibernate + postgresql

I am a newb to java web. So I wanted to learn some new skills about Jsp + Spring 3 + Hibernate + postgresql. And I am having a very hard time to do the setup and configurate xml files in eclipse maven ...
1
vote
1answer
41 views

Why is “Driver not found: [org.postgresql.Driver]” with postgresql 9.3-1102.jdbc41 dependency declared?

I'm working with JDK 1.7 (Eclipse) and downloaded version '9.3-1102 JDBC 41' and added the 'postgresql-9.3-1102.jdbc41.jar' file to the 'Referenced Libaries'. Here's my 'build.sbt' file dependencies: ...
-1
votes
0answers
35 views

how to add attachment in postgresql table?

I migrated from mysql to postgre. In mysql this code worked fine to save attachments. But I am unable to modify the code to save file in postgre. This is my action method public String ...
1
vote
1answer
29 views

Can't instantiate class using Hibernate createQuery

I'm trying to use hibernate to create objects, which are not domain models, but I get a incomprehensible error message. My Java code: public BoxMeasureStat getBoxStat(long box_id, long ) { ...
3
votes
2answers
50 views

Loading data from Java to Postgresql very slow

I have 26 CSV files that I want to grab from the internet on a nightly basis and upload them into a Postgresql table. I have this working using Java, PreparedStatement, and Batch. Despite this, ...