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
1 answer

Getting EntityManagerFactory with Hibernate dynamic models in Spring: Unable to resolve named mapping-file

I am trying to get JPA EntityManagerFactory while working with Hibernate. Additionally, I am using Dynamic Models as they're described here https://docs.jboss.org/hibernate/core/4.3/manual/en-US/html/ch04.html#persistent-classes-dynamicmodels So I…
fedd
  • 880
  • 12
  • 39
1
vote
0 answers

EntityManager "remove" does not delete

I have many entities and for CUD operations i use persist(), merge() and remove() methods, respectively. But delete method below did not work. So i had to use query for deleting a given object. I have googled it but could not find any satisfactory…
Ahmet
  • 908
  • 1
  • 17
  • 26
1
vote
1 answer

Print Records from FindAll() in CrudRepository

I am extending CrudRepository in my Repository class. I want to print the records in my table using the findAll method. So far, I have written a test class, and I can see the result query is correct. How can I print the individual records in the…
user1324418
  • 267
  • 1
  • 6
  • 14
1
vote
1 answer

JPA @ElementCollection mysteriously cached

My POJO (named Category) have a langMap (Language Map) , which stores Locale -> String mapping. It's defined as : @Entity class Category implements Serializable { @ElementCollection @MapKeyColumn(name = "locale") @Column(name = "name") …
smallufo
  • 11,516
  • 20
  • 73
  • 111
1
vote
1 answer

Strange self-referencing constraint violation after upgrading Hibernate

I'm using hibernate-entitymanager in a Spring application. I'm in the process of upgrading my Hibernate version. Narrowed it down to the exact version: when I upgrade from 4.2.1.Final to 4.2.2.Final (or anything higher than that), I'm getting the…
Sander Verhagen
  • 8,540
  • 4
  • 41
  • 63
1
vote
3 answers

Usage of mule-module-jpa 1.2.0 with Hibernate in 3.4.0 CE. How to define EntityManager?

Could anyone point me to a working example of the mule-module-jpa suitable for Mule 3.4 CE? I have looked high and low and spent the better part of a day trying to get a test running and am stuck trying to get a properly defined entityManagerFactory…
mmeyer
  • 3,598
  • 1
  • 19
  • 22
1
vote
1 answer

Hibernate 4 EntityManager CriteriaBuilder sortby nested Property

My model: public class Nested { private Integer id; private String sortBy; [...] } public class ObjectToQuery { private Integer id; private Nested nested; private OtherProperty otherProperty; [...] } My…
1
vote
2 answers

EntityManager per DAO method

I have question about usage of EntityManager. I've read that is not wise, opening and closing an EntityManager for every simple database call in a single thread! Is it better to have one EntityManager per all DAO methods or one EntityManager per DAO…
Mitja Rogl
  • 894
  • 9
  • 22
  • 39
1
vote
0 answers

Hibernate JPA Inheritance strange behavior

I have two tables. Employee and User. Employee is annotated with Inheritance(strategy = InheritanceType.JOINED) User is annotated with @PrimaryKeyJoinColumn(name = "super_id") Everything is fine if i use the User entity. When i want to load…
hjunior
  • 91
  • 2
  • 6
1
vote
1 answer

EnityManager query returns a strange unaccessible object

I have 2 entities connected through join annotations and everything works fine except for the query result which is strange. So I have this class say Cat and the other class say Home. So if I execute a named query of the class Cat I expect it's…
1
vote
1 answer

No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 0

I have a problem with my spring security/hibernate app, which i can't resolve, since i'm new to spring and also hibernate. Here's my problem: org.springframework.beans.factory.BeanCreationException: Error creating bean with name…
Kapaacius
  • 655
  • 4
  • 10
  • 22
1
vote
2 answers

How to detect transaction conflicts with Hibernate?

I am using Hibernate 2.6 with hibernate-entitymanager. I am trying to catch and handle situations when 2 transactions conflict on an object. Here is what happens: Two threads are updating a single object wich has a @Version field. The thread which…
artemb
  • 9,251
  • 9
  • 48
  • 68
1
vote
1 answer

Hibernate EntityManager + JOTM: transactions are not used

I am trying to integrate together JOTM and Hibernate EntityManager to test my EJBs in a transactional manner environment but out-of-container. My test looks like the following: Start JOTM Put JOTM's UserTransaction into JNDI Create and configure…
artemb
  • 9,251
  • 9
  • 48
  • 68
1
vote
1 answer

How to commit and rollback data after getEntityManager.perist(object)

Now I am using jpa with hibernate , when i was done getEntityManager.persist(objects) then i will ask for user confirmation like continue and rollback using user interface private List tempCustomer =new ArrayList(); …
nag
  • 647
  • 6
  • 25
  • 43
1
vote
1 answer

Using Hibernate 4.1 & JPA 2.0 with an Entity Manager, what is the optimal way to load multiple entities with sub-entities down to multiple levels?

We are using Hibernate 4.1.4 with an entity manager implementation and are very pleased with it. When loading a single entity or small sets of entities (10-50 + sub-entities) we get excellent performance and all our joins work great and are…
skel625
  • 876
  • 3
  • 7
  • 17