Questions tagged [spring-orm]
Spring Framework Object Relational Mapping (ORM) Data Access
0
votes
0answers
8 views
DuplicateKeyException hibernate 3 version update on saveorUpdate
This error occuring while updating hibernate version from 3.3.1GA to 3.6.10.Final
I am updating an application(JSP + spring 4.2 + hibernate+ java 8) where i need to perform edit and add ...
0
votes
0answers
27 views
Server Tomcat v9.0 Server at localhost failed to start.| A child container failed during start
here trying to create a spring MvcOrm project, where with this file trying to add dependency jar to my project, but after including hibernate-core dependency jar file tomcat server failed to start and ...
0
votes
0answers
31 views
How to get Metadata during build session factory
Using Spring 4.3.4 & Hibernate 5.1.17
I want to know how to modify metadata or get entity mapping metadata at runtime.
Can i extend LocalSessionFactoryBean, getMetadata and modify it to use ...
0
votes
0answers
33 views
Spring boot with apache OpenJPA
I am trying to integrate my test spring boot application with DB.
I don't want to use Hibernate vendor, I want to use apache OpenJPA.
My current bootstrap.yml looks like this
spring:
...
0
votes
1answer
85 views
NoClassDefFoundError org.hibernate.engine.spi.SharedSessionContractImplementor while using hibernate 5.1.0 with Spring 5.1.3
While using Hibernate 5.1.0 in Spring 5.1.3 I see NoClassDefFoundError
Error is reported for missing class SharedSessionContractImplementor. Which is valid because this was added in Hibernate 5.2.0 ...
0
votes
1answer
50 views
SpringBoot CloudStream (Kafka) and JPA
I have built an application which receives data requests via kfka and uses JPA to persist data, on every JPA error for example
Exception in thread "user-4db12638-e58b-4728-9374-886ef20d0f31-...
0
votes
1answer
22 views
Failed to load ApplicationContext with spring-orm/ hibernate
I have the following file with only one @Test uncommented:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfig.class)
@Transactional
public class ...
0
votes
1answer
34 views
@Transactional in spring working for read only but not write
Previously, I used to explicitly begin and commit the transactions but now I am trying to make use of @Transactional annotation in spring. For some reason, all the read-only operations are working but ...
2
votes
0answers
77 views
@EnableJpaAuditing and LocalSessionFactoryBean
After migrating a pure spring v4 app to spring boot 2.1 I have some issues with auditing.
For demonstration purposes I created a little demo app which's setup basically looks like this:
@...
1
vote
0answers
26 views
JPA Changes in calling Stored procedure
Is there any other way to reduce the below code snippet. Before we are using Hibernate4 current we changing to Hibernate5(Version 5.3.6.Final) so there are so many changes in Hibernate5. We are new to ...
0
votes
0answers
103 views
Failed to instantiate [org.apache.commons.dbcp.BasicDataSource] no default constructor found
I am getting following error when I am trying to connect my program with database through spring-dao using HibernateTemplate.
WARNING: Exception encountered during context initialization - cancelling ...
3
votes
1answer
57 views
why Spring ORM JpaTransactionManager using native entity manger factory?
Is there any specific reason while creating entity manager jps transaction using the native object?
EntityManagerFactory emf = this.getEntityManagerFactory();
if (emf instanceof ...
0
votes
0answers
34 views
Abstract routing datasource with different Databases
We have an application where we have implemented Abstract Routing Data source feature in dealing multiple data bases of same type mysql (jdbc:mysql://127.0.0.1:3306/test, jdbc:mysql://127.0.0.1:3306/...
-1
votes
1answer
42 views
spring security sql-error-codes.xml , no exception trace is found
I have configured spring security with my application,but got stuck at one place with following INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader-Loading XML bean definitions from ...
0
votes
0answers
126 views
HibernateJPaVendorAdapter :Cannot convert value of type String to required type 'org.springframework.orm.jpa.vendor.Database' ENitty
I have configured my entityManagerFactory in spring xml file something like :
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
...
0
votes
0answers
30 views
How to access dom4j session in hibernate 5.x?
I am currently working on migration project from hibernate 3.x to hibernate5.x, DOM4J session was used in the old code and I would like to use DOM4J enabled session in hibernate 5.x. is it possible to ...
0
votes
1answer
89 views
Issue in using Spring Data JPA with Spring JPA
Issue -
Getting a war file deployment error. Getting runtime exception. Error details are mentioned after some additional information.
Some background -
1) Functionality was working with Spring JPA ...
0
votes
0answers
43 views
java.lang.ClassNotFoundException: Could not load requested class : datetime
I use this Spring configuration:
@Configuration
@EnableTransactionManagement
public class ContextDatasource {
@Bean
public LocalSessionFactoryBean sessionFactory() throws NamingException {
...
1
vote
2answers
38 views
Configure Hibernate models discovery in Spring
I want to configure Spring with Hibernate 5 and JNDI using this code:
@Configuration
@EnableTransactionManagement
public class ContextDatasource {
@Bean
public LocalSessionFactoryBean ...
0
votes
0answers
36 views
How can I inject an EntityManager to a managed bean without using annotation-config?
I have the following code, which works fine:
beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/...
0
votes
2answers
145 views
Hibernate does not rollback in case of a runtime exception thrown
I have below piece of code in my project. An exception is thrown at line # 4 still my product details are saved. I am having hard time to understand why does it save product details even after ...
0
votes
0answers
38 views
Hibernate calls save even after exception thrown
I have below piece of code in my project. An exception is thrown at line # 4 still my product details are saved. I am having hard time to understand why does it save product details even after ...
0
votes
1answer
399 views
Issue with JdbcTemplate BeanPropertyRowMapper - setting int & double field as 0 instead of actual value
I am trying to fetch an record from a database using Spring Jdbctemplate.. In JdbcTemplate I am trying to automate data bind by making use of the class BeanPropertyRowMapper... My database table ...
1
vote
0answers
42 views
Neo4j SDN5 proper schema design for performance - @RelationshipEntity vs @NodeEntity
I have the following SDN5 node entities:
@NodeEntity
public class Decision {
@Index(unique = true)
private Long id;
}
@NodeEntity
public class Characteristic{
@Index(unique = true)
...
0
votes
0answers
78 views
Using both JDBCTemplate and JPA in spring
I am working on a project in which Spring with JDBCTemplate is getting used. Now I want to migrate that project to JPA with Hibernate for database layer. So Situation is like to migrate some ...
0
votes
0answers
28 views
Set context info for each session created by Spring Data repository method calling
Without Spring data early I used session factory to open session, that was able to execute many queries. And before that it was able to doWork in session to execute additional statement like "set ...
2
votes
1answer
956 views
Dynamic datasource in Spring boot JPA
I have an application that need to connect to few different schema's but everything of same type (ORACLE). The decision of which schema comes from UI.
if User selects schema1, then entity should ...
1
vote
1answer
26 views
Unable to perform LAZY FETCH operation using JPA in one-to-one relationship
I am trying to lazily fetch PetDetails entity using JPA. However, I get LazyInitialization Exception. I read many solutions for this exception and came to find solution using JOIN FETCH in JPQL. Also ...
0
votes
2answers
304 views
Spring Boot with Tomcat DB Pool and Oracle, not retuning connections to pool in timely manner
I'm using Spring Boot with Oracle and the Tomcat DB Pool. I am running into issues where it is taking a very long time for connections to be returned to the pool. I have a max-active of 500, which is ...
1
vote
0answers
252 views
Difference between OpenEntityManagerInViewInterceptor and OpenEntityManagerInViewFilter
Spring Boot is configured to automatically use OpenEntityManagerInViewInterceptor. I do have a HandlerInterceptor that access JPA and I need it to run after OpenEntityManagerInViewInterceptor, but I ...
1
vote
0answers
72 views
Configure interceptor to be registered after the open session in view interceptor in Spring Boot
I'm writing an Inteceptor in a Spring Boot application but this interceptor must be run after the OSIV interceptor, as I understand, it's configured by Spring's JpaWebConfiguration class in ...
0
votes
0answers
517 views
could not extract ResultSet error
I am getting could not extract ResultSet error. I checked the repository method for a case where zero results were returned and everything seemed to work fine. I am unable to understand and reproduce ...
0
votes
1answer
235 views
How to select all elements that have another element in their list
I'm new to hibernate and can't RTFM so I hope someone can help save me a lot of time.
I have a many-to-many relationship between objects in my database. Let's say Employees and Jobs.
I want to ...
0
votes
2answers
378 views
Hibernate 4 returns list of null object for native sql query
I've recently upgrade from hibernate 3.5 to 4.3.11 with Spring 4.3.9 Before the upgrade everything was working fine. After the upgrade I get this error.
Environment:
Java 8,
Tomcat 7.0.23,
Hibernate ...
0
votes
1answer
48 views
Unknown entity: com.boto.SpringHibernatee.entity.Employee;
it is workin when i call .setAnnotatedClasses(Employee.class)
but when i call .setAnnotatedPackage("com.boto.SpringHibernatee.entity") it throws unknown Entity Exception
@Bean
public ...
7
votes
2answers
2k views
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
<bean id="sessionFactorySettings" class="org....
5
votes
2answers
788 views
Spring Transactional slows down complete process
I am trying to analyze a situation where I have two classes. One class is ProcessImpl which is starting point and internally calls other child transactions.I dont know whats going wrong.
The ...
1
vote
0answers
2k views
Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:orcale:thin:@localhost:1521:xe'
I am writing a program based on CURD operation based on Spring-orm module.
//dao class
//StudentDAO.java
package com.nt.dao;
import com.nt.domains.StudentInfo;
public interface StudentDAO {
public ...
1
vote
1answer
374 views
The embedded Derby DB to access with multiple clients
I write Java SE 8 based, desktop application. Its got Derby DB (v10.13.1.1) which comes together with my app. I use the Hibernate ORM framework (v5.2.10.Final) for the communication with the DB, and ...
0
votes
1answer
281 views
Write junit for JPA repository
Hi I need to write junit test cases for JPA repository. Code is as below.
Test is written as below. I have already added @ContextConfiguration on the class.
@Autowired
@Qualifier("repository")
...
1
vote
0answers
228 views
Migration from spring 3.2 to 4.3
I am getting the same exact issue as mentioned in the link below :
Upgraded from Spring 4.1.6 to 4.2.4 and suddenly getting TransactionRequiredException
For me too the target is null in the ...
1
vote
1answer
77 views
Hibernate : One-to-many bi-directional mapping storing
I am actually new to hibernate and was working on One-to-many bidirectional mapping. The relationship goes like this
One user has many blogs
One user has many forums
As per my understanding, if we ...
0
votes
1answer
58 views
Clarify the sequence of events in a Spring MVC ORM web app project
My professor gave a sample Spring MVC ORM project with Hibernate but I can not figure out the sequence of events involved, in particular about the usage of service business object.
This is just a ...
0
votes
0answers
301 views
How to configure to inject JPA EntityManagerFactory insted of EntityManager into spring beans
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(){
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(...
0
votes
1answer
961 views
Unable to build Hibernate SessionFactory when using Joined inheritance
I have a class that defines an InheritanceType.JOINED from which a couple more classes inherit from:
BaseClass
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "...
1
vote
1answer
1k views
org.springframework.beans.factory.BeanCreationException in Spring+Hibernate
I am using spring and Hibernate integration using mysql created a simple java project with a package and 3 class inside it ,and an application context.xml file ,and an hbm.xml for mapping,But the ...
1
vote
3answers
382 views
Why i can not change flushmode in hibernate
org.springframework.dao.InvalidDataAccessApiUsageException: Write
operations are not allowed in read-only mode (FlushMode.MANUAL): Turn
your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' ...
0
votes
0answers
155 views
SessionFactory created using LocalSessionFactoryBean doesn't have the same object of CurrentTenantIdentifierResolver
I am facing one issue with multi-tenant implemenation with Hibernate 5.1.5.Final.
I have implmented MultiTenantConnectionProvider and CurrentTenantIdentifierResolver. Below are their implmentations....
0
votes
2answers
115 views
What are possible causes for Spring @ComponentScan being unable to auto create a class anotated by @Repository
I came across a tutorial which seemed to be fitting my usecase and tried implementing it. I failed but wasn't sure why. So I tried to find another example with similar code and looked at the book "...
1
vote
0answers
2k views
Spring JPA with Hibernate: Error during managed flush [Session/EntityManager is closed]
I am in the process of updating my application to hibernate 5.2.x and Spring 4.3.x and Spring data JPA 1.11.x
A current problem I can't figure out is related to a number of integration tests failing ...