0
votes
2answers
20 views

Database table row prevention for multiple users access

I am using PostgreSQL with java spring application and requirement is , if any row in table access by any user then if same time another user will try to access the same row then this user will get a ...
0
votes
0answers
23 views

How to properly call PostgreSQL functions (stored procedures) within Spring/Hibernate/JPA?

I'm using Spring MVC 4, Hibernate and PostgreSQL 9.3 and have defined function (stored procedure) inside Postgres like this: CREATE OR REPLACE FUNCTION spa.create_tenant(t_name character varying) ...
0
votes
0answers
19 views

Spring security adding a user, and checking it in database later

I am using spring security framework with a spring-mvc application, and its been not such a good experience for me. So basically I would like to initially register a user with role 'ROLE_USER' in the ...
0
votes
1answer
53 views

Hibernate is committing but not saving

I am using Hibernate 4 with Postgresql Database. The selection queries executing well, but when it comes to updating queries (Insertion) is not working at all. The logs doesn't say anything about ...
1
vote
2answers
34 views

Spring JPA + dynamically switch the datasource between schemas in postgresql

I have to modify design of the existing application according to following manner, According to above design each project contains it's own schema and that mapping table (project_schema_table) is ...
0
votes
1answer
31 views

Relation table1_table2 does not exist Postgres

I am currently working using Spring-MVC and hibernate. I have 2 tables in database, table1 and table2. Table1 has oneToMany relationship with table2. When I run the application with a query to delete ...
0
votes
1answer
35 views

Spring boot and JPA configure simple repository

I am making a simple springboot application with JPA. I am trying to make a repository and a domain model for a legacy postgres database with a "tags" table Table ...
2
votes
0answers
168 views

How to use PostgreSQL hstore/json with jdbctemplate

Is there a way to use PostgreSQL json/hstore with jdbctemplate? esp query support. for eg: hstore: INSERT INTO hstore_test (data) VALUES ('"key1"=>"value1", "key2"=>"value2", ...
2
votes
1answer
33 views

jOOQ + Spring : PSQLException: current transaction is aborted, commands ignored until end of transaction

I'm developing a webapp which uses Spring and jOOQ. Consider the following use case: I open URL which renders result of the db query: select * from contract_ref, everything works ok. I open URL ...
0
votes
1answer
52 views

How to optimize pagination on a SELECT DISTINCT sql?

My query is a select distinct on a very large database, and in pgAdmin sql tool the query itself lasts 12 sec. SELECT DISTINCT ON (city, airport, zip, country, name) city, airport, price, id FROM ...
0
votes
0answers
25 views

How to fetch only specific columns in a @NamedQuery? [duplicate]

I have a large database row, and want to only fetch some specific colums. Ideally they should be automatically mapped to my @Entity. I tried the following, which did not work, as somehow the id ...
0
votes
0answers
25 views

How to write DISTINCT ON sql in JPQL?

select distinct on (origin, destination) * from datatable; I want to rewrite that sql statement into JPQL, so that spring-batch JpaPagingItemReader can use the query. But what is the equivalent, ...
0
votes
0answers
21 views

How to create PagingQueryProvider with multiple sortKeys?

I want to create a distinct on query with PagingQueryProvider: PostgresPagingQueryProvider queryProvider = new PostgresPagingQueryProvider(); queryProvider.setSelectClause("DISTINCT ON ...
1
vote
1answer
23 views

How to combine multiple date-between searches with CrudRepository of Spring Data JPA?

spring-data provides a way to generate SQL search by defining the method name. The following works fine: @Entity public class Book { Date from, to; } //CrudRepository<Book> ...
0
votes
1answer
30 views

Spring JUnit Test fail caused by: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already

If I run all my JUnit test cases at once (~300) I get the following Exception: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already at ...
7
votes
2answers
3k views

Manage Connection Pooling in multi-tenant web app with Spring, Hibernate and C3P0

I'm trying to setup a multi-tenant web application, with (ideally) possibility for both Database-separated and Schema-separated approach at the same time. Although I'm going to start with Schema ...
0
votes
1answer
53 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") ...
1
vote
1answer
144 views

Error in SPRING JPA using eclipse link POSTGRESQL when executing findBy[NAME]In(List<Long> ids)

I got a problem with my SPRING JpaRepository class when trying to use the findByIdIn(List ids), eg i want to pass a list of ids to the native query and expect it to return a list of objects. Maven ...
0
votes
1answer
59 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
2answers
477 views

Upsert with a transaction

I'm using Spring with PostgreSQL and I try to do a sort of UPSERT by using a code like this: jt.update("delete from A where id = 1") jt.update("insert into A (id, value) values (1, 100)") wrapped ...
2
votes
1answer
27 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
0answers
38 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
118 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 ...
1
vote
3answers
39 views

setup for Spring + hibernate + postgresql

Do someone have a good tutorial for beginner about Spring + hibernate + postgresql(mysql) for mave project? Please shrare. I found a lot of tutorials on the internet but most (all) of them are out of ...
1
vote
1answer
77 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
1answer
18 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
1answer
160 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 ...
0
votes
2answers
33 views

Jpa with dynamic scheme

I'm working on a software that uses JSF(2.1)/JPA(Hibernate)/Spring/Jboss7.1. The user will have many clients, and their data wont be used together. So, I have these tables: Company ID | Name 1 | ...
0
votes
1answer
169 views

How to configure JNDI datasource in Jboss using HikariCP?

How to configure a JNDI datasource in jboss configuration file using HikariCP I can't find aything in the help contents of Hikari there is only Tomcat configuration . I have a Spring webb app, I have ...
0
votes
0answers
53 views

Spring JDBC With transaction commit fails

I'm working on a Spring JDBC project using transactions. I'm using PostgreSQL as a database : Here is my spring configuration : <tx:annotation-driven/> <bean ...
0
votes
4answers
41 views

How to connect postgresql in hibernate.cfg.xml

I am trying to insert some data into postgresql through hibernate. However, there are not much tutorial about configurate hibernate with postgresql (I know, it should be similar to mysql =)) ...
0
votes
0answers
18 views

Large Objects may not be used in auto-commit mode with Jpa+Spring [duplicate]

I'm using Spring with Hibernate+JPA and a postgresql database. I have an entity with a Blob. @Column @Lob private Blob serialized_object; I have a repository I use to query for the entity but when ...
0
votes
2answers
35 views

Multiple Spring modules dependecy

I'm trying to deploy an Spring web application that has as dependendy another Spring Application (in this case a jar) where this jar has all the domain definition and database connection info. The ...
0
votes
1answer
43 views

Transaction started but not ended on database test connection query

Recently a bug was noticed in our application which caused the time of the operation to differ from the actual time(we are using current_timestamp() PostgreSQL function instead of passing time from ...
0
votes
1answer
32 views

Hibernate DST Date mapping issue for timestamps without time zone

I've a problem with storing java.util/sql.Date in PostgreSQL using hibernate: I'm storing dates as timestamp without time zone type. Now, in most cases everything is alright, as I'm mapping it in ...
1
vote
2answers
379 views

Spring + JPA + Postgresql Configuration

Creating a simple Spring MVC from scratch. My configuration is Spring + JPA + Postgresql . I want the configurations to be done using XML, and I am unable to set the database connection configuration ...
2
votes
2answers
656 views

org.hibernate.StaleObjectStateException when using Grails with PostgreSQL

I've written a grails service with the following code: EPCGenerationMetadata requestEPCs(String indicatorDigit, FilterValue filterValue, PartitionValue partitionValue, String companyPrefix, ...
0
votes
1answer
28 views

Understanding transactions in Spring Test

I have a little bit trouble with Integration Test and the transactions. I have a Rest Service System. Behind all I have a JPA-Repository, with a Postgres database. Now to test them I build JunitTest ...
0
votes
0answers
36 views

Bad value for type int : text Hibernate issue

Folks I am passing a Person Object (not null) to this method and I am getting this problem from my stacktrace SEVERE: Servlet.service() for servlet [spring] in context with path [/api] threw ...
0
votes
0answers
116 views

Dynamically switching databases at runtime with Spring 4 + Hibernate 4 using AbstractRoutingDataSource

I have a web app that up until this point exclusively was configured to use an in-memory HSQL database. I have a pure JavaConfig configuration. My goal was to modify the config to use a ...
1
vote
1answer
43 views

How to structure layers and responsibilities in Spring application?

I went through some articles, tutorials about creating application in Spring to get some information how to structure my standalone (not web) Spring application into layers. Situation - my ...
5
votes
3answers
5k views

How to setup Spring/Heroku/postgres SSL datasource

I'm trying to create a datasource from my Heroku/Spring application to postgres.heroku.com postgres database. Here is my applicationContext.xml snippet. <bean id="securityDataSource" ...
0
votes
1answer
58 views

How to filter postgres array column with the JPA criteria API?

I am using: Hibernate 4.3.5 Spring JPA 1.6.0 Javax Persistence API 2.1 The "refcodemailing" column is defined as an array of int: int[] My entity object: @Entity @Table public class ...
0
votes
1answer
198 views

How to store java.util.ArrayList in Postgresql using Spring

I am trying to do a batch-insert of a collection of beans. One of the properties of the bean is an ArrayList. The batch update fails with the exception: Can't infer the SQL type to use for an ...
2
votes
1answer
300 views

Postgres idle connections: CannotAcquireResourceException

I have a web application in Java/ Wicket using Hibernate 4.1.1 and Spring 3.1.1 and Postgres 9.2. I also use spring transaction api and c3p0 connection pool. My Problem is that the available ...
0
votes
2answers
42 views

Problems with session (hibernate)

I'm getting exception: No Session found for current thread, when I want to connect with database via hibernate, my cfg files: web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app ...
0
votes
1answer
43 views

could not autowire sessionFactory

I can't autowire sessionFactory bean defined in context.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" ...
0
votes
1answer
151 views

Could not autowire. No beans of … type found

can you help me solve why i can't autowire a class?? class UserDaoImpl: @Repository public class UserDaoImpl implements UserDao { @Autowired private SessionFactory sessionFactory; ...
0
votes
2answers
35 views

MVC application cannot perform RequestMapping

I'm new with javaEE development, i want to make simple "hello world" - spring,hibernate application, i already have mapped class to hibernate, dao classes etc... problem is that i would like to try my ...
0
votes
1answer
35 views

Fallback Database with Hibernate

do someone of you know a way to have 2 Databases running parallel? We are using Hibernate 4 and as a main database Postgres 9.3 - this db is hosted on another machine then the application - if the ...