Questions tagged [entitymanager]

The EntityManager is the representation of a PersistenceContext, allowing a user to manipulate data pulled from a database.

1802 questions
0
votes
0 answers

symfony entity manager in handler

I am currently developping a REST API. I need to log all successfull connections in my database. To do that, I've tried to edit my AuthenticationSuccessHandler. But i don't know how to use the entity manager in it. I've read in forums to inject the…
0
votes
0 answers

persist() is failing to save to Database

I have a session called an OrderManager. This session is used to collect orders from a form (thorough a controller) and post it in the database. My OrderManager is acting strange and I'd really appreciate some help. Persist works for one part and…
0
votes
0 answers

EntityManager em.getTransaction().begin() locks thread

My question is, if the method "begin()" is capable of lock a thread further than the "timeout" config in the persistence.xml. Here is a snippet: @Inject EntityManager em; @Inject ContextControl ctxCtrl; String fileType; String fileName; String…
McCoy
  • 780
  • 1
  • 10
  • 21
0
votes
0 answers

EntityManager NullPointerException because it's not injected for some Operations

I have created a Singleton-Bean containing the database-access. The EntityManager is injected as PersistenceContext and i've created some basic methods to persist items. Stripped-Down-Version: @Singleton public class Database implements Serializable…
Klumbe
  • 370
  • 2
  • 12
0
votes
2 answers

getServiceLocator only works with LoginController

I am using ZF2 with Doctrine 2 ORM, using the following: $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager'); seems to work in LoginController but doesn't seem to work in any other controller, what might be the reasons ?…
user4128992
0
votes
1 answer

SpringJUnit4ClassRunner - static access to EntityManager(Factory)

I'm using JUnit4 with SpringJUnit4ClassRunner to write some test classes and I need to access the application persistence context inside a static method, a method with the @BeforeClass annotation. My actual code is seen…
Matheus Moreira
  • 2,338
  • 4
  • 24
  • 31
0
votes
1 answer

Entitymanager automatic update netbeans

I have a question regarding my entity manager (eclipselink). I'Ve generated eclipselink JPA entitymanager for my project with netbeans(let netbeans generate the classes and relationships) but now I made some changes to my database tables: added some…
user4095898
0
votes
1 answer

Attaching JavaSE EntityManager to JTA

I'm working with JBoss Wildfly as an application server on my JPA layer. For technical requirements i need to get my entity persistence manager using the JavaSE/application managed approach. I. e.: EntityManagerFactory emf =…
Alex
  • 1,515
  • 2
  • 22
  • 44
0
votes
1 answer

Load objects from db by parameter Date

I have some objects in db. Every object has parameter Date in date format like a "Mon Oct 05 08:55:36 CEST 2015". I want load all objects from 24h before to present time. I am using hibernate entity manager. Can you help me please Here is my entity…
J.T.
  • 3
  • 4
0
votes
1 answer

Connection Reset using Spring + Hibernate

I am using Spring + Hibernate on my JavaEE project. In this project the user can upload an XLS file which I should import to my database. Before importing I have to validate this file checking its integrity with the other entities on my database. So…
João Menighin
  • 3,083
  • 6
  • 38
  • 80
0
votes
1 answer

JPA2.0 commits transaction on flush immediatly

I'm using EJB3 and JPA2 in a project containing several modules. Lately i have noticed that the DB-records won't rollback on exception. After doing some research i found that entity manager commits the transaction on flush immediatly even before the…
mersen
  • 51
  • 3
0
votes
0 answers

EntityManager find method with proper arguments returns null

I'm trying to get Emails entity in one of my DAO's method by this method: Emails mail = entityManager.find(Emails.class, email); //test System.out.println("code: " + code + ", email: " + email); System.out.println(mail == null ? "mail equal null" …
Kavv
  • 209
  • 3
  • 13
0
votes
1 answer

Getting duplicated rows when persisting a child entity

I have a one-to-many relation between entity Visite and Datevisite. I'm getting a duplicate row in the database when I persist a new child. That means when I persist a new Datevisite I find a duplicate row in the database but with a differet ID. Can…
user3419507
  • 117
  • 1
  • 4
  • 16
0
votes
2 answers

EntityManager not injected into Jboss Module

I'm working with jboss wildfly 9. I have a provider deployed as module into the : wildfly > modules > com > mycompany > myprovider folder. Then i have a jpa project with DAO pattern writing and reading inside my database. I want to handle the DAO…
Alex
  • 1,515
  • 2
  • 22
  • 44
0
votes
1 answer

No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined"}}

I'm having problem with my web-app, cannot deploy the project to WildFly. Problem: Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookedRoomDao': Injection of…
user4956718