The EntityManager is the representation of a PersistenceContext, allowing a user to manipulate data pulled from a database.
Questions tagged [entitymanager]
1802 questions
0
votes
1 answer
Spring @Transactional is not working for mysql function call
There is an existing code in my project it calls the mysql function. mysql function updates the value in a table.
function next_val (input varchar(10))
returns decimal(5,0)
begin
update table set val = (@next_val := next_val) + inc where name =…

newstackoverflowuser5555
- 741
- 2
- 11
- 31
0
votes
1 answer
How to I query sql for a Object in a Table with a single sub-object based on a field?
What I have right now is:
Getting a List with all neighborhoods & etc:
(Town) em.createQuery(from Town towns"
+ " left join fetch towns.neighborhoods neighborhood"
+ " left join fetch neighborhood.population population"
…

user3450862
- 379
- 1
- 6
- 22
0
votes
1 answer
What em.merge will do with the state of detached entity?
I have code like this
private Identifiable updateEntityInternal(JPABaseEntity entity) {
Identifiable updated = null;
try {
updated = em.merge(entity);
em.flush();
As I understand em.merge creates new…

liotur
- 809
- 2
- 17
- 36
0
votes
1 answer
How to avoid null parameter in And condition using Entity Manager in spring data JPA
I am trying to implement search functionality on grid using And condition.
If am giving two parameter its giving Result. But if I want to search using only first field and second is null. Its giving empty array according to AND functionality. How to…

SpringUser
- 1,351
- 4
- 29
- 59
0
votes
0 answers
Need to rollback for update only one table
I'm new in JPA/Hibernate. I'm using EntityManager. I read that if a transaction failed to update, it must rollback. It make sense for updating multi tables, but if I want to update only one table, do I need to rollback the transaction?

Fotis Tasou
- 5
- 2
- 7
0
votes
2 answers
Symfony3 Use Entity Manager in Custom Container
I want to create HelperController for my project. I generate a controller with doctrine:generate:controller and I need to use entity manager in it.
I enjected to services.yml but it is giving an error like this:
Argument 1 passed to…

Çağdaş DAĞ
- 3
- 3
0
votes
1 answer
Doctrine 2.5.14 EntityManager - No Metadata Classes to process
I can't get through setting up phase of Entity Manager on official Doctrine website tutorial:
I keep geting No Metadata Classes to process in the part Starting with the Product Entity, where I should in put this code to terminal:
$…

Václav Stummer
- 349
- 2
- 8
- 21
0
votes
0 answers
Why Read operations don't require Transaction in JPA?
The below code give me the org.hibernate.HibernateException: The internal connection pool has reached its maximum size and no connection is currently available!.
This error shows that I am not closing the transaction and since I have connection pool…

The Coder
- 3,447
- 7
- 46
- 81
0
votes
0 answers
Spring data: How to change EntityManager at runtime
In my project I have a series of interfaces that extends "JpaRepository".
I need to filter the entity manager with data that arrives from the Http Request.
At runtime whenever the app use a repository I need to change the instance of the…

user801661
- 177
- 8
- 15
0
votes
0 answers
how to get alias name in Spring boot
how to get alias name using spring-data-jpa in Spring boot?
I want alias name for stored procedure
StoredProcedureQuery storedProcedure = entitymanager.createStoredProcedureQuery(Proc);
if (params != null && params.length > 0) { // If…

Mitesh Lodhiya
- 1
- 3
0
votes
1 answer
Produce context managed EntityManager programmatically
I'm working on a JavaEE application which uses JPA and is deployed on JBoss/Wildfly. I have my persistence.xml and standalone.xml properly configured for JPA to recognize the datasource. I understand that the normal way to obtain a context managed…

Felk
- 7,720
- 2
- 35
- 65
0
votes
0 answers
Oracle does not close the cursors opened by JPA query even after EntityManager.close() is called
I am using JPA, hibernate and Oracle DB.
While calling method findAll(..) multiple times (say 1000), each time Oracle opens a new cursor. The opened cursor is not closed after entity manager transaction is committed or entityManager is closed…

user2128672
- 191
- 1
- 5
0
votes
1 answer
Spring boot Jaxb Exception
I am biulding a spring boot application. but not getting the desired output. Can anyone help for this basic application.
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in…

Abhay SIngh
- 27
- 1
- 6
0
votes
1 answer
Find an entity which use a class Id
To find an object from entity with primary key we use em.find(Person.class, ).
I'm using JPA EclipseLink and I have a Person entity which has a composite primary key(@classId),
the Person entity:
@Entity
@IdClass(PersonId.class)
public…

M.A.Bell
- 398
- 1
- 16
0
votes
0 answers
Retrieving Blob as stream from EntityManager
I got a test using HSQL for memory persisting that persists a blob and then tries to retrieve this blob.
When I try to get the input stream from the stored Blob I got the following error:
java.io.IOException: java.lang.IndexOutOfBoundsException:…

fefedo
- 11
- 4