Tagged Questions
0
votes
1answer
13 views
how to call postgres function with hibernate criteria
I am getting sorted results using hibernate criteria which generates the below sql:
select * from mytable order by name asc;
This is how i do it with hiberante criteria:
...
-3
votes
0answers
33 views
Auto Commit Error with Postgres using Java
I have a application that work with some transactions.
So I plan to use auto commit false before doing calculations and insert statements and after calling inserting I commit.
But there is error ...
0
votes
1answer
41 views
How to normalize your database in hibernate? (Repeating values don't get saved again and again)
imagine I have a table called Photo and a table called Tag.
A Photo can have any amount of tags. Like a picture of the Brandenburg Gate in Berlin has as tags "Berlin", "Gate", ...
Now there is a ...
0
votes
2answers
43 views
Exception in selecting values from database
I have written a query to fetch values from database and is to be shown in datagrid in jsf page. But i am raised with exception in daoimpl layer. While converting stringbuffer to string and getting it ...
1
vote
2answers
72 views
Null pointer exception while using hibernate
I am using Hibernate and spring. this is my model class
@Entity
@NamedNativeQueries({@NamedNativeQuery(
name = "CSI_TARGET",
query = "select * from CSITARGET('CSIINDEX',2)",
...
0
votes
1answer
50 views
No value specified for parameter 1
I am using Hiberante to connect to postgres database. I am trying to insert a record into the database. I have the values for the record in a string array which I got from a csv file. This is my dao ...
3
votes
1answer
51 views
How to pass BigInteger from java to Postgres?
I need to pass a BigInteger argument to SQL query. (on Postgres 9.2)
I have this code in my DAO:
public List<PersonInfo> select(String id) {
BigInteger bigIntId = new ...
0
votes
1answer
23 views
data comes in a string, inserting into postgresql with java, what's most efficient way to break up the data?
I am writing a program in Java that uses the JDBC driver with Postgresql. I am using an API which when called, returns data in a string like so:
id=-870229851 date = finished-20130501 ...
0
votes
0answers
29 views
Handling newline character in Greenplum external table
I am creating Greenplum external table and populating it with data from my map reduce output files present in hdfs. I am able to connect external table to the HDFS and access all the files present in ...
2
votes
3answers
57 views
Postgresql, pgAdmin, Java: How to make them all UTC?
How can I make sure my entire development environment around PostgreSQL is not messing about with local timezones. For simplicity I need to be 100% sure that each and every time(stamp) value is UTC. ...
0
votes
1answer
19 views
Group by with Named Parameter with Spring's NamedParamterJdbcTemplate
I'm using PostgreSQL and Spring 3.1 NamedParameterJdbcTemplate.
If I have some SQL which uses a named parameter in the Select & Group By clauses, Postgres will return this as bad grammar. Running ...
0
votes
1answer
19 views
Security on single application/database server with PostgreSQL and Tomcat
(This isn't a question about whether it's better to use separate servers or a single server for application and database)
My situation is that I've chosen to use a single server configuration with ...
1
vote
3answers
40 views
How to track position of columns on a DB table
Okay, this is a little bit odd to explain, I'll try my best.
I have a DB table (SQL) called versions which contains a list of different operations that are part of a version.
For example, version ...
0
votes
1answer
111 views
Escaping special character in Hibernate select query with fts
I am having the query like these
Query query = session.createQuery("select object from EntityObject object where lower(object.columnName) like lower (E'%\\(test\\)%')");
and
Query query = ...
0
votes
2answers
65 views
PostgreSQL equivalent of Oracle “bulk collect”
In PostgreSQL exists some ways to make a statement using bulk collect into like in Oracle?
Example in Oracle:
create or replace procedure prc_tst_bulk_test is
type typ_person is table of ...
0
votes
0answers
24 views
How can Apache Commons QueryRunner be used to insert array into table?
Part of my static method for inserting data into Postgres DB:
public static int insertNew(DBConnBean dbConnBean, String insertStr, Object... params) throws Exception {
// Connection will be ...
0
votes
0answers
47 views
Criteria builder grouping null and empty strings together
I want to create sql query with criteria builder when I will group by some text field. The case is I want to group by fields with null values and empty strings together (I know that there is a ...
0
votes
1answer
35 views
enable logs in Postgres only for particular table
How to enable sql logs only for particular table ?
Current logs are printing like below. If we enable this, logs are taking high memory only 30 mins.
GMT_jbpm_LOG: 00000: duration: 0.104 ms bind ...
0
votes
2answers
87 views
Web Service Architecture: Redis (as cache) & PostgreSQL for persistence
I'm developing a Java REST API that uses client data from a postgreSQL database.
The numbers:
. About 600 clients at the beginning
. Some of them doing requests every few seconds
Because clients ...
-1
votes
1answer
18 views
How to connect to other system db using jdbc type 4 driver
I have a JDBC program which connects to my local system postgresql DB.
Class.forName("org.postgresql.Driver");
Connection ...
0
votes
0answers
24 views
Function invocation of postgresql database from java program
There is a Postgresql database with the following function stub
CREATE OR REPLACE FUNCTION net_train(terms text[], perceptron_id integer)
RETURNS void AS
$BODY$begin
-- stub
end;$BODY$
LANGUAGE ...
1
vote
1answer
50 views
hibernate - error during frequent queries
I use server Tomcat + HttpServlet + hibernate. I test the server performance, for this, I created an application that simulates the operation 500 clients, each client with a periodicity repeats HTTP ...
0
votes
1answer
70 views
Quartz Cron scheduler in Spring with jdbc store
I need to create Cron service in Spring, but I can not find enough info how to do it with jdbc store. I want Quartz to use my present connection to Datasource, my database is PostgreSql. I need to ...
-1
votes
2answers
41 views
Reading from database postgresql in java and record of result in ArrayList [closed]
I decided to remove the intermediate link and as a whole to simplify the decision, having transferred everything to the java program. There is a code on С++, reading of database postgresql
#include ...
1
vote
1answer
25 views
Insert into DB via hibernate
I have created this class which is created in my postgresql db:
@Entity
public class Test implements Serializable {
@Id
@GeneratedValue
private Long id;
@NotNull
...
0
votes
1answer
50 views
Retrieving serial id from batch inserted rows in postgresql
Here is the code that works:
Connection c = ds.getConnection();
c.setAutoCommit(false);
PreparedStatement stmt = c.prepareStatement("INSERT INTO items (name, description) ...
1
vote
1answer
40 views
Change schema dynamically
How can I set Postgres schema dynamically in Java? I tried doing:
this.getDataSource().getConnection().setSchema("mySchema");
I am using spring-jdbc and this is a JdbcDaoSupport instance.
Note: I ...
0
votes
2answers
47 views
Batch inserts in JDBC - how much slower will a single transaction be?
I just found out that JDBC's addBatch operation, if given "INSERT INTO mytable (id, name) VALUES (?, ?)" will create something like this:
BEGIN TRANSACTION
INSERT INTO mytable (id, name) VALUES (1, ...
-2
votes
1answer
52 views
Returning PostgreSQL queries as objects using JDBC [closed]
Currently I have a web services that connects to PostgreSQL using the JDBC. As of now the query returns as one long string as it was the only way I could get it to work. I would like to returned ...
0
votes
2answers
73 views
What Java library can map a PostgreSQL array literal to a Java array or list?
What third-party Java class library is available to map a PostgreSQL array literal string to a Java array or list of strings?
For example, suppose I wish to convert a PostgreSQL array literal string ...
0
votes
0answers
35 views
How to use same domain class for HBase and PostgreSQL
I have domain objects that are stored in both HBase and PostgreSQL.
While defining the class the annotations used for PostgreSQL are not applicable to HBase, so I end up defining two classes with the ...
0
votes
0answers
32 views
Use JDBI to get Postgres Array Data
I have a java program using JDBI (a JDBC wrapper) to access a PostgreSQL database. One of the columns is of the array data type (mycolumn integer[]).
What the heck to I use in my mapper class? I ...
1
vote
2answers
51 views
htop and top showing multiple instances of process?
I am currently running a java process with ant. I am running just one process.
When I use htop, I am seeing the following information:
scrolling right gives:
basically, the middle section is ...
0
votes
1answer
29 views
jdbc postgresql transaction error occurred
public class JDBC {
static Connection con;
static Statement stmt;
public static void main(String argv[]){
connect();
con.setAutoCommit(false);
// Statement s= conn.createStatement();
...
0
votes
1answer
40 views
JDBC ERROR: operator does not exist: date = integer
String checkAvailable_flight = String.format("SELECT Flightid, flightdate,"
+ " origin, destination FROM flight"
+ " WHERE Flightdate::Date = %s AND origin = %s"
...
0
votes
2answers
37 views
How to get large data with JDBC and PostgresSQL
I'm trying to fetch millions data from my table, and I'm using Java Play Framework 2.0 but there is some issue. When I set limit to my query it works well and if I ask for all the data it throws error ...
9
votes
2answers
74 views
JDBC what's the purpose of PreparedStatement#setNull
I did an experiment with a table having a VARCHAR column with null values trying to get the number of rows that have a specific column NULL. I used three forms:
form A
SELECT COUNT(*) FROM buyers ...
0
votes
2answers
17 views
Error connection to herokupostgresql locally
I am writing a struts2 app and using hibernate for persistence. I deploy may app on heroku and everything works ok, but when ever I run it locally I get:
org.postgresql.util.PSQLException: FATAL:no ...
0
votes
1answer
30 views
Transfer regex from Java to PostgreSQL
How can I transfer the following regex from Java to PostgreSQL syntax:
Pattern.compile("(?imu)(P\\W*Ř\\W*E\\W*D\\W*V\\W*O\\W*L\\W*Á\\W*N\\W*Í)"));
I have tried:
select regexp_matches('P Ř E D V O ...
3
votes
1answer
91 views
MyBatis special result when select returns no rows
My MyBatis select is
// result map that sub-selects a folder
<resultMap id="beanWithFolderMap" type="com.example.BeanWithFolder">
<id column .../>
<association ...
0
votes
1answer
36 views
Remove with entitymanager sometimes fails
I've a problem with removing persisted objects from my database.I have some tables with bidirectional relationships between them. I've a test for removing an object that is still referenced by an ...
0
votes
1answer
47 views
Add Social Functionality To Play App [closed]
I am creating the backend of my mobile application in Play. I have several different models and one of them is a Users model. I would like to have Users be able to add each other (similar to Facebook ...
1
vote
2answers
104 views
why does executeUpdate return 1 even if no new row has been inserted?
here is my very simple table (Postgres):
CREATE TABLE IF NOT EXISTS PERFORMANCE.TEST
(
test text NOT NULL UNIQUE
);
if I try to insert a String using the command below FROM the database,everything ...
0
votes
2answers
91 views
How to set postgres schema in play framework
We are using play framework 2.1 in our web application. We want to explicitly set the database schema(not public schema) in our postgresql database which will be used. How can set it ?
Thanks
2
votes
1answer
190 views
No Suitable Driver found Postgres JDBC
I am receiving a "no suitable driver found" error when I test my web service on tomcat. I have the JDBC .jar in the lib folder as various tutorials says to do. Here is my code:
public class ...
0
votes
1answer
72 views
Troubleshooting in JDBC/Postgres Authentication Example
I am trying to teach myself Java Servlets and JSP, and I am having an issue with authenticating with Tomcat 7 and Postgres 9.1.
It seems to be error free (Tomcat is not throwing any JAVA errors in ...
0
votes
1answer
141 views
java.lang.ClassNotFoundException: org.postgresql.Driver but CLASSPATH set [closed]
I don't know why I get "java.lang.ClassNotFoundException: org.postgresql.Driver" since my CLASSPATH is set properly:
user1@machine:~$ echo $CLASSPATH
:/usr/share/java/postgresql.jar
I installed the ...
0
votes
2answers
75 views
sorting by code
I have food categories in db like:
category_id | parent_id | code | name
-------------+-----------+--------+----------------------------------
1 | ...
0
votes
0answers
58 views
Postgres Java Webservice response issue
I have a webservice that I use to execute postgres queries. The problem is the response is anyType{} with nothing in it. I checked the server and it seems there are no errors in the log files.
...
0
votes
1answer
52 views
PostgreSQL Between clause
I have this sample statement here:
WHERE e.modified_date::DATE between '2013-04-02'::DATE
AND '2013-04-02'::DATE
Note:
Those dates were actually variables.
In pgAdmin, running this will result to ...