entitymanager Questions

5

I want to migrate a project from spring boot 2.2.7 to spring boot 3.0.0. For this I generated a fresh project with spring starter and beside what was generated I added few of my dependency's: lomb...
Epigoni asked 6/12, 2022 at 8:18

2

I'm trying to get a better handle on the use of Spring's @Transactional attribute. I understand that it basically wraps the contents of the method marked as @Transactional in a transaction. Would i...
Umbrageous asked 5/6, 2015 at 13:36

3

Solved

Some confusing explanation: flush(); Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.it will update or insert into your tables in the ...
Beaulahbeaulieu asked 20/8, 2015 at 2:10

7

What is the difference between: @Autowired private EntityManager em; versus: @PersistenceContext private EntityManager em; Both options work in my application, but can I break something by us...
Cancellate asked 10/7, 2015 at 7:44

5

Solved

I got the following code @Stateless public class BondecomandeDAO { @PersistenceContext private EntityManager em; public Bondecommande findBCbyid(int id) { Query q =em.createNamedQuery("sele...
Termitarium asked 10/12, 2013 at 15:2

5

I am working on standardizing a legacy code base and new development to both use EntityManager for persistence. In order to succeed however, I need to provide the ability to break out into native S...
Oxytocic asked 6/5, 2015 at 21:39

2

Solved

I use Hibernate 5.1.0.Final. My GenericDAO class main methods: public T save(T entity) { entityManager.getTransaction().begin(); entityManager.persist(entity); entityManager.getTransaction().co...
Bancroft asked 16/8, 2016 at 12:25

5

I am trying to insert a data in my database, i am using JPA in my project. This is what my bean looks like. @PersistenceContext EntityManager em; em.createNativeQuery("INSERT INTO testtable ('...
Linea asked 29/5, 2013 at 3:54

16

Solved

EntityManager.merge() can insert new objects and update existing ones. Why would one want to use persist() (which can only create new objects)?
Manzoni asked 1/7, 2009 at 16:3

2

Solved

I'm using the JPA EntityManager + Hiberate, and a myserious piece of the where clause is appearing. The debug from Hibernate is basically showing: select /* bunch of columns */ from some_table whe...
Egregious asked 6/6, 2013 at 22:5

4

I believe the entity that I wish to delete, is a managed entity. But, regardless, why is merging it then removing it giving me the following error: deleted instance passed to merge Someone said o...
Guttery asked 15/10, 2014 at 17:46

4

Solved

I have the following SQL Query : SELECT COUNT(*) FROM DOG where ID = 'SampleId'; I am trying to write this in java : public int returnCountOfDogTable(String id){ String sql= "SELECT COUNT(*...
Paraffin asked 4/10, 2016 at 16:13

21

Solved

[Doctrine\ORM\ORMException] The EntityManager is closed. After I get a DBAL exception when inserting data, EntityManager closes and I'm not able to reconnect it. I tried like this but it didn...
Ufa asked 10/1, 2013 at 13:3

4

Solved

I would like to use the autowiring in a service that use 2 different entity manager. How to achieve something like that ? use Doctrine\ORM\EntityManager; class TestService { public function __con...
Yesima asked 10/12, 2019 at 11:39

1

Solved

The em.refresh(person) in the following code does not work. Rather than refreshing the person with a fresh value from database, it resets (undo or discards) the changes made in the cache. I am not ...
Scholl asked 24/9, 2021 at 6:33

3

I'm trying to write JUnit tests for a stateless session bean that has an injected EntityManager: @Stateless public class MyServiceBean implements MyService, ... { @PersistenceContext private Enti...
Transition asked 2/2, 2012 at 13:5

7

Can anybody explain what is the difference between the Spring Framework's LocalContainerEntityManagerFactoryBean and LocalEntityManagerFactoryBean?
Mancy asked 27/5, 2011 at 19:28

5

Solved

I have an EJB where I am saving an object to the database. In an example I have seen, once this data is saved (EntityManager.persist) there is a call to EntityManager.flush(); Why do I need to do t...
Stevana asked 17/7, 2013 at 15:0

2

Solved

I am using Wildfly 8.1 together with a EJB Project (EJB 3.2) containing entities. When trying to inject the Entity Manager into one of my Beans i get the following: JBAS011440: Can't find a persi...
Zampardi asked 19/10, 2015 at 14:2

4

Solved

I am trying to use Pagination with EntityManager.createNativeQuery(). Below is the skeleton code that I am using: var query = em.createNativeQuery("select distinct id from ... group by ... hav...
Gameto asked 4/9, 2020 at 9:56

4

Solved

I have an application that uses Hibernate/JPA, with Spring and Jersey. In my application context I set the data source, define an entity manager factory, set the transaction manager with that entit...
Ternion asked 8/2, 2012 at 23:22

1

Can someone tell me how to get all entities of one type which are marked with "EDIT" ACL permission? I would like to build a query with the Doctrine EntityManager.
Pagandom asked 1/6, 2011 at 12:39

3

Solved

I'm currently getting connection timeout errors from my EntityManager queries. Is it possible to set a timeout for these? persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persiste...
Timberwork asked 16/6, 2014 at 13:13

1

Solved

Doctrine advises that - Calling Doctrine\ORM\EntityManager::clear() with any arguments to clear specific entities is deprecated since doctrine/persistence 1.3 and will be removed in 2.0. We h...
Tamelatameless asked 29/1, 2020 at 15:20

5

Solved

I am introducing JPA2.0 in my application working on Oracle9i database and I added the libraries EclipseLink(JPA2.0) and created the entity classes but when I use javax.persistence.criteria.Crite...
Parse asked 24/4, 2012 at 13:25

© 2022 - 2025 — McMap. All rights reserved.