Tagged Questions
1
vote
1answer
10 views
How to work with custom SGBD types with jOOQ
I'm wondering how to leverage the new range types you can find in the latests versions of PostgresSQL.
I can find the jOOQ documentation on how to manage normal column with custom Java types, ...
1
vote
0answers
36 views
Duplicate values present in primary key column in postgresql
I have a table in which one of the columns is primary key and it is of data type citext.
Many threads will update the table, they are properly synchronized. Those threads write the data in ...
1
vote
0answers
29 views
DB can not find the true relation
I have two postgres DB (e.g: DB one & DB two)
In the both of them I have the same relation ,the problem is that when I want to use relation on DB two it stores the data on relation of DB one ...
0
votes
1answer
26 views
How to write Timestamp with Before Christ date in PostgreSQL via jdbc?
I've tried to write the date Before Christ in PostgreSQL with PreparedStatement and failed.
Are there any tricks to do this?
The field in Postgres is TIMESTAMP WITHOUT TIME ZONE.
When I tried to ...
2
votes
2answers
71 views
Postgresql money (or numeric?) type and its corresponding type in Scala (Java)
I have a project in Scala which uses Postresql. It involves the type money of Postresql. I did a research and found that I should avoid using money data type in Postgresql and better use NUMERIC.
...
0
votes
1answer
15 views
DBUnit ignores xml element
I am using DBUnit (version 2.4.9) for loading the data for integration tests. I'm getting a weird problem that 1 field (deleted) is not being set in the DB (postgres).
Here is my XML data load:
...
-1
votes
2answers
15 views
Postgre SQL Schema Bind of Connection
we have a presentation of a java gui handling a postgresql database.
On the presentation-server we have some schemas and one is reserved for our group.
My problem now is in binding a Schema to the ...
0
votes
0answers
34 views
Hibernate does not create table from Entity
I have created two classes that should be mapped to tables by hibernate. The first one ("citizenmissionpath") is mapped correctly and the second table is not created.
package com.eworld.missions;
...
0
votes
1answer
9 views
DBUnit Current thread was interrupted
I'm using maven dbunit plugin (tweaked version 1.0-beta-3).
In my pom.xml file I have plugin defined with few executions:
<plugin>
<groupId>org.codehaus.mojo</groupId>
...
0
votes
2answers
43 views
How to convert letter codes to digit?
I'd like to save 3 letter codes to SQL database, and would like to use them later to execute many queries against that codes (probably 3-4 combinations of these codes to identify some a list of ...
0
votes
1answer
18 views
How to tell hibernate to create Date instead of timestamp in DB?
How can I tell hibernate that a Date should be created as a Date in postgres SQL database, and not as a timestamp?
According to www.postgresql.org/docs/9.3/static/datatype-datetime.html Date should be ...
0
votes
2answers
53 views
Store date as yyyy-MM-dd in database without time?
How can I best store a String with format yyyy-MM-dd (without time declaration) in SQL database (postgres)?
I later want to use that String always as Date type. I also want to execute query against ...
1
vote
1answer
25 views
Hibernate: childEntity null id on merge parentEntity
I've the code:
modifiedParentEntity.addChild(newChildEntity);
session.merge(modifiedParentEntity);
newChildEntity.getId(); // == 0!!!
Where parent entity has a collection of child entities with ...
0
votes
1answer
33 views
processing data from local postgres in play framework 1.2.5
I was working on a simple login application using play framwork 1.2.5 and connection to local postgres database was established; the problem is attempting to read from database inorder to verify if ...
1
vote
1answer
27 views
Does the Postgresql JDBC Driver support Pgpass authentication?
I am trying to connect to a Postgresql database from Java using the JDBC Driver and would like to use pgpass to authenticate.
My Postgresql server is correctly setup for password authentication and I ...
0
votes
0answers
16 views
checkbox form (array values) to jquery to JSON to JPA [closed]
i am receiving checkbox ( which contain 5 values ) user either select or leave it as blank, how to get that arrayvalue by id and how to convert into JSON and how to create a java persistence entity, i ...
-1
votes
1answer
42 views
Problems to return in Openshift JSON object with Spring framework [duplicate]
I have an application in Java with Tomcat 7 (JBoss EWS 2.0), PostgreSQL 9.2 and Spring framework. It consists in a REST web service that get requests from an Android client and returns JSON objects.
...
0
votes
1answer
30 views
Write entity bean contents to db before transaction commits
I'm using GlassFish v2ur1 (it's the one our company uses and I cannot upgrade it at this point). I have an EJB (ejbA) which gets called periodically from a timer. In the call, I'm reading a file, ...
0
votes
0answers
27 views
Postgres Backup on linux server [migrated]
I am trying to take backup of postgres from InstallAnyWhere which is installer for linux and windows machine.
I am calling pg_dump from Java process builder as command line below
cmdLine : ...
1
vote
1answer
18 views
How to prevent repeated EntityManager transaction code (open, commit, close) in client app?
Is there any way of better writing database methods, without always having to get the entity amanager, begin the trasnaction, commit, close etc?
private updateDB() {
EntityManager em = ...
0
votes
1answer
29 views
Postgresql: read uncommitted data in the same transaction [closed]
the problem is using PostgreSQL via JDBC:
start transaction (implicit)
insert a row
select that involve the row you just insert
other
commit
and seems results of select don't consider the insert. ...
1
vote
0answers
28 views
permission denied to access to database tomcat7
I'm working on Eclipse with Tomcat6 and I use PostgreSQL as database.
I try to configure Tomcat6 on eclipse but it doesn't work. So I download a Tomca6 server.
When I test my application I put my ...
0
votes
1answer
22 views
No Persistence provider for EntityManager with JavaSE app?
I'm trying to set up simple postgres database with Hibernate JPA (local javaSE app, not container managed JEE). But I cannot even create the EntityManager. What might be wrong with the following?
...
1
vote
2answers
22 views
Transaction-type for local postgres tool?
I have a local application (no JEE server) that shall use postgres at the end.
I'd like to chose Hibernate as my database framework. I'm now creating the persistence.xml, and wonder which ...
0
votes
3answers
58 views
How to convert PostgreSQL timestamp with time zone to DateTime?
This is a date which I get in my application:
String psqlDate = "2013-11-17 14:08:33+01";
What is best way to convert psqlDate to joda DateTime?
[EDIT]
I can use DateTime parse method. It works ...
0
votes
1answer
61 views
Insert json value to postgresql table using Hibernate
I have a table with a column of type json in my postgreSQL DB (9.2). I'm using Hibernate and implemented the code example from Mapping postgreSQL JSON column to Hibernate value type suggested by Tim ...
0
votes
2answers
48 views
How can I build a comparator that sorts Strings the same way that PostgreSQL does?
I'm writing an integration test that is passing a complex order by to PostgreSQL and then checking that the data comes back in the correct order. I'm writing this integration test in Java and its ...
4
votes
1answer
57 views
Running a simple Hibernate project has no effect
I using postgres 9.2, hibernate 4.3.0 final.
I have 'testClass':
@Entity
@Table(name="testClass")
public class testClass implements Serializable {
@Id
@Column(name = "id")
private ...
0
votes
0answers
22 views
Postgres Encrypt Function behaves differently from PGAdmin and JDBC Api
We have our passwords encrypted in the database using the encrypt function using AES.
When we call the function through Java/Eclipse it stores the value differently.
Whereas when we call it from ...
0
votes
1answer
22 views
Criteria in Hibernate to return some aggregated results in a List
Here is my code. The problem is my results list always return size of 1 instead of size of 4 as expected. The list should contain values for max,min,avg,count. Thanks for helping
Criteria crit = ...
1
vote
1answer
31 views
Solr select only returning ids
I am new to Solr I followed some tutorials to set it up. I am using Postgresql. When I run http://localhost:8080/solr/select?q=*:* I get back:
<response>
<lst name="responseHeader">
...
0
votes
1answer
34 views
How to set timeout for INSERT query in postgres with MyBatis (Java)
In Mybatis there is an attribute timeout for mapper files but that throws Exception.
Cause: org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) ...
0
votes
2answers
27 views
JDBC file in Hibernate configuration not found
When I want to add an database connection in Hibernate there are no drivers.
I selected Database connection -> "New" then "Generic JDBC" and then there are no drivers listed:
Does anybody know how ...
0
votes
1answer
49 views
JPA can't access PostgreSQL due to cast problems
I'm writing a Java ee7 Webapp with PostgreSQL 9.1.1, Glassfish 4, EclipseLink 2.
My problem is, that I can't access some tables of the database.
I have two (actually 3) entity-classes, which I ...
0
votes
3answers
27 views
How to jump from the first record to the last record in my database
I have this piece of Java code in which I try to loop through the records, means I want to jump from the first records to the last and and vice versa. As you can see 'n' iterates forward through the ...
0
votes
2answers
67 views
What is the max JDBC batch size?
I have a list and that list increasing continuously. I am doing add batch depend on the list size. I forgot to put limit for do executeBatch in specified size.
Program is working for hours. I dont ...
1
vote
1answer
58 views
PostgreSQL Exception : org.postgresql.util.PSQLException: An I/O error occured while sending to the backend
I know it is a duplicate question . But I couldn't find solution for the same.
I have hosted my application in the Amazon EC2 cloud.
And I am using postgresql .
I am getting an exception ...
3
votes
1answer
27 views
PostGIS Functions not working using hibernate in java?
I need to execute select ST_AsText(column_name) from table using hibernate createSQlQuery().
When i executed that query, it fires an exception.
But when i execute the same query using simple JDBC ...
1
vote
2answers
52 views
How to pass special characters in HQL?
I have a query which is working fine using JDBC but when switched to hibernate it throws QueryException for the syntax(name is the column in my table masterTable using PostGreSql Database):
String ...
0
votes
1answer
42 views
Intellij 13 EclipseLink Class [] not found Error
i ve a huge problem with intellij 13.0.1. I set up a JPA Project for the first time in intellij 13 and need some help to get some rid of an strange error.
Caused by: Exception [EclipseLink-4003] ...
0
votes
1answer
41 views
Hibernate fails to create foreign key in Oracle between different schemas
I have a java7+Spring3.2.0+hibernate3 application that used a Postgresql database. Now I have to migrate this application to use the latest Oracle.
When at startup I set hbm2ddl to "create" the ...
0
votes
2answers
32 views
any api to get geo location by ip, that relies on a database table and ranges
I need a table to find the geo location of a person. I used maxmind api algorith and a table given which had numeric numbers (representing ips when the user ip is also converted to an integer).
The ...
2
votes
1answer
39 views
Migrate MS Access to PostgreSQL
I'm getting data as an Access file.
My application uses PostgreSQL/Java. I'd like to convert the Access database to PostgreSQL.
can any one help me to code this
0
votes
1answer
48 views
How to synchronize data within programs using a database?
I have a very small program that is going to be used by two or more computers at the same time. It's a small program that can add string to the list and remove it from the list. I save all these ...
2
votes
2answers
48 views
how to swap records having unique constraint in hibernate
I have 2 tables user and userinfo. userinfo table contains user_id(id of user table) column which has UNIQUE constraint.
now i have 2users(primaryUser and secondaryUser) which has records in user and ...
1
vote
1answer
44 views
ERROR: COALESCE types bytea and character varying in PostgreSQL
I write a postgresql and pass parameter name1 from my java code with Spring + Hibernate.
SELECT * FROM Test
WHERE name = COALESCE(:name1, name2)
but i got an error
ERROR: COALESCE types bytea and ...
-1
votes
1answer
33 views
When I run pg_restore via process in java application, application freeze
When I run pg_restore via process in java application, application freeze and info message don't show, but process successfully finished. Why it so? I use PostgreSQL 9.2.
Method's code:
private ...
1
vote
0answers
44 views
Hibernate deletes manyToMany relationship rows on fetch
I am using Hibernate4 with Spring and I am trying to map a Term class to a Document class. A term may occur in many documents and a document can contain many terms. I have read up on this, and I have ...
0
votes
0answers
52 views
Storing byte array image using JPA2 in PostgreSQL
I am trying to store an image in the database but when I read the value I am getting always null.
I've tried several combinations of following annotations but result is always same:
@Lob
...
3
votes
3answers
88 views
Get ID before saving to database
I use hibernate sequences to generate id of an entity. I use PostgreSQL 9.1.
Is it possible to get entity id before it is saved to database? How?