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
1
vote
0 answers

How to map foreign key relationship in hibernate using just primary key column and not the entire entity?

I want to achieve something like this where A_id is a foreign key to A. @Entity Class A { @Id private long id } @Entity Class B { @Id private long id; @ManyToOne private long A_id; }
1
vote
1 answer

NoSuchBeanDefinitionException Spring Data + JPA + Hibernate

I´m trying to do an example of Spring Data following the documentation...But i got an NoSuchBeanDefinitionException in the repository Interface, it does not appear be proxified neither contained in spring container...Here my example: This is my…
1
vote
0 answers

Spring MVC with Hibernate - Transaction exception

I got exception while try insert data to MySQL with Hibernate JPA in Spring MVC. I have a this exception: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is…
1
vote
0 answers

Merging entity with Play! framework and JPA silently failed

I've been looking around and around without finding any topics related to my situation. I'm using: Play! framework v2.5.3 in Java Hibernate EntityManager v5.1.0.Final Hibernate JPA 2.1 API v1.0.0.Final PostgreSQL 9.4 Here the route called with…
1
vote
1 answer

How can I get EntityManager in BaseDao (Maven+JSF+hibernate)

I have JSF maven project with Hibernate. There are some DAO classes in project, but it have failed implementation I think. public class HibernateUtil { private static final SessionFactory sessionFactory; static { try { …
user5620472
  • 2,722
  • 8
  • 44
  • 97
1
vote
0 answers

Spring-data-Jpa and Hibernate-entitimanager dependency conflict in gradle project

I have a gradle project. I am new to gradle and converted one of my project to gradle. My project was working then it started me giving error. Then I noticed that if I comment out my Hibernate-entitymanger dependency, then no error. Here is my…
1
vote
1 answer

bidirectional onetomany causes "Unable to build Hibernate SessionFactory" error

I'm trying to make my entities be related through bidirectional onetomany realtionship but it causes some errors i will posted at the end of the post. I have 'users' table and 'task' table, which contains 'username_users' foreign key. I want to make…
Kavv
  • 209
  • 3
  • 13
1
vote
1 answer

How to configure OpenEntityManagerInViewFilter Spring MVC

I want to use OpenEntityManagerInViewFilter to be able to avoid lazyinitialization loading. This is my web.xml configuration: contextConfigLocation
1
vote
0 answers

How can I set pattern like @DateTimeFormat(pattern="yyyy/MM")

I got issue about hibernate pojo annotation. One column in database is varchar with date pattern yyyy-MM (such as 2015-07, 2015-06), I CAN NOT change this varchar date pattern in database. When I use @DateTimeFormat(pattern="yyyy-MM"), I got…
1
vote
1 answer

In a JavaEE stateless session bean, why is the SessionContext responsible for rolling transactions back and not the EntityManager?

To me (someone who is new to JavaEE development), I would think that a container managed EntityManager would be responsible for rolling back failed transactions and not a SessionContext instance. Suppose the following scenario... @Stateless public…
Rob L
  • 3,073
  • 6
  • 31
  • 61
1
vote
1 answer

LazyInitializationException while updating Entity in database

I have three entities Employee, Person and EmailAdress as given below: @Entity public class Employee { private Person person; //Other data members @ManyToOne(fetch=FetchType.LAZY, cascade = CascadeType.MERGE) …
Saumesh
  • 71
  • 1
  • 2
  • 5
1
vote
2 answers

JPA2 + Hibernate + Order By

Is it possible (using Hibernate and JPA2 Criteria Builder) to order by a methods result rather than an entities member? public class X { protected X() {} public String member; public String getEvaluatedValue() { // order by …
Jan
  • 1,594
  • 1
  • 20
  • 30
1
vote
1 answer

get cannot access EntityBean error where remove javaEbean dependency

i have a Play application that integrated with Spring and Hibernate JPA. When I remove a javaEbean dependency from my build.sbt file I receive cannot access EntityBean This are my dependencies: scalaVersion := "2.11.1" libraryDependencies ++=…
1
vote
2 answers

What does "Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1" mean

I would like to save two entities with the following relationship: @Entity public class Synonyme { @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL, orphanRemoval = true) @JoinColumn(name="ID", nullable = false) private…
Manuela
  • 1,379
  • 3
  • 16
  • 25
1
vote
2 answers

JPA detach and immediate merge causes errors

I am using JPA (with Hibernate as the JPA provider). I have an operation to remove an entity, and it seems that if I detach the entity and immediately merge it an exception is thrown, i.e. em.find(entity.class,…
apines
  • 1,254
  • 14
  • 36