Tagged Questions
1
vote
0answers
29 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
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
18 views
Change join table by another entity in JPA
I have 3 tables: Person, Phone and Person_Phone. Person_Phone is JoinTable for Person and Phone tables.
All the three tables have a primary key.(PostgresSQL sequence). I want to map this using JPA or ...
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 ...
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 ...
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
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
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 ...
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
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 = ...
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 ...
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
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
0answers
75 views
spring + hibernate + maven + postgres result in nullpointer
I have an postgresql db which i mapped with hibernate and generate pojo classes. With spring i should return a json list of all users but it results in :
HTTP Status 500 - Request processing failed; ...
0
votes
1answer
38 views
Hibernate + PostgreSQL - Connection with state “Idle in transaction”
I have a JSF application running on Tomcat using Hibernate.
I have made a little test that exposed te problem - A servlet was created, and the only thing it does is this:
EntityManager em=null;
try {
...
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 ...
0
votes
1answer
30 views
Hibernate don't close JDBC Connections
I have a JSF web application running on tomcat.
This application connect to Postgres database using hibernate.
After some time, the applications stops working because it can't open new connections.
...
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
...
0
votes
0answers
23 views
How to get JPA unique constraints into postgresql
My application is JPA/Hibernate, and uses H2 for unit tests and PostgreSQL for deployment.
I have the following JPA entity:
@Entity
...
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?
-2
votes
0answers
48 views
Does this query uses the indexes?
Appreciate your help.
I'm using Hibernate and Postgres.
Say I have the following DB tables :
table1
key1 (key, index, not nullable)
key2 (key, nullable)
val1
val2
table2
key1 (key, index, not ...
0
votes
0answers
57 views
Hibernate: PSQLException: Error: Column “column_name” does not exist
Hey I'm new to hibernate and I've tried to get information out of an existing database
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ...
1
vote
0answers
51 views
How to deal with postgresql data types that Hibernate can not deserialize?
I recently started attempting to use hibernate to interact with my database. I was following a guide I found online to set it up and use it.
https://netbeans.org/kb/docs/java/hibernate-java-se.html
...
0
votes
1answer
53 views
Remove/Find Nodes in hierarchical table of JPA Hibernate
I have created a table to store hierarchical data for a purpose.
In LEAF column Its there to decide whether its a leaf. And PARENT_ID column is for checking which one is the parent of the node. Below ...
0
votes
1answer
40 views
hibernate postgres many to one mapping issue
I got the issue with hibernate mapping when generate "create table" sql. The property sid is String type but it becomes integer type after generating table acl_entry in database. And i dont know why. ...
2
votes
0answers
112 views
Spring 3 + Hibernate 4 + JSF 2 + Postgresql 9 + Multi-tenancy - Connection Pool! Plz help me to check is it possible or not? [closed]
The situation is:
I am going to build a small web application (Spring-JSF-Hibernate, support only 2-10 internal users in my company). I decided to use PostgreSQL to store the data (around 10 tables - ...
0
votes
2answers
60 views
Hibernate doesn't generate id
I have a Java spring project using hibernate to store its data into a postgresql database. Manually writing data into the database and reading it with hibernate works fine. However, saving newly ...
0
votes
1answer
31 views
Avoid unnecessary fetches in @onetomany join
I have two classes mapped to two different tables in DB.
For example ,
@Entity
@Table(schema = "schema", name = "tableA")
public class ClassA{
@Id
@Column(name = "id", ...
1
vote
0answers
122 views
Mapping JSON String as Postgresql's JSON type with hibernate
How should I tell Hibernate to map a String containing a JSON value to PostgreSQL as PostgreSQL's JSON Type ? Assume I have an attribute like this:
private String foo_json_value;
I have used Gson ...
0
votes
1answer
32 views
Repeated column in mapping for entity: com.priyan.patients.EPrescriber column: id (should be mapped with insert=“false” update=“false”)
Here is my bean classes
@Entity
@Table(name="TABLETS", uniqueConstraints = {@UniqueConstraint(columnNames = "tradeName")})
public class Tablets implements Serializable{
private static final long ...
0
votes
1answer
66 views
Migrating Spring application from Postgres to Oracle: defining table's schema
FINAL EDIT
The reason why I didn't see any logs is that I was using an old version of log4j. Hibernate hbm2ddl uses slf4j for logging and so all the logs were ignored by log4j 1. Now I upgraded to ...
0
votes
1answer
71 views
Getting org.postgresql.geometric.PGpoint instead of org.postgis.PGgeometry in Hibernate Spatial
I've been struggling with this for a while. Running on Tomcat 7.0.47
Relevant Entity Class snippet:
@Column(name = "geopoint", columnDefinition = "org.postgis.Geometry")
@Type(type = ...
0
votes
1answer
113 views
Hibernate/JDBC hanging when connecting top PostgreSQL 9.3.1 on Amazon RDS
Last thing shown in logs is :
2013-12-01 19:40:00,454 DEBUG localhost-startStop-1 org.hibernate.engine.jdbc.internal.JdbcServicesImpl - Database ->
name : PostgreSQL
version : 9.3.1
...
0
votes
1answer
54 views
Postgresql and Spring Roo Binding serial type for ID
I am having trouble using the Postgresql serial type in Spring Roo. What I want is to have the an auto-incrementing id column which will work with the auto generated entity classes in Roo.
The ...
0
votes
1answer
54 views
Add a unique constraint over muliple reference columns
Hello i want to add a unique constraint over two referenced columns:
@Entity()
@Table(uniqueConstraints = @UniqueConstraint(columnNames = { "ast", "tfs" }))
public class N extends UUID {
...
1
vote
1answer
54 views
Application is getting stuck at hibernate txOracle.commit();
try {
sessionOracle = BaseDAO.getHibernateSession().openSession();
sessionPostgres = BaseDAOgis.getHibernateSession().openSession();
int id = 0;
JSONArray jaRoute = new ...
0
votes
1answer
83 views
postgresql - Error in Hibernate Program
I just started working on Hibernate but faced errors with the first program itself. Please help me identify the error. Here is the code. I am using Hibernate 4.2.7 and postgreSQL 9.3
...
6
votes
1answer
131 views
Hibernate Spatial - 'Invalid endian flag value encountered' Exception
I'm trying to run a simple query in Hibernate Spatial 4.0 on PostgreSQL 9.3. I have a number of objects in a table with latitude/longitude values, and I'm trying to query objects that fall within a ...
1
vote
1answer
143 views
Slow JBoss startup, possibly related to DataSource pointing to Heroku Postgres
I am observing a slow JBoss startup. Specifically there is a freeze in the startup when deploying my application, it seems during Hibernate initialisation:
22:43:00,066 DEBUG ...
1
vote
1answer
96 views
Hibernate + PostgreSQL + Network Address Type (inet, cdir)
I have started my example project with Hibernate 4.2.7 and PostgreSQL 9.3.1 and everything is going well.
At the moment I would like to use INET PostgreSQL type but I am not able to map it with ...
0
votes
2answers
66 views
Using Hibernate to CREATE SCHEMA in PostgreSQL
All i want is to execute the following SQL on my PostgreSQL server after my Hibernate SessionFactory has been initialized:
CREATE SCHEMA IF NOT EXISTS "fooschema" AUTHORIZATION "foouser";
Currently ...
0
votes
2answers
53 views
accessing heroku database with hibernate eclipse plugin
I'm new to hibernate and heroku. I created a database on heroku and trying to access database with my eclipse plugin - hibernate to generate POJO classes. I'm getting error like - "Reading Schema ...
0
votes
2answers
104 views
PGpoint hibernate (de)serialization exception
In my database I've this table:
CREATE TABLE base_station
(
MCC INT NOT NULL,
MNC INT NOT NULL,
LAC INT NOT NULL,
CID INT NOT NULL,
type TEXT NOT NULL,
geoposition point NOT ...
0
votes
1answer
34 views
Find ColumnDefinition Enum or Constants
I am looking a class that will contain the constants or enum for JPA columnDefinition.
Ex:
public class MyEntity {
@JoinColumn(name = "my_value", columnDefinition = "BIGINT")
private ...
0
votes
1answer
110 views
Criteria: ClassCastException Integer to Long
I'm using Hibernate 4.2, and PostgreSQL.
I have this table in postgres:
id bigserial NOT NULL (chave primária)
name text
And my entity is:
@Entity @Table(name="customer") public class ...
1
vote
1answer
49 views
hibernate persist fails tries to create object with existing id
I am using spring-hibernate-postgres. I have a table say 'some_entity'. It already contains some records.
I have a program that tries to create new SomeEntity object. I am populating that object with ...