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
3
votes
2 answers

Filter JPA Entities without removing them from database

i have a database table "viewmodule" with a FK to itself (parent_id) to allow recursive structures. CREATE TABLE viewmodule ( id, type, parent_id, hide); My Java application uses JPA/Hibernate to map the entities on that table. We have fixed…
martin
  • 980
  • 1
  • 13
  • 28
3
votes
2 answers

Spring JPA: Providing Schema Name Dynamically

I am building a CRUD application where I am using spring data jpa to work with Database. I don't want to give schema name in my entity class, like mentioned below. @Entity @Table(name = "PROPERTY",schema = "ABC") public class PropertyDTO extends…
3
votes
4 answers

Could not open JPA EntityManager for transaction (using LocalContainerEntityManagerFactoryBean)

I'm seeing this when I run my test. I'm confident that the database connection is being established (or attempted) as it initially gave an error when I didn't include the password, then it complained because the database of that name didn't exist.…
Martyn
  • 6,031
  • 12
  • 55
  • 121
3
votes
2 answers

Spring JPA repository Converter not found

I have an entity class UserModel.java @Entity @Table @Data @EqualsAndHashCode( of = { "id" } ) @ToString( of = { "id" } ) public class UserModel { @Id @GeneratedValue( strategy = GenerationType.AUTO ) @Column( name = "u_id" ) private Long…
Naanavanalla
  • 1,412
  • 2
  • 27
  • 52
3
votes
2 answers

Spring-boot default EntityManager

Does spring-boot have a default EntityManager. I am setting one up right now but I noticed when my project loads I see this: LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' Is this…
Alert1201
  • 31
  • 1
  • 2
3
votes
0 answers

@NamedEntityGraph is not working when using with Spring data jpa 1.9.1

I define the following entity @Entity @NamedEntityGraph(name="Course.findByCourseStatusGraph", attributeNodes={ @NamedAttributeNode("id"), @NamedAttributeNode("courseGUID"), @NamedAttributeNode(value="courseTitle"), …
Basit
  • 8,426
  • 46
  • 116
  • 196
3
votes
0 answers

java.lang.ClassNotFoundException: javax.persistence.Persistence

I have an application using JPA and i am trying to deploy it on a Tomcat 7. It seems that I didn't include all the libraries correctly since I get the stack error mentioned below. But when i run as a java application it compiles…
Ayman S
  • 247
  • 1
  • 7
  • 19
3
votes
1 answer

Removing both @Entity and @MappedSuperclass in the same class

One of the existing classes (class A) has both @Entity and @MappedSuperclass annotations and the child class (class B extends A) has @Entity. Although this in not right, it is working fine with hibernate-entitymanager 3.3. Both entities have their…
L. Holanda
  • 4,432
  • 1
  • 36
  • 44
3
votes
0 answers

Java Persistence API - Overriding/Extending Hibernate (or similar) EntityManager

I am currently using hibernate's implementation of JPA to persist objects to a datasouce, successfully. Now, I would like to override hibernate's implementation of EntityManager, specifically, the createQuery function. Therefore, when my persistence…
t.smith.htc
  • 203
  • 1
  • 3
  • 12
3
votes
1 answer

Can a single EntityManager (Hibernate) participate in multiple concurrent transactions?

Is there a way one EntityManager can participate smoothely in multiple concurrent transactions? Well, not that concurrent. Something like: Start tx 1 Do stuff in tx 1 Start tx 2 Do stuff in tx 2 Commit tx 2 Join tx 1 back Do stuff in tx 1 Commit tx…
artemb
  • 9,251
  • 9
  • 48
  • 68
2
votes
1 answer

Is it possible to create a container-managed EntityManager via a specific EntityManagerFactory

I'd like to use the container-managed EntityManager of JPA, but want it to be created from one specific EntityManagerFactory, is it possible to do that? Thanks
zjffdu
  • 25,496
  • 45
  • 109
  • 159
2
votes
1 answer

How to create Spring JPA Entity Manager manually that contains all the default JPA properties

I need to create an Entity Manager manually to support having multiple datasources. I've realised that by creating it manually (instead of autowiring it as when you have only one single datasource), I actually do need to set all the JPA properties…
His
  • 5,891
  • 15
  • 61
  • 82
2
votes
1 answer

Spring boot 2 multiple datasource issue - IllegalArgumentException: Name cannot be null

I am trying to connect to two database in Spring boot 2. One is MySQL and other is DB2. If I use only MySQL I'm able to connect to it and query the database successfully. However if I add secondary database to my application, entityManagerFactory…
2
votes
1 answer

Unrecognized JPA persistence.xml XSD version : `` - hibernate, java ee and postgresql

The issue is appearing when trying to make entityManager with entitiManagerFactory. Application is running inside docker container and postgresql database is on localhost of the machine (not inside docker). my persistence.xml
Piotr
  • 33
  • 1
  • 7
2
votes
0 answers

using setParameter with createNativeQuery very slow

we are trying to improve a performance with JPA with mysql, the code: private String getProfileIdsSQL = "select up.user_profile_fk, up.Profile_id from account_config.user_profile as up " + " where up.user_profile_fk IN (%s)"; . . . …
user1120007
  • 268
  • 3
  • 13
1 2
3
19 20