Questions tagged [hibernate-entitymanager]

Hibernate EntityManager implements the programming interfaces and lifecycle rules as defined by the JPA 2.0 specification.

Hibernate EntityManager implements the programming interfaces and lifecycle rules as defined by the JPA 2.0 specification. For more informatio refer the link.

288 questions
2
votes
2 answers

Spring application startup validating entities with wrong database tables

I have 2 databases in mysql server named Database1 & Database2. Database1 has a table Database1.dummy_table with primary key Database1.dummy_table.id as integer and Database2 has a table Database2.dummy_table with primary key…
Esty
  • 1,882
  • 3
  • 17
  • 36
2
votes
2 answers

How to change Hibernate GenerationType identifier depending on the underlying database

I have a project called main_project (uses spring-boot v2) that contains all configuration classes including JPA configuration. The main_project also has entity classes (Like User, Personnel). The JPA configuration for managed entity class in…
Mohsen Mahmoudi
  • 127
  • 1
  • 16
2
votes
0 answers

Caused by: javax.persistence.PersistenceException: Unable to build entity manager factory

When I'm trying to lunch my project I get the Java PersistenceException here the part where I'm creating EntitiyManagerFactory: package com.politechnika.hibernatealone.application; import javax.persistence.EntityManager; import…
PiiiTeeeR
  • 45
  • 3
2
votes
2 answers

Entity manager get or create

How can I make sure if the object already exist its not created again. @Component public class ProductServiceImpl implements ProductService { @PersistenceContext private EntityManager em; public Product getOrCreateProduct(String…
digitalized
  • 59
  • 1
  • 10
2
votes
1 answer

Getting Exception when upgrading Hiberate 5.0.2.Final to 5.2.6.Final

I am getting exception when i am trying to upgrade latest Hiberate version. It works smooth in 5.0.2.Final. This is my maven configuration…
iamjustcoder
  • 4,714
  • 10
  • 33
  • 46
2
votes
2 answers

How to mockup an entityManager for unit testing a service

I´m trying to write some unit tests for my company, so its not possible for me to change anything in sourceCode but everything in the tests. I´m using Java8, Spring, Mockito and JUnit4. Problem: There are some services with a entityManager, which…
2
votes
1 answer

Retrieveing list from a many-to-many relation with JPA/HQL

I have 3 classes, I am trying to get a list of all the events of an eventhost that a user is subscribed to. I am probably thinking way too complicated but I have very little experience with JPA/HQL. User class @ManyToMany @JoinTable(name =…
Patidati
  • 1,048
  • 2
  • 12
  • 19
2
votes
1 answer

HTTP session scoped EntityManagerFactory in Spring

I have a need of using separate EntityManagerFactory for each HTTP session in Spring 4. It is because of authentication by DB login-password. So I make session-scoped DataSource and EntityManagerFactory like this: @Bean @Scope(value = "session",…
AlexZam
  • 1,147
  • 7
  • 18
2
votes
0 answers

Inject EntityManager in SwitchYard Junit implementation

I am trying to implement Junit in SwitchYard Application. i am using JPA , without using Camel. i have persistence.xml with the following details. And i am using resource producer pattern to expose EntityManager. But when i am testing a service, i…
JavaTweets
  • 91
  • 1
  • 1
  • 7
2
votes
1 answer

BeanCreationException: Error creating bean with name entityManagerFactory defined in class path resource [applicationContext.xml]

I am trying to run my project but I get the following error : WARN : org.hibernate.ejb.HibernatePersistence - HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use…
2
votes
1 answer

Spring 4 and Hibernate 4/c3p0 with Entity Manager don't start

I create the configuration of Spring + JPA/Hibernate/c3p0 on this way: Spring-Servlet.xml
user3333944
2
votes
1 answer

@NaturalId only valid on root entity (or its @MappedSuperclasses), using Natural Id in Joined, Multiple Table Inheritance

basically I cant find in google some similar problems by just pasting the root exception "@NaturalId only valid on root entity (or its @MappedSuperclasses)" in the search tab. I'm using a Joined, Multiple Table inheritance strategy to map my…
2
votes
1 answer

Spring, Hibernate, EntityManager and class inheritance

I'm pretty much new to Spring & Hibernate. In our team, we are building a web application using Struts 2 for the presentation layer, with Spring 3 and Hibernate 3 (with Annotations) underneath. We are still debating on whether to use DAOs or not and…
Alessandro
  • 601
  • 3
  • 11
  • 26
2
votes
2 answers

Spring 3.2 + Hibernate 4.3.4 + jUnit : EntityManagerFactory is closed

I'm writing some junit tests for my Spring 3.2.8 + Hibernate 4.3.4 application. My test class is annotated with: @DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD) @Transactional public class UserServiceImplTest { ... ... } However,…
Eric B.
  • 23,425
  • 50
  • 169
  • 316
2
votes
2 answers

Getting EntityManagerFactory in an Equinox OSGI Framework using Hibernate Unmanaged JPA

I am developing two OSGI bundles with Equinox Eclipse and Hibernate/JPA trying to persist one Entity using Unmanaged JPA. The first bundle: "Testhibernate" is a bundle that export all the packages from the hibernates jars and has an Activator…