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
Accessing Entity Manager from Model Class in Silex
I'm using Silex for simple site.
I use Doctrine DBAL and that project
https://github.com/dflydev/dflydev-doctrine-orm-service-provider
as ORM and Entity Manager.
I know how access that manger from controller but I wonder how to do that from Model…

Inweo
- 173
- 2
- 11
0
votes
1 answer
NullPointerException in dao layer (only persist is working)
I was looking for a similar problems, but no actual results, so I'm trying to create simple DAO layer with JPA/Maven, but if I use it then only persist method (insert) is working when I using EntityManager until class, but tests are working good if…

Nesquik27
- 234
- 1
- 7
- 18
0
votes
1 answer
EntityManager + Spring Transactional Question
i have a doubt on concept i think i am mixing some stuff. I have a application with DAO layer the implementation of those DAO use SessionFactory (Hibernate) to execute the CRUD operation, i also have a service layer and manage my unit of work with…

Necronet
- 6,704
- 9
- 49
- 89
0
votes
1 answer
JPA Entity Manager why to use?
I've got involved in a project with entity manager in it. It's a bit unclear why should one use it. We have databases to store information in if we don't we can use classes to store informations in without the entity manager. The question is is it…

dben
- 484
- 1
- 6
- 21
0
votes
0 answers
how make for not save the change the one entity in database after the method @transactional end?
I have a method annotated with @Transactional in a Service.
I retrieve an object from my DB. After the method annotated with @Transactional end, change a field with one set in the Action (after call the Service), and not save the object, but the…
0
votes
0 answers
Read and write the same table defined as two different persistent entity with different entity manager - JPA/Eclipelink
Here's a scenario I need to execute to throw the optimistic lock exception in case if something has changed underneath between the time I read from the DB and by the time I actually writes it back. I have a project that defines it's own persistence…

Barbareek
- 52
- 10
0
votes
2 answers
hibernate parameter with that name [] did not exist
I am running the following code.
UserService.java
String alias = "u";
String select = "SELECT u.email";
String where = "u.userId = :id";
Map params = new HashMap<>();
params.put("id", userId);
List users =…

Sid
- 435
- 4
- 9
- 19
0
votes
2 answers
One entityManger finds entity , the other does not
I have a very strange behavior in my program. I have 2 classes (class LogIn and CreateGame) where i have injected an EntityManager in each using the annotation
@PersistenceContext(unitName="myUnitPU")
EntityManager entitymanger;
In some point i…

C.LS
- 1,319
- 2
- 17
- 35
0
votes
1 answer
IllegalStateException with relationship CascadeType.ALL JPA
I have master child entity relationship where master entity is request and child entity is requestitem
I have defined the relationship in them in following way
@OneToMany(mappedBy="iagrequest", cascade={CascadeType.ALL},fetch=FetchType.EAGER)
…

user1670018
- 11
- 3
0
votes
2 answers
Update DB via EntityManager
I'm working on a Spring-MVC project, trying to update a user's username and password using jpa. But I don't seem to be making any progress. :D
I checked other questions like this one and tried to use their approved answers for my case. Alas, nothing…

Sarah_A
- 150
- 4
- 18
0
votes
0 answers
configure c3p0 with eclipselink
I am using EclipseLink in my project. Due to some connection pool issue, I have to use c3p0 with EclipseLink. Is it possible to use both c3p0 and EclipseLink configuration both combined as follows,

Prakash Krishnakumar
- 73
- 2
- 7
0
votes
2 answers
Multiple entityManager in Spring application. Persistence of duplicate objects issue
My Spring component gets a request from a client, asks a web-service about some data and saves received objects to a database.
I identify all objects and save only new ones.
The issue occurs when the client makes two or more same requests in the…

Kirill Ch
- 5,496
- 4
- 44
- 65
0
votes
0 answers
hibernate5 assign duplicate ids to the objects
I'm upgrading Hibernate4 to Hibernate5. Spring-4.3.7 And facing the problem that hibernate assigns duplicate IDs to the objects while EntityManager.persist(object) that results in exception :-…

Abhishek-M
- 410
- 2
- 14
0
votes
0 answers
How can I use EntityManager to call java stored procedure?
I am trying to call java sp , which is having select query like
Select a.name, b.age from tablea a, tableb b where a.emp=b.emp;
I am not sure how I can create Entity class for this and how to call.
I have done similar kind of coding where in java…

rocky
- 737
- 4
- 11
- 19
0
votes
2 answers
pass entityManager to EntityType class
Using Symfony 3.2, I would pass entityManager object to EntityType class through constructor.
I found that it can been done using services, as my configuration below:
config.yml
imports:
- { resource: parameters.yml }
- { resource:…

mardif
- 331
- 2
- 12