Tagged Questions
0
votes
0answers
8 views
Hibernate - Get “selected” and “all available” objects
I've been searching for the last 2 days, and I have to just be missing something.
I have 2 objects -
public class Project
int id;
ProjectStatus status;
List<ProjectStatus> statusesAvailable;
...
0
votes
1answer
6 views
Glassfish Severe Warnings using Hibernate on MySQL
I use Hibernate 3.6.10 as my ORM and MySQL as my database. I am having this wierd errors/warning when I run my web application. Can someone help me figure this out? Should I be worried about this ...
0
votes
0answers
6 views
Hibernate giving org.hibernate.NonUniqueObjectException and saving obsolete object to the database
I have below code in my service class. This code is called twice from 2 different methods as part of a functionality.
//Some code here...
LOG.info("###Inside customer interceptor");
...
0
votes
1answer
10 views
Proper way to use @Transactional on a service
I have a service, which uses multiple DAOs to do a unit of work like following. The DAOs fetch the data/save by creating a session and commit. In that case, why do i need to have transactional on the ...
0
votes
1answer
4 views
exception when updating hibernate object whose table has a history trigger tied to it
I have a table Schools, with and update trigger SchoolsHistory. The trigger works fine when I update via simple sql statement. When hibernate (via Spring) updates the object, I get this exception:
...
1
vote
0answers
15 views
org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session
I've an entity setup that looks like that:
User <- (M:N) -> Project
Project <- (1:n) -> WorkPackage
WorkPackage <- (N:1) -> Category
Using: Hibernate 4.3.4
Now I want to create a ...
0
votes
0answers
7 views
Creating hibernate.cfg by an app
I am trying to do app which will be creating hibernate.cfg.xml. But i do not know what path i should use. If I use relative path then file will be created in GlassFish folder, not in my project. What ...
0
votes
1answer
29 views
Why does Hibernate's DELETE return 1 even when table is empty?
I have this very simple piece of code, aimed at deleting only 1 record (if present!) :
public String deleteOneRecord(String recordUniqId) {
// System.out.println(recordUniqId);
try {
String ...
0
votes
0answers
22 views
Error starting tomcat7 server
When I try to start the apache tomcat 7 via a command line I have this error:
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ...
0
votes
0answers
5 views
Reading Postgres geometry into byte[] with hibernate
I'm trying to read a geometry column and save it as a byte [] with hibernate.
As far as I know - it's the way it's represented in PSQL...
I manage to write it and even see it within the psql but...
...
0
votes
0answers
4 views
Memcached Server VS Memcached Client : What is the role of everyone?
I hope to receive some answers to my 2 questions.
I use as ORM : Hibernate.
I need to cache the objects that I get from the Database.
In a Client-Server architecture :
What would be the role of ...
0
votes
0answers
21 views
JPA intermediary table [duplicate]
I asked this question yesterday and I thought I found the correct answer, but sadly it isn't the case, so I'll try rephrasing it.
I have your typical M:M relationship, in my case think of the ...
0
votes
2answers
20 views
Switch from EclipseLink to Hibernate
We want to change the JPA Provider EclipseLink and use Hibernate for the future. The problem is that I didn't find all property equivalents. So the following are missing:
<property ...
0
votes
0answers
8 views
Join using an intermediary table in JPA (Need to order the final result by a column of intermediary table)
I am able to do a jointable using an intermediate table like below code:
Here is the keywords for a story
In Story.java
@ManyToMany(targetEntity=Keyword.class,
...
0
votes
0answers
18 views
OpenSessionInViewFilter cascade merge probems
I am using OpenSessionInViewFilter, Spring, and Hibernate for data access.
OpenSessionInViewFilter configured like this
<filter>
...
0
votes
1answer
14 views
Persistence.xml file for Hibernate JPA and Mysql
I'm finding it difficult to find an up-to-date and clear explanation of how the persistence.xml should look and what it needs to contain. What would your typical persistence.xml file look like for the ...
-3
votes
0answers
30 views
Need to convert following query in hibernate criteria
I want to make the following query using Hibernate's Criteria API:
select * from
(
select
*
from
infoready_reports.workflow_fact order by submitted_on desc
) t
group by t.dim_candidate_id , ...
0
votes
1answer
25 views
Inconsistent id generated with an sql sequence
I have a Trace class, and I need to save its instances in an Oracle DB.
I choose to generate its id with a sequence, like this :
@Entity
@Table(name = "TRACES")
@SequenceGenerator(name = "TraceGen", ...
0
votes
0answers
26 views
Spring JPA Hibernate Many2Many with extra column
i have a problem with a Many2Many relation using Spring JPA/Hibernate with an @Embeddedid.
The relation is as follows:
Project 1 <--- n ProjectUser n ---> 1 User
Project
@Entity
public class ...
0
votes
1answer
27 views
Hibernate one to many mapping with additional relation table
I want to have two tables with one to many relation that are linked by third table. How can I approach this? I want to create exactly the same thing as in this tutorial but using one-to-many instead ...
1
vote
1answer
18 views
spring data jpa @query and pageable
I'm using spring data jpa now, and when I use @query to customize an sql and WITHOUT pageable, it works,
But if I add the second param "pageable", the @query will NOT work, and spring will parse the ...
0
votes
0answers
17 views
Maven archetypes for hibernate using JPA annotations method
Does anyone know where to find or how to setup a hibernate project from a maven archetype? The important part being it using the standard JPA annotations method rather than the hibernate specific ...
0
votes
0answers
6 views
What are the intended use cases for CustomCollectionType vs. UserCollectionType in Hibernate?
What are the intended use cases for CustomCollectionType vs. UserCollectionType ?
Which one should I use if I want to use my own collection with Hibernate?
This example uses UserCollectionType. I ...
0
votes
0answers
20 views
how to save special charchter name like Āhualoa in mysql using hibernate
I need to save a us country city name which has some special character.
I am using Spring hibernate and using save method of hibernate to persist and object.
when i pass string Āhualoa while saving ...
0
votes
2answers
25 views
org.hibernate.MappingException: Unknown entity: java.lang.Integer
I am doing a project on spring MVC with maven.I pass my data using Ajax to the controller.it is ok..but when i call the function for delete,i got org.hibernate.MappingException: Unknown entity: ...
0
votes
0answers
21 views
Hibernate 4 JPA EntityListeners not firing in Spring MVC/ Spring Data application
I've got a Hibernate 4 / Spring MVC 3.2.4/ Spring Data 1.4.1 with Spring Security application in which I am trying to integrate EventListeners on my entity classes. I think I have everything ...
0
votes
0answers
10 views
How to use both @Embadable and @CollectionOfElements in entity class
Hi could anyone please help me to resolve this problem,I have an entity called a person, And I have taken the person states(Instance variables) has personname as String type,person petnames as Set ...
0
votes
2answers
35 views
Spring, JUnit, Hibernate Testing
Can someone point me out to a good source of information on Spring mvc testing? I would like to test:
Entities: I want to be able to create a new record in the database, fetch all records and assert ...
0
votes
0answers
13 views
spring data jpa @Query method naming
As i know, generally, spring data jpa will parse the method's name to create a sql.
For example: findByUsername, and the sql will be select * from xxx where username = ?, but how if we use @Query,
...
0
votes
1answer
43 views
JPA and creating Audit Log
Rephrase of original question:
I have your typical M:M relationship, in my case think of the User/Role example:
USER, ROLE, USER_ROLE
I need a second USER_ROLE table matching up Users to Roles. I ...
0
votes
1answer
13 views
@AttributeOverrides and @Embeddable not working
This is from Hibernate Recipies book at chapter 3 first question when I am trying to run I am getting the following error Exception in thread "main" org.hibernate.MappingException: Repeated column in ...
-1
votes
0answers
23 views
Binary tree with hibernate
I want create a binary tree in java with hibernate. Before, i managed without hibernate but i can't create my tree with hibernate.
here is my bean without hibernate.
private Long id_node;
...
0
votes
0answers
27 views
Please help me with this bidirectional mapping in hibernate
I have two tables, quotation and quotation_item. There is one to many relationship them. My requirement is when I do quotation.setQuotationItem(set), old quotationItem mapped to quotation should get ...
0
votes
1answer
17 views
How to join fields of two tables using Hibernate?
I have two tables and related Java mapping.
CREATE TABLE country (
code VARCHAR(3) PRIMARY KEY NOT NULL,
name VARCHAR(100) NOT NULL
);
CREATE TABLE user (
id INT PRIMARY KEY NOT NULL ...
0
votes
0answers
15 views
Understanding persistence context basics in Grails
This is a long one, so grab your coffee (...or whiskey?) before sitting down. I have read the posting rules and suggestions and will attempt to be as specific and concise (ha) as possible.
I'm ...
0
votes
1answer
38 views
Spring 4 Hibernate 4 No Session found for current thread
I am getting the following exception in my web application. If you look closely, it appears to be going through the transactions managers, which means my point cuts are correct.
...
0
votes
1answer
19 views
Avoid Date Overlapping using JPA
I have an entity class with properties 'code','fromDate' and 'toDate' and i need to insert one new record using JPA such a way that for given code date range should not overlap.
For example
If code- ...
0
votes
0answers
28 views
sending entity properties from GET to Post
In a spring mvc application using hibernate and jpa, I am having trouble getting an entity to travel from the get method to the post method, which is leading to other downstream problems. Can someone ...
0
votes
0answers
15 views
Hibernate wraps collection but when ?
The Java Persistence With Hibernate book says : "Hibernate only wraps the collection object you've already initialised." (See Fig. 1).
The problem is that according to the code below it replaces my ...
0
votes
1answer
26 views
how to select an object from a list which is an attribute of another object in a database with spring
I have two classes where one of them contains a Map of objects of the second class, and I want to make a query to find one object by its id.
here's my code:
@Entity
@Table(name="objectx", ...
0
votes
0answers
24 views
Hibernating - Generating part of a composite key
I have the following class:
@Entity
public class User {
@Embeddable
public static class Key implements Serializable {
private static final long serialVersionUID = 1L;
...
0
votes
0answers
9 views
Hibernate Uppercase interceptor - stalestateexception
I wrote a hibernate interceptor for converting all strings into upper case as shown below. It works well in general except for one case where it is throwing a stalestateexception. for now I created a ...
0
votes
2answers
22 views
hibernate.cfg.xml already exists in my project but I'm getting this error hibernate.cfg.xml not found
I am getting the above mentioned error.I have the xml file hibernate.cfg.xml already within the web application. As well as this I have the full jar files required for hibernate under WebINF lib ...
0
votes
1answer
23 views
Hibernate: Deserialize String to Value
I have a string in a database that corresponds to the string value of an enum. I would like to tell Hibernate that this string should be regarded as a value from the enum class. Something like ...
-2
votes
1answer
14 views
How to save unlimited lengthy string in derby using Hibernate?
I have the following pojo with the annotation. But it doesn;t persist the largeString to database.
@Lob
@Type(type = "org.hibernate.type.TextType")
private String largeString;
0
votes
0answers
16 views
Connect to a VFP Database
I get this error while attempting to connect to a VFP Database using Hibernate 4.3.4:
Exception in thread "main"
org.hibernate.exception.GenericJDBCException: Could not open
connection at
...
0
votes
1answer
22 views
Errors when writing to DB
I'm getting some errors when trying to write to DB using Hibernate.
I'm following this guide but i want to use MySQL instead: http://www.gwtproject.org/articles/using_gwt_with_hibernate.html
I have ...
0
votes
0answers
14 views
Distributed caching : Terracota VS JBoss Cache VS Memcached or other [on hold]
I need to implement a distributed caching.
I don't know which technology to choose for a Java EE solution, but I know that there are these solutions :
Terracota
JBoss cache
MemCached
Can anybody ...
0
votes
0answers
17 views
embedded database hsqldb hibernate persistance
im trying to persist a blob of size 27Kb to an embedded database (for test purposes) but hibernate is creating the blob field with limit of 255 (e.g. creation sql contains "blob (255)"). Can this be ...
0
votes
3answers
33 views
How Lazy loading of child records works in Hibernate?
I know the above question is very common but I just wanted to know exactly when and How Hibernate is fetching the lazily loaded child records.
below is the sample table structure:
Table Structure:
...