Questions tagged [spring-orm]

Spring Framework Object Relational Mapping (ORM) Data Access

Spring Framework is a Java platform that provides comprehensive infrastructure support for developing Java applications. Spring adds significant enhancements to the ORM layer of your choice when you create data access applications. You can leverage as much of the integration support as you wish, and you should compare this integration effort with the cost and risk of building a similar infrastructure in-house.

The Spring Framework supports integration with:

  • Hibernate
  • Java Persistence API (JPA)
  • Java Data Objects (JDO)
  • iBATIS SQL Maps for resource management
  • data access object (DAO) implementations
  • transaction strategies

For example, for Hibernate there is first-class support with several convenient IoC features that address many typical Hibernate integration issues. You can configure all of the supported features for O/R (object relational) mapping tools through Dependency Injection. They can participate in Spring's resource and transaction management, and they comply with Spring's generic transaction and DAO exception hierarchies. The recommended integration style is to code DAOs against plain Hibernate, JPA, and JDO APIs.

Spring ORM Documentation

Please note that this tag is unrelated to Spring Data which provides Repository abstractions for various persistence store and has its own set of tags which start with

228 questions
117
votes
18 answers

Spring Hibernate - Could not obtain transaction-synchronized Session for current thread

I created an application with spring + hibernate, but I always get this error. This is my first application with hibernate, I read some guides but I can not solve this problem. Where am I doing wrong? This is the code of my application ott 05, 2014…
Alex
  • 1,885
  • 5
  • 23
  • 36
107
votes
5 answers

Spring DAO vs Spring ORM vs Spring JDBC

I was going through data access technologies supported by Spring, and I noticed that it mentions multiple options and I am not sure about the difference among them: Spring-DAO (http://docs.spring.io/spring/docs/2.0.8/reference/dao.html) Spring-ORM…
Pat
  • 2,026
  • 4
  • 17
  • 21
66
votes
1 answer

Trouble using ScrollableResults-backed Stream as return type in Spring MVC

Important note: this has been accepted as a Spring issue with a target fix version of 4.1.2. My goal is to achieve O(1) space complexity when generating an HTTP response from Hibernate's ScrollableResults. I want to keep the standard mechanism…
Marko Topolnik
  • 179,046
  • 25
  • 276
  • 399
46
votes
4 answers

Spring + hibernate versus Spring Data JPA: Are they different?

Although not novice, I am trying to learn spring framework (again!) in order to be sure that I really understand this. I have got fair idea on core Spring (DI). Now, I am focusing on Data layer. I have come across the term "Spring and Hibernate". As…
CuriousMind
  • 6,665
  • 12
  • 49
  • 95
43
votes
4 answers

Spring 3.1 Hibernate 4 exception for Inheritance [cannot be cast to org.hibernate.mapping.RootClass]

Hi I have just started using Spring , with Hibernate4 and maven. Basically my class hierarchy is HUmanMicroTask extends from MicroTask . In future there may be several other classes extending from MicroTask. I was trying to have a one table per…
Raveesh Sharma
  • 1,458
  • 5
  • 21
  • 37
41
votes
7 answers

What is the difference between LocalContainerEntityManagerFactoryBean and LocalEntityManagerFactoryBean?

Can anybody explain what is the difference between the Spring Framework's LocalContainerEntityManagerFactoryBean and LocalEntityManagerFactoryBean?
BlueSky
  • 1,333
  • 3
  • 11
  • 9
35
votes
2 answers

Spring 3.1 entityManagerFactory java.lang.NoSuchFieldError: NULL Error

I have just migrated Spring 3.0.5 to 3.1 GA. I faced runtime error during initialization: org.springframework.beans.factory.BeanCreationException: Error creating bean with name…
Lee Chee Kiam
  • 9,693
  • 10
  • 56
  • 76
25
votes
7 answers

java.lang.IllegalArgumentException: expecting IdClass mapping

I have configured composite primary key for my entity Employee as follows Employee.java: @Entity @Table(name="employee") @Proxy(lazy=false) @IdClass(EmployeeId.class) public class Employee implements Serializable { private static final long…
Achaius
  • 5,326
  • 16
  • 59
  • 107
24
votes
1 answer

How to Pass Multiple Packages to packagesToScan property in Spring using XML Configuration

Assume i have two packages com.test1 and com.test2 in different modules called M1 (com.test1) and M2 (com.test2). Now in the following example i configured module1 package.
Ranga Reddy
  • 2,433
  • 3
  • 26
  • 34
21
votes
1 answer

java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor

i am trying to migrate to hibernate 4.1.0.Final with spring 3.1.1.RELEASE and following is my configuration for hibernate:
fresh_dev
  • 6,414
  • 22
  • 63
  • 95
11
votes
2 answers

NoUniqueBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean

I have 2 separate databases and I am trying to access them in repositories. Unfortunately I am receiving the following exception. Things I have tried have tried making one of the bean as Primary. have used PersistenceContext as can be seen in code…
lesnar
  • 2,112
  • 5
  • 32
  • 67
10
votes
2 answers

JPA DescriptorEventAdapter ChangeSet always null

I'm trying to include a changes tracker to my JPA Entitys (to a log file, not a database) however the changeSet returned by my DescriptorEventAdapter is always null. I'm using EclipseLink 2.5.2, ojdbc6, spring-orm 4.1.1. All events are called…
martinyyyy
  • 1,551
  • 3
  • 18
  • 42
9
votes
3 answers

java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean

I'm new to Spring this is my first example (JSF 2, PrimeFaces 3, Spring & Hibernate Integration) here's the pom.xml :
Amira
  • 2,642
  • 10
  • 55
  • 83
9
votes
1 answer

Spring Hibernate Vs jdbc template vs spring orm

We have a project with MySQL database and Spring as the framework. I am very new to Spring and looking to implement the database access layer and found that there are several options available, like Using Spring + Hibernate Using Spring JDBC…
Sunil
  • 1,160
  • 3
  • 12
  • 20
7
votes
2 answers

org.hibernate.UnknownEntityTypeException: Unable to locate persister: entity.Settings

I am trying to use Hibernate 5 (5.2.11) together with Spring ORM. Following tutorials I came up with following configuration: Spring Bean
Hannes
  • 4,292
  • 7
  • 25
  • 48
1
2 3
15 16