Represents the 4.x release of the Hibernate Object/Relational Mapping project
Questions tagged [hibernate-4.x]
302 questions
0
votes
1 answer
Insert into database after spring hibernate sessionfactory is created
I want to insert some data in a table of database after the SessionFactory of spring hibernate has been created.
I have a CUSTOMER table and I want to insert a particular Customer into this table if the Customer doesn't exist.
This is the…

Tapas Bose
- 28,796
- 74
- 215
- 331
0
votes
1 answer
JPA 2.0 hobernate 4+ @OneToMany unidirectional set
I read a lot of topic and forum about @OneToMany but unfortunatelly any of this couldn't help.
For example we have Entities like these:
@Entity
@Table(name = "MANAGER")
public class Manager{
@Id
@GeneratedValue(strategy =…

grachol
- 82
- 1
- 7
0
votes
1 answer
buildSessionFactory in Hibernate alternatives
I am following this tutorial on Hibernate. The tutorial is quite old already since it still uses the old buildSessionFactory().
My Question is how would I use the latest buildSessionFactory(serviceRegistry) I am new to hibernate. I have no idea…

user962206
- 15,637
- 61
- 177
- 270
0
votes
4 answers
Java: Best practice for updating information
I have an application that is connected to an SQL database using Hibernate. When removing a person from a particular part of the application I want to reset all the information that had been set in the particular part. Below is an example of what I…

Hip Hip Array
- 4,665
- 11
- 49
- 80
0
votes
1 answer
Spring 3.1 + hibernate 4: Can't get it to run
I tried different configurations but to no effect. The error remained the same. Here the desired config taken from BoneCPs web site:

beginner_
- 7,230
- 18
- 70
- 127
0
votes
3 answers
Spring+Hibernate: No session found in the thread
I have made a project which is built on Maven+Spring 3.1+Spring MVC 3.1+Hibernate 4.1
In the transaction if I use the code:
Session session=sessionFactory.getCurrentSession();
session.save(user);
It gives the exception at the…

yyy
- 437
- 2
- 9
- 23
0
votes
1 answer
I'm using jdbc &hibernate to connect my DB oracle11gr2.I need to upgrade client libraries from hibernate 3.1.3 to 4.1.6
I need to upgrade my client libraries i.e hibernate from 3.1.3 to 4.x.I'm preferring 4.1.6.I have done upgrading jdbc 4 to 5 successfully.Now the problem is we are going to latest release from 3.1.6. I'm seeing more than 250 errors.I'm bit confused…

gnr14
- 21
- 1
- 1
- 10
0
votes
2 answers
java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()
For some reason I get the following exception when using Spring Batch in combination with Hibernate 4.
java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;
at…

Tranquilized
- 721
- 2
- 6
- 23
0
votes
1 answer
HibernateException: Found shared references to a collection
For some strange reason when I upgrade to Hibernate 4 I get the following exception:
HibernateException: Found shared references to a collection
I have the following beans mapped like this:
@Entity(name = "CIN_PRODUCTS")
@Inheritance(strategy =…

Tranquilized
- 721
- 2
- 6
- 23
0
votes
1 answer
Hibernate 4 not sorting
I have a SortedSet within an entity. But when I try to fetch it doesn't sort. I tried to use hibernate or jpa, both not working. Any reason? (My set entity has implemented comparable too)
private SortedSet news = new TreeSet();
…

Roy Chan
- 2,888
- 6
- 36
- 43
0
votes
1 answer
how to configure hibernate 4 with spring 3.1
I have one springapp-dao.xml which looks like below

DNAj
- 240
- 3
- 9
0
votes
1 answer
Implementation of Annotation Driven Transaction in Open-Session-In-View with Spring 3 and Hibernate 4
I am developing an application with Wicket-1.5.3, Spring-3.1.1 and Hibernate-4.1.1.
I want to implement
Open-Session-In-View Pattern where the
Transaction will be Annotation Driven and the
Application should net get any…

Tapas Bose
- 28,796
- 74
- 215
- 331
-1
votes
1 answer
java.lang.ClassCastException: java.lang.Integer cannot be cast to abc.def.myproject.orm.EmployeeTopMetaData
I am trying to run a SELECT query using Hibernate Criteria API which is defined in the code below. I checked the console and it seems like the
query is running fine. Here is what I am getting in the console for the SQL Query :
Hibernate:
…

Dan
- 443
- 1
- 7
- 19
-1
votes
1 answer
super.configuration is not loading all namedqueries tables,imports and collections in Hibernate4 with Spring4
We are upgrading Hibernate 3 and Spring 3 to Hibernate4 and Spring4.
My sessionfactory code in Hibernate 4 is like following.
import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder;
import…

user3198259
- 178
- 3
- 13
-1
votes
1 answer
hibernate many to many mapping not inserting row into join table from service layer
i am witnessing weird behavior in hibernate , i have many to many relation and i have tables as shown below
Attribute -- Attribute_Category -- Category
when i try running my DAO layer test , hibernate inserting rows in all three tables including …

pappu_kutty
- 2,378
- 8
- 49
- 93