Tagged Questions
0
votes
0answers
7 views
Filtering over pulled list from a database in Tapestry
I have structured my class like following:
@Entity
@Table(name = "Tiket")
public class Tiket {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = ...
0
votes
0answers
13 views
Update values in join table using Hibernate
Given this entity class
@Entity
public class Profile extends Model {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
...
@OneToMany(fetch=FetchType.EAGER)
...
0
votes
2answers
24 views
How to make JpaRepository return records for repository specified class only?
I have two entities:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
class A
@Entity
class B extends A
and a spring JpaRepository interface:
@Repository
...
0
votes
0answers
10 views
Hibernate/JPA + HSQLDB - Failed to access the database in Server mode although the same configuration works for Standalone mode
I am working on a web service that uses Spring and Hibernate-JPA.
So far I was using HSQQLDB in the Standalone (In-File) mode. Now I need to access the data base from other application at the same ...
0
votes
2answers
24 views
hibernate cannot find sequence
I need a simple sequence which would give me incremented integers that I later on use as part of a String.
I made this sequence using postgresql command line:
CREATE SEQUENCE my_seq
INCREMENT BY 1
...
0
votes
2answers
16 views
Could not obtain transaction-synchronized Session for current thread
I am getting the following Exception with a Spring4/Hibernate4 project I converted from xml- to Java-Config.
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for ...
0
votes
1answer
26 views
Mapping of data types in hibernate
I have a scenario where a database column is of the data type mediumtext. My entity has the following interface:
@Lob
@Column(name = "data", length = 16777215)
public String getData() {
return ...
1
vote
0answers
40 views
Could not resolve property Hibernate
I have 2 entities whose extracts are like these:
public class Visita {
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="pdv_uid")
private PuntoDeVenta pdv;
}
public class PuntoDeVenta ...
0
votes
1answer
16 views
Grails / GORM withCriteria serach toString()
I am displaying a table with Userobjects. The displayed information are:
User.firstName
User.lastName
User.email
but displayed by using user.toString() which results in the following output:
...
0
votes
0answers
4 views
Integration of Apache Shiro with Hibernate4 and Java Jersey2 without Spring
I'm trying to integrate Apache Shiro in my RESTful web service. I use Java Jersey 2 and Hibernate 4 for DB access, but not the Spring framework. There is some example or tutorial for the Realm or the ...
-1
votes
2answers
30 views
java.lang.NullPointerException:sessionfactory is null
Hi all i am using spring with hibernate and getting null as sessionFactory when i try to save my data.I try hard but not able to find why i am getting sessionFactory as null;
Below is my xml and java ...
0
votes
0answers
26 views
Two Versions of JPA entities for a Single Table
Hi How do I get Two JPA entities for a Single Table.
I tried to achieve One Lighter Version with out any Joins (For List Page).
and One Heavier version with all mappings (For View Details Page).
For ...
0
votes
1answer
10 views
Operations timeout in Hibernate [on hold]
Learning hibernate..please go easy :)
This is my main class i am using to perform operations depending on users choice :
package hibernate_tut_emp;
import java.util.Iterator;
import ...
1
vote
1answer
21 views
How to pass userid from one table to another table in spring mvc using hibernate
I'm using Spring security for the login. I have the User.java which contains user-details.
@Entity(name = "user_table")
//@Table(name = "user_table")
public class User {
@Id
@Column(name ...
0
votes
3answers
26 views
java.lang.IncompatibleClassChangeError:
This is my first Hibernate practice, I got the following Error
java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
I added the jar file to project library but the error still ...
0
votes
1answer
11 views
HQL: Counting a child collection conditionally within a query
I'm fairly inexperienced when it comes to HQL, so I was wondering if anyone can help me out on this. I have a relationship where Student has a OneToMany relationship with StudentCollege. I'm trying to ...
0
votes
1answer
18 views
Hiberate delete rows from table with limit
Hi want to delete the millions of rows from the table in batch to avoid locking. I am trying below code but its deleting all the rows.
Session session;
try {
session = ...
0
votes
0answers
24 views
Joining two entities with another entity (association) - Hibernate / JPA
I have 3 entities.
Member:
mem_id;
mem_name;
@OneToOne
Address address;// ???!?!?
....
Customer:
cust_id // PK
mem_id // FK to member.member_id
type; //needed field
....
Addr
...
0
votes
1answer
14 views
Java - Read a List returned from MYSQL query with hibernate
My Java class do a mysql query and it's result is stored in result list.
In the attached image you can see the structure data of one element of the list result.
My question is: how can I parse each ...
0
votes
0answers
14 views
how to filter a specific exception from log4j
I'm implementing some new features of Java 8 on my desktop app and Hibernate 3.6 seems to doesn't like it.
I added to an Interface a "default method", since then Hibernate it throwing:
2014-10-02 ...
0
votes
0answers
13 views
Hibernate Reverse Engineering Create Set (Composite Key)
I'm having trouble getting Hibernate to correctly reverse engineer a MySQL database into a Java Class.
I have 3 tables:
departments (pk = dept_no)
employees (pk = emp_no)
dept_emp (composite pks ...
1
vote
0answers
27 views
Entity proxy initialization
I'm having a problem with a Hibernate entity that does not get initialised.
It seems that it's still returning a not initialised proxy...
If I take a look at my debug info I would expect my entity ...
0
votes
1answer
27 views
update query in hibernate using NamedQuery
Learning Hibernate.Not sure if this is a right question...
I am trying to use NamedQuery for Update in my table
mysql> select * from hib1;
+----+--------+---------+
| id | name | surname |
...
0
votes
0answers
32 views
Java JPA sequence ID as String
This is what I currently have, which works fine
@Id
@SequenceGenerator(name="EDGE_DEAL_BOOKING_EDGEDEALNUMBER_GENERATOR", sequenceName="EDGEDEALNUM_SEQ")
...
0
votes
0answers
10 views
Jersey / Jackson serialization of lazy-loaded collection
I try to serialize with Jackson (2.x) an JPA entity which have lazy relation with other entities.
i have 3 entities and i try to serialize an instance of A. I created a jackson Configuration to use ...
1
vote
1answer
18 views
How to retrieve a list of objects from a different table in same model?
I have two models, both of them are using hibernate and uses mySQL, they have a ManyToOne relationship, I am using AngularJS to display the view. I was wondering if there is a way to retrieve a list ...
1
vote
2answers
27 views
Dynamically create SessionFactory in Hibernate
In my application, there are multiple databases for each client.I want to access database as per the client logged in my application.
There are two options for that:
1) Using multiple SessionFactory ...
0
votes
1answer
49 views
Getting a list of objects in model and implementing into ng-repeat
I have a webapp and two models which I would like to use. One model is Trainees and another one is TraineeStatus. I would like to get an array or a list of TraineeStatus inside Trainees and then pass ...
0
votes
1answer
26 views
hibernate/jpa how to store relation between one entity
I would like to store hierarchical folders in database.
F.e
@Entity
public class Folder {
int id
String name
Folder parentFolder
}
So if folder is in subfolder he should store information about ...
1
vote
2answers
24 views
Getting hibernate persistent object at the time of pre update event
I am implementing pre update event listener in java hibernate 4.3.
I need to get old persistent object value before update occures.
I have tried using event.getOldState() in PreUpdateEventListener. ...
0
votes
1answer
17 views
cvc-complex-type.3.2.2: Attribute 'key' is not allowed to appear in element 'props'
I am new to use hibernate in spring. I am trying to set the properties of hibernate through properties prop tag, but it is giving some error, can you please tell what it means and how it can be ...
0
votes
0answers
42 views
Error using Spring, Play Framework, Hibernate and MySql
I'm a long time trying to turn the architecture play-spring-hibernate but everytime I try the the following error:
I've tried reset and reconfigure often.
Is it that I am missing some dependency?
...
0
votes
0answers
13 views
Updating Hibernate mapping in Intellij IDEA
I am using IntelliJ IDEA 13.1.4 and Hibernate 4.3.6.
I have mapped my database to Hibernate entities, but I made a change to the database (added a foreign key to a table) and now, obviously, it will ...
1
vote
2answers
34 views
Is it a good practice to use the same Hibernate Session over and over
I'm developing a JavaFX Hibernate desktop application. I configured my application so that I use the same session from the application runs till it close.
This is how I did it:
public static Session ...
-1
votes
1answer
49 views
JPA not merging neither flushing my entity
I'm facing a trouble where I've my transactions controlled by Spring Tx and when I do a merge and after flush, my implementation does not print the command neither the Spring Tx commit them.
Follows ...
0
votes
0answers
20 views
Hibernate AutoIncrement non primary key based on foreign key
I'm working with a table that has an integer column and a foreign key. This integer has to be incremental, but it has to start again in 1 when the foreign key is changed.
Example:
Foreign 1, int col ...
0
votes
1answer
28 views
Hibernate - Query multiple tables with one hibernate-mapping
I do have a hibernate mapping which looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
...
0
votes
1answer
21 views
many to many set - add entry - org.hibernate.HibernateException: Found shared references to a collection:
I just need to add an entry on a many to many table/object with hibernate (associate a song to a playlist) called SongsPlaylist.
the structure of the tables is so defined: ...
0
votes
2answers
24 views
Foreign key usage in Java with Hibernate
I am trying to develop a web application and I was wondering if there is a way to utilize a foreign key without writing a lot of code.
My Trainees.java
@Entity
public class Trainees {
@Id
...
1
vote
3answers
34 views
Setting up a postgresql database using *.sql files and Java and Hibernate [on hold]
I have some *.sql files that create roles, databases, tables, sequences, triggers, etc. Whats the best way to automatically build all of those objects?
Keep this in mind:
An aplication that needs to ...
0
votes
0answers
34 views
Is Hibernate 4.3 @DynamicUpdate really does not include null values?
I have been trying to implement entity updating using @DynamicUpdate. Documentation (http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/) says:
dynamicInsert / dynamicUpdate ...
0
votes
2answers
29 views
Unable to get usage of CascadeTypes
I have two domain classes. Below is the rough sketch of the classes.
Company.java
public class Company{
@OneToMany(orphanRemoval="true",cascade=CascadeType.ALL,
mappedBy="company")
...
1
vote
2answers
41 views
org.hibernate.exception.SQLGrammarException: hibernate will not join column
I have a problem with hibernate... I have tried all things to solve this past two days and I have no more ideas...
I have a Mysql 5.0 database and made classes from entities.
Two of them:
@Entity
...
0
votes
1answer
26 views
hibernate update instead of throwing expected error after save
My code works well but shouldn't according to what I know about Hibernate.
I'm performing a save operation on a object as following:
IProfile profile = ...
0
votes
0answers
10 views
Hibernate: delete associated non-DB entities when an entity is deleted (manual cascade)
Following situation: I have Document objects which contain StorageFile objects (representing the document's data and renditions).
The documents are stored in the database, whereas the StorageFiles ...
0
votes
1answer
24 views
How to correctly convert JPQL query using “%”
I have this query (works fine):
@Override
public List<Product> getProductsByName(String name) {
Query q = em.createQuery("SELECT p FROM Product p WHERE p.productName LIKE '%"+name+"%'");
...
0
votes
1answer
25 views
mysql autocommit vs managers and daos insert methods
I've searched through the net but no answer so far, at least no clear answer.
Suppose you are in the following situation
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
...
0
votes
2answers
21 views
Hibernate Configration file error
I am new to hibernate framework. i made a sample project just to test hibernate. i set up the project. but when i run it i got this error
org.hibernate.HibernateException: /hibernate.cfg.xml not ...
1
vote
1answer
19 views
NamingException: jta.UserTransaction
I have a hibernate application which directly uses Java Transaction API resources. I'm trying to use UserTransaction to accomplish some basic database transactions
The UserTransaction interface ...
0
votes
2answers
21 views
org.hibernate.NonUniqueObjectException when saving a list of child objects
I need to save several child objects when creating the parent object. Ideally, I want to save them in one transaction, however, I keep getting an org.hibernate.NonUniqueObjectException: a different ...