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

Not able to wire entityManager with applicationContext bean

I am facing a problem to wire entity manager with the bean present in application context. whenever i do some operation it gives NullPointerException. this is my applicationContext.xml file
Ajit Singh
  • 2,436
  • 23
  • 27
0
votes
1 answer

Entitymanager, too many connections

I create only one session factory for the whole progamm and create everytime i want to persist/update/query smth. an new entity manager but i get always an to many connection error. Can anybody give me an adivce? In my point of view it cant be the…
0
votes
1 answer

Override EntityManager.remove() in Spring Roo

I would like to override the EntityManager.remove() method for certain entities so that I can set an active boolean attribute to false rather than remove the object from the database entirely. This can be seen as a soft delete. The remove method in…
Aram Kocharyan
  • 20,165
  • 11
  • 81
  • 96
0
votes
1 answer

search engine with createQuery does not work

I just want to code a simple search engine using JPA. Here's example of native sql request that works with PHP : "SELECT mobiles.brand, argus_waitings_mobiles_prices.mobile, argus_waitings_mobiles_prices.argus_buyer_id, " .…
user1364743
  • 5,283
  • 6
  • 51
  • 90
0
votes
1 answer

NullPointerException occured when I use the EntityManagerFactory

My goal is to instanciate the EntityManagerFactory from applicationContext.xml file to get all posts registered in SQL database. Here's the content of the main files : applicationContext.xml
user1364743
  • 5,283
  • 6
  • 51
  • 90
0
votes
1 answer

Compare Date from the database with current date using jpa

I am using JPA 1 with hibernate as provider. I want to compare date of the entity with current date(regardless of time) and I am saving that field as timestamp(as i need it). I was getting the correct result when i was using oracle dialect by…
0
votes
1 answer

Hibernate Entity Manager: Result Set Mapping

I'm new to Hibernate and I am a fan of iBATIS, but my new work environments forces me to use Hibernate. In the current scenario at my workplace, there are many complex select queries that I feel hibernate doesn't handles very well. So I thought of…
0
votes
1 answer

JPA EntityManagerFactory

I use jpa in my project. But I must call all method and ever connect to database. I want to connect once database with entitymanagerfactory and other method want used. I made static entitymanagerfactory and entitymanager therefore ı take a error…
0
votes
1 answer

Hibernate Batch Update

I am trying to update a collection of a Java entity, but the order in which Hibernate executes the batch update leads to a constraint violation exception. I will use the following example to explain the situation. Entity Student Int id String…
Prim
  • 1,312
  • 5
  • 25
  • 51
0
votes
1 answer

complex query to equivalent criteriabuilder query(EntityManager)

My Query is this: query1 = select a.id from entity1 a where a.id in (:List1) and not exists (select ex2 from entity2 ex2 where ex2.assignedId = a.id) union select ex.assignedId from entity2 ex ,entity3 pi where ex.entity3Id = pi.id…
0
votes
2 answers

Does Hibernate flush after the whole transaction is committed?

I have two application First Application will persist into a database in a while loop , the loop will end after a long time (say 10-15 minutes). But The second application needs the data that the first application has already persisted in the…
web2dev
  • 557
  • 10
  • 28
0
votes
2 answers

Spring + Hibernate + Maven NullPointerException

I thought it was a good idea to add some testing to my project, but during the process I somehow managed to get the real deal broken. I am using Spring MVC with JPA (Hibernate). The entityManager cannot be loaded properly anymore: INFO -…
David
  • 1,086
  • 2
  • 11
  • 18
-1
votes
1 answer

Nullified stored data

can you please explain me what i do wrong. I Am learning JPA and i'm stuck with tests. On the first test "teslaOne" i create and persist Entity to the db and i would like to get access to this data from second test "teslaTwo". When i use…
Romillion
  • 101
  • 1
  • 3
-1
votes
1 answer

JPA Mapping getresultlist() to entity class is not working

List ml = emf.createNamedQuery("user-model",usermodel.class).getSingleResult(); results in org.springframework.dao.InvalidDataAccessApiUsageException: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds…
vs922905
  • 55
  • 4
-1
votes
1 answer

kotlin Springboot mockito integration test - EntityManger

How to mock the EntityManger in springboot mockito integration test @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = [EntityManager::class], properties = [ …
1 2 3
19
20